Class TextShapingBuffer
A reusable, caller-owned buffer holding text, the properties it is shaped under, and the glyphs shaping produces. Text and properties are set on the buffer, the buffer is shaped, and the glyphs are read back from it. Each shaping call replaces the glyphs.
public sealed class TextShapingBuffer
- Inheritance
-
TextShapingBuffer
- Inherited Members
Remarks
Shape(Font, TextShapingBuffer) treats the text as unwrapped logical lines separated by hard breaks.
ShapeRun(Font, TextShapingBuffer) treats the text as one directional run. An instance is not thread safe.
Glyph identifiers and positions are specific to the Font and LayoutMode used while shaping. Pass that same font and layout mode in the GlyphOptions used to measure or render the shaped buffer.
Properties
Count
Gets the number of shaped glyphs the last shaping call produced.
public int Count { get; }
Property Value
Glyphs
Gets the shaped glyphs in visual order within each logical line, or reading order for a directional run.
public ReadOnlySpan<ShapedGlyph> Glyphs { get; }
Property Value
this[int]
Gets a read-only reference to the shaped glyph at the given index.
public ref readonly ShapedGlyph this[int index] { get; }
Parameters
indexintThe zero-based glyph index.
Property Value
KerningMode
Gets or sets the kerning mode used while positioning glyphs. Defaults to Standard.
public KerningMode KerningMode { get; set; }
Property Value
Language
Gets or sets the language the run is written in, which selects the language specific behaviour of the font's features.
public CultureInfo Language { get; set; }
Property Value
LayoutMode
Gets or sets the layout mode used to select horizontal or vertical shaping. Defaults to HorizontalTopBottom.
public LayoutMode LayoutMode { get; set; }
Property Value
LineEnds
Gets the glyph-end indices of hard-delimited lines. An empty span represents one directional run or one logical line.
public ReadOnlySpan<int> LineEnds { get; }
Property Value
Script
Gets or sets the script to use for the entire shaping request, or null to infer scripts from the text.
public ScriptClass? Script { get; set; }
Property Value
Text
Gets the text of the run.
public ReadOnlySpan<char> Text { get; }
Property Value
TextDirection
Gets or sets the base direction of a logical line, or the direction of a directional run. Defaults to Auto.
public TextDirection TextDirection { get; set; }
Property Value
Methods
Add(ReadOnlySpan<char>)
Replaces the text of the run, discarding any glyphs already shaped.
public void Add(ReadOnlySpan<char> value)
Parameters
valueReadOnlySpan<char>The text of the run.
Add(string)
Replaces the text of the run, discarding any glyphs already shaped.
public void Add(string value)
Parameters
valuestringThe text of the run.
Clear()
Removes the text and the glyphs while retaining the storage.
public void Clear()