When a web font swaps in, lines get longer or shorter and the page jumps. I can make a fallback font that takes up almost the same room by scaling a local font with size-adjust.
@font-face {
font-family: "Brand Fallback";
src: local("Arial");
size-adjust: 107%;
}
body {
font-family: "Brand", "Brand Fallback", sans-serif;
}
The rule defines a new font family that is really Arial from the visitor’s computer, scaled by 107 percent. That number is only an example. Find yours by comparing the width of a paragraph in both fonts, or use a tool that calculates it from the font metrics. The fallback then sits in the stack right after the web font, so it is what people see while the real font loads.
size-adjust scales the glyphs and the metrics together, so it fixes the width of lines. Line height can still differ. For that there are ascent-override and descent-override.
Support for size-adjust is good: Chrome 92, Firefox 92 and Safari 17. The override descriptors are a different story. MDN lists them for Chrome and Firefox but not for a stable Safari release yet, so on iPhones only the width correction applies. Also keep in mind that local() depends on what is installed, and Arial is not on every Linux or Android device.
Further reading: MDN: size-adjust, MDN: ascent-override