Table of Contents

Class TextRun

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Represents a run of text spanning a series of graphemes within a string.

public class TextRun
Inheritance
TextRun
Derived
Inherited Members

Properties

ColorFontSupport

Gets or sets the color font support options for this run, or null to use those supplied by the owning text options.

public ColorFontSupport? ColorFontSupport { get; set; }

Property Value

ColorFontSupport?

Culture

Gets or sets the culture used to select language-specific shaping for this run, or null to use the culture supplied by the owning text options.

public CultureInfo? Culture { get; set; }

Property Value

CultureInfo

End

Gets or sets the exclusive end index of the last grapheme in this TextRun.

public int End { get; set; }

Property Value

int

FeatureTags

Gets or sets the additional shaping features for this run, or null to use those supplied by the owning text options. A non-null empty collection applies no additional features to the run.

public IReadOnlyList<Tag>? FeatureTags { get; set; }

Property Value

IReadOnlyList<Tag>

Font

Gets or sets the font for this run.

public Font? Font { get; set; }

Property Value

Font

FontPalette

Gets or sets the color palette selection used to resolve COLR glyph colors for this run, or null to use the palette supplied by the owning text options.

public FontPalette? FontPalette { get; set; }

Property Value

FontPalette

FontWeight

Gets or sets the font weight for this run, or null to use the weight supplied by the owning text options.

public FontWeight? FontWeight { get; set; }

Property Value

FontWeight?

Placeholder

Gets or sets the inline placeholder represented by this run.

public TextPlaceholder? Placeholder { get; set; }

Property Value

TextPlaceholder?

Remarks

Placeholder runs are inserted at Start and must have End equal to Start.

Script

Gets or sets the script to use for this run, or null to use the script selection supplied by the owning text options.

public ScriptClass? Script { get; set; }

Property Value

ScriptClass?

Start

Gets or sets the inclusive start index of the first grapheme in this TextRun.

public int Start { get; set; }

Property Value

int

TextAttributes

Gets or sets the text attributes applied to this run.

public TextAttributes TextAttributes { get; set; }

Property Value

TextAttributes

TextDecorations

Gets or sets the text decorations applied to this run.

public TextDecorations TextDecorations { get; set; }

Property Value

TextDecorations

Methods

GetDecorationOptions(TextDecorations)

Gets the geometry overrides to apply to the specified decoration, or null to use the values derived from the font's metrics.

public virtual TextDecorationOptions? GetDecorationOptions(TextDecorations decoration)

Parameters

decoration TextDecorations

The decoration to retrieve overrides for.

Returns

TextDecorationOptions

The TextDecorationOptions for the decoration, or null.

Remarks

The base implementation returns null for every decoration. Derived runs can override this to supply values sourced from styling that the font metrics do not describe, such as an explicit stroke width.

Slice(ReadOnlySpan<char>)

Returns the slice of the given text representing this TextRun.

public ReadOnlySpan<char> Slice(ReadOnlySpan<char> text)

Parameters

text ReadOnlySpan<char>

The text to slice.

Returns

ReadOnlySpan<char>

The ReadOnlySpan<T>.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.