Glyph positioning
= Glyph positioning
<Glyph positioning> assigns locations to the <glyphs> selected during <text shaping>. It specifies how each <glyph> is placed and how the logical <pen position> progresses through the text. A <text baseline> supplies a common reference for placing the shapes. An <OpenType> GPOS table can adjust horizontal and vertical placement, <glyph advances> and attachment between selected <glyphs>.<Glyph Positioning Table by Microsoft>[Overview, ValueRecords and positioning/attachment lookup types]{ref}
A simple coordinate model separates the two effects. Let $\mathbf p_i$ be the <pen position>, $\mathbf o_i$ a placement offset and $\mathbf a_i$ the <glyph advance>. Draw glyph $i$ with its origin at
$$
\mathbf p_i+\mathbf o_i,
$$
then update the logical position by
$$
\mathbf p_{i+1}=\mathbf p_i+\mathbf a_i.
$$
Changing $\mathbf o_i$ moves the current shape; changing $\mathbf a_i$ moves the starting position of subsequent shapes.
For example, a <combining character> can select an accent <glyph> that must be positioned above an earlier base <glyph>. The accent's placement and its <glyph advance> answer different questions. <Kerning> similarly changes spacing according to context, while <glyph substitution> changes which forms are selected. These choices precede the <rasterization> of the placed outlines into <pixels>.