Vixen
02b45cc4
csharp
public sealed class TextLayout

An element's text, wrapped into the lines it is drawn on.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Three types, one for each thing a line of text is made of. A TextRun is one face; a TextLine is the runs sharing a baseline; a block is the lines stacked down the page. Most text is one line of one run and costs no more than it did when that was the only shape available.

⚠ Wrapped in pixels, and each line shaped on its own. The break opportunities come from UAX#14 and are about the characters; the widths are measured across whatever faces the fallback chose, which is why the wrapping happens here rather than in Vixen.Ui.Text's LineWrapper overload that takes a ShapedText — that one is a single font by construction. Once the breaks are known, each line's text is covered and shaped by itself, which is what a line is: a break stops a ligature and unjoins an Arabic word, and it is supposed to.

Fields and properties (3)

  • public ImmutableArray<TextLine> Lines

    The lines, top to bottom.

  • public float Width

    How wide the widest line is, in pixels.

  • public float Height

    How tall all the lines together are, in pixels.

Methods (6)

  • public TextLayout(ImmutableArray<TextLine> lines)

    Builds a block from its lines, in order.

  • public float TopOf(int line)

    Where a line's top edge sits, in pixels from the top of the block.

  • public int LineOf(int index)

    Which line a caret index falls on.

  • public (float X, float Y) CaretAt(int index)

    Where a caret sits, in pixels from the top left of the block.

  • public int CaretIndexAt(float x, float y)

    Which caret index a point in the block lands on.

  • public static LayoutSize Measure(in MeasureRequest request)

    Measures a leaf whose size is its text.

Used by (9)

  • CodeEditorVixen.Ui.Controls.Advanced
  • DrawListBuilderVixen.Ui
  • FontFallbackTestsVixen.Ui.Tests
  • FontRegistryTestsVixen.Ui.Tests
  • TextFieldVixen.Ui.Controls
  • TextFieldTestsVixen.Ui.Controls.Tests
  • TextTestsVixen.Ui.Tests
  • TextWrapTestsVixen.Ui.Tests
  • UiElementVixen.Ui