CanvasTypography Class |
Namespace: Microsoft.Graphics.Canvas.Text
public sealed class CanvasTypography : IDisposable
The CanvasTypography type exposes the following members.
Name | Description | |
---|---|---|
CanvasTypography | Initializes a new instance of the CanvasTypography class. |
Name | Description | |
---|---|---|
AddFeature(CanvasTypographyFeature) | Adds an OpenType font feature. | |
AddFeature(CanvasTypographyFeatureName, UInt32) | Adds an OpenType font feature. | |
Dispose | Releases all resources used by the CanvasTypography. | |
GetFeatures | Gets an array of all the OpenType font features that comprise this CanvasTypography. |
As an example of how to apply a typography option to a piece of text:
var typography = new CanvasTypography(); typography.AddFeature(CanvasTypographyFeatureName.ContextualSwash, 1); var format = new CanvasTextFormat(); var textLayout = new CanvasTextLayout(resourceCreator, "Abc", format, 100, 100); textLayout.SetTypography(1, 1, typography);
A CanvasTypography is mutable; adding features will modify it. It's valid to add the same feature multiple times, regardless of the parameter.
Not all features are supported by all fonts. If a feature is not supported by the font being used with the typography option, the feature will simply be ignored.
While font features treat their parameters in different ways, there is a general convention that setting a feature's parameter to zero disables the feature, and a nonzero parameter enables it.
When using Direct2D interop, this Win2D class corresponds to the DirectWrite interface IDWriteTypography.