Back to API Reference
Class
TextProcessor
sealed
Processes Unicode text through script analysis, BiDi reordering, shaping, and layout.
Remarks
TextProcessor is the main entry point for the text processing pipeline. It orchestrates multiple Unicode algorithms to produce correctly shaped and positioned glyphs. Processing pipeline: Parsing — converts UTF-16 to codepoints Script analysis (UAX #24) — identifies script per codepoint BiDi algorithm (UAX #9) — determines text direction and reordering Itemization — splits text into runs by script, direction, and font Shaping — converts codepoints to positioned glyphs via HarfBuzz Line breaking (UAX #14) — determines line break opportunities Layout — positions glyphs according to alignment settings Performance: The processor caches intermediate results. Use invalidation methods only when necessary to avoid redundant processing.
Example
csharp
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.
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)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 float FindOptimalFontSize(float minSize, float maxSize, float targetWidth, float targetHeight, TextProcessSettings baseSettings)Finds the optimal font size to fit text within the specified dimensions.
public void ForceRelayout(ReadOnlySpan<float> cpWidths)Forces a complete relayout using custom codepoint widths.
public readonly UniTextBuffers bufThe buffer container holding all intermediate and final processing results.
