| CanvasTextFormat Class |
Namespace: Microsoft.Graphics.Canvas.Text
public sealed class CanvasTextFormat : IDisposable
The CanvasTextFormat type exposes the following members.
| Name | Description | |
|---|---|---|
| CanvasTextFormat | Initializes a new instance of the CanvasTextFormat class. |
| Name | Description | |
|---|---|---|
| CustomTrimmingSign | Gets or sets a custom trimming sign. | |
| Direction | Specifies the direction in which the text is read. | |
| FontFamily | Specifies the font family name (Arial, Times New Roman, etc.) | |
| FontSize | Specifies the font size. | |
| FontStretch | Specifies the degree to which the font is stretched, compared to the normal aspect ratio of that font. | |
| FontStyle | Specifies the style of a font face (for example, normal or italic). | |
| FontWeight | Specifies the density of a typeface, in terms of the lightness or heaviness of the strokes. | |
| HorizontalAlignment | Specifies the horizontal paragraph alignment. | |
| IncrementalTabStop | Specifies the incremental tab stop position. | |
| LastLineWrapping | Specifies whether the last line is wrapped. | |
| LineSpacing | Negative values use default line spacing; non-negative values specify the line height. | |
| LineSpacingBaseline | Specifies the distance from top of line to baseline. A reasonable ratio to lineSpacing is 80 percent. | |
| LineSpacingMode | Specifies how lines are spaced apart. | |
| LocaleName | Specifies the locale name. | |
| OpticalAlignment | Specifies how glyphs are aligned to the margin. | |
| Options | Specifies text drawing options. | |
| TrimmingDelimiter |
A character code used as the delimiter that signals the beginning of the portion of text to be preserved.
Most useful for path ellipsis, where the delimiter would be a slash.
| |
| TrimmingDelimiterCount | A value that indicates how many occurrences of the delimiter to step back. | |
| TrimmingGranularity | Specifies the granularity used to trim text overflowing the layout box. | |
| TrimmingSign | Specifies the type of trimming sign used, when text is drawn outside a text layout's requested size extents. | |
| VerticalAlignment | Specifies the vertical paragraph alignment. | |
| VerticalGlyphOrientation | Specifies the orientation of glyphs when a vertical reading direction is used. | |
| WordWrapping | Specifies word wrapping behavior. |
| Name | Description | |
|---|---|---|
| Dispose | Releases all resources used by the CanvasTextFormat. | |
| GetSystemFontFamilies | Gets a list of font families available. | |
| GetSystemFontFamilies(IReadOnlyListString) | Gets a list of font families available, prioritizing the specified locales. |
When using Direct2D interop, this Win2D class corresponds to the Direct2D interface IDWriteTextFormat1.
var format = new CanvasTextFormat();
var format = new CanvasTextFormat() { FontFamily = "Arial" };
var format = new CanvasTextFormat() { Options = CanvasDrawTextOptions.Clip };
var format = new CanvasTextFormat() { FontFamily = "CustomFont.ttf#CustomFont" };