TextBox.Typography TextBox.Typography TextBox.Typography TextBox.Typography Property

定义

获取文本框的文本内容的当前有效版式变体。Gets the currently effective typography variations for the text contents of the text box.

public:
 property System::Windows::Documents::Typography ^ Typography { System::Windows::Documents::Typography ^ get(); };
public System.Windows.Documents.Typography Typography { get; }
member this.Typography : System.Windows.Documents.Typography
Public ReadOnly Property Typography As Typography

属性值

一个 Typography 对象,它指定当前有效的版式变体。A Typography object that specifies the currently effective typography variations. 有关默认版式值的列表,请参见 TypographyFor a list of default typography values, see Typography.

示例

下面的示例演示如何使用Typography Paragraph作为示例元素来设置特性。The following example shows how to set the Typography attribute, using Paragraph as the example element.

<Paragraph
  TextAlignment="Left"
  FontSize="18" 
  FontFamily="Palatino Linotype"
  Typography.NumeralStyle="OldStyle"
  Typography.Fraction="Stacked"
  Typography.Variants="Inferior"
>
  <Run>
    This text has some altered typography characteristics.  Note
    that use of an open type font is necessary for most typographic
    properties to be effective.
  </Run>
  <LineBreak/><LineBreak/>
  <Run>
    0123456789 10 11 12 13
  </Run>
  <LineBreak/><LineBreak/>
  <Run>
    1/2 2/3 3/4
  </Run>
</Paragraph>

下图显示了此示例的呈现效果。The following figure shows how this example renders.

图更改了版式Screenshot: Text with altered typography

与此相反,下图显示了一个具有默认版式属性的类似示例的呈现效果。In contrast, the following figure shows how a similar example with default typographic properties renders.

图更改了版式Screenshot: Text with altered typography

下面的示例演示如何以编程方式Typography设置属性。The following example shows how to set the Typography property programmatically.

Paragraph par = new Paragraph();

Run runText = new Run(
    "This text has some altered typography characteristics.  Note" +
    "that use of an open type font is necessary for most typographic" +
    "properties to be effective.");
Run runNumerals = new Run("0123456789 10 11 12 13");
Run runFractions = new Run("1/2 2/3 3/4");

par.Inlines.Add(runText);
par.Inlines.Add(new LineBreak());
par.Inlines.Add(new LineBreak());
par.Inlines.Add(runNumerals);
par.Inlines.Add(new LineBreak());
par.Inlines.Add(new LineBreak());
par.Inlines.Add(runFractions);

par.TextAlignment = TextAlignment.Left;
par.FontSize = 18;
par.FontFamily = new FontFamily("Palatino Linotype");

par.Typography.NumeralStyle = FontNumeralStyle.OldStyle;
par.Typography.Fraction = FontFraction.Stacked;
par.Typography.Variants = FontVariants.Inferior;
Dim par As New Paragraph()

Dim runText As New Run("This text has some altered typography characteristics.  Note" & "that use of an open type font is necessary for most typographic" & "properties to be effective.")
Dim runNumerals As New Run("0123456789 10 11 12 13")
Dim runFractions As New Run("1/2 2/3 3/4")

par.Inlines.Add(runText)
par.Inlines.Add(New LineBreak())
par.Inlines.Add(New LineBreak())
par.Inlines.Add(runNumerals)
par.Inlines.Add(New LineBreak())
par.Inlines.Add(New LineBreak())
par.Inlines.Add(runFractions)

par.TextAlignment = TextAlignment.Left
par.FontSize = 18
par.FontFamily = New FontFamily("Palatino Linotype")

par.Typography.NumeralStyle = FontNumeralStyle.OldStyle
par.Typography.Fraction = FontFraction.Stacked
par.Typography.Variants = FontVariants.Inferior

注解

属性仅适用于OpenTypeOpenType字体。 TypographyThe Typography property is applicable only to OpenTypeOpenType fonts. 版式变体对不支持变体的字体不起作用。A typography variant has no effect on fonts that do not support the variant. 有关此主题的详细信息, 请参阅WPF 中的版式For more information about this topic, see Typography in WPF.

适用于