4 ms·
Here's the browser view of this brief interaction: http://i.imgur.com/IWFEKGt.png http://i.imgur.com/IWFEKGt.png [0] Basically, the stylesheet finished transfe
by paulirish 10y ago
Here's the browser view of this brief interaction: http://i.imgur.com/IWFEKGt.png http://i.imgur.com/IWFEKGt.png [0]
Basically, the stylesheet finished transferring and the browser followed up with laying out the page. Some data:uri requests were in flight and when they finished (200ms later) the page was laid out again and now applied the fonts.
Typekit has historically detect in JavaScript when a font loads because they like to ensure the text stays invisible (across browsers) while the page hasn't finished loading the fonts. But in this case, it looks like there's a problem with either Typekit not finding the load "events"[1] of these fonts, or Chrome mishandling data uri fonts in some way. We've filed https://crbug.com/607788 https://crbug.com/607788 to investigate further.
Loading fonts well is hard. Here's some advice on doing it well: https://gist.github.com/paulirish/d511793a1c3b74b31460 https://gist.github.com/paulirish/d511793a1c3b74b31460
[0] You can explore the same recording here: https://frontend.chrome-dev.tools/serve_rev/@db7757b63f29696b9b465949f9704a0d9d149f2b/inspector.html?loadTimelineFromURL=https://dl.dropboxusercontent.com/u/39519/fout-trace.json&experiments=true https://frontend.chrome-dev.tools/serve_rev/@db7757b63f29696... (Chrome only. Check the screenshots checkbox)
[1] https://drafts.csswg.org/css-font-loading/ https://drafts.csswg.org/css-font-loading/ was standardized for these purposes. It's available in Chrome, Opera and Firefox to reliably detect when a font has finished loading.
[‽] As mentioned later by hatsix, the font-display spec introduces a CSS property to provide control over FOUT/FOIT to the site: https://tabatkins.github.io/specs/css-font-display/ https://tabatkins.github.io/specs/css-font-display/ It will definitely bring a lot of sanity to a something that's been a problem since at least 2009 :) http://www.paulirish.com/2009/fighting-the-font-face-fout/ http://www.paulirish.com/2009/fighting-the-font-face-fout/
- 33degrees 10y agoSeems to be affecting google fonts too
- paulirish 10y agoGot any URLs where you're seeing this with Google Fonts (or any other non-JS webfont situations)?
- tollmanz 10y agoI've been hearing reports of increased FOUT lately and noticed it myself. I just so happened to use someone else's computer this evening tonight and did not see the issue. Turns out that I am seeing FOUT on every page load with Typekit fonts in Chrome 50, but not Chrome 49 or Firefox. Are you getting the results from your tests in 49, 50, or both? It seems like Chrome 50 was the catalyst for the issue.
- paulirish 10y agoI'm digging in a little more and seeing some odd behavior, but it's unclear if this stuff is new to 50. Star this ticket to follow along: https://crbug.com/607788 https://crbug.com/607788