TextProcessor
Processes Unicode text through script analysis, BiDi reordering, shaping, and layout.
Remarks
Example
public OrderedEvent<TextProcessSettings> ConfigureSettings{ get }Mutates paragraph-level settings before each processing stage consumes them.
public OrderedEvent<LineStyleContext> OnResolveLineStyle{ get }Resolves paragraph-scoped alignment for each line.
public OrderedEvent<LineHeightModeContext> OnResolveLineHeight{ get }Resolves line-height mode and scale before each line's base height is computed.
public OrderedEvent<LineHeightContext> OnCalculateLineHeight{ get }Mutates the vertical advance calculated for each line.
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)The largest font size in minSize–maxSize whose text fits the target box, or minSize when none does. Layout state is restored around the search.
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.
Reserves width shaping units beside every line for something the text holds room for rather than wraps — a label a frontier keeps a place for, and its like. Added to the width the text reports, so a host sizing to that width leaves the room instead of handing back exactly the text and forcing whoever reserves to take it out of the content. Largest request wins, and requests last until the next parse re-declares them. Called from a modifier's shaped-phase callback, over widths no allocated width can move — a reserve answering to the width it helps decide would chase itself.
Adds a signed amount to the gap between lineIndex and the following line — negative pulls them together, down to full overlap; the gap never inverts. Requests sum, unlike the largest-wins ReserveLineSpace, so a caller composing several of its own values resolves them before calling. Out-of-range indices are ignored, which is what keeps block edges untouched. Called from a modifier's line-height callback.
public readonly UniTextBuffers bufThe buffer container holding all intermediate and final processing results.
