Live data from Hacker News

Self-host your fonts for better performance

wicki.io

121–130 of 417 posts

Re: Self-host your fonts for better performance

#123
post #80

Earlier quoted context omitted.

firefox options -> language and appearance -> advanced -> uncheck 'Allow pages to choose their own fonts, instead of your selections above'

Won't this break the UI of most sites because they (ab)use web fonts to add icons? It's annoying to hit a page with a video player, and all the buttons are little boxes with numbers in them because the icon font didn't load...

It depends.

In Firefox, disabling "Allow pages to choose their own fonts" does not completely block web fonts (as setting gfx.downloadable_fonts.enabled to false would); what it does is to prioritise the default fonts, and move any page-specified fonts to the end of the fallback list.

This means that for "normal" text, the browser's default fonts will be used, but if there are Private Use Area character codes that are only supported by the site's custom webfont, it'll still get used for those. So icon fonts that are based on PUA code points will still work.

What doesn't work in this scenario is when the icon font doesn't encode its icons in the PUA, but uses normal Unicode characters -- either symbol code points that are supported by the system's default fonts, or as some icon fonts do, regular English words that then use ligature rules to produce the icon glyphs. (So the icon font contains OpenType mappings such as "phone" -> [phone icon].) In this case the content on the page will end up rendered using the default font instead.

[Edited: HN doesn't let me include an actual phone icon there, apparently.]

Re: Self-host your fonts for better performance

#124
post #113
post #81

Earlier quoted context omitted.

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…

What lunatic would strip hinting!?

Is this really done?

Re: Self-host your fonts for better performance

#125
post #113

Earlier quoted context omitted.

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…

What lunatic would strip hinting!? Is this really done?

Yes - after all, it makes the font resource smaller. (And if the designer is working on a Mac, they won't notice any difference.)

Re: Self-host your fonts for better performance

#126
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)

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.

Have you got a screenshot? I'm curious as I regularly switch between Windows and MacOS and I'm happy enough with font rendering on both.

In my recollection (and it's been a few years since I used a Linux GUI) Linux was the one with dodgy font rendering.

Re: Self-host your fonts for better performance

#127

It's infuriating to see so much web tech being discarded created during the 90s and 00s in good faith, just because the web was subverted into an app delivery platform (in this case, shared caches were obsoleted by timing attacks) and the arms race for ever more crap to counter the negative effects, insufficiently. The web may now be a platform to lock-in and enslave users; just isn't anymore a recommendable place fo…

“Enslave users”, really?

Re: Self-host your fonts for better performance

#128

Does this mean that all CDN hosting of libraries, etc. will now be semi pointless for optimization?

Yes, it will be. The main reason, as all things, comes down to breaking human trust: tracking companies may send a small picture/small JS (that only contains a unique ID) that is randomly generated but is continously cached by the browser, effectively circumventing cookie policy.

Re: Self-host your fonts for better performance

#129
post #47

I'd also point out that Google CDNs don't work in China and make your websites broken for 1/5th of the world's population. (Not to mention your leaking your user's info to Google - which is a dick move..)

which is a dick move

Perhaps blocking a big part of the internet is the real dick move?

Re: Self-host your fonts for better performance

#130
post #55
post #15

Mainly for performance reasons I've recently gone from using hosted/local Google Fonts to just calling the system ones (some variant of `-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue`).

Something like this is really popular, covers most cases and older systems/browsers and even emojis: `ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji` For brand-specific fonts though, I highly recommend cleaning the font files from any characters/features you don't need, and then just s…

Once you’ve cut it down to just the characters you need (say it’s the letters in your logo and slogan) could you inline that within the page itself (and how?) to make it not need an extra request.
Post reply on HN