Skip to main content

ShapedTextRun Class

Definition​

Assembly:Avalonia.Base
Package:Avalonia

A text run that holds shaped characters.

public class ShapedTextRun

Inheritance: object -> TextRun -> DrawableTextRun -> ShapedTextRun

Implements: IDisposable

Remarks​

Glyph data in the underlying Avalonia.Media.TextFormatting.ShapedTextRun.ShapedBuffer is immutable after shaping: LTR buffers are in ascending-cluster (logical) order, RTL buffers are in descending-cluster (visual) order. Avalonia.Media.TextFormatting.BidiReorderer only reorders runs, it never mutates glyph order.

Ref-counted: the initial constructor call establishes one reference. Call Avalonia.Media.TextFormatting.ShapedTextRun.AddRef when taking an additional reference (e.g., when a Avalonia.Media.TextFormatting.TextRunCache stores a shaped run a formatter is also about to use), and Avalonia.Media.TextFormatting.ShapedTextRun.Dispose to release. The underlying shaped buffer is disposed only when the last reference is released.

Constructors​

NameDescription
ShapedTextRunNo summary available.

ShapedTextRun Constructor​

public ShapedTextRun(Avalonia.Media.TextFormatting.ShapedBuffer shapedBuffer, Avalonia.Media.TextFormatting.TextRunProperties properties)

Parameters​

shapedBuffer Avalonia.Media.TextFormatting.ShapedBuffer

properties Avalonia.Media.TextFormatting.TextRunProperties

Methods​

NameDescription
DisposeNo summary available.
DrawDraws the Avalonia.Media.TextFormatting.DrawableTextRun at the given origin.
TryMeasureCharactersNo summary available.

Dispose Method​

public void Dispose()

Draw Method​

Draws the Avalonia.Media.TextFormatting.DrawableTextRun at the given origin.

public void Draw(Avalonia.Media.DrawingContext drawingContext, Avalonia.Point origin)

Parameters​

drawingContext Avalonia.Media.DrawingContext

The drawing context.

origin Avalonia.Point

The origin.

TryMeasureCharacters Method​

public bool TryMeasureCharacters(double availableWidth, int& length)

Parameters​

availableWidth double

length int&

Returns​

bool

Properties​

NameDescription
BaselineNo summary available.
BidiLevelNo summary available.
GlyphRunNo summary available.
LengthGets the text source length.
PropertiesA set of properties shared by every characters in the run
ShapedBufferNo summary available.
SizeNo summary available.
TextGets the text run's text.
TextMetricsNo summary available.

Baseline Property​

public double Baseline { get; set; }

BidiLevel Property​

public sbyte BidiLevel { get; set; }

GlyphRun Property​

public Avalonia.Media.GlyphRun GlyphRun { get; set; }

Length Property​

Gets the text source length.

public int Length { get; set; }

Properties Property​

A set of properties shared by every characters in the run

public Avalonia.Media.TextFormatting.TextRunProperties Properties { get; set; }

ShapedBuffer Property​

public Avalonia.Media.TextFormatting.ShapedBuffer ShapedBuffer { get; set; }

Size Property​

public Avalonia.Size Size { get; set; }

Text Property​

Gets the text run's text.

public ReadOnlyMemory<char> Text { get; set; }

TextMetrics Property​

public Avalonia.Media.TextFormatting.TextMetrics TextMetrics { get; set; }

Fields​

NameDescription
DefaultTextSourceLengthInherited from TextRun.