Next.js Discord

Discord Forum

Prevent FOUT when self hosting fonts

Unanswered
! AlexNotTheLion posted this in #help-forum
Open in Discord
Using next 14 and next/fonts/local I cant seem to apply a font to the layout without getting a flash of unstyled text when refreshing the page ? does anyone know what im doing wrong ?

1 Reply

Asian paper wasp
Nothing is wrong here, that's the point of display: swap.
Basically, it takes time for your font to load. Before it is loaded, the browser will attempt to use OS built-in font as a fallback to display the text, hence the "unstyled" font.

The display property can be changed to make the page wait for the Inter font to load before displaying any text, but that's not really a good idea in general