Skip to content

Contributor Developer Setup

Ryan L McIntyre edited this page Aug 18, 2019 · 19 revisions

Nerd Fonts

  1. Prerequisites
    1. Required
    2. Highly Recommended
  2. Base Nerd Fonts Development
    1. OSX
    2. Linux
    3. Windows 7
    4. Windows 10
  3. Hack font specific
  4. Sanity Tests
  5. Troubleshooting
  6. Resources

  • The basics of what you need to get up and running :)

Prerequisites

Required

  • Git
  • FontForge
  • FontForge python bindings
  • Python 2 and/or Python 3

Highly Recommended

  • ShellCheck
  • Pyflakes (PEP8 compliance)
  • Pandoc

Base Nerd Fonts Development

  • What you need to contribute to the core of Nerd Fonts

OSX

todo

Linux

Windows 7

Prerequisites

Setup for Python 2

Open a terminal with Administrator priviledges

cd into FontForge installation directory

For example:

cd "C:\Program Files (x86)\FontForgeBuilds"

Run fontforge console batch file

fontforge-console.bat

install configparser

ffpython -m pip install configparser

Test out Nerd Fonts font-patcher script

ffpython C:\Path\to\nerd-fonts\font-patcher

Output should yield similar to:

...
font-patcher: error: too few arguments

Windows 10

Prerequisites

Setup for Python 2

TODO

Hack font specific Development

  • What you need to contribute to the Hack specific portion of Nerd Fonts

OSX

todo

Windows

Linux

  • FreeType
  • Harfbuzz
  • ttfautohint
  • fonttools

Build from source with Script from Hack Repo

  • Pros: A lot easier and faster
  • Cons: Not as much fine grained control
pip install fonttools
curl https://raw.githubusercontent.com/source-foundry/Hack/master/tools/scripts/install/ttfautohint-build.sh --output ~/ttfautohint-build.sh
chmod 770 ~/ttfautohint-build.sh
cd ~
sudo ./ttfautohint-build.sh
# Add the bin to your path

Build each dependency individually ad hoc

  • Pros: More control and better understanding of what is getting installed and setup
  • Cons: more tedious

fonttools

pip install fonttools

Build FreeType from source

wget http://downloads.sourceforge.net/project/freetype/freetype2/2.7/freetype-2.7.tar.gz
tar -zxf freetype-2.7.tar.gz
cd freetype-2.7
./configure
make
sudo make install

Build Harfbuzz from source

wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2
tar -xjf harfbuzz-1.3.4.tar.bz2
cd harfbuzz-1.3.4
./configure
make
sudo make install

g++ (if needed)

  • if you ran into an issue where a compiler is needed you will probably have to start over with the config but first run: make distclean
sudo apt install g++

Build ttfautohint from source

wget http://download.savannah.gnu.org/releases/freetype/ttfautohint-1.6.tar.gz
tar -zxf ttfautohint-1.6.tar.gz
cd ttfautohint-1.6
./configure --with-qt=no --with-doc=no
make
sudo make install
C++11 compiler
  • if you get an error during make for ttfautohint: configure: error: *** A compiler with support for C++11 language features is required.

Then install compiler such as g++ (shown above) then re-run configure & make, etc

Verify the version

ttfautohint --version
ttfautohint 1.6

Sanity Tests

Adhoc test autohint

# cd into Nerd Fonts root directory
ttfautohint -l 4 -r 80 -G 350 -x 0 -H 181 -D latn -f latn -w G -W -t -X "" -I -m "bin/scripts/Hack/Hack-Regular-TA.txt" src/unpatched-fonts/Hack/Regular/Hack-Regular.ttf temp/Hack-Nerd-Font-autohinted.ttf

We can run post build processing fixes on Hack

# cd into Nerd Fonts root directory
./font-patcher temp/Hack-Nerd-Font-autohinted.ttf
# spot check font, open in FontForge, etc.

Troubleshooting

ttfautohint: unrecognized option '-H'

cause: Too old of a version of ttfautohint, works but doesn't have -H option

checking for HARFBUZZ... no
configure: error: Package requirements (harfbuzz >= 0.9.19) were not met:

No package 'harfbuzz' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables HARFBUZZ_CFLAGS
and HARFBUZZ_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

cause: harfbuzz not installed or not installed correctly

tashaper.h:29:19: fatal error: hb-ft.h: No such file or directory
 #include <hb-ft.h>
                   ^
compilation terminated.

cause: harfbuzz not installed or not installed correctly

ttfautohint: undefined symbol: hb_ft_font_create

cause: harfbuzz not installed or not installed correctly

Resources