Back to API Reference
Class
TextLayout
sealed
Positions glyphs within the layout bounds based on line breaking results and alignment settings.
Remarks
This is the final positioning stage of the text processing pipeline. It takes the output from
LineBreaker (lines and runs) and produces PositionedGlyph data with final X/Y coordinates. Handles: Horizontal alignment (left, center, right) with RTL awareness Vertical alignment (top, middle, bottom) Line spacing and margins Glyph scaling based on font sizeInitializes a new instance of the TextLayout class with default settings.
public void SetLayoutSettings(LayoutSettings newSettings)Sets the layout settings controlling dimensions and alignment.
public void Layout(Span<TextLine> lines, ReadOnlySpan<ShapedRun> runs, ReadOnlySpan<ShapedGlyph> glyphs, ReadOnlySpan<float> perLineAdvances, float totalHeight, PositionedGlyph[] result, int glyphCount, float width, float height)Positions all glyphs from the line breaking results into final screen coordinates.
public static float ComputeTrimAmount(float ascender, float descender, float capHeight, TextOverEdge overEdge, TextUnderEdge underEdge, LeadingDistribution distribution, float effectiveFirstLineHeight, float effectiveLastLineHeight)Computes the total height trim based on edge metrics and leading distribution.
