Skip to content

Instantly share code, notes, and snippets.

@tekwiz
Last active March 6, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekwiz/3bf27e84261ed760830669717b7ea308 to your computer and use it in GitHub Desktop.
Save tekwiz/3bf27e84261ed760830669717b7ea308 to your computer and use it in GitHub Desktop.
Web Font Conversion

Woff2

https://github.com/google/woff2

brew install brotli
curl -L -o /usr/local/src/woff2-1.0.2.tar.gz https://github.com/google/woff2/archive/v1.0.2.tar.gz
tar -C /usr/local/src -xzvf /usr/local/src/woff2-1.0.2.tar.gz
mkdir -vp /usr/local/src/woff2-1.0.2/out
cd /usr/local/src/woff2-1.0.2/out
cmake -Wno-dev -DBUILD_SHARED_LIBS=OFF .. && make -j2 && make instal
rm -Rvf /usr/local/src/woff2-1.0.2.tar.gz /usr/local/src/woff2-1.0.2
woff2_compress font.ttf
find . -name '*.ttf' -print0 | xargs -0 -L 1 woff2_compress

Woff1

http://wizard.ae.krakow.pl/~jb/ttf2woff/

brew install zopfli
curl -L -o /usr/local/src/ttf2woff-1.2.tar.gz https://github.com/doio/ttf2woff/archive/v1.2.tar.gz
tar -C /usr/local/src -xzvf /usr/local/src/ttf2woff-1.2.tar.gz
cd /usr/local/src/ttf2woff-1.2
make -j2 && make install
rm -Rvf /usr/local/src/ttf2woff-1.2.tar.gz /usr/local/src/ttf2woff-1.2
ttf2woff font.ttf font.wof
find . -name '*.ttf' -exec ttf2woff '{}' '{}'.woff \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment