Why wouldn't I just self-host the fonts on my server?
What are the benefits of such CDN? Years ago I could understand it because it may reduce latency (cache), but since browsers don't cache from 3rd party servers anymore, also this is argument is obsolet.
I just went through the process of self-hosting Google Fonts. The process is actually surprisingly tricky.
Google Fonts lets you download fonts for desktop use, in the form of .ttf or .otf rather than the .woff[2] with one file per Latin/Greek/Vietnamese/etc. script served by Google Fonts itself. If you want the same font-embedding CSS as Google Fonts itself, you can use https://google-webfonts-helper.herokuapp.com/fonts (a font browser, outdated, doesn't support font-display: swap), or https://nextgenthemes.com/google-webfont-downloader/ (a converter from Google Fonts CSS URLs to downloadable font packs, supports font-display: swap, it works well but I chose to not host the large CSS files with embedded fonts in base64 format).
As a technical curiosity, the second site can suffer a race condition resulting in partial or broken file downloads (I never tested what happens), if two people request the same font bundle at the same time, and they overwrite each other: https://github.com/nextgenthemes/open-webfonts#bug-reports-a...
I wish browsers would give users an option to set the default font-display policy to swap.
Browsers don't use cross-site cache anymore (so if 2 sites are both using google fonts you don't get the speedup) but I think browsers still cache content from request to request for a domain.
Additionally, a CDN will let that content be closer to your customer, so even if it wasn't cached with the magic of CDNs it should be faster than one origin server.
Correct. The last major browser stopped in early 2021.
> I think browsers still cache content from request to request for a domain.
Definitely! A cache still provides substantial speedup. Modern browsers fragment the cache on a per-site basis: www.example.com and www.example.org don't share, but www.example.com and forums.example.com do share.
True that there's no 3rd party caching benefit anymore, but it's still just very convenient – select fonts a'la carte, copy the CSS/HTML snippet, paste it in, and that's it. All for free, no licensing considerations with Google Fonts.