Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Save webfonts for specific sites

If you disable webfonts (aka remote fonts ) in your web browser, you might discover that many sites use fonts for all sorts of glyphs that you wouldn't have thought were stored as fonts. While that's a neat technical trick, it can make navigation difficult when you disable those remote fonts. I won't ramble about why one might choose to disable webfonts. What I will do is show how I allow fonts for a specific site (or page), so that my system caches the fonts locally so I can view things correctly! I wrote a tool, save- webfonts (Gitlab), that parses through the given URL(s), finds the css files, finds the listed fonts, and saves those down. The project has a few gaps, such as it just downloads all ttf, woff, woff2, and eot files listed, even though they might be duplicates. However, it does have a few nice features. If you are well-versed in fontconfig, you'll realize that of course ttf is the native format for fonts for displaying locally. Woff2 and the older woff format are decent choices for webfonts, but not useful locally. These non-ttf formats can be converted down, however, to ttf, which this script handles for you when you add the --convert flag. So take back control of your web browsing by choosing whose fonts you use! I started with the Open Build Service (SuSE OBS) and COmmunity PRojects (Fedora copr).

Comments