Subsetting Fonts

TIL: If you need only certain glpyhs from a font you can subset it using fonttools. This reduces the font size a lot:

fonttools subset IosevkaTermNerdFont-Regular.ttf --text="â–‘â–’â–“â–ˆ" --flavor=woff2 --with-zopfli --desubroutinize --output-file=Iosevka-subset.woff2

The size difference will vary, but here the original font is roughly one thousand times as large:

du -hs IosevkaTermNerdFont-Regular.ttf Iosevka-subset.woff2
4.1M	IosevkaTermNerdFont-Regular.ttf
5.0K Iosevka-subset.woff2