Font descent (source code)

= Font descent

The <font descent> supplies the below-<text baseline> part of a <font>'s vertical layout metrics. It must be distinguished from the <descender> of an individual <glyph>. The coordinate convention also matters: a downward extent can be represented as a negative coordinate in a system whose vertical axis points upward, or as a positive distance in another API.<Glyph Metrics in the FreeType documentation>[Section2: descent sign in FreeType and other font formats]{ref}

For example, a signed descent $d_f=-200$ <font units> represents a downward extent $D=200$ <font units>. With 1000 <font units> per <em> and 20 <pixels per em>, its magnitude scales to 4 <pixels>. Calling that a negative height would confuse the coordinate with the distance being allocated.

Using a signed descent, an ascent $a=800$ and a <font line gap> $g=200$ in the same <font units> gives
$$
h=a-d_f+g=800-(-200)+200=1200.
$$
Equivalently, if $D=-d_f$ is the positive downward extent, the same <line height> is $h=a+D+g$. This is the elementary typographic spacing model; the rendering system's choice of metrics must still be respected.<Glyph Metrics in the FreeType documentation>[Section2: linespace = ascent - descent + linegap]{ref}

A <computer font> can contain several descent-related fields. For example, <OpenType>'s `hhea` header stores a typographic `descender`; an application must not infer the sign and purpose of every other API field merely from the word descent.<Horizontal Header Table by Microsoft>[descender and lineGap fields; remarks on platform-specific interpretations]{ref}