TextProcessor
Processes Unicode text through script analysis, BiDi reordering, shaping, and layout.
Remarks
Example
public ReadOnlySpan<PositionedGlyph> PositionedGlyphs{ get }Gets the positioned glyphs ready for rendering.
[ctor]public TextProcessor(UniTextBuffers uniTextBuffers)Initializes a new instance of the TextProcessor class.
public void SetFontProvider(UniTextFontProvider provider)Sets the font provider used for font lookup and glyph metrics. Must be called with a non-null provider before EnsureFirstPass.
public void EnsureFirstPass(ReadOnlySpan<char> text, TextProcessSettings settings)Ensures the first pass processing (parsing, BiDi, shaping) is complete.
public bool CanReusePositions(float maxHeight, HorizontalAlignment hAlign, VerticalAlignment vAlign, TextJustify textJustify, LastLineAlignment lastLineAlignment)Determines whether cached glyph positions can be reused for the specified parameters.
public void EnsurePositions(TextProcessSettings settings)Ensures final glyph positioning is complete for the specified settings.
public void ForceRelayout(ReadOnlySpan<float> cpWidths)Forces a complete relayout using custom codepoint widths.
public float FindOptimalFontSize(float minSize, float maxSize, float targetWidth, float targetHeight, TextProcessSettings baseSettings)Finds the optimal font size to fit text within the specified dimensions.
Reserves extra leading on one side of a specific line for boundary decorations (over/under ruby, etc.): over above the line, under below it. Added to that line's outer gap, or to the block edge for the first/last line. Largest request per side wins. Called from a modifier's line-height callback.
public readonly UniTextBuffers bufThe buffer container holding all intermediate and final processing results.
public Action ParsedOccurs after text parsing completes but before shaping.
public Action ShapedOccurs after text shaping completes.
public Action LinesBrokenOccurs after line breaking completes, before glyph positioning. Use to adjust lines widths or run widths in a line-aware way (e.g. strip trailing letter-spacing at line edges so centered/justified output remains symmetric). Fires after both the initial wrap pass and re-wrap caused by ForceReposition.
public Action LayoutCompleteOccurs after layout calculation completes.
