Typography Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides access to a set of Microsoft OpenType typography properties. These properties are implemented as XAML attached properties such that they can be set from text object model properties as well as from specific text controls.
public ref class Typography sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Typography final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class Typography
Public NotInheritable Class Typography
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
Here, Typography values are set on a TextBlock to render the text in small caps using stylistic set 4.
<TextBlock Text="Hello, world!"
Typography.Capitals="SmallCaps"
Typography.StylisticSet4="True"/>
TextBlock textBlock1 = new TextBlock();
textBlock1.Text = "Hello, world!";
Windows.UI.Xaml.Documents.Typography.SetCapitals(textBlock1, FontCapitals.SmallCaps);
Windows.UI.Xaml.Documents.Typography.SetStylisticSet4(textBlock1, true);
In this example, the Typography.Fraction attached property is set on a Run in a RichTextBlock.
<RichTextBlock>
<Paragraph>12 x <Run Typography.Fraction="Slashed">1/3</Run> = 4.</Paragraph>
</RichTextBlock>
Remarks
You typically use Typography attached properties with the text of TextBlock or RichTextBlock controls.
Note
You cannot use these properties with the TextBox or RichEditBox controls.
The Typography object exposes the set of features that the Microsoft OpenType font supports. By setting the properties of Typography in markup or code, you can author documents that take advantage of Microsoft OpenType features, and turn those features on at a per-element level if desired.
Some fonts contain stylistic variant glyphs that correspond to portions of a character set. Glyphs in stylistic sets may be designed to harmonize visually, interact in particular ways, or work together in other ways. Some of these variants are identified by particular conventions, for example the font might have discretionary ligatures. In this example case, the typography behavior can be enabled by setting Typography.DiscretionaryLigatures to true. Other stylistic variants are not identified by any Microsoft OpenType set or convention, and are instead specific to that particular font's typography design. These variants can be accessed by setting any of the StylisticSet# attached properties to true.
Note
Whenever possible, TextBlock renders text using an efficient fast path. Only the default values for the various Typography attached properties are fast path. Non-default values require TextBlock to fall back to a more CPU intensive code path for text rendering. For more info, see the TextBlock control guide.
XAML attached properties
Typography is the host service class for several XAML attached properties.
In order to support XAML processor access to the attached properties, and also to expose equivalent get and set operations to code, each XAML attached property has a pair of Get and Set accessor methods. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing the identifier field as the dependency property identifier.
Attached property | Description |
---|---|
AnnotationAlternates | Gets or sets an extension instance that defines helper methods for phased rendering of a data template. |
Capitals | Gets or sets a FontCapitals value that indicates the capital form of the selected font. |
CapitalSpacing | Gets or sets a value that determines whether inter-glyph spacing for all-capital text is globally adjusted to improve readability. |
CaseSensitiveForms | Gets or sets a value that determines whether glyphs adjust their vertical position to better align with uppercase glyphs. |
ContextualAlternates | Gets or sets a value that determines whether custom glyph forms can be used based upon the context of the text being rendered. |
ContextualLigatures | Gets or sets a value that determines whether contextual ligatures are enabled. |
ContextualSwashes | Gets or sets a value that specifies the index of a contextual swashes form. |
DiscretionaryLigatures | Gets or sets a value that determines whether discretionary ligatures are enabled. |
EastAsianExpertForms | Gets or sets a value that determines whether the standard Japanese font forms have been replaced with the corresponding preferred typographic forms. |
EastAsianLanguage | Gets or sets a FontEastAsianLanguage value that indicates glyphs used for a specific writing system or language. |
EastAsianWidths | Gets or sets a FontEastAsianWidths value that indicates the proportional width for Latin characters in an East Asian font. |
Fraction | Gets or sets a FontFraction value that indicates the fraction style. |
HistoricalForms | Gets or sets a value that determines whether historical forms are enabled. |
HistoricalLigatures | Gets or sets a value that indicates whether historical ligatures are enabled. |
Kerning | Gets or sets a value that indicates whether kerning is enabled. Kerning is a typographic function that adjusts the spacing between characters to enhance word shape. |
MathematicalGreek | Gets or sets a value that indicates whether standard typographic font forms of Greek glyphs have been replaced with corresponding font forms commonly used in mathematical notation. |
NumeralAlignment | Gets or sets a FontNumeralAlignment value that indicates the alignment of widths for numerals. |
NumeralStyle | Gets or sets a FontNumeralStyle value that determines the set of glyphs that are used to render numeric alternate font forms. |
SlashedZero | Gets or sets a value that indicates whether a nominal zero font form should be replaced with a slashed zero. |
StandardLigatures | Gets or sets a value that indicates whether standard ligatures are enabled. |
StandardSwashes | Gets or sets a value that specifies the index of a standard swashes form. |
StylisticAlternates | Gets or sets a value that specifies the index of a stylistic alternates form. |
StylisticSet1 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet2 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet3 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet4 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet5 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet6 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet7 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet8 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet9 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet10 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet11 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet12 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet13 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet14 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet15 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet16 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet17 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet18 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet19 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet20 | Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
Variants | Gets or sets a FontVariants value that indicates a variation of the standard typographic form to be used. |
Properties
Attached Properties
AnnotationAlternates |
Gets or sets an extension instance that defines helper methods for phased rendering of a data template. |
Capitals |
Gets or sets a FontCapitals value that indicates the capital form of the selected font. |
CapitalSpacing |
Gets or sets a value that determines whether inter-glyph spacing for all-capital text is globally adjusted to improve readability. |
CaseSensitiveForms |
Gets or sets a value that determines whether glyphs adjust their vertical position to better align with uppercase glyphs. |
ContextualAlternates |
Gets or sets a value that determines whether custom glyph forms can be used based upon the context of the text being rendered. |
ContextualLigatures |
Gets or sets a value that determines whether contextual ligatures are enabled. |
ContextualSwashes |
Gets or sets a value that specifies the index of a contextual swashes form. |
DiscretionaryLigatures |
Gets or sets a value that determines whether discretionary ligatures are enabled. |
EastAsianExpertForms |
Gets or sets a value that determines whether the standard Japanese font forms have been replaced with the corresponding preferred typographic forms. |
EastAsianLanguage |
Gets or sets a FontEastAsianLanguage value that indicates glyphs used for a specific writing system or language. |
EastAsianWidths |
Gets or sets a FontEastAsianWidths value that indicates the proportional width for Latin characters in an East Asian font. |
Fraction |
Gets or sets a FontFraction value that indicates the fraction style. |
HistoricalForms |
Gets or sets a value that determines whether historical forms are enabled. |
HistoricalLigatures |
Gets or sets a value that indicates whether historical ligatures are enabled. |
Kerning |
Gets or sets a value that indicates whether kerning is enabled. |
MathematicalGreek |
Gets or sets a value that indicates whether standard typographic font forms of Greek glyphs have been replaced with corresponding font forms commonly used in mathematical notation. |
NumeralAlignment |
Gets or sets a FontNumeralAlignment value that indicates the alignment of widths for numerals. |
NumeralStyle |
Gets or sets a FontNumeralStyle value that determines the set of glyphs that are used to render numeric alternate font forms. |
SlashedZero |
Gets or sets a value that indicates whether a nominal zero font form should be replaced with a slashed zero. |
StandardLigatures |
Gets or sets a value that indicates whether standard ligatures are enabled. |
StandardSwashes |
Gets or sets a value that specifies the index of a standard swashes form. |
StylisticAlternates |
Gets or sets a value that specifies the index of a stylistic alternates form. |
StylisticSet1 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet10 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet11 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet12 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet13 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet14 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet15 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet16 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet17 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet18 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet19 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet2 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet20 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet3 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet4 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet5 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet6 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet7 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet8 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
StylisticSet9 |
Gets or sets a value that indicates whether a stylistic set of a font form is enabled. |
Variants |
Gets or sets a FontVariants value that indicates a variation of the standard typographic form to be used. |
Methods
GetAnnotationAlternates(DependencyObject) |
Returns the value of the AnnotationAlternates attached property for a specified dependency object. |
GetCapitals(DependencyObject) |
Returns the value of the Capitals attached property for a specified dependency object. |
GetCapitalSpacing(DependencyObject) |
Returns the value of the CapitalSpacing attached property for a specified dependency object. |
GetCaseSensitiveForms(DependencyObject) |
Returns the value of the CaseSensitiveForms attached property for a specified dependency object. |
GetContextualAlternates(DependencyObject) |
Returns the value of the ContextualAlternates attached property for a specified dependency object. |
GetContextualLigatures(DependencyObject) |
Returns the value of the ContextualLigatures attached property for a specified dependency object. |
GetContextualSwashes(DependencyObject) |
Returns the value of the ContextualSwashes attached property for a specified dependency object. |
GetDiscretionaryLigatures(DependencyObject) |
Returns the value of the DiscretionaryLigatures attached property for a specified dependency object. |
GetEastAsianExpertForms(DependencyObject) |
Returns the value of the EastAsianExpertForms attached property for a specified dependency object. |
GetEastAsianLanguage(DependencyObject) |
Returns the value of the EastAsianLanguage attached property for a specified dependency object. |
GetEastAsianWidths(DependencyObject) |
Returns the value of the EastAsianWidths attached property for a specified dependency object. |
GetFraction(DependencyObject) |
Returns the value of the Fraction attached property for a specified dependency object. |
GetHistoricalForms(DependencyObject) |
Returns the value of the HistoricalForms attached property for a specified dependency object. |
GetHistoricalLigatures(DependencyObject) |
Returns the value of the HistoricalLigatures attached property for a specified dependency object. |
GetKerning(DependencyObject) |
Returns the value of the Kerning attached property for a specified dependency object. |
GetMathematicalGreek(DependencyObject) |
Returns the value of the MathematicalGreek attached property for a specified dependency object. |
GetNumeralAlignment(DependencyObject) |
Returns the value of the NumeralAlignment attached property for a specified dependency object. |
GetNumeralStyle(DependencyObject) |
Returns the value of the NumeralStyle attached property for a specified dependency object. |
GetSlashedZero(DependencyObject) |
Returns the value of the SlashedZero attached property for a specified dependency object. |
GetStandardLigatures(DependencyObject) |
Returns the value of the StandardLigatures attached property for a specified dependency object. |
GetStandardSwashes(DependencyObject) |
Returns the value of the StandardSwashes attached property for a specified dependency object. |
GetStylisticAlternates(DependencyObject) |
Returns the value of the StylisticAlternates attached property for a specified dependency object. |
GetStylisticSet1(DependencyObject) |
Returns the value of the StylisticSet1 attached property for a specified dependency object. |
GetStylisticSet10(DependencyObject) |
Returns the value of the StylisticSet10 attached property for a specified dependency object. |
GetStylisticSet11(DependencyObject) |
Returns the value of the StylisticSet11 attached property for a specified dependency object. |
GetStylisticSet12(DependencyObject) |
Returns the value of the StylisticSet12 attached property for a specified dependency object. |
GetStylisticSet13(DependencyObject) |
Returns the value of the StylisticSet13 attached property for a specified dependency object. |
GetStylisticSet14(DependencyObject) |
Returns the value of the StylisticSet14 attached property for a specified dependency object. |
GetStylisticSet15(DependencyObject) |
Returns the value of the StylisticSet15 attached property for a specified dependency object. |
GetStylisticSet16(DependencyObject) |
Returns the value of the StylisticSet16 attached property for a specified dependency object. |
GetStylisticSet17(DependencyObject) |
Returns the value of the StylisticSet17 attached property for a specified dependency object. |
GetStylisticSet18(DependencyObject) |
Returns the value of the StylisticSet18 attached property for a specified dependency object. |
GetStylisticSet19(DependencyObject) |
Returns the value of the StylisticSet19 attached property for a specified dependency object. |
GetStylisticSet2(DependencyObject) |
Returns the value of the StylisticSet2 attached property for a specified dependency object. |
GetStylisticSet20(DependencyObject) |
Returns the value of the StylisticSet20 attached property for a specified dependency object. |
GetStylisticSet3(DependencyObject) |
Returns the value of the StylisticSet3 attached property for a specified dependency object. |
GetStylisticSet4(DependencyObject) |
Returns the value of the StylisticSet4 attached property for a specified dependency object. |
GetStylisticSet5(DependencyObject) |
Returns the value of the StylisticSet5 attached property for a specified dependency object. |
GetStylisticSet6(DependencyObject) |
Returns the value of the StylisticSet6 attached property for a specified dependency object. |
GetStylisticSet7(DependencyObject) |
Returns the value of the StylisticSet7 attached property for a specified dependency object. |
GetStylisticSet8(DependencyObject) |
Returns the value of the StylisticSet8 attached property for a specified dependency object. |
GetStylisticSet9(DependencyObject) |
Returns the value of the StylisticSet9 attached property for a specified dependency object. |
GetVariants(DependencyObject) |
Returns the value of the Variants attached property for a specified dependency object. |
SetAnnotationAlternates(DependencyObject, Int32) |
Sets the value of the AnnotationAlternates attached property for a specified dependency object. |
SetCapitals(DependencyObject, FontCapitals) |
Sets the value of the Capitals attached property for a specified dependency object. |
SetCapitalSpacing(DependencyObject, Boolean) |
Sets the value of the CapitalSpacing attached property for a specified dependency object. |
SetCaseSensitiveForms(DependencyObject, Boolean) |
Sets the value of the CaseSensitiveForms attached property for a specified dependency object. |
SetContextualAlternates(DependencyObject, Boolean) |
Sets the value of the ContextualAlternates attached property for a specified dependency object. |
SetContextualLigatures(DependencyObject, Boolean) |
Sets the value of the ContextualLigatures attached property for a specified dependency object. |
SetContextualSwashes(DependencyObject, Int32) |
Sets the value of the ContextualSwashes attached property for a specified dependency object. |
SetDiscretionaryLigatures(DependencyObject, Boolean) |
Sets the value of the DiscretionaryLigatures attached property for a specified dependency object. |
SetEastAsianExpertForms(DependencyObject, Boolean) |
Sets the value of the EastAsianExpertForms attached property for a specified dependency object. |
SetEastAsianLanguage(DependencyObject, FontEastAsianLanguage) |
Sets the value of the EastAsianLanguage attached property for a specified dependency object. |
SetEastAsianWidths(DependencyObject, FontEastAsianWidths) |
Sets the value of the EastAsianWidths attached property for a specified dependency object. |
SetFraction(DependencyObject, FontFraction) |
Sets the value of the Fraction attached property for a specified dependency object. |
SetHistoricalForms(DependencyObject, Boolean) |
Sets the value of the HistoricalForms attached property for a specified dependency object. |
SetHistoricalLigatures(DependencyObject, Boolean) |
Sets the value of the HistoricalLigatures attached property for a specified dependency object. |
SetKerning(DependencyObject, Boolean) |
Sets the value of the Kerning attached property for a specified dependency object. |
SetMathematicalGreek(DependencyObject, Boolean) |
Sets the value of the MathematicalGreek attached property for a specified dependency object. |
SetNumeralAlignment(DependencyObject, FontNumeralAlignment) |
Sets the value of the NumeralAlignment attached property for a specified dependency object. |
SetNumeralStyle(DependencyObject, FontNumeralStyle) |
Sets the value of the NumeralStyle attached property for a specified dependency object. |
SetSlashedZero(DependencyObject, Boolean) |
Sets the value of the SlashedZero attached property for a specified dependency object. |
SetStandardLigatures(DependencyObject, Boolean) |
Sets the value of the StandardLigatures attached property for a specified dependency object. |
SetStandardSwashes(DependencyObject, Int32) |
Sets the value of the StandardSwashes attached property for a specified dependency object. |
SetStylisticAlternates(DependencyObject, Int32) |
Sets the value of the StylisticAlternates attached property for a specified dependency object. |
SetStylisticSet1(DependencyObject, Boolean) |
Sets the value of the StylisticSet1 attached property for a specified dependency object. |
SetStylisticSet10(DependencyObject, Boolean) |
Sets the value of the StylisticSet10 attached property for a specified dependency object. |
SetStylisticSet11(DependencyObject, Boolean) |
Sets the value of the StylisticSet11 attached property for a specified dependency object. |
SetStylisticSet12(DependencyObject, Boolean) |
Sets the value of the StylisticSet12 attached property for a specified dependency object. |
SetStylisticSet13(DependencyObject, Boolean) |
Sets the value of the StylisticSet13 attached property for a specified dependency object. |
SetStylisticSet14(DependencyObject, Boolean) |
Sets the value of the StylisticSet14 attached property for a specified dependency object. |
SetStylisticSet15(DependencyObject, Boolean) |
Sets the value of the StylisticSet15 attached property for a specified dependency object. |
SetStylisticSet16(DependencyObject, Boolean) |
Sets the value of the StylisticSet16 attached property for a specified dependency object. |
SetStylisticSet17(DependencyObject, Boolean) |
Sets the value of the StylisticSet17 attached property for a specified dependency object. |
SetStylisticSet18(DependencyObject, Boolean) |
Sets the value of the StylisticSet18 attached property for a specified dependency object. |
SetStylisticSet19(DependencyObject, Boolean) |
Sets the value of the StylisticSet19 attached property for a specified dependency object. |
SetStylisticSet2(DependencyObject, Boolean) |
Sets the value of the StylisticSet2 attached property for a specified dependency object. |
SetStylisticSet20(DependencyObject, Boolean) |
Sets the value of the StylisticSet20 attached property for a specified dependency object. |
SetStylisticSet3(DependencyObject, Boolean) |
Sets the value of the StylisticSet3 attached property for a specified dependency object. |
SetStylisticSet4(DependencyObject, Boolean) |
Sets the value of the StylisticSet4 attached property for a specified dependency object. |
SetStylisticSet5(DependencyObject, Boolean) |
Sets the value of the StylisticSet5 attached property for a specified dependency object. |
SetStylisticSet6(DependencyObject, Boolean) |
Sets the value of the StylisticSet6 attached property for a specified dependency object. |
SetStylisticSet7(DependencyObject, Boolean) |
Sets the value of the StylisticSet7 attached property for a specified dependency object. |
SetStylisticSet8(DependencyObject, Boolean) |
Sets the value of the StylisticSet8 attached property for a specified dependency object. |
SetStylisticSet9(DependencyObject, Boolean) |
Sets the value of the StylisticSet9 attached property for a specified dependency object. |
SetVariants(DependencyObject, FontVariants) |
Sets the value of the Variants attached property for a specified dependency object. |