Skip to main content

FormattedText Class

The FormattedText class is targeted at programmers needing to add some simple text to a MIL visual.

Definition

Namespace: Avalonia.Media
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public class FormattedText
View Source
InheritanceObject → FormattedText

Constructors

FormattedText(String, CultureInfo, FlowDirection, Typeface, Double, IBrush)Construct a FormattedText object.

Properties

BaselineThe distance from the top of the first line to the baseline of the first line.
ExtentThe distance from the topmost black pixel of the first line to the bottommost black pixel of the last line.
FlowDirectionDefines the flow direction
HeightThe distance from the top of the first line to the bottom of the last line.
LineHeightGets or sets the height of, or the spacing between, each line where zero represents the default line height.
MaxLineCountDefines the maximum number of lines to display. The last line of text displayed is the lineCount-1'th line, or the last whole line that will fit within the count set by MaxTextHeight, whichever occurs first. Use the Trimming property to control how the omission of text is indicated
MaxTextHeightSets the maximum length of a column of text. The last line of text displayed is the last whole line that will fit within this limit, or the nth line as specified by MaxLineCount, whichever occurs first. Use the Trimming property to control how the omission of text is indicated.
MaxTextWidthThe MaxTextWidth property defines the alignment edges for the FormattedText. For example, left aligned text is wrapped such that the leftmost glyph alignment point on each line falls exactly on the left edge of the rectangle. Note that for many fonts, especially in italic style, some glyph strokes may extend beyond the edges of the alignment rectangle. For this reason, it is recommended that clients draw text with at least 1/6 em (i.e of the font size) unused margin space either side. Zero value of MaxTextWidth is equivalent to the maximum possible paragraph width.
OverhangAfterThe distance from the bottom of the last line to the extent bottom.
OverhangLeadingThe maximum distance from the leading black pixel to the leading alignment point of a line.
OverhangTrailingThe maximum distance from the trailing black pixel to the trailing alignment point of a line.
TextAlignmentDefines the alignment of text within the column
TrimmingDefines how omission of text is indicated. CharacterEllipsis trimming allows partial words to be displayed, while WordEllipsis removes whole words to fit. Both guarantee to include an ellipsis ('...') at the end of the lines where text has been trimmed as a result of line and column limits.
WidthThe maximum advance width between the leading and trailing alignment points of a line, excluding the width of whitespace characters at the end of the line.
WidthIncludingTrailingWhitespaceThe maximum advance width between the leading and trailing alignment points of a line, including the width of whitespace characters at the end of the line.

Methods

BuildGeometry(Point)Obtains geometry for the text, including underlines and strikethroughs.
BuildHighlightGeometry(Point)Builds a highlight geometry object.
BuildHighlightGeometry(Point, Int32, Int32)Builds a highlight geometry object for a given character range.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize()Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetMaxTextWidths()Obtains a copy of the array of lengths, which will be applied to each line of text in turn. If the text covers more lines than there are entries in the length array, the last entry is reused as many times as required. The maxTextWidths array overrides the MaxTextWidth property.
GetType()Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone()Creates a shallow copy of the current Object.
(Inherited from Object)
SetCulture(CultureInfo)Sets or changes the culture for the text object.
SetCulture(CultureInfo, Int32, Int32)Sets or changes the culture for the text object.
SetFontFamily(FontFamily)Sets or changes the font family for the text object
SetFontFamily(String)Sets or changes the font family for the text object
SetFontFamily(FontFamily, Int32, Int32)Sets or changes the font family for the text object
SetFontFamily(String, Int32, Int32)Sets or changes the font family for the text object
SetFontFeatures(FontFeatureCollection)Sets or changes the font features for the text object
SetFontFeatures(FontFeatureCollection, Int32, Int32)Sets or changes the font features for the text object
SetFontSize(Double)Sets or changes the font em size measured in MIL units
SetFontSize(Double, Int32, Int32)Sets or changes the font em size measured in MIL units
SetFontStyle(FontStyle)Sets or changes the font style
SetFontStyle(FontStyle, Int32, Int32)Sets or changes the font style
SetFontTypeface(Typeface)Sets or changes the type face
SetFontTypeface(Typeface, Int32, Int32)Sets or changes the type face
SetFontWeight(FontWeight)Sets or changes the font weight
SetFontWeight(FontWeight, Int32, Int32)Sets or changes the font weight
SetForegroundBrush(IBrush)Sets foreground brush used for drawing text
SetForegroundBrush(IBrush, Int32, Int32)Sets foreground brush used for drawing text
SetMaxTextWidths(Double[])Sets the array of lengths, which will be applied to each line of text in turn. If the text covers more lines than there are entries in the length array, the last entry is reused as many times as required. The maxTextWidths array overrides the MaxTextWidth property.
SetTextDecorations(TextDecorationCollection)Sets or changes the text decorations
SetTextDecorations(TextDecorationCollection, Int32, Int32)Sets or changes the text decorations
ToString()Returns a string that represents the current object.
(Inherited from Object)

Fields

DefaultIdealToReal 
DefaultRealToIdeal 
GreatestMultiplierOfEm 
IdealInfiniteWidth 
RealInfiniteWidth 

See Also

Reference

Avalonia.Media Namespace