Export (0) Print
Expand All

TextBox.Typography Property

Gets the currently effective typography variations for the text contents of the text box.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

'Declaration
Public ReadOnly Property Typography As Typography

Property Value

Type: System.Windows.Documents.Typography
A Typography object that specifies the currently effective typography variations. For a list of default typography values, see Typography.

The Typography property is applicable only to OpenType fonts. A typography variant has no effect on fonts that do not support the variant. For more information about this topic, see Typography in WPF.

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

The following example shows how to set the Typography property programmatically.


			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


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft