5 ms·
If you have a worldwide CDN yourself, or you only care about local users, or your fonts are small (Latin subset), yes. If you're using CJK fonts and you don't
by marcan_42 7y ago
If you have a worldwide CDN yourself, or you only care about local users, or your fonts are small (Latin subset), yes.
If you're using CJK fonts and you don't already have a CDN for your stuff, no. Google Fonts' CDN is going to beat your own server from any other continent.
- nsomaru 7y agoBut if you’re already loading your entire site from your server, what difference does it make if the fonts come from there too?
- maple3142 7y agoMaybe the site owner has a CDN(CloudFront, CloudFlare, ...) in front of their whole website.
- gen3 7y agoWouldn't that cache font files along with the rest of the website?
- robjan 7y ago[deleted]
- jeff18 7y agoShared cache is going away: https://news.ycombinator.com/item?id=21429621 https://news.ycombinator.com/item?id=21429621
- marcan_42 7y agoCJK fonts can be megabytes. The rest of an otherwise lean site can be a few hundred kilobytes or less. E.g. my site's About page is tiny, but pulls in a CJK font (with delayed load) for one line of text. It would make no sense to self-host that: https://marcan.st/about/ https://marcan.st/about/
- detaro 7y agoA self-hosted font containing just those few characters would be tiny, and nicer to your visitors than forcing a mostly useless megabyte download on them. Makes a lot of sense.
- dylan604 7y agodoes it really make sense to load a large font for a single line of text on the page regardless if it is self-hosted or not? that must be one important line of text.
- e12e 7y agoIf you use a custom/download able font at all, it would make sense to use one copy (URL) - so every visitor only has to download it once - then use it from cache. This probably also the best reason to use a central CDN over your own - likely some other site already warmed up the client cache for you, with popular fonts (the ultimate in pre-warmed font cache, is of course the fonts the browser/os already have installed - unfortunately the lowest common denominator is a problem here, between Android, ios, os x, windows, Linux). I'm not sure if Google font service actually does facilitate cross-site caching though - there might be tailored URLs or account?
- XelNika 7y agoThe article already addresses that. Cross-site caching is blocked in Safari and will be blocked in Chrome in the future.
- tjoff 7y agoJesus, why bother we a lean site with that mindset. If it truly is a must make it a small (self-hosted) png.
- e12e 7y agoEh, then it's no longer text? Fwiw I don't really think a one-time large font download is much of a problem - considering that improved typography is a very good way to improve how a site looks. And unlike your png - the text will display without the custom font. Fall-back fonts are only really a problem with icon font sets.
- alwillis 7y agoAn alternative is jsdelivr, a CDN for hosting open source libraries and fonts: https://www.jsdelivr.com https://www.jsdelivr.com For example, here’s Lato: https://www.jsdelivr.com/package/npm/lato-font https://www.jsdelivr.com/package/npm/lato-font
- fiblye 7y agoIf you're using the C in CJK, then there's a good chance absolutely anything will beat Google Fonts since approximately 99% of your users have Google permanently blocked.