Table of Contents

Class GlyphRunPlanner

Namespace
DocWright.Fonts
Assembly
DocWright.Fonts.dll

Turns a GlyphRun into the glyphs that draw it.

public static class GlyphRunPlanner
Inheritance
GlyphRunPlanner
Inherited Members

Remarks

Why this is shared code rather than a renderer's private helper. A GlyphRun carries text, a family, a size and per-cluster advances — but not glyph ids, except where a complex shaper populated ClusterMap. Every renderer therefore has to decide which glyphs a run draws, and two renderers that decide differently produce output that cannot be compared. The PDF and imaging renderers are required to agree pixel for pixel (they consume one LayoutDocument), so this decision is made once, here, and both call it.

The pen model. Inside a cluster, glyphs advance by the font's own widths, each in whole twips (their sum is NominalAdvance), or by their placements; and every cluster starts where layout put it, at the sum of the DesiredAdvance values before it. The correction toward layout's advance is therefore applied between clusters, never within one, because layout has no position for a glyph inside a cluster - a ligature's parts, a shaped Arabic or Devanagari cluster. Both renderers put every glyph at exactly these positions: the imaging renderer walks its pen there, and the PDF renderer writes before each glyph the TJ number that takes the viewer's pen there, since that pen moves by the /W width at the drawn size and neither is layout's.

Methods

EnumerateCodePoints(string, int, int)

Splits a text range into Unicode code points, pairing surrogates.

Plan(GlyphRun, FontFace, IConversionDiagnostics)

Plans the clusters of a run against a resolved face.

Plan(GlyphRun, FontFace, bool, IConversionDiagnostics)

Plans the clusters of a run against a resolved face, optionally omitting glyphs the face cannot draw.