TextElement.Typography Propiedad

Definición

Obtiene las variaciones de tipografía en vigencia para el contenido del elemento.

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

Valor de propiedad

Typography

Las variaciones de tipografía vigentes actualmente. Para obtener una lista de valores de tipografía predeterminados, vea Typography.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer el Typography atributo utilizando Paragraph como elemento de ejemplo.

<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>

En la ilustración siguiente se muestra cómo se representa el ejemplo anterior.

Captura de pantalla: texto con tipografía modificada

En cambio, en la siguiente ilustración se muestra cómo se representa un ejemplo similar con propiedades tipográficas predeterminadas.

Captura de pantalla: texto con tipografía modificada

En el ejemplo siguiente se muestra cómo establecer la Typography propiedad mediante programación.

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

Comentarios

La Typography propiedad solo se aplica a las fuentes OpenType. Una variante de tipografía no tiene ningún efecto en las fuentes que no admiten la variante. Para obtener más información sobre este tema, vea Tipografía en WPF.

Se aplica a