In This Article

ITextLayout Interface

Provides the base requirements for a formatted text layout.

public interface ITextLayout : IDisposable

Properties

Lines

Gets the collection of visual lines in the layout.

IList<ITextLayoutLine> Lines { get; }

Property Value

IList<ITextLayoutLine>:

The collection of visual lines in the layout.

SpaceWidth

Gets the width of a space.

double SpaceWidth { get; }

Property Value

double:

The width of a space.

Spacers

Gets the read-only collection of spacers in the text layout.

IList<ITextSpacer> Spacers { get; }

Property Value

IList<ITextSpacer>:

The read-only collection of spacers in the text layout.

TabSize

Gets or sets the number of space characters in a tab.

int TabSize { get; set; }

Property Value

int:

The number of space characters in a tab. The default value is 4.

TextFormattingMode

Gets or sets the TextFormattingMode that indicates the formatting mode to use.

TextFormattingMode TextFormattingMode { get; set; }

Property Value

TextFormattingMode:

The TextFormattingMode that indicates the formatting mode to use.

TextProvider

Gets the ITextProvider for retrieving text.

ITextProvider TextProvider { get; }

Property Value

ITextProvider:

The ITextProvider for retrieving text.

TextWrapping

Gets or sets the TextLayoutWrapping that indicates the wrap mode to use when text doesn't fit within the layout width.

TextLayoutWrapping TextWrapping { get; set; }

Property Value

TextLayoutWrapping:

The TextLayoutWrapping that indicates the wrap mode to use when text doesn't fit within the layout width.

WrappedLineIndentAmount

Gets or sets the number of characters to indent any wrapped lines beyond the original indent level of the primary line.

int WrappedLineIndentAmount { get; set; }

Property Value

int:

The number of characters to indent any wrapped lines beyond the original indent level of the primary line. The default value is 2.

Remarks

A value of 2 will indent wrapped lines to the original indent level of the primary line, plus 2 additional character widths. A value of 0 will indent wrapped lines to the original indent level of the primary line. A value of -1 will not indent wrapped lines at all, and will simply align them to the left edge of the view. The indent amount may be limited or altogether disabled if there is not enough available width in the view to support proper indentation.

Methods

RunTextFormatter(IDisposable)

Runs the text formatter using the specified batch text renderer to help in processing speed when multiple sequential calls are made.

void RunTextFormatter(IDisposable batch)
Parameter Type Description
batch IDisposable

A reference to the result of a previous call to CreateTextBatch().

SetFontFamily(int, int, string)

Sets a font family over range of text.

void SetFontFamily(int characterIndex, int characterCount, string fontFamilyName)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

fontFamilyName string

The font family name to apply over the range.

SetFontSize(int, int, float)

Sets a font size over range of text.

void SetFontSize(int characterIndex, int characterCount, float fontSize)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

fontSize float

The font size to apply over the range.

SetFontStyle(int, int, FontStyle)

Sets a font style (i.e. italic) over range of text.

void SetFontStyle(int characterIndex, int characterCount, FontStyle fontStyle)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

fontStyle FontStyle

The font style to apply over the range.

SetFontWeight(int, int, FontWeight)

Sets a font weight (i.e. bold) over range of text.

void SetFontWeight(int characterIndex, int characterCount, FontWeight fontWeight)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

fontWeight FontWeight

The font weight to apply over the range.

SetForeground(int, int, Brush)

Sets a foreground over range of text.

void SetForeground(int characterIndex, int characterCount, Brush brush)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

brush Brush

The foreground to apply over the range.

SetForeground(int, int, Color)

Sets a foreground over range of text.

void SetForeground(int characterIndex, int characterCount, Color color)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

color Color

The foreground to apply over the range.

SetStrikethrough(int, int, LineKind, Color?, TextLineWeight)

Sets a strike-through decoration over range of text.

void SetStrikethrough(int characterIndex, int characterCount, LineKind lineKind, Color? color, TextLineWeight lineWeight)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

lineKind LineKind

The kind of strike-through line.

color Color?

The optional strike-through line foreground.

lineWeight TextLineWeight

The line weight. A common value is Single.

SetStrikethrough(int, int, LineKind, Brush, TextLineWeight)

Sets a strike-through decoration over range of text.

void SetStrikethrough(int characterIndex, int characterCount, LineKind lineKind, Brush brush, TextLineWeight lineWeight)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

lineKind LineKind

The kind of strike-through line.

brush Brush

The optional strike-through line foreground.

lineWeight TextLineWeight

The line weight. A common value is Single.

SetStrikethrough(int, int, bool)

Sets a strike-through decoration over range of text.

void SetStrikethrough(int characterIndex, int characterCount, bool hasStrikethrough)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

hasStrikethrough bool

Whether the range has a strike-through decoration.

SetUnderline(int, int, LineKind, Color?, TextLineWeight)

Sets an underline decoration over range of text.

void SetUnderline(int characterIndex, int characterCount, LineKind lineKind, Color? color, TextLineWeight lineWeight)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

lineKind LineKind

The kind of underline line.

color Color?

The optional underline line foreground.

lineWeight TextLineWeight

The line weight. A common value is Single.

SetUnderline(int, int, LineKind, Brush, TextLineWeight)

Sets an underline decoration over range of text.

void SetUnderline(int characterIndex, int characterCount, LineKind lineKind, Brush brush, TextLineWeight lineWeight)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

lineKind LineKind

The kind of underline line.

brush Brush

The optional underline line foreground.

lineWeight TextLineWeight

The line weight. A common value is Single.

SetUnderline(int, int, bool)

Sets an underline decoration over range of text.

void SetUnderline(int characterIndex, int characterCount, bool hasUnderline)
Parameter Type Description
characterIndex int

The start character index.

characterCount int

The number of characters in the range.

hasUnderline bool

Whether the range has an underline decoration.

Inherited Members