Menu

Font Loading Is a Layout Decision: Measured Shift for swap, optional, fallback and block
πŸ“°

Font Loading Is a Layout Decision: Measured Shift for swap, optional, fallback and block

DEV Community: cssΒ·Design Den SolutionsΒ·6 days ago
#7oyI8bHP
#devtocss#devto#dev#font#swap
Reading 0:00
15s threshold

Most advice about font-display stops at "use swap unless you can't stand the flash". That framing is wrong in two ways. First, swap is not a single behaviour β€” it is a three-phase timing contract, and what your page does depends on where the font lands inside those phases. Second, the layout shift it causes is not just "text gets slightly wider". On a page that sizes anything in ch , the swap changes the width of the container itself , which changes the line count, which moves everything below it.

I built a small harness to measure this rather than argue about it. Everything below is a number I actually got out of it, with the limits stated at the end.

The setup

One page, one viewport (1366Γ—768), Chromium (system Chrome, driven by Playwright), served over http://127.0.0.1 so the font request can be genuinely intercepted and delayed.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.