Skip to main content

TextCollapsingProperties Class

Definition​

Assembly:Avalonia.Base
Package:Avalonia

Properties of text collapsing.

public class TextCollapsingProperties

Methods​

NameDescription
CollapseCollapses the given text line and returns the resulting runs, or if no collapse is needed (the consumer then keeps the original line unchanged).
CreateCollapsedRunsCreates a list of runs for given collapsed length which includes specified symbol at the end.

Collapse Method​

Collapses the given text line and returns the resulting runs, or if no collapse is needed (the consumer then keeps the original line unchanged).

public Avalonia.Media.TextFormatting.TextRun[] Collapse(Avalonia.Media.TextFormatting.TextLine textLine)

Parameters​

textLine Avalonia.Media.TextFormatting.TextLine

Text line to collapse.

Returns​

Avalonia.Media.TextFormatting.TextRun[]

Remarks​

Implementations MUST return runs in logical order. The consumer (TextLineImpl.Collapse) wraps the returned array in a new Avalonia.Media.TextFormatting.TextLine and re-runs the BiDi reorderer via FinalizeLine, so pre-applying visual order here would be reordered a second time and produce garbled output on RTL or mixed-bidi lines.

Iterate the source line's runs via LogicalTextRunEnumerator, not Avalonia.Media.TextFormatting.TextLine.TextRuns (which is post-bidi visual order). Use Avalonia.Media.TextFormatting.TextCollapsingProperties.CreateCollapsedRuns(Avalonia.Media.TextFormatting.TextLine,int,Avalonia.Media.TextFormatting.TextRun) when an implementation only needs the standard "logical prefix + symbol" shape.

The returned runs may be in any arrangement, for example a leading or middle symbol, and may reuse runs of textLine as they are. The collapsed line takes its own reference to each reused run, so disposing either line leaves the other intact. Every other run in the result, such as the symbol from Avalonia.Media.TextFormatting.TextFormatter.CreateSymbol(Avalonia.Media.TextFormatting.TextRun,Avalonia.Media.FlowDirection), passes to the collapsed line, which disposes it with itself; dispose the symbol when the result does not contain it.

CreateCollapsedRuns Method​

Creates a list of runs for given collapsed length which includes specified symbol at the end.

public Avalonia.Media.TextFormatting.TextRun[] CreateCollapsedRuns(Avalonia.Media.TextFormatting.TextLine textLine, int collapsedLength, Avalonia.Media.TextFormatting.TextRun shapedSymbol)

Parameters​

textLine Avalonia.Media.TextFormatting.TextLine

The text line.

collapsedLength int

The collapsed length.

shapedSymbol Avalonia.Media.TextFormatting.TextRun

The symbol. The returned runs take it over.

Returns​

Avalonia.Media.TextFormatting.TextRun[]

The logical prefix of textLine followed by the symbol.

Properties​

NameDescription
FlowDirectionGets the flow direction that is used for collapsing.
SymbolGets the text run that is used as collapsing symbol.
WidthGets the width in which the collapsible range is constrained to.

FlowDirection Property​

Gets the flow direction that is used for collapsing.

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

Symbol Property​

Gets the text run that is used as collapsing symbol.

public Avalonia.Media.TextFormatting.TextRun Symbol { get; set; }

Width Property​

Gets the width in which the collapsible range is constrained to.

public double Width { get; set; }