共用方式為


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 支援數種大寫樣式格式,包括小大寫、小大寫、Titling 和大寫間距。 這些樣式格式可讓您控制大寫的外觀。

下列文字會顯示 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 屬性使用方式

< objectTypography.Capitals=“FontCapitals”/>

相依性屬性資訊

標識元欄位 CapitalsProperty
設定為 true 的元數據屬性 AffectsMeasureAffectsRenderInherits

適用於

另請參閱