Font size (source code)

= Font size

The <font size> sets the nominal scale at which a <font> is used. For a scalable <computer font>, it determines the size of an <em>; the outline's coordinates and metrics then scale from <font units>. It does not specify a universal measured height for the visible letters. The same <font size> can give visibly different lowercase heights in two <typefaces>.<CSS Fonts Module Level 4 by W3C>[Section2.5: definition of font-size and the note about EM boxes and apparent size]{ref}

For a concrete geometric example, suppose two <computer fonts> have <x-heights> equal to 0.45 and 0.60 of an <em>. At a nominal 16 <pixels per em>, the ideal scaled heights are 7.2 and 9.6 <pixels>, respectively. Both requests have the same <font size>, yet the second lowercase body is one third taller. These are hypothetical metrics, before <grid fitting>.

\Image[/font-size-and-x-height.png]
{title=Equal <font sizes> can produce different <x-heights>}
{description=Original toy letterforms with <x-heights> of 0.45 and 0.60 <em> at a nominal scale of 16 <pixels per em>. The ideal heights are 7.2 and 9.6 <pixels>; these are schematic shapes rather than measured <computer fonts> or a demonstration of <rasterization>.}

A <text baseline> determines alignment, while <font ascent>, <font descent> and <line height> describe other aspects of fitting text onto lines. Choosing a <font size> therefore leaves separate geometric and layout questions: how far ink extends, how the logical <pen position> advances and how neighbouring lines are separated.