Table of Contents

Class ShapedGlyphBuffer

Namespace
DocWright.Core.Text
Assembly
DocWright.Core.dll

A reusable, growable buffer of ShapedGlyph values. Shapers append into it; layout reads it as a span. Reusing one buffer per measurement context keeps the per-run shaping path allocation-free after warmup.

public sealed class ShapedGlyphBuffer
Inheritance
ShapedGlyphBuffer
Inherited Members

Constructors

ShapedGlyphBuffer()

Initializes a buffer with the default initial capacity (64 glyphs).

ShapedGlyphBuffer(int)

Initializes a buffer with an explicit initial capacity.

Properties

Capacity

Gets the current capacity.

Count

Gets the number of glyphs in the buffer.

this[int]

Gets the glyph at the given index.

Methods

Add(in ShapedGlyph)

Appends a glyph, growing the buffer geometrically when full.

AsSpan()

Returns a span over the glyphs currently in the buffer. The span is invalidated by any subsequent Add(in ShapedGlyph) or EnsureCapacity(int) call.

Clear()

Resets the count to zero. The capacity is retained so the buffer can be reused without reallocating.

EnsureCapacity(int)

Ensures the buffer can hold at least the given number of glyphs without growing.