EDIT: Unless there's a way to include metrics outside the font there really isn't a way to prevent reflows when it loads other than blanking the entire page until then.
EDIT: Unless there's a way to include metrics outside the font there really isn't a way to prevent reflows when it loads other than blanking the entire page until then.
(There are many ways to avoid reflows with font loading, eg font-display: optional)
- The page takes an extra 100ms to load
- ~ a minute later (when you're halfway through reading it) the content will jump by some large amount.
There isn't a nice way to do custom fonts on the web and you should just avoid them.
> The page takes an extra 100ms to load
Nope. Slow connections' floor for first paint is 100ms when using `font-display: optional` – not an additional 100ms. The page is still loading like normal in this period. (If you're already under a 100ms FCP for 3G users, you know all of this already)
> the content will jump by some large amount
`font-display: optional` is literally designed to prevent this from ever occurring. Either the font is ready for first paint in 100ms, or another font is used.
On Firefox, this is as simple as going to about:config and setting gfx.downloadable_fonts.enabled to false.
On Chrome, it requires adding the flag --disable-remote-fonts to however you're opening it.