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 属性用法

<objectTypography.Capitals=“FontCapitals”/>

依赖项属性信息

标识符字段 CapitalsProperty
元数据属性设置为 true AffectsMeasure, AffectsRender, Inherits

适用于

另请参阅