Bewerken

Share via


Typography.Variants Property

Definition

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

public:
 property System::Windows::FontVariants Variants { System::Windows::FontVariants get(); void set(System::Windows::FontVariants value); };
public System.Windows.FontVariants Variants { get; set; }
member this.Variants : System.Windows.FontVariants with get, set
Public Property Variants As FontVariants

Property Value

A FontVariants enumerated value. The default value is Normal.

Remarks

This property gets or sets a value on the object that owns a Typography property, which is the only way to access a Typography class instance. In addition, this property supports an attached property usage so that it can be set on text-containing objects in XAML.

Variants are similar to superscript or subscript font forms. It is possible for a font form to contain differing glyph sets between superscript and the ordinal form, or between subscript and inferior forms. The Variants property allows you to set superscript and subscript values for an OpenType font.

The following text displays superscripts for the Palatino Linotype font.

Text using OpenType superscripts
Example of superscripts

The following code example shows how to define superscripts for the Palatino Linotype font, using the Variants property.

<Paragraph FontFamily="Palatino Linotype">
  2<Run Typography.Variants="Superscript">3</Run>
  14<Run Typography.Variants="Superscript">th</Run>
</Paragraph>

The following text displays subscripts for the Palatino Linotype font.

Text using OpenType subscripts
Example of subscripts

The following code example shows how to define subscripts for the Palatino Linotype font, using the Variants property.

<Paragraph FontFamily="Palatino Linotype">
  H<Run Typography.Variants="Subscript">2</Run>O
  Footnote<Run Typography.Variants="Subscript">4</Run>
</Paragraph>

Fonts that do not support variants may have an algorithmic approximation of the font form.

XAML Attribute Usage

<object Typography.Variants="FontVariants"/>

Dependency Property Information

Identifier field VariantsProperty
Metadata properties set to true AffectsMeasure, AffectsRender, Inherits

Applies to