Skip to content

Instantly share code, notes, and snippets.

@rileyjshaw
Created May 3, 2021 02:32
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 rileyjshaw/6b71d994646bd2362f766aa0c3e0a495 to your computer and use it in GitHub Desktop.
Save rileyjshaw/6b71d994646bd2362f766aa0c3e0a495 to your computer and use it in GitHub Desktop.
A one-liner to convert a folder of TTFs (also works with OTFs) to WOFF and WOFF2
mkdir -p woff && for f in *.ttf; do sfnt2woff "$f"; woff2_compress "$f"; done && mv *.woff* woff
@rileyjshaw
Copy link
Author

With gliffhanger:

glyphhanger https://rileyjshaw.com --spider --spider-limit=30 --US_ASCII --whitelist="“”‘’–—…" --family="Geomanist" --subset=*.ttf --formats=woff2,woff-zopfli --css && rename 's/-subset(.zopfli)?//' *.woff*

@rileyjshaw
Copy link
Author

rileyjshaw commented May 22, 2022

Inelegant but working way to generate .woff fallbacks from a directory of .woff2 files. Careful using this in a folder with .ttfs in it, it’ll delete them all.

for f in *.woff2; do woff2_decompress "$f"; sfnt2woff "${f%.*}.ttf"; done && rm *.ttf

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