語言

Typography.Capitals 屬性

定義

取得或設定一個 FontCapitals 列舉值,表示所選字體的大寫形式。

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

屬性值

FontCapitals列舉值。 預設值為 Normal。

備註

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

大寫字母是一組字體形式,用於將文字呈現為大寫樣式的字符。 一般而言,當文字全部轉譯為大寫時,字母之間的間距可能太近,字母的加權和比例會過重。 OpenType 支援數種大寫字樣式格式,包括小型大寫字、特小大寫字、標題和大寫字母間距。 這些樣式格式可讓您控制大寫字的外觀。

下列文字顯示 Pescadero 字型的標準大寫字母,後面接著樣式設定為 "SmallCaps" 和 "AllSmallCaps" 的字母。 在此情況下,三個單字全都使用相同的字型大小。

使用OpenType大寫文字 柱頭範例

以下程式碼範例展示了如何使用 Capitals 屬性為 Pescadero 字型定義大寫字母。 使用 "SmallCaps" 格式時會略過任何開頭的大寫字母。

<Paragraph FontFamily="Pescadero" FontSize="48">
  <Run>CAPITALS</Run>
  <Run Typography.Capitals="SmallCaps">Capitals</Run>
  <Run Typography.Capitals="AllSmallCaps">Capitals</Run>
</Paragraph>

下列程式碼範例可以完成與先前標記範例相同的工作。

MyParagraph.FontFamily = new FontFamily("Pescadero");
MyParagraph.FontSize = 48;

Run run_1 = new Run("CAPITALS ");
MyParagraph.Inlines.Add(run_1);

Run run_2 = new Run("Capitals ");
run_2.Typography.Capitals = FontCapitals.SmallCaps;
MyParagraph.Inlines.Add(run_2);

Run run_3 = new Run("Capitals");
run_3.Typography.Capitals = FontCapitals.AllSmallCaps;
MyParagraph.Inlines.Add(run_3);

MyParagraph.Inlines.Add(new LineBreak());
MyParagraph.FontFamily = New FontFamily("Pescadero")
MyParagraph.FontSize = 48

Dim run_1 As New Run("CAPITALS ")
MyParagraph.Inlines.Add(run_1)

Dim run_2 As New Run("Capitals ")
run_2.Typography.Capitals = FontCapitals.SmallCaps
MyParagraph.Inlines.Add(run_2)

Dim run_3 As New Run("Capitals")
run_3.Typography.Capitals = FontCapitals.AllSmallCaps
MyParagraph.Inlines.Add(run_3)

MyParagraph.Inlines.Add(New LineBreak())

XAML 屬性使用方式

< 物件Typography.Capitals=“FontCapitals”/>

相依財產資訊

Item 價值觀
識別碼欄位 CapitalsProperty
元資料屬性設為 true AffectsMeasure、AffectsRender、Inherits

適用於

另請參閱