PeachDrawing.Text

PeachDrawing.Text.Layout

PlacedRun Class

A stretch of one line that is drawn as one: text of one style, direction and script, shaped in one face.

public sealed class PlacedRun

Inheritance System.Object → PlacedRun

Remarks

The glyphs of Glyphs are in the order they are drawn, left to right, and each starts where the previous one’s advance ends. The face of a glyph’s advance and the layout size give a distance in layout units as (Typeface.GetAdvance(glyph) + glyph.XAdvanceDelta) * Size / Typeface.Metrics.UnitsPerEm, and the offsets of a glyph scale the same way.

Properties  
Baseline The distance from the top of the layout to the baseline the run sits on, in layout units.
Glyphs The shaped glyphs, in the order they are drawn.
InlineBox The inline box the run stands for (see AddInlineBox(InlineBox)), or null for a run of text. Such a run has one character of the text (a U+FFFC), no glyphs, and the box’s width; the caller draws the box in InlineBoxBounds.
InlineBoxBounds Where the run’s inline box is, in the layout’s coordinates: at X, sized as given and placed on the line as its alignment says; empty for a run of text.
IsGenerated Whether the run is not text of the paragraph but drawn in it: the hyphen a line broken inside a word ends with, or the ellipsis of a line that is cut. Its Range is empty, and a caret at the place it is generated is before it (after it, for a right-to-left paragraph). It is drawn like any other run.
IsRightToLeft Whether the run’s text reads right to left.
Level The bidirectional embedding level of the run; odd for right to left.
Range The text this run stands for; it is empty, at the place the run is generated, for a run that is IsGenerated.
Style The face and size the run is set in.
Width How wide the run is, in layout units.
X The distance from the left edge of the layout to the left edge of the run, in layout units.
Methods  
GetCaretX(int) Where a caret at a boundary of the run’s text is, measured from the left edge of the layout.
GetGlyphAdvance(int) How far the pen moves after a glyph of the run, in layout units: its advance and positioning adjustment, plus the letter spacing, and the word spacing and justification for a space. A glyph is drawn at the sum of the advances of the glyphs before it, from X, plus its own XOffset and YOffset scaled by the size over the units per em.