Typography.StylisticAlternates 屬性

定義

取得或設定值,這個值會指定樣式替代型態的索引。

public:
 property int StylisticAlternates { int get(); void set(int value); };
public int StylisticAlternates { get; set; }
member this.StylisticAlternates : int with get, set
Public Property StylisticAlternates As Integer

屬性值

Int32

樣式替代形式的索引。 預設值是 0 (零)。

備註

這個屬性會取得或設定擁有 Typography 屬性的物件上的值,這是存取類別實例的唯一 Typography 方法。 此外,這個屬性支援附加屬性使用方式,以便在 XAML 中的文字包含物件上設定它。

替代項目是可以取代標準字符的字符。 OpenType 字型,例如下列範例中使用的 Pericles 字型,包含可用來為文字建立不同外觀的替代字元。 下列文字顯示 Pericles 字型的標準字符。

使用 OpenType 標準字符的文字
標準字元集的範例

Pericles OpenType 字型包含額外的圖像,可提供標準字元集的文體替代字元。 下列文字顯示文體替代字符。

使用 OpenType 文體替代圖像的文字
文體替代字元的範例

下列程式碼範例示範如何使用 屬性來 StylisticAlternates 定義 Pericles 字型的手寫替代字元。

<Paragraph FontFamily="Pericles">
  <Run Typography.StylisticAlternates="1">A</Run>NCIENT
  GR<Run Typography.StylisticAlternates="1">EE</Run>K
  MYTH<Run Typography.StylisticAlternates="1">O</Run>LOGY
</Paragraph>

下列文字顯示數個 Pericles 字型的其他文體替代字符。

使用 OpenType 文體替代圖像的文字
其他文體替代字元的範例

下列程式碼範例示範如何定義這些其他文體替代字元。

<Paragraph FontFamily="Pericles">
  <Run Typography.StylisticAlternates="1">A</Run>
  <Run Typography.StylisticAlternates="2">A</Run>
  <Run Typography.StylisticAlternates="3">A</Run>
  <Run Typography.StylisticAlternates="1">C</Run>
  <Run Typography.StylisticAlternates="1">E</Run>
  <Run Typography.StylisticAlternates="1">G</Run>
  <Run Typography.StylisticAlternates="1">O</Run>
  <Run Typography.StylisticAlternates="1">Q</Run>
  <Run Typography.StylisticAlternates="1">R</Run>
  <Run Typography.StylisticAlternates="2">R</Run>
  <Run Typography.StylisticAlternates="1">S</Run>
  <Run Typography.StylisticAlternates="1">Y</Run>
</Paragraph>

XAML Attribute Usage

<object Typography.StylisticAlternates="int"/>

相依性屬性資訊

識別碼欄位 StylisticAlternatesProperty
設定為 的中繼資料屬性 true AffectsMeasureAffectsRenderInherits

適用於

另請參閱