Sphere
Log in Join
☆ 6

Text shifts when a web font loads

Self-hosted font with font-display: swap. Text reflows on every first load because the fallback has different metrics. How do people avoid this?

⚑ Report

3 replies

☆ 0
R Rhea ·2026-10-29#1

Preload the font file and define a fallback with similar metrics using size-adjust and ascent-override in @font-face.

⚑ Report
☆ 0
T Tom ·2026-10-29#2

Is preload enough by itself?

⚑ Report
☆ 0
A Amir ·2026-10-29#3

Not if the font is slow. Preload helps, but metric overrides stop the reflow when swap happens. Use a system fallback stack tuned to your font.

⚑ Report
Log in to reply.