Guide

Web Performance • Core Web Vitals

Font Fallback Generator (CLS & size-adjust Matcher)

Create metric-adjusted @font-face fallback rules for Inter, Roboto, Playfair Display, Merriweather, and custom webfonts to keep Cumulative Layout Shift near zero.

Google Font Presets:
Live Fallback Metric Preview (Est. CLS reduction: ~93%)
Zero layout shift typography keeps Core Web Vitals green while custom webfonts load.
Generated @font-face Fallback CSS
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107.00%;
  ascent-override: 90.40%;
  descent-override: 22.50%;
  line-gap-override: 0.00%;
}

:root {
  --font-primary: "Inter", "Inter Fallback", sans-serif;
}

body {
  font-family: var(--font-primary);
}

CSS @font-face Metric Override Descriptors

DescriptorWhat It ControlsCLS Impact
size-adjustScales glyph widths and em-box uniformlyPrevents horizontal line-wrap changes
ascent-overrideHeight above the baselineMatches vertical line-box top
descent-overrideDepth below the baselineMatches vertical line-box bottom
line-gap-overrideExtra default leading between linesEliminates paragraph height drift

Related Accessibility & Performance Tools

Frequently Asked Questions

How does a CSS font fallback generator reduce Cumulative Layout Shift (CLS)?

When a webfont finishes downloading, it often has a different character width and vertical line height than the temporary system font (like Arial or Times New Roman), causing paragraphs to reflow. By applying size-adjust, ascent-override, descent-override, and line-gap-override to a local @font-face rule, the fallback font matches the webfont's bounding box before swap.

Which browsers support size-adjust and ascent-override?

Chrome, Edge, Firefox, Safari (17+), and Opera all support @font-face size-adjust and metric override descriptors. Older browsers safely ignore unsupported descriptors and still render the local fallback font.

What is the difference between size-adjust and font-size?

size-adjust scales the glyph metrics of a specific @font-face without changing the computed CSS font-size property. That keeps em, rem, and line-height calculations consistent across both the fallback font and the final webfont.

Do I still need font-display: swap when using a matched fallback font?

Yes. Pairing font-display: swap (or optional) with a metric-matched fallback font gives visitors immediate readable text while minimizing visible jump when the webfont swaps in.