Font-size adjustment (source code)

= Font-size adjustment

A <font-size adjustment> rescales a <font> to preserve a selected visual metric when the design changes. Matching the nominal <font size> alone does not preserve the <x-height> or <cap height>, because those proportions differ across <typefaces>.

The <x-height> calculation gives a direct rule. If a requested scale $p$ and desired lowercase ratio $r$ should be matched by a fallback design with ratio $r_f>0$, use
$$
\boxed{p_f=p\frac{r}{r_f}.}
$$
For example, matching $r=0.55$ at 20 <pixels per em> with a fallback ratio $r_f=0.5$ requires 22 <pixels per em>. Both designs then have ideal lowercase body height 11 <pixels>. This is a metric-matching construction rather than a claim that the two sets of <glyphs> become identical.

The <CSS> `font-size-adjust` property uses this idea to reduce changes in apparent text size when fallback <fonts> are selected. Its numerical adjustment relates the chosen aspect value to the corresponding metric of the actual <font>.<CSS Fonts Module Level 4 by W3C>[Section 2.6: aspect value and the adjustment formula]{ref}

Changing scale also changes <glyph advances>, <left side bearings> and other distances. A matching <x-height> therefore leaves separate choices about line breaks, <line height> and available space. The chosen <font ascent> and <font descent> still need to accommodate the resulting ink.