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.
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
.
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, FontStyles)
Sets a font style (i.e. italic) over range of text.
void SetFontStyle(int characterIndex, int characterCount, FontStyles fontStyle)
Parameter | Type | Description |
---|---|---|
characterIndex | int | The start character index. |
characterCount | int | The number of characters in the range. |
fontStyle | FontStyles | The font style to apply over the range. |
SetFontWeight(int, int, FontWeights)
Sets a font weight (i.e. bold) over range of text.
void SetFontWeight(int characterIndex, int characterCount, FontWeights fontWeight)
Parameter | Type | Description |
---|---|---|
characterIndex | int | The start character index. |
characterCount | int | The number of characters in the range. |
fontWeight | FontWeights | The font weight to apply over the range. |
SetForeground(int, int, Color?)
Sets a foreground over range of text.
void SetForeground(int characterIndex, int characterCount, Color? brush)
Parameter | Type | Description |
---|---|---|
characterIndex | int | The start character index. |
characterCount | int | The number of characters in the range. |
brush | 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? 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 | Color? | The optional strike-through line foreground. |
lineWeight | TextLineWeight | The line weight. A common value is |
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? 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 | Color? | The optional underline line foreground. |
lineWeight | TextLineWeight | The line weight. A common value is |
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. |