Install Webfontools from Homebrew:
brew tap bramstein/webfonttools
brew update
brew install sfnt2woff-zopfli
brew install woff2
brew install sfntly
go to folder with *.ttf/otf files, put webfont.sh and run it
sh webfont.shbrew tap bramstein/webfonttools
brew update
brew install sfnt2woff-zopfli
brew install woff2
brew install sfntly
go to folder with *.ttf/otf files, put webfont.sh and run it
sh webfont.sh| #!/usr/bin/env bash | |
| for f in *.otf *.ttf ; do | |
| FILE=$(basename "$f") | |
| if [ "$FILE" != "." ] && [ "$FILE" != ".." ] && [ "$FILE" != "*.otf" ] && [ "$FILE" != "*.ttf" ] | |
| then | |
| echo "Converting $FILE" | |
| echo "=> woff" | |
| sfnt2woff-zopfli $FILE >/dev/null | |
| echo "=> woff2" | |
| woff2_compress $FILE >/dev/null | |
| echo "=> eot" | |
| #sfnttool -ex $FILE >/dev/null | |
| fi | |
| done | |
| echo "" | |
| echo "All done." |