Grimoire-
Command
.es

GNU+Linux command memo

Convert font file to woff2 format

Convertir une police de caractère vers le format woff2 qui est actuellement le plus comprimé.

$ pacmac -S python-fonttools python-brotli
$ python
>>> from fontTools.ttLib import TTFont
>>> f = TTFont('path/to/fontfile.ttf') (1)
>>> f.flavor = 'woff2'
>>> f.save('path/to/newfontfile.woff2')
1 Any popular format is accepted

This allows to compress for instance AmaticSC-Regular.ttf from 151,6 ko to 65,3 ko (the new file occupy only 43% of the first one). This will save some kilo-bytes for the next release of Meta-Press.es !