Typography class
TOC
Collapse the table of content
Expand the table of content

Typography class

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.

Inheritance

Object
  Typography

Syntax


public sealed class Typography

Members

The Typography class has these types of members:

Methods

The Typography class has these methods. It also inherits methods from the Object class.

MethodDescription
GetAnnotationAlternates Returns the value of the AnnotationAlternates attached property for a specified dependency object.
GetCapitals Returns the value of the Capitals attached property for a specified dependency object.
GetCapitalSpacing Returns the value of the CapitalSpacing attached property for a specified dependency object.
GetCaseSensitiveForms Returns the value of the CaseSensitiveForms attached property for a specified dependency object.
GetContextualAlternates Returns the value of the ContextualAlternates attached property for a specified dependency object.
GetContextualLigatures Returns the value of the ContextualLigatures attached property for a specified dependency object.
GetContextualSwashes Returns the value of the ContextualSwashes attached property for a specified dependency object.
GetDiscretionaryLigatures Returns the value of the DiscretionaryLigatures attached property for a specified dependency object.
GetEastAsianExpertForms Returns the value of the EastAsianExpertForms attached property for a specified dependency object.
GetEastAsianLanguage Returns the value of the EastAsianLanguage attached property for a specified dependency object.
GetEastAsianWidths Returns the value of the EastAsianWidths attached property for a specified dependency object.
GetFraction Returns the value of the Fraction attached property for a specified dependency object.
GetHistoricalForms Returns the value of the HistoricalForms attached property for a specified dependency object.
GetHistoricalLigatures Returns the value of the HistoricalLigatures attached property for a specified dependency object.
GetKerning Returns the value of the Kerning attached property for a specified dependency object.
GetMathematicalGreek Returns the value of the MathematicalGreek attached property for a specified dependency object.
GetNumeralAlignment Returns the value of the NumeralAlignment attached property for a specified dependency object.
GetNumeralStyle Returns the value of the NumeralStyle attached property for a specified dependency object.
GetSlashedZero Returns the value of the SlashedZero attached property for a specified dependency object.
GetStandardLigatures Returns the value of the StandardLigatures attached property for a specified dependency object.
GetStandardSwashes Returns the value of the StandardSwashes attached property for a specified dependency object.
GetStylisticAlternates Returns the value of the StylisticAlternates attached property for a specified dependency object.
GetStylisticSet1 Returns the value of the StylisticSet1 attached property for a specified dependency object.
GetStylisticSet10 Returns the value of the StylisticSet10 attached property for a specified dependency object.
GetStylisticSet11 Returns the value of the StylisticSet11 attached property for a specified dependency object.
GetStylisticSet12 Returns the value of the StylisticSet12 attached property for a specified dependency object.
GetStylisticSet13 Returns the value of the StylisticSet13 attached property for a specified dependency object.
GetStylisticSet14 Returns the value of the StylisticSet14 attached property for a specified dependency object.
GetStylisticSet15 Returns the value of the StylisticSet15 attached property for a specified dependency object.
GetStylisticSet16 Returns the value of the StylisticSet16 attached property for a specified dependency object.
GetStylisticSet17 Returns the value of the StylisticSet17 attached property for a specified dependency object.
GetStylisticSet18 Returns the value of the StylisticSet18 attached property for a specified dependency object.
GetStylisticSet19 Returns the value of the StylisticSet19 attached property for a specified dependency object.
GetStylisticSet2 Returns the value of the StylisticSet2 attached property for a specified dependency object.
GetStylisticSet20 Returns the value of the StylisticSet20 attached property for a specified dependency object.
GetStylisticSet3 Returns the value of the StylisticSet3 attached property for a specified dependency object.
GetStylisticSet4 Returns the value of the StylisticSet4 attached property for a specified dependency object.
GetStylisticSet5 Returns the value of the StylisticSet5 attached property for a specified dependency object.
GetStylisticSet6 Returns the value of the StylisticSet6 attached property for a specified dependency object.
GetStylisticSet7 Returns the value of the StylisticSet7 attached property for a specified dependency object.
GetStylisticSet8 Returns the value of the StylisticSet8 attached property for a specified dependency object.
GetStylisticSet9 Returns the value of the StylisticSet9 attached property for a specified dependency object.
GetVariants Returns the value of the Variants attached property for a specified dependency object.
SetAnnotationAlternates Sets the value of the AnnotationAlternates attached property for a specified dependency object.
SetCapitals Sets the value of the Capitals attached property for a specified dependency object.
SetCapitalSpacing Sets the value of the CapitalSpacing attached property for a specified dependency object.
SetCaseSensitiveForms Sets the value of the CaseSensitiveForms attached property for a specified dependency object.
SetContextualAlternates Sets the value of the ContextualAlternates attached property for a specified dependency object.
SetContextualLigatures Sets the value of the ContextualLigatures attached property for a specified dependency object.
SetContextualSwashes Sets the value of the ContextualSwashes attached property for a specified dependency object.
SetDiscretionaryLigatures Sets the value of the DiscretionaryLigatures attached property for a specified dependency object.
SetEastAsianExpertForms Sets the value of the EastAsianExpertForms attached property for a specified dependency object.
SetEastAsianLanguage Sets the value of the EastAsianLanguage attached property for a specified dependency object.
SetEastAsianWidths Sets the value of the EastAsianWidths attached property for a specified dependency object.
SetFraction Sets the value of the Fraction attached property for a specified dependency object.
SetHistoricalForms Sets the value of the HistoricalForms attached property for a specified dependency object.
SetHistoricalLigatures Sets the value of the HistoricalLigatures attached property for a specified dependency object.
SetKerning Sets the value of the Kerning attached property for a specified dependency object.
SetMathematicalGreek Sets the value of the MathematicalGreek attached property for a specified dependency object.
SetNumeralAlignment Sets the value of the NumeralAlignment attached property for a specified dependency object.
SetNumeralStyle Sets the value of the NumeralStyle attached property for a specified dependency object.
SetSlashedZero Sets the value of the SlashedZero attached property for a specified dependency object.
SetStandardLigatures Sets the value of the StandardLigatures attached property for a specified dependency object.
SetStandardSwashes Sets the value of the StandardSwashes attached property for a specified dependency object.
SetStylisticAlternates Sets the value of the StylisticAlternates attached property for a specified dependency object.
SetStylisticSet1 Sets the value of the StylisticSet1 attached property for a specified dependency object.
SetStylisticSet10 Sets the value of the StylisticSet10 attached property for a specified dependency object.
SetStylisticSet11 Sets the value of the StylisticSet11 attached property for a specified dependency object.
SetStylisticSet12 Sets the value of the StylisticSet12 attached property for a specified dependency object.
SetStylisticSet13 Sets the value of the StylisticSet13 attached property for a specified dependency object.
SetStylisticSet14 Sets the value of the StylisticSet14 attached property for a specified dependency object.
SetStylisticSet15 Sets the value of the StylisticSet15 attached property for a specified dependency object.
SetStylisticSet16 Sets the value of the StylisticSet16 attached property for a specified dependency object.
SetStylisticSet17 Sets the value of the StylisticSet17 attached property for a specified dependency object.
SetStylisticSet18 Sets the value of the StylisticSet18 attached property for a specified dependency object.
SetStylisticSet19 Sets the value of the StylisticSet19 attached property for a specified dependency object.
SetStylisticSet2 Sets the value of the StylisticSet2 attached property for a specified dependency object.
SetStylisticSet20 Sets the value of the StylisticSet20 attached property for a specified dependency object.
SetStylisticSet3 Sets the value of the StylisticSet3 attached property for a specified dependency object.
SetStylisticSet4 Sets the value of the StylisticSet4 attached property for a specified dependency object.
SetStylisticSet5 Sets the value of the StylisticSet5 attached property for a specified dependency object.
SetStylisticSet6 Sets the value of the StylisticSet6 attached property for a specified dependency object.
SetStylisticSet7 Sets the value of the StylisticSet7 attached property for a specified dependency object.
SetStylisticSet8 Sets the value of the StylisticSet8 attached property for a specified dependency object.
SetStylisticSet9 Sets the value of the StylisticSet9 attached property for a specified dependency object.
SetVariants Sets the value of the Variants attached property for a specified dependency object.

 

Attached Properties

The Typography class has these attached properties.

Access typeDescription

Typography.AnnotationAlternates

Read/write

Gets or sets a value that specifies the index of an alternate annotation form.

Typography.Capitals

Read/write

Gets or sets a FontCapitals value that indicates the capital form of the selected font.

Typography.CapitalSpacing

Read/write

Gets or sets a value that determines whether inter-glyph spacing for all-capital text is globally adjusted to improve readability.

Typography.CaseSensitiveForms

Read/write

Gets or sets a value that determines whether glyphs adjust their vertical position to better align with uppercase glyphs.

Typography.ContextualAlternates

Read/write

Gets or sets a value that determines whether custom glyph forms can be used based upon the context of the text being rendered.

Typography.ContextualLigatures

Read/write

Gets or sets a value that determines whether contextual ligatures are enabled.

Typography.ContextualSwashes

Read/write

Gets or sets a value that specifies the index of a contextual swashes form.

Typography.DiscretionaryLigatures

Read/write

Gets or sets a value that determines whether discretionary ligatures are enabled.

Typography.EastAsianExpertForms

Read/write

Gets or sets a value that determines whether the standard Japanese font forms have been replaced with the corresponding preferred typographic forms.

Typography.EastAsianLanguage

Read/write

Gets or sets a FontEastAsianLanguage value that indicates glyphs used for a specific writing system or language.

Typography.EastAsianWidth

Read/write

Gets or sets a FontEastAsianWidths value that indicates the proportional width for Latin characters in an East Asian font.

Typography.Fraction

Read/write

Gets or sets a FontFraction value that indicates the fraction style.

Typography.HistoricalForms

Read/write

Gets or sets a value that determines whether historical forms are enabled.

Typography.HistoricalLigatures

Read/write

Gets or sets a value that indicates whether historical ligatures are enabled.

Typography.Kerning

Read/write

Gets or sets a value that indicates whether kerning is enabled.

Typography.MathematicalGreek

Read/write

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.

Typography.NumeralAlignment

Read/write

Gets or sets a FontNumeralAlignment value that indicates the alignment of widths for numerals.

Typography.NumeralStyle

Read/write

Gets or sets a FontNumeralStyle value that determines the set of glyphs that are used to render numeric alternate font forms.

Typography.SlashedZero

Read/write

Gets or sets a value that indicates whether a nominal zero font form should be replaced with a slashed zero.

Typography.StandardLigatures

Read/write

Gets or sets a value that indicates whether standard ligatures are enabled.

Typography.StandardSwashes

Read/write

Gets or sets a value that specifies the index of a standard swashes form.

Typography.StylisticAlternates

Read/write

Gets or sets a value that specifies the index of a stylistic alternates form.

Typography.StylisticSet1

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet10

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet11

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet12

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet13

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet14

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet15

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet16

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet17

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet18

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet19

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet2

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet20

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet3

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet4

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet5

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet6

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet7

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet8

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.StylisticSet9

Read/write

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Typography.Variants

Read/write

Gets or sets a FontVariants value that indicates a variation of the standard typographic form to be used.

 

Properties

The Typography class has these properties.

PropertyAccess typeDescription

AnnotationAlternatesProperty

Read-only

Identifies the AnnotationAlternates attached property.

CapitalSpacingProperty

Read-only

Identifies the CapitalSpacing attached property.

CapitalsProperty

Read-only

Identifies the Capitals attached property.

CaseSensitiveFormsProperty

Read-only

Identifies the CaseSensitiveForms attached property.

ContextualAlternatesProperty

Read-only

Identifies the ContextualAlternates attached property.

ContextualLigaturesProperty

Read-only

Identifies the ContextualLigatures attached property.

ContextualSwashesProperty

Read-only

Identifies the ContextualSwashes attached property.

DiscretionaryLigaturesProperty

Read-only

Identifies the DiscretionaryLigatures attached property.

EastAsianExpertFormsProperty

Read-only

Identifies the EastAsianExpertForms attached property.

EastAsianLanguageProperty

Read-only

Identifies the EastAsianLanguage attached property.

EastAsianWidthsProperty

Read-only

Identifies the EastAsianWidths attached property.

FractionProperty

Read-only

Identifies the Fraction attached property.

HistoricalFormsProperty

Read-only

Identifies the HistoricalForms attached property.

HistoricalLigaturesProperty

Read-only

Identifies the HistoricalLigatures attached property.

KerningProperty

Read-only

Identifies the Kerning attached property.

MathematicalGreekProperty

Read-only

Identifies the MathematicalGreek attached property.

NumeralAlignmentProperty

Read-only

Identifies the NumeralAlignment attached property.

NumeralStyleProperty

Read-only

Identifies the NumeralStyle attached property.

SlashedZeroProperty

Read-only

Identifies the SlashedZero attached property.

StandardLigaturesProperty

Read-only

Identifies the StandardLigatures attached property.

StandardSwashesProperty

Read-only

Identifies the StandardSwashes attached property.

StylisticAlternatesProperty

Read-only

Identifies the StylisticAlternates attached property.

StylisticSet10Property

Read-only

Identifies the StylisticSet10 attached property.

StylisticSet11Property

Read-only

Identifies the StylisticSet11 attached property.

StylisticSet12Property

Read-only

Identifies the StylisticSet12 attached property.

StylisticSet13Property

Read-only

Identifies the StylisticSet13 attached property.

StylisticSet14Property

Read-only

Identifies the StylisticSet14 attached property.

StylisticSet15Property

Read-only

Identifies the StylisticSet15 attached property.

StylisticSet16Property

Read-only

Identifies the StylisticSet16 attached property.

StylisticSet17Property

Read-only

Identifies the StylisticSet17 attached property.

StylisticSet18Property

Read-only

Identifies the StylisticSet18 attached property.

StylisticSet19Property

Read-only

Identifies the StylisticSet19 attached property.

StylisticSet1Property

Read-only

Identifies the StylisticSet1 attached property.

StylisticSet20Property

Read-only

Identifies the StylisticSet20 attached property.

StylisticSet2Property

Read-only

Identifies the StylisticSet2 attached property.

StylisticSet3Property

Read-only

Identifies the StylisticSet3 attached property.

StylisticSet4Property

Read-only

Identifies the StylisticSet4 attached property.

StylisticSet5Property

Read-only

Identifies the StylisticSet5 attached property.

StylisticSet6Property

Read-only

Identifies the StylisticSet6 attached property.

StylisticSet7Property

Read-only

Identifies the StylisticSet7 attached property.

StylisticSet8Property

Read-only

Identifies the StylisticSet8 attached property.

StylisticSet9Property

Read-only

Identifies the StylisticSet9 attached property.

VariantsProperty

Read-only

Identifies the Variants attached property.

 

Remarks

You typically use Typography attached properties with the text of TextBlock or RichTextBlock controls. The Typography object exposes the set of features that the OpenType font supports. By setting the properties of Typography in markup or code, you can author documents that take advantage of 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 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.

Caution  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.
 

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>

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Documents
Windows::UI::Xaml::Documents [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

See also

Object
TextBlock
RichTextBlock
TextBlock control guide
RichTextBlock control guide

 

 

Show:
© 2016 Microsoft