Pen position (source code)

= Pen position

In <glyph positioning>, the <pen position> is the logical point from which the next <glyph> is placed. The word pen describes a layout convention: the renderer can draw an outline or a collection of <pixels> rather than trace a physical pen stroke. Simple horizontal layout places this reference point on the <text baseline>.<Glyph Metrics in the FreeType documentation>[Section 1: the baseline and logical origin; section 3: advances]{ref}

Let $\mathbf p_i$ be the current <pen position>, $\mathbf o_i$ a placement offset and $\mathbf a_i$ the resolved <glyph advance>. The current <glyph>'s drawing origin and the next logical point are, respectively,
$$
\mathbf r_i=\mathbf p_i+\mathbf o_i,\qquad
\boxed{\mathbf p_{i+1}=\mathbf p_i+\mathbf a_i.}
$$
For example, in one horizontal <coordinate system>, $\mathbf p_i=(10,20)$, $\mathbf o_i=(-1,2)$ and $\mathbf a_i=(8,0)$ draw at $(9,22)$ but leave the next logical point at $(18,20)$. Moving the current shape and changing the progression of the run are separate operations.

A <glyph>'s <bounding box> is therefore not a substitute for its <pen position>. A <left side bearing> can leave space between the logical origin and the ink, and a <right side bearing> records how the ink ends relative to the default advance. <Kerning> or attachment of a <combining character> can modify the placement or progression without changing the stored outline.