Re:Self-host your fonts for better performance
by SquareWheel on Friday December 04, 2020 @08:35AM
(#25302057)
I wasn't aware Google Fonts' CSS didn't include local. That's disappointing. Thanks for letting me know!
[ Parent
| on HN ]
Re:Self-host your fonts for better performance
by jfk13 on Friday December 04, 2020 @09:46AM
(#25302740)
I've definitely seen use of src:local(...) in the CSS served by Google Fonts in the past, but they may have changed things, or perhaps it depends on details of the request, the detected browser, etc. YMMV.
Re:Self-host your fonts for better performance
by Flimm on Saturday December 05, 2020 @02:40AM
(#25312654)
I just checked on a website I maintain, and it's looks like Google Fonts behaviour has changed. It definitely used to prioritise local fonts, and now it doesn't. In a way, I understand, because local fonts aren't always identical to the online ones, leading to weird bugs that might not be noticed at first (especially in languages that don't use Latin characters). Fonts also get updated over time.
When you select fonts on Google Fonts, the website instructs you to link to CSS hosted by Google, which is simple to implement, but not performant. Really, you would want to load that CSS asynchronously, so that the rendering of the whole website doesn't wait for Google Fonts. (Here's how you load CSS asynchronously, by the way: https://stackoverflow.com/q/32759272/247696 ) Or even better, host the fonts yourself.