FormattedText Class

Summary

Represents a piece of text with formatting.
Namespace
Avalonia.Media
Base Types
  • object
graph BT Type-->Base0["object"] Type["FormattedText"] class Type type-node

Syntax

public class FormattedText

Constructors

Name Summary
FormattedText() Initializes a new instance of the FormattedText class.
FormattedText(IPlatformRenderInterface) Initializes a new instance of the FormattedText class.

Properties

Name Value Summary
Bounds Rect
Gets the bounds of the text within the Constraint.
Constraint Size
Gets or sets the constraint of the text.
PlatformImpl IFormattedTextImpl
Gets platform-specific platform implementation.
Spans IReadOnlyList<FormattedTextStyleSpan>
Gets or sets a collection of spans that describe the formatting of subsections of the text.
Text string
Gets or sets the text.
TextAlignment TextAlignment
Gets or sets the alignment of the text.
Typeface Typeface
Gets or sets the base typeface.
Wrapping TextWrapping
Gets or sets the text wrapping.

Methods

Name Value Summary
GetLines() IEnumerable<FormattedTextLine>
Gets the lines in the text.
HitTestPoint(Point) TextHitTestResult
Hit tests a point in the text.
HitTestTextPosition(int) Rect
Gets the bounds rectangle that the specified character occupies.
HitTestTextRange(int, int) IEnumerable<Rect>
Gets the bounds rectangles that the specified text range occupies.