How to subset a Google icon font for optimal dowload size?

233 views Asked by At

Google contains instructions for how to subset a font, and even specifies:

This feature also works for international fonts, allowing you to specify UTF-8 characters. For example, ¡Hola! is represented as: https://fonts.googleapis.com/css?family=Inconsolata&text=%c2%a1Hola!.

Each symbol in the Google Material Icons/Symbols fonts has a codepoint, as specified in this SO question.

Is there a way to pass the codepoint values as the value to &text URL parameter, so that I can a download a subset of the Material Symbols font with all the icons that I want to use in my app? For example, the search icon has a codepoint of e8b6. I tried several incantations, including &text=e8b6 and &text=%e8%b6 that didn't download the search icon. Then I found a converter from codepoint to utf-8, which converted e8b6 to some non-printable characters ^H^F. I then passed &text=^H^F and it downloaded the search icon, but it didn't subset the font, i.e. it downloaded the whole font file, rather than a subset of it.

0

There are 0 answers