Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created May 23, 2017 16:24
Show Gist options
  • Save ELLIOTTCABLE/5b87ab21b11acb76a5c52d47a022b519 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/5b87ab21b11acb76a5c52d47a022b519 to your computer and use it in GitHub Desktop.
How to make a Nerd Fonts-patched (‘Powerline’) version of the Input Mono font
# Creating this because I'm *sure* I'll forget how to do this.
# 1. Customize your Input fontface, and download it from their website:
open -a Safari \
"http://input.fontbureau.com/download/index.html?size=14&language=javascript&theme=base16-dark&family=InputMono&width=200&weight=300&line-height=1.2&a=0&g=ss&i=serif&l=serifs_round&zero=slash&asterisk=height&braces=straight&preset=dejavu&customize=please"
# 2. Download the ‘patcher script’:
# (I have no idea why the hell this script requires the `changelog.md` as well; and we [ab]use
# GitHub's SVN bridge to download *just* the `src/glyphs`, instead of the 100s of megabytes of
# pre-patched fonts)
cd ~/Downloads/Input-Font
curl -o nerd-patcher.py -JO -fsSl --proto-redir -all,https \
https://raw.githubusercontent.com/ryanoasis/nerd-fonts/1.0.0/{font-patcher,changelog.md}
svn checkout https://github.com/ryanoasis/nerd-fonts/branches/1.0.0/src/glyphs src/glyphs
# 3. Install the patcher-script's dependencies:
brew install fontforge
# 4. Patch the files:
for font in Input_Fonts/Input/*.ttf; do
python nerd-patcher.py --careful --complete --progressbars "$font"; done
# 5. Install the patched fonts:
open -a 'Font Book' 'Input '*
@cviebrock
Copy link

cviebrock commented Mar 6, 2018

Sorry for the slow response! I actually gave up on this for a while but have tried again on MacOS 10.13.3 with success:

  • clone the nerd-fonts repo
  • install fontforge via brew
  • sudo easy_install pip and sudo pip install configparser (I tried using python3 from brew, but that didn't work, so sticking with the system python)
  • for font in ~/Downloads/Input-Font/Input_Fonts/Input/*.ttf
    do
    fontforge -script ./font-patcher --careful --complete  --progressbars "$font"
    done
    

I get one minor warning from Font Book about the BoldItalic variation ('name' table usability), but it all seems to work nicely:

screen shot 2018-03-05 at 10 20 43 pm

@cviebrock
Copy link

You can also try adding --adjust-line-height to the list of patcher arguments. If you look closely, the Powerline separator isn't exactly the same height as the prompt. I'm sure it has to do with either the line height I chose when creating a custom Input font, or the exaggerated vertical spacing I'm adding in iTerm2. Either way, it appears to only be a pixel off ... I can live with it. 😄

@akaralar
Copy link

akaralar commented Aug 6, 2018

@cviebrock you rock! I had the same problem. One other issue I had was if I patched with --complete then letter J would turn into an icon. Excluding --materialicons solves the issue for my flavor of Input Mono

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment