Edit

Share via


Typography.ContextualAlternates Property

Definition

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

public:
 property bool ContextualAlternates { bool get(); void set(bool value); };
public bool ContextualAlternates { get; set; }
member this.ContextualAlternates : bool with get, set
Public Property ContextualAlternates As Boolean

Property Value

true if custom glyph forms can be used; otherwise, false. The default value is true.

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.

Random contextual alternates provide multiple substitute glyphs for a single character. When implemented with script-type fonts, this feature can simulate handwriting by using of a set of randomly chosen glyphs with slight differences in appearance. The following text uses random contextual alternates for the Lindsey font. Notice that the letter "a" varies slightly in appearance

Text using OpenType random contextual alternates
Example of random contextual alternates

The following code example shows how to define random contextual alternates for the Lindsey font, using the ContextualAlternates property.

<TextBlock FontFamily="Lindsey">
  <Run Typography.ContextualAlternates="True">
    a banana in a cabana
  </Run>
</TextBlock>

XAML Attribute Usage

<object Typography.ContextualAlternates="bool"/>

Dependency Property Information

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

Applies to

See also