Provides services for formatting text and breaking text lines using a custom text layout client.
Assembly: PresentationCore (in PresentationCore.dll)
Thetype exposes the following members.
|Create||Creates a new instance of the class. This is a static method.|
|Create(TextFormattingMode)||Creates a new instance of the class with the specified formatting mode. This is a static method.|
|Dispose||Releases all managed and unmanaged resources used by the object.|
|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.)|
|FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak)||Creates a TextLine that is used for formatting and displaying document content.|
|FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak, TextRunCache)||Creates a TextLine that is used for formatting and displaying document content.|
|FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)||Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.|
|FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)||Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
is the WPF text engine that provides services for formatting text and breaking text lines. can handle different text character formats and paragraph styles, and includes support for international text layout.
Unlike a traditional text API, the interacts with a text layout client through a set of callback methods. It requires the client to provide these methods in an implementation of the TextSource class. The following diagram illustrates the interaction of the text formatter client and the text layout client.
Text Formatting Services
provides support for text features, such as OpenType typography, as well as support for text run, line, and paragraph level features.
The following table is a list of the key supported services for text features.
Determines the baseline distance of the line. See the BaselineAlignment property.
Provides font linking through the use of composite fonts.
Advanced OpenType typographic features, such contextual alternates and standard ligatures. See the TextRunTypographyProperties class properties.
Determines the typeface, as well as, weight, style, and stretch. See the Typeface property.
The following table is a list of the key supported services for paragraph-level features.
Flow direction of the paragraph—left-to-right, or right-to-left. See the FlowDirection property.
Indentation for each line in the paragraph. See the Indent property.
Marker characteristics of the first line in the paragraph. See the TextMarkerProperties property.
Indentation for the first line in the paragraph. See the ParagraphIndent property.
Includes support for tab alignment and tab leader.
Determine minimum and maximum paragraph width. See the FormatMinMaxParagraphWidth methods.
Determine how text wraps when it reaches the flow edge. See the TextWrapping property.
The following table is a list of the key supported services for line-level features.
Text alignment—left, right, centered, or justified. See the TextAlignment property.
Height of the line. See the Height property.
Line collapsing support. See the Collapse method.
Black box measurement
Represents the metrics used to lay out a character in a device font. See the CharacterMetrics class.
The following table is a list of the key supported services for text run-level features.
Range of characters that are not visible. See the TextHidden object.
Line and paragraph breaking.
The following example shows how to use a object to generate formatted lines of text that can be displayed as drawing objects.
' Create a TextFormatter object. Dim formatter As TextFormatter = TextFormatter.Create() ' Create common paragraph property settings. Dim customTextParagraphProperties As New CustomTextParagraphProperties() ' Format each line of text from the text store and draw it. Do While textStorePosition < customTextSource.Text.Length ' Create a textline from the text store using the TextFormatter object. Using myTextLine As TextLine = formatter.FormatLine(customTextSource, textStorePosition, 96 * 6, customTextParagraphProperties, Nothing) ' Draw the formatted text into the drawing context. myTextLine.Draw(drawingContext, linePosition, InvertAxes.None) ' Update the index position in the text store. textStorePosition += myTextLine.Length ' Update the line position coordinate for the displayed line. linePosition.Y += myTextLine.Height End Using Loop