The Layout Pipeline
Pango fundementally operates with paragraphs of text. The reason
for working a paragraph at a time is that bidirectional reordering
can affect the order of text within a paragraph but not beyond
that. The steps Pango takes to lay out a paragraph are listed
below. Not all of these steps need to be implemented as separate
passes over the text. The input to the process is a piece of
UTF-8 encoded text and a PangoAttributeList that applies to that
text. The attribute list includes attributes for language tag,
font properties, and other attributes that do not affect to the
layout process, such as foreground color.
-
Modify the language tags on the text using information about
the possible language tags for each Unicode character point.
(Not yet implemented, see the design document for
font selection.)
-
Determine the bidirectional levels for the text.
-
Determine a language engine for each character in the text
from the language tag and code point.
-
Determine a font for each character in the text from the
attributes for that character and the language tag.
-
Determines a shaper for each character by querying the font
for that character.
-
Split the text into segments with consistent font, shaper,
directional level and language tag.
-
Convert the characters in each segment into positioned glyphs.
(Glyphs are represented as a PangoGlyphString).
-
Determine how many segments fit on each line. Break the segments
to fit as necessary.
-
Reorder the segments on each line from logical order to
visual order.
The output of this process is list of PangoGlyphStrings per
line. These are then fed into the renderer.
|