Back to API Reference
Class

UniTextBuffers

sealed

Container for all intermediate and final buffers used during text processing.

Remarks

UniTextBuffers holds all data produced during the text processing pipeline: codepoints, BiDi levels, text runs, shaped glyphs, line breaks, and positioned glyphs. Performance: All buffers use PooledBuffer<T> for zero-allocation operation in steady state. Call EnsureRentBuffers before processing and EnsureReturnBuffers when done.
public T GetOrCreateAttributeData(string key)

Gets or creates typed attribute data for the specified key.

public void PrepareAttribute()

Gets or creates a PooledArrayAttribute<T> and clears it to codepoint count. Combines GetOrCreateAttributeData + EnsureCountAndClear into a single call.

public T GetAttributeData(string key)

Gets typed attribute data for the specified key if it exists.

public void ReleaseAttributeData(string key)

Releases and removes attribute data for the specified key.

public float GetGlyphScale(float targetFontSize)

Gets the scale factor to convert from shaping font size to target font size.

public void EnsureRentBuffers(int textLength)

Ensures all buffers are rented from the pool with appropriate initial capacity.

public void EnsureReturnBuffers()

Returns all rented buffers back to the pool.

public void Reset()

Resets all buffer counts to zero without releasing pooled memory.

public void EnsureCodepointCapacity(int required)

Ensures codepoint-related buffers have at least the specified capacity.

public void PrepareStartMargins()

Lazily allocates startMargins to fit the current codepoint count and zero-initializes any region not yet prepared in this pass.

public PooledBuffer<int> codepoints

Parsed Unicode codepoints from the input text.

public PooledBuffer<TextRun> runs

Text runs before shaping (segmented by script, direction, font).

public PooledBuffer<ShapedRun> shapedRuns

Shaped runs with glyph ranges and metrics.

public PooledBuffer<ShapedGlyph> shapedGlyphs

Shaped glyphs with glyph IDs, advances, and offsets.

public PooledBuffer<float> cpWidths

Width of each codepoint for line breaking calculations.

public PooledBuffer<LineBreakType> breakOpportunities

Line break types per codepoint (UAX #14).

public PooledBuffer<bool> graphemeBreaks

Grapheme cluster boundaries per codepoint (UAX #29).

public PooledBuffer<TextLine> lines

Computed text lines after line breaking.

public PooledBuffer<ShapedRun> orderedRuns

Runs reordered for visual display within each line.

public PooledBuffer<PositionedGlyph> positionedGlyphs

Final positioned glyphs ready for rendering.

public PooledBuffer<uint> virtualCodepoints

Virtual codepoints for synthesized glyphs (e.g., modifiers).

public PooledBuffer<PositionedGlyph> virtualPositionedGlyphs

Virtual positioned glyphs injected by modifiers (ellipsis, list markers). Separate from positionedGlyphs to not affect hit testing / selection.

public PooledBuffer<byte> bidiLevels

BiDi embedding levels per codepoint (UAX #9).

public PooledBuffer<UnicodeScript> scripts

Unicode script per codepoint (UAX #24).

public PooledBuffer<float> startMargins

Start margins per codepoint (for list items, indentation).

public PooledBuffer<float> perLineAdvances

Advance width per line for alignment calculations.

public TextDirection baseDirection

The resolved base paragraph direction.

public float shapingFontSize

Font size used during shaping (for scaling calculations).

public bool hasValidGlyphCache

Indicates whether glyphDataCache contains valid data.

public bool isRented

Indicates whether buffers are currently rented from the pool.

See Also