Live data from Hacker News

Self-host your fonts for better performance

wicki.io

221–230 of 417 posts

Re: Self-host your fonts for better performance

#221

I never understood why browsers don't ship with more fonts, especially Chrome.

It would pressure smaller browsers into shipping the same fonts. That's a good and a bad thing.

It's good because we could stop caring about FOUC and friends, but it's bad because it would give Google even more power over the web.

Re: Self-host your fonts for better performance

#222
post #194
post #5

I'm usually the first one to sneer in disbelief at super users who 'go nuclear' and disable the likes of javascript and images when browsing the web, but lately, I've been experimenting with having custom fonts disabled (that is, fonts I don't have locally), and it feels to me that page loads are much faster, and in some case more readable (pages feel 'cleaner'?). The only issues I've come across so far is when a sit…

I HATED sites that used custom fonts when I lived in the country. There are only two ways loading such a site goes: a) you get to stare at a blank page for a couple minutes while the font downloads, if it downloads at all. (this seemed to be google's favorite way to screw over people with bad connections; acknowledgment that it's going to suck and doing it anyway) b) you get two minutes into reading the page only for…

Turn them off entirely, it's an about:config in Firefox and I think a commandline flag on Chrome(?)

Re: Self-host your fonts for better performance

#223
post #14
post #2

LocalCDN (Firefox Extension) solves the performance issue on the client side, i assume: https://addons.mozilla.org/en-US/firefox/addon/localcdn-fork... https://codeberg.org/nobody/LocalCDN/src/branch/main/resourc... (and adds extra privacy as a bonus.)

There is this tried-and-true extension: https://addons.mozilla.org/en-US/firefox/addon/decentraleyes... LocalCDN seems to be a fork of it, why should we be using it when it has so few users?

Decentraleyes has very few resources compared to LocalCDN. It doesnt cache the important ones too.

LocalCDN is also under active development, and the dev seems more pro-privacy.

Re: Self-host your fonts for better performance

#224
post #194

Earlier quoted context omitted.

I HATED sites that used custom fonts when I lived in the country. There are only two ways loading such a site goes: a) you get to stare at a blank page for a couple minutes while the font downloads, if it downloads at all. (this seemed to be google's favorite way to screw over people with bad connections; acknowledgment that it's going to suck and doing it anyway) b) you get two minutes into reading the page only for…

Re: (b): I know there’s a MathJax clone that works around the constant reformatting by precalculating the sizes of the various blocks and putting that into the HTML. So your browser basically makes a big empty placeholder box that the renderer will render into. It’d be neat if something like that were available for web fonts. Each paragraph gets its own “block” that the installed font uses (and contains padding), and…

It's also likely to be implemented as a ton of JS to download, which would either block rendering (see option 1 above), or apply after the content loaded (see option 2).

So, a bunch of work to fix something that isn't broken when you turn off webfonts and respect user settings.

Re: Self-host your fonts for better performance

#225
post #80

Earlier quoted context omitted.

Won't this break the UI of most sites because they (ab)use web fonts to add icons? It's annoying to hit a page with a video player, and all the buttons are little boxes with numbers in them because the icon font didn't load...

“No web fonts for elements containing multiple characters” would be a great ublock rule, now I think about it...

That'd break sites that use ligature-based icon fonts, with the actual content being an icon identifier like "thumbs-up" and an OpenType ligature rule in the font to render this as an icon glyph.

Re: Self-host your fonts for better performance

#226

To me, Google Fonts means "A repository of free fonts you can download". To the author, Google Fonts means "A CDN for fonts". The article obviously talks about his definition, which may be confusing to people who use my definition.

Exactly. I use Google Fonts mainly to conveniently try out different fonts. It used to be even better, when you could select a bunch of fonts, and preview all of them on one single page. It's sad that feature is gone now.

Re: Self-host your fonts for better performance

#227
post #80

Earlier quoted context omitted.

firefox options -> language and appearance -> advanced -> uncheck 'Allow pages to choose their own fonts, instead of your selections above'

Won't this break the UI of most sites because they (ab)use web fonts to add icons? It's annoying to hit a page with a video player, and all the buttons are little boxes with numbers in them because the icon font didn't load...

Very few sites do this, in my experience.

Re: Self-host your fonts for better performance

#228
post #47

I'd also point out that Google CDNs don't work in China and make your websites broken for 1/5th of the world's population. (Not to mention your leaking your user's info to Google - which is a dick move..)

> which is a dick move

Ah yes. It is Google's problem that xi jinping doesn't like Chinese people having an open internet.

Re: Self-host your fonts for better performance

#229
post #220

FYI Google fonts are also loaded from the google.com domain. They can associate your login cookies with every page you visit. As you can see, it is very sneaky by using CNAME Cloaking - https://i.imgur.com/VB2DB75.png The request is to fonts.gstatic.com, but it resolves to gstaticadssl.l.google.com Tracking using CNAME cloacking - https://medium.com/nextdns/cname-cloaking-the-dangerous-disg...

> They can associate your login cookies with every page you visit.

This is why 3rd party cookies should always be disabled.

Re: Self-host your fonts for better performance

#230

Earlier quoted context omitted.

> Any correctly-coded website will try a local source first, which should help a lot for poor connections. Then Google Fonts is not correctly coded, as it'll use remote font only. And myriads of websites reusing Google Fonts snippets. To try local source first, you have to explicitly ask for it in @font-face/src which Google Fonts does not do. So installing font into your OS won't help you with any website using Goog…

I wasn't aware Google Fonts' CSS didn't include local. That's disappointing. Thanks for letting me know!

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.
Post reply on HN