Re:Self-host your fonts for better performance
by colejohnson66 on Friday December 04, 2020 @08:58AM
(#25302246)
Re: (b): I know there’s a MathJax clone that works around the constant reformatting by precalculating the sizes of the various blocks and putting that into the HTML. So your browser basically makes a big empty placeholder box that the renderer will render into.
It’d be neat if something like that were available for web fonts. Each paragraph gets its own “block” that the installed font uses (and contains padding), and when the font downloads, it won’t reflow. But I’d assume it’d be way too complicated to deal with (different screen widths is the first to come to mind).
Re:Self-host your fonts for better performance
by scrollaway on Friday December 04, 2020 @12:32PM
(#25305197)
The easiest fix is to ensure you pick a native fallback to your web font which has metrics which closely match your web font. You might have to use a different font-size and letter-spacing while it's loading, even.
Re:Self-host your fonts for better performance
by ori_b on Friday December 04, 2020 @09:39AM
(#25302658)
It's also likely to be implemented as a ton of JS to download, which would either block rendering (see option 1 above), or apply after the content loaded (see option 2).
So, a bunch of work to fix something that isn't broken when you turn off webfonts and respect user settings.
Re:Self-host your fonts for better performance
by ashtonkem on Friday December 04, 2020 @12:11PM
(#25304890)
With an isomorphic web app, that should be calculated server side.
Re:Self-host your fonts for better performance
by ori_b on Saturday December 05, 2020 @12:22AM
(#25312011)
Using what screen size, page zoom level, and font rendering engine?
Re:Self-host your fonts for better performance
by ashtonkem on Saturday December 05, 2020 @11:11AM
(#25315557)
.... ah, right.
Re:Self-host your fonts for better performance
by kevin_thibedeau on Friday December 04, 2020 @12:26PM
(#25305095)
You'd just have to send the font metrics first or extract them early from a partially downloaded font. Then render with temporary glyphs.
There are only two ways loading such a site goes:
a) you get to stare at a blank page for a couple minutes while the font downloads, if it downloads at all. (this seemed to be google's favorite way to screw over people with bad connections; acknowledgment that it's going to suck and doing it anyway)
b) you get two minutes into reading the page only for everything to suddenly jump somewhere else when it switches to the font. (this seems more like the result of ignorant web designers)
JS sucks but webfonts consistently make the web an awful place.