Live data from Hacker News

Self-host your fonts for better performance

wicki.io

391–400 of 417 posts

Re: Self-host your fonts for better performance

#392

Maybe I'm being naïve, but why don't browsers ship with more popular fonts bundled to avoid problems like these? I have no issue with any of my browsers taking up fractionally more space for an extensive cache of the most popular web fonts when the payoff is better performance on so many sites. Of course, servers should still be capable of serving the fonts that the client requires to render the content correctly, bu…

Why can't users install the fonts directly on their OSes instead? If it's on the OS, browsers can pick them up and I can install only the fonts I want.

Re: Self-host your fonts for better performance

#393
post #230

Earlier quoted context omitted.

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.

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.

Re: Self-host your fonts for better performance

#394
post #96

Earlier quoted context omitted.

They also don't work with, well, Chinese or most of the Asian languages for that matter. Also most of the population in Asia don't consume the web in English. So you are definitely not missing 1/5th of the world just because your fonts don't render the same, you are missing them because of no localization.

If it's your knitting blog then maybe it doesn't matter. It really depends on the content. If you're selling software then it matters. They purchase software licenses like everyone else - so you're losing clients. If it's a code related thing then software developers in China will also look at it just because there is never enough programming resources for obscure issues. They just might not post issues and "engage".…

"They purchase software licenses like everyone else" no they don't, in countries where English is not common they favour software in their language, willing to give up a margin in software quality for it being localized. So they don't purchase "like everyone else".

I am not in China but in Japan, and I'm tired of seeing second-class clones of US companies that strongly win the local market just because they are localized.

Only with translating their websites, western companies would be able to win a lot of the market. And if they can also localize it, then it's a lot better. But if they do neither, as long as there is some sort of local alternative, your software is dead on the water.

Re: Self-host your fonts for better performance

#395
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…

My favourites are sites that load the layout, the ads, the analytics, then the fonts and only then the actual text of the page. If the font doesn’t load, the text doesn’t load — and if you have JavaScript turned off just a blank layout with ad-sized blocks waiting for something to happen.

Re: Self-host your fonts for better performance

#396
post #96

Earlier quoted context omitted.

If it's your knitting blog then maybe it doesn't matter. It really depends on the content. If you're selling software then it matters. They purchase software licenses like everyone else - so you're losing clients. If it's a code related thing then software developers in China will also look at it just because there is never enough programming resources for obscure issues. They just might not post issues and "engage".…

"They purchase software licenses like everyone else" no they don't, in countries where English is not common they favour software in their language, willing to give up a margin in software quality for it being localized. So they don't purchase "like everyone else". I am not in China but in Japan, and I'm tired of seeing second-class clones of US companies that strongly win the local market just because they are local…

I don't think China and Japan are alike in that regard. At least that wasn't my experience in China. I personally know they bought licenses for things like Matlab and TouchDesigner and whatnot. There are no local equivalents and local brands are not very highly respected. In my very short interning experience in Japan - thing were much more insular and they like their own Japanese brands

Re: Self-host your fonts for better performance

#397

Earlier quoted context omitted.

This comment touches on some points which don't make sense from an engineering perspective. Different tools for different use cases. You can't throw the baby out with the bathwater and choose SPAs for every single application. They still perform poorly with SEO and people with disabilities that need a screen reader. It's not black and white (good or bad). Also, using Django and Rails are hardly the same as using Perl…

Nothing about SPAs hurts screen readers.

Then DOM changing above or close to current position does trip up many accessibility technologies. Most SPA frameworks load all page components async so the page DOM fills in out-of-order.

This is a problem even without accessibility tech, the page content bounces all over the place during load by default in many SPAs.

Re: Self-host your fonts for better performance

#398

Earlier quoted context omitted.

> Why hasn’t w3c taken on some way to avoid the unnecessary complexity? They did. Your browser will use the fall back when you use "font-family" selector. But that's just the best the CSS spec can offer. Why? Because the problem isn't a browser problem. It's a system level problem. Operating systems only come with a handful of fonts. And those packs of fonts may differ per OS. Moreover, most fonts are protected by in…

> Needless to say, this dramatically reduces the number of fonts designers can choose from. Why is a web designer trying to choose fonts? The web is not a print medium.

> The web is not a print medium.

No. It is not. However, the foundations of digital media are very much rooted in analogue media, including print.

This includes typography. Whether it's for the web, or movable type. The history of typography is a crucially important part of the Web with pioneering designers such as Jeffrey Zeldman, Jason Santa Maria or even Edward Tufte in fields such as Information Design and human interaction design.

https://www.printmag.com/post/questions-for-jeffrey-zeldman-...

Re: Self-host your fonts for better performance

#399
post #371
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.)

Note that LocalCDN doesn't handle Google Fonts: https://codeberg.org/nobody/LocalCDN/issues/159

Oh right... Google Fonts seem to be blocked (per default LocalCDN settings.)

Re: Self-host your fonts for better performance

#400

Earlier quoted context omitted.

I live in a rural area with bad internet, and the trend to load all of these external fonts, images and javascript externally over https basically makes the web unusable for us. The overhead of the handshakes required by the https connection greatly increased the page load time, and there is about a 1-in-4 chance of one of them timing out and not loading, so as a result the page doesn't load properly or pauses and st…

There are so many solutions! * In uBlock Origin (which is a must have on bad internet): Settings > Block remote fonts * In browser, Firefox about:config, gfx.downloadable_fonts.enabled, Chrome run with --disable-remote-fonts * Download fonts when on good connection > You can download all Google Fonts in a simple ZIP snapshot (over 300MB) > https://github.com/google/fonts installation depends on OS, on Arch Linux it w…

Unfortunately

> If the local() function is provided, specifying a font name to look for on the user's computer, and the user agent finds a match, that local font is used. Otherwise, the font resource specified using the url() function is downloaded and used.

https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face

And this is not the case for Google Fonts anymore, for example

https://fonts.googleapis.com/css2?family=Noto%20Sans

I've created issue

https://github.com/google/fonts/issues/2855

----

>> 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 Google Fonts service.

https://news.ycombinator.com/item?id=25301830

Post reply on HN