Hacker News new | ask | show | jobs
by lukepothier 2026 days ago
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, but the browser should be equipped to make that happen as quickly as possible.

7 comments

I've always thought the same. I see the same web fonts being used time and time again. It just makes sense for browsers to have an intelligent "permanent cache" - not based on your specific history but a common set of frequently sourced fonts, libraries, etc.

This would be especially helpful now that shared caches are going away.

One other option is to actually install the font into your OS. Any correctly-coded website will try a local source first, which should help a lot for poor connections.

> 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.

> Then Google Fonts is not correctly coded, as it'll use remote font only.

For a good technical reason: the version installed on the computer may not really match whatever the version on Google Fonts serves (fonts have notoriously no semantic versioning aside from some programmer-oriented fonts, examples of these outside are Segoe UI (changed between Windows 7 and 8) and Liberation fonts (some versions notoriously lack some glyph symbols) and on Google Fonts platform the Exo and Exo 2 problem (which was resolved by renaming the second version to Exo 2)).

Of course, there are also some benefits to Google (you know what are those benefits are).

From the google fonts FAQ it says they will use the locally installed font if possible

https://developers.google.com/fonts/faq#can_i_download_the_f...

> Note that when browsers render websites that use the Google Fonts API, they will check if a font is installed locally on your computer, and prefer to use the local version over web fonts.

Here's snippet from CSS served to my browser:

https://fonts.googleapis.com/css2?family=Inconsolata&display...

    @font-face {
      font-family: 'Inconsolata';
      ...
      src: url(https://fonts.gstatic.com/s/inconsolata/....woff2) format('woff2');
  unicode-range: U+0000-00FF, ...;
Wow! That used to not be the case. I can't find anything about the change but it used to include a check for local(font-face) in the sources.

Some random references to it w/ the snippets:

https://stackoverflow.com/a/52413970

https://stackoverflow.com/questions/18303215/how-can-i-preve...

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

Thank you, I gave advice and missed this change.

I've created issue "Local font name makes web accessible", and I hope it would be fixed.

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

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.

I'm not an expert but:

- 1. Copyright (though many fonts are free, true)

- 2. Everyone uses a different font (just like everyone uses a slightly different version jquery) so cache hit would be pretty small IMO. Do you really want a browser to be gigabytes large? Especially on mobile it's not viable

Maybe if browsers standardized on shipping, say, 20 carefully chosen fonts (not necessarily the most popular ones, just a good variety of different types of fonts), the smaller websites would follow and use them; but I think any major brand likes to distinguish themselves and have a custom unique font.

> "Do you really want a browser to be gigabytes large? Especially on mobile it's not viable"

Absolutely, i would rather give the browser 50 GB even on my phone over paying my mobile operator for downloading the same data over and over again.

And it wouldn't take anywhere near that much, I am sure 80% of most used fonts are only a couple dozen, that wouldn't tale gigabytes

It also doesn't have to be a binary proposition.

For example, Google Maps by default doesn't load maps of the entire world when you install it. However, it does let you opt-in to pre-downloading specific areas that you frequently travel.

Browsers could do the same by simply adding an opt-in to download / cache common assets like fonts, jquery, etc.

From a privacy point of view,

Not embedding all of them would allow tracking. Caching all web fonts would allow tracking.

The solution is embedding all the popular ones so everyone has them and it can't be used as a signal.

It would be interesting to gather a list. uBlock Origin can disable Web Fonts

https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-...

so it should be possible to log. And given a list it is not hard to download.

> Maybe if browsers standardized on shipping, say, 20 carefully chosen fonts (not necessarily the most popular ones, just a good variety of different types of fonts), the smaller websites would follow and use them; but I think any major brand likes to distinguish themselves and have a custom unique font.

It may be not really carefully chosen, but didn't Microsoft have done this already? (Core fonts for the Web, https://web.archive.org/web/20020124085641/http://www.micros...). The reason they have discontinued this programme is that it actually costs them some money (as the fonts are not owned by Microsoft.)

Also, how would you cater to non-LGC (Latin, Greek, Cyrillic) users?

Yep Asian fonts in particular are _huge_. It's a complex topic.
I mean I’ve said it before but shipping like 20 (montserrat, raleway, open sans, etc) would cover most websites who use Google Fonts.
You might be right, but the next question is fashion. Will the same fonts be used still in 5 years, or (more likely) the new hotness will arrive? Should the browsers update the list each year? Then some fonts that were available will suddenly be not? Not so great.

Web standards and browser features are generally built for the long term and backward compatibility. I mean, it's not impossible to find a solution, but it's definitely not "let's download some fonts and bundle with the browser, done" kind of problem.

When you control 70% of the desktop market share, and you are releasing an evergreen browser that updates weekly, if not more frequently, any argument about not being able to stay on top of changes in the environment become rather silly.
We keep root ssl certificates up to date, surely we can handle a few fonts.
At least it is not a problem for Google, since it controls both the most popular browse and most popular web font distribution channels.
Microsoft's old "core fonts for the web" are still widely in use. (including here on HN.)
Aside from Arial, which core fonts are still used widely?
Right-click and inspect element.
Do we really want to invite a couple of browser vendors to set the course of typographic design for the next few decades?
I believe already there but maybe a set of categories of fonts like UI, sans, monospace, handwriting could be alias usual for all websites and apps
Copyright and size: fonts are larger than you might think because they need full Unicode support and good fonts have tuned variants for different weights, styles, and sizes, along with alternate symbols and ligatures, etc. which all add up.

Self-hosting is the way to go since it gives you full artistic control and you can use things like the Unicode-range CSS property to tell clients how to combine smaller fonts so you can support many languages without forcing a French browser to download a ton of Chinese glyphs which aren’t used on the page.

Another nice option we have now is using font-display to allow using a similar system font until downloads are completed, which can work really well for slow connections:

https://calendar.perfplanet.com/2020/a-font-display-setting-...

> fonts are larger than you might think because they need full Unicode support

Correct me if I'm misunderstanding, but don't the vast majority of fonts _not_ include full Unicode support, or even close to it? I know of GNU Unifont, but not many people are using that on the web...

I take your point on selectively downloading the relevant glyphs for the user's locale, but this could be done by the browser too - it is aware of the locale.

full coverage, yes, that's relatively uncommon but the most popular fonts will have a wide variety of languages and that adds up even if you don't support Chinese but do want coverage of the range of fonts designers want to use.
Because web tech (and Google in particular) is a mess of weird politics.

There are some things that are really well executed, and other things where the ball gets dropped completely.

Chrome will come along and do something like hide parts of the url, or allow scroll-jacking, but then say that fonts should probably be a system level implementation.

It would be trivial for the chrome team to establish something like a series of web-safe fonts like Roboto, Inter, Merriweather, etc. Stuff that gets used incredibly often. Even things like licensing aren't really an issue when most of these fonts are under their open license not to mention that Google has the money to be able to license it if they wanted to.

Doesn’t google benefit from getting data on where fonts are served?
e.g. Chrome could ship with the Google fonts. Would improve the experience of something like 50% of web users.
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.
I'm a "proficient" computer user and don't really know how to install fonts on my OS.

I could learn how to do it in 30 minutes, but I don't feel like spending 30 minutes learning that.

I'd guess that 99% of users don't know how to install fonts or simply don't care about it enough to their spend time installing fonts.

answer: licensing. nightmare. fuel.