Live data from Hacker News

Self-host your fonts for better performance

wicki.io

111–120 of 417 posts

Re: Self-host your fonts for better performance

#111

What if you had a declaration like @font-face { font-signature: somehash } And the browser just checks to see if it already has the font. If you release a webfont you can share it with signatures or just generate signatures if the author hasn't done it for you. This way if you're self-hosting Lato and the user already has Lato, they don't need to download it again.

That kind of content addressable naming based on hashes would be awesome for the web in general.

Think of all the big JS frameworks. If they were all referenced by hash, their size would become pretty much irrelevant, as they would be amortised across potentially thousands of requests.

But the web chose to go with unified resource LOCATORS for everything, and I don't think it'll be easy to change that mindset.

It's the reason why people do crazy things like register DOI (a location based URL, that is hosted with a single point of trust/failure) to reference git hashes (a content addressed URN). They don't know better, and they want readable names.

A different issue with this kind of caching tho is that it is a potential side channel for privacy sensitive information.

For example if my script requests the pornHub logo, or something else that might even be more specific, like videos themselves. I can use a timing side-channel to figure out wether or not that particular item was in the users cache, and thus visited previously.

Imho they applied the wrong solution to that issue: domain separated caches. You loose the timing channel, but also loose all the caching advantages.

A much better solution would have been to close that timing side channel. If every browser ran TypeScript this could actually be a monad, where a "low resolution timer"-monad is strictly separating timing sensitive portions from high resolution timers.

Re: Self-host your fonts for better performance

#112
post #4

A question: instead of redownloading the same resources again and again, can we achieve privacy by adding delay between requesting a resource and providing it? It could be the same amount of time it took downloading it the first time or some randomized value. It won't speed up pages, but at least will save from bandwidth and data caps.

You don't need a timing attack as you could e.g. put a unique identifier in the resourcce you're delivering via the CDN. When the browser delivers the resource from its cache for another domain you could simply extract the identifier from it again to achieve cross-site tracking.

This is actually valid. Without third party to ensure the neutrality of the resource, this would be a unregulated cookie.

A better trap would be if the browser downloads the resource on the second request as well and compares the hashes. If they differ, the resource is considered uncachable.

Re: Self-host your fonts for better performance

#113
post #81

Earlier quoted context omitted.

Well, TIL about it being a container. But do they really contain an identical amount of information for font rendering? I'm no font expert, but I do know that you can have more or less information in a font file that affects how it's rendered.

Yes, it's just an Open Type file. The usual omitted stuff is subsetting a bigger font to include only certain glyphs you need, usually you don't mutilate font by removing rendering data from glyphs.

Yes, it's just a container for the exact same data that an OpenType font holds.

On the other hand, it's possible that in the course of deployment, various things may be dropped from the original font resource: not just subsetting (reducing the repertoire of supported characters), but in some cases also OpenType features (e.g. ligatures or contextual forms), and in some cases hinting is stripped.

If that is done, the webfont version may indeed appear differently than the original "desktop" font, depending on local font-rendering settings.

Re: Self-host your fonts for better performance

#114
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 did an experiment a few months ago where I just switched of font overrides and set my default font to Comic Sans, at a pretty large default size (and I tend to zoom in a lot, too).

It actually was quite pleasant and readable, despite the particular font choice.

Re: Self-host your fonts for better performance

#115
post #58

Earlier quoted context omitted.

Most free fonts are rather poor quality. Most font designers seem to publish web fonts for free as an advertisement for their services or print font products they sell. As a consequence, while the sample sentence might look great, the feeling when reading is poor. Especially screen optimisation is lacking, which is what distinguishes the usual fonts you get with your OS (like Arial or Roboto) from stuff you would buy…

Font designers publish poor quality fonts to promote their products? That isn't supposed to work.

You’re underestimating how much work and skill it takes to make a good font, even for a great designer, so type foundries like to lock good fonts up behind rent-seeking license agreements.

Re: Self-host your fonts for better performance

#116

Earlier quoted context omitted.

As a guy who does this blocking pretty ruthlessly (edit: inc. cookies), I'd like to understand why - I don't take offence at 'sneer', ISWYM but I'd like to understand the other side of the fence. TIA

sorry, 'sneer' is probably a bit strong - it's really just a lack of understanding on my part (of your side of the fence). I personally find browsing the internet without javascript or cookies enabled by default to be incredibly frustrating/inconvenient, but I'm sure it's all very subjective, down to your own personal browsing habits.

Overcoming frustration regarding ads, performance, nag screen, consent screens, poor design, various hijacking, tracking, clickbait and otherwise poor content is very personal in my experience.

Some people even invent new protocols (Gemini comes to mind) to circumvent some of these frustrations.

Re: Self-host your fonts for better performance

#117
post #92
post #68

Earlier quoted context omitted.

The cleaner look is because most designers use macOS which renders most fonts in a way that makes them all look good (let’s not get into technical details). On Windows the same fonts might look like shit (for example some parts of a character are thicker than the rest for no apparent reason)

Well, good is relative. MacOS renders fonts in a weight-and-form-correct way which makes them look blurry however. Windows renders fonts in a weight-and-form-incorrect way, which however makes them sharper and easier to read on screens, especially with resolutions below 200dpi. Now if you use a high-resolution monitor and print-optimized fonts, MacOS will look better. If you use a low-resolution monitor and screen-op…

Designers primarily designing for other designers is a core problem with the entire field of design and it holds back a lot of society as it seems to really encourage apps having super low information density displays with slow animations.

Re: Self-host your fonts for better performance

#118
post #58

Earlier quoted context omitted.

Most free fonts are rather poor quality. Most font designers seem to publish web fonts for free as an advertisement for their services or print font products they sell. As a consequence, while the sample sentence might look great, the feeling when reading is poor. Especially screen optimisation is lacking, which is what distinguishes the usual fonts you get with your OS (like Arial or Roboto) from stuff you would buy…

Font designers publish poor quality fonts to promote their products? That isn't supposed to work.

Maybe it does. It isn't poor quality per se, on the first contact those fonts look great. Only prolonged usage will reveal their flaws, and then only if you know what you are looking for. Most buyers won't be so sophisticated, so it can work. Actually, lots and lots of products are sold in such a superficial way.

Re: Self-host your fonts for better performance

#120
post #68

Earlier quoted context omitted.

The "cleaner" feel may well be to do with better font rendering for desktop fonts, because you'll be using something like TTF rather than WOFF. Web font files have to trade off file size for quality, which desktop fonts don't have to do.

The cleaner look is because most designers use macOS which renders most fonts in a way that makes them all look good (let’s not get into technical details). On Windows the same fonts might look like shit (for example some parts of a character are thicker than the rest for no apparent reason)

Its actually incredible how ugly fonts render on windows. After using linux for so long I thought I was experiencing a bug when seeing fonts on windows.
Post reply on HN