4 ms·
> although you’ll still be on the hook for downloading the entire 1.4MB font file I haven't tested with emojis (never thought of it, great test case!) but try
by vintagedave 2y ago
> although you’ll still be on the hook for downloading the entire 1.4MB font file
I haven't tested with emojis (never thought of it, great test case!) but try Fontimize, which creates font subsets based on text your site actually uses. It runs over the HTML and CSS and creates an applicable subset.
But the Python API supports passing just some specific text. Try using that, passing any and every flag you wish. You should be able to get a font file that contains just the country flags this way.
I really need to get back to this library and add predefined subsets like, say, extended Latin, or country flags!
https://github.com/vintagedave/Fontimize https://github.com/vintagedave/Fontimize
- notpushkin 2y agoThat was my first thought, too! The article actually links to a polyfill which uses a subset font. Here’s the subsetting script it uses: https://github.com/talkjs/country-flag-emoji-polyfill/blob/master/build/make-font.sh https://github.com/talkjs/country-flag-emoji-polyfill/blob/m... Looks like the flags-only font is just 77 kb!