Enum LayoutRunKind
What a LayoutRun holds.
public enum LayoutRunKind
Fields
Control = 3A hard break or another control character, which takes no space.
Placeholder = 1A placeholder's box.
Tab = 2A tab's space.
Text = 0Glyphs.
Examples
ParagraphStyle style = new() { DefaultStyle = new TextStyle { FontFamilies = [family], Size = 16 } };
Paragraph paragraph = Paragraph.Create("A paragraph is shaped once and laid out at any width.", style);
// Each width gives an immutable layout: lines of glyph runs, positioned from the box's top-left corner.
TextLayout narrow = paragraph.Layout(120);
TextLayout wide = paragraph.Layout(400);
foreach (TextLine line in narrow.Lines)
{
string text = paragraph.Text[line.Start..line.End]; // the line's text, its trailing space included
float baseline = line.Baseline; // y of the baseline
foreach (LayoutRun run in line.Runs)
{
GlyphRun? glyphs = run.Glyphs; // glyphs at their layout positions
}
}
// No wrapping: the box is as wide as the longest line.
TextLayout unbounded = paragraph.Layout(float.PositiveInfinity);