Pixels per em (source code)

= Pixels per em
{title2=ppem}

<Pixels per em> specifies the raster scale of one <em>. If $U$ <font units> make an <em> and the requested scale is $p$ <pixels per em>, a design length $q$ becomes $pq/U$ <pixels> before <grid fitting>. The value measures the nominal typographic scale rather than the ink height of an individual <glyph>.<Glyph Outlines in the FreeType documentation>[Section2: pixel_coord, EM_size and ppem]{ref}

For output with a stated physical raster resolution of $d$ <pixels> per <inch>, a <font size> of $S$ digital <typographic points> gives
$$
\boxed{p=\frac{Sd}{72}.}
$$
The factor 72 comes from the digital <typographic point> convention. For example, $S=12$ and $d=144$ give 24 <pixels per em>; a hypothetical <glyph advance> of 0.6 <em> then scales to 14.4 <pixels>. Doubling $d$ doubles the <pixel> count while preserving the requested physical length.

Horizontal and vertical <pixel density> can differ, in which case the two directions have distinct <pixels per em>. An application can also impose its own screen-to-physical-unit mapping. One must state which scale is being used rather than infer the physical size from a <pixel> count alone. <Rasterization> and <grid fitting> then determine how the scaled geometry becomes a visible image.