Επεξεργασία

Κοινή χρήση μέσω


Typography Class

Definition

Provides access to a rich set of OpenType typography properties.

public ref class Typography sealed
public sealed class Typography
type Typography = class
Public NotInheritable Class Typography
Inheritance
Typography

Examples

The following code sample shows the use typographic Capitals in XAML. Notice that the variant feature is applied to all text contained with the Paragraph element.

<FlowDocument FontFamily="Palatino Linotype" FontSize="24">
  <Paragraph Typography.Capitals="SmallCaps">
    This example shows the use of the Capitals property
    of the Typography object. The entirety of this paragraph
    is displayed in small capitals letters,
    except for the first letter of a sentence,
    and where an uppercase letter is used. In these cases,
    a large capital letter is used.
  </Paragraph>
</FlowDocument>

The following code sample shows the use typographic Capitals and NumeralStyle features in XAML. Notice that both typographic properties are applied to the entire paragraph.

<FlowDocument FontFamily="Palatino Linotype" FontSize="24">
    <Paragraph Typography.Capitals="SmallCaps" Typography.NumeralStyle="OldStyle">
      Welcome to C#! . . . 14<LineBreak/>
      Working with Variables, Operators, and Expressions . . . 29<LineBreak/>
      Writing Methods and Applying Scope . . . 45
    </Paragraph>
</FlowDocument>

Remarks

The Typography object exposes the set of features that an OpenType font supports. By setting the properties of Typography in markup or code, you can easily author documents that take advantage of OpenType features.

The following text displays standard capital letters for the Pescadero font, followed by the letters styled as "SmallCaps" and "AllSmallCaps". In this case, the same font size is used for all three words.

Text using OpenType capitals
Text using OpenType capitals

The following markup example shows how to define capitals for the Pescadero font, using properties of the Typography object. When the "SmallCaps" format is used, any leading capital letter is ignored.

<Paragraph FontFamily="Pescadero" FontSize="48">
  <Run>CAPITALS</Run>
  <Run Typography.Capitals="SmallCaps">Capitals</Run>
  <Run Typography.Capitals="AllSmallCaps">Capitals</Run>
</Paragraph>

The following code example accomplishes the same task as the previous markup example.

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

Typography Properties

The following table lists the properties, values, and default value of the Typography object.

Property Value(s) Default Value
AnnotationAlternates Numeric value - byte 0
Capitals AllPetiteCaps | AllSmallCaps | Normal | PetiteCaps | SmallCaps | Titling | Unicase FontCapitals.Normal
CapitalSpacing Boolean false
CaseSensitiveForms Boolean false
ContextualAlternates Boolean true
ContextualLigatures Boolean true
ContextualSwashes Numeric value - byte 0
DiscretionaryLigatures Boolean false
EastAsianExpertForms Boolean false
EastAsianLanguage HojoKanji | Jis04 | Jis78 | Jis83 | Jis90 | NlcKanji | Normal | Simplified | Traditional | TraditionalNames FontEastAsianLanguage.Normal
EastAsianWidths Full | Half | Normal | Proportional | Quarter | Third FontEastAsianWidths.Normal
Fraction Normal | Slashed | Stacked FontFraction.Normal
HistoricalForms Boolean false
HistoricalLigatures Boolean false
Kerning Boolean true
MathematicalGreek Boolean false
NumeralAlignment Normal | Proportional | Tabular FontNumeralAlignment.Normal
NumeralStyle Boolean FontNumeralStyle.Normal
SlashedZero Boolean false
StandardLigatures Boolean true
StandardSwashes numeric value - byte 0
StylisticAlternates numeric value - byte 0
StylisticSet1 Boolean false
StylisticSet2 Boolean false
StylisticSet3 Boolean false
StylisticSet4 Boolean false
StylisticSet5 Boolean false
StylisticSet6 Boolean false
StylisticSet7 Boolean false
StylisticSet8 Boolean false
StylisticSet9 Boolean false
StylisticSet10 Boolean false
StylisticSet11 Boolean false
StylisticSet12 Boolean false
StylisticSet13 Boolean false
StylisticSet14 Boolean false
StylisticSet15 Boolean false
StylisticSet16 Boolean false
StylisticSet17 Boolean false
StylisticSet18 Boolean false
StylisticSet19 Boolean false
StylisticSet20 Boolean false
Variants Inferior | Normal | Ordinal | Ruby | Subscript | Superscript FontVariants.Normal

All dependency properties of this class also have an attached property usage in XAML. For instance, you can set the AnnotationAlternates property through this syntax:

<object Typography.AnnotationAlternates="value" .../>

Fields

AnnotationAlternatesProperty

Identifies the AnnotationAlternates attached property.

CapitalSpacingProperty

Identifies the CapitalSpacing attached property.

CapitalsProperty

Identifies the Capitals attached property.

CaseSensitiveFormsProperty

Identifies the CaseSensitiveForms attached property.

ContextualAlternatesProperty

Identifies the ContextualAlternates attached property.

ContextualLigaturesProperty

Identifies the ContextualLigatures attached property.

ContextualSwashesProperty

Identifies the ContextualSwashes attached property.

DiscretionaryLigaturesProperty

Identifies the DiscretionaryLigatures attached property.

EastAsianExpertFormsProperty

Identifies the EastAsianExpertForms attached property.

EastAsianLanguageProperty

Identifies the EastAsianLanguage attached property.

EastAsianWidthsProperty

Identifies the EastAsianWidths attached property.

FractionProperty

Identifies the Fraction attached property.

HistoricalFormsProperty

Identifies the HistoricalForms attached property.

HistoricalLigaturesProperty

Identifies the HistoricalLigatures attached property.

KerningProperty

Identifies the Kerning attached property.

MathematicalGreekProperty

Identifies the MathematicalGreek attached property.

NumeralAlignmentProperty

Identifies the NumeralAlignment attached property.

NumeralStyleProperty

Identifies the NumeralStyle attached property.

SlashedZeroProperty

Identifies the SlashedZero attached property.

StandardLigaturesProperty

Identifies the StandardLigatures attached property.

StandardSwashesProperty

Identifies the StandardSwashes attached property.

StylisticAlternatesProperty

Identifies the StylisticAlternates attached property.

StylisticSet10Property

Identifies the StylisticSet10 attached property.

StylisticSet11Property

Identifies the StylisticSet11 attached property.

StylisticSet12Property

Identifies the StylisticSet12 attached property.

StylisticSet13Property

Identifies the StylisticSet13 attached property.

StylisticSet14Property

Identifies the StylisticSet14 attached property.

StylisticSet15Property

Identifies the StylisticSet15 attached property.

StylisticSet16Property

Identifies the StylisticSet16 attached property.

StylisticSet17Property

Identifies the StylisticSet17 attached property.

StylisticSet18Property

Identifies the StylisticSet18 attached property.

StylisticSet19Property

Identifies the StylisticSet19 attached property.

StylisticSet1Property

Identifies the StylisticSet1 attached property.

StylisticSet20Property

Identifies the StylisticSet20 attached property.

StylisticSet2Property

Identifies the StylisticSet2 attached property.

StylisticSet3Property

Identifies the StylisticSet3 attached property.

StylisticSet4Property

Identifies the StylisticSet4 attached property.

StylisticSet5Property

Identifies the StylisticSet5 attached property.

StylisticSet6Property

Identifies the StylisticSet6 attached property.

StylisticSet7Property

Identifies the StylisticSet7 attached property.

StylisticSet8Property

Identifies the StylisticSet8 attached property.

StylisticSet9Property

Identifies the StylisticSet9 attached property.

VariantsProperty

Identifies the Variants attached property.

Properties

AnnotationAlternates

Gets or sets a value that specifies the index of an alternate annotation form.

Capitals

Gets or sets a FontCapitals enumerated value that indicates the capital form of the selected font.

CapitalSpacing

Gets or sets a value that determines whether inter-glyph spacing for all-capital text is globally adjusted to improve readability.

CaseSensitiveForms

Gets or sets a value that determines whether glyphs adjust their vertical position to better align with uppercase glyphs.

ContextualAlternates

Gets or sets a value that determines whether custom glyph forms can be used based upon the context of the text being rendered.

ContextualLigatures

Gets or sets a value that determines whether contextual ligatures are enabled.

ContextualSwashes

Gets or sets a value that specifies the index of a contextual swashes form.

DiscretionaryLigatures

Gets or sets a value that determines whether discretionary ligatures are enabled.

EastAsianExpertForms

Gets or sets a value that determines whether the standard Japanese font forms have been replaced with the corresponding preferred typographic forms.

EastAsianLanguage

Gets or sets a FontEastAsianLanguage enumerated value that indicates the version of glyphs to be used for a specific writing system or language.

EastAsianWidths

Gets or sets a FontEastAsianWidths enumerated value that indicates the proportional width to be used for Latin characters in an East Asian font.

Fraction

Gets or sets a FontFraction enumerated value that indicates the fraction style.

HistoricalForms

Gets or sets a value that determines whether historical forms are enabled.

HistoricalLigatures

Gets or sets a value that indicates whether historical ligatures are enabled.

Kerning

Gets or sets a value that indicates whether kerning is enabled.

MathematicalGreek

Gets or sets a value that indicates whether standard typographic font forms of Greek glyphs have been replaced with corresponding font forms commonly used in mathematical notation.

NumeralAlignment

Gets or sets a FontNumeralAlignment enumerated value that indicates the alignment of widths when using numerals.

NumeralStyle

Gets or sets a FontNumeralStyle enumerated value that determines the set of glyphs that are used to render numeric alternate font forms.

SlashedZero

Gets or sets a value that indicates whether a nominal zero font form should be replaced with a slashed zero.

StandardLigatures

Gets or sets a value that indicates whether standard ligatures are enabled.

StandardSwashes

Gets or sets a value that specifies the index of a standard swashes form.

StylisticAlternates

Gets or sets a value that specifies the index of a stylistic alternates form.

StylisticSet1

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet10

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet11

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet12

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet13

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet14

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet15

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet16

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet17

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet18

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet19

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet2

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet20

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet3

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet4

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet5

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet6

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet7

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet8

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

StylisticSet9

Gets or sets a value that indicates whether a stylistic set of a font form is enabled.

Variants

Gets or sets a FontVariants enumerated value that indicates a variation of the standard typographic form to be used.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAnnotationAlternates(DependencyObject)

Returns the value of the AnnotationAlternates attached property for a specified dependency object.

GetCapitals(DependencyObject)

Returns the value of the Capitals attached property for a specified dependency object.

GetCapitalSpacing(DependencyObject)

Returns the value of the CapitalSpacing attached property for a specified dependency object.

GetCaseSensitiveForms(DependencyObject)

Returns the value of the CaseSensitiveForms attached property for a specified dependency object.

GetContextualAlternates(DependencyObject)

Returns the value of the ContextualAlternates attached property for a specified dependency object.

GetContextualLigatures(DependencyObject)

Returns the value of the ContextualLigatures attached property for a specified dependency object.

GetContextualSwashes(DependencyObject)

Returns the value of the ContextualSwashes attached property for a specified dependency object.

GetDiscretionaryLigatures(DependencyObject)

Returns the value of the DiscretionaryLigatures attached property for a specified dependency object.

GetEastAsianExpertForms(DependencyObject)

Returns the value of the EastAsianExpertForms attached property for a specified dependency object.

GetEastAsianLanguage(DependencyObject)

Returns the value of the EastAsianLanguage attached property for a specified dependency object.

GetEastAsianWidths(DependencyObject)

Returns the value of the EastAsianWidths attached property for a specified dependency object.

GetFraction(DependencyObject)

Returns the value of the Fraction attached property for a specified dependency object.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetHistoricalForms(DependencyObject)

Returns the value of the HistoricalForms attached property for a specified dependency object.

GetHistoricalLigatures(DependencyObject)

Returns the value of the HistoricalLigatures attached property for a specified dependency object.

GetKerning(DependencyObject)

Returns the value of the Kerning attached property for a specified dependency object.

GetMathematicalGreek(DependencyObject)

Returns the value of the MathematicalGreek attached property for a specified dependency object.

GetNumeralAlignment(DependencyObject)

Returns the value of the NumeralAlignment attached property for a specified dependency object.

GetNumeralStyle(DependencyObject)

Returns the value of the NumeralStyle attached property for a specified dependency object.

GetSlashedZero(DependencyObject)

Returns the value of the SlashedZero attached property for a specified dependency object.

GetStandardLigatures(DependencyObject)

Returns the value of the StandardLigatures attached property for a specified dependency object.

GetStandardSwashes(DependencyObject)

Returns the value of the StandardSwashes attached property for a specified dependency object.

GetStylisticAlternates(DependencyObject)

Returns the value of the StylisticAlternates attached property for a specified dependency object.

GetStylisticSet1(DependencyObject)

Returns the value of the StylisticSet1 attached property for a specified dependency object.

GetStylisticSet10(DependencyObject)

Returns the value of the StylisticSet10 attached property for a specified dependency object.

GetStylisticSet11(DependencyObject)

Returns the value of the StylisticSet11 attached property for a specified dependency object.

GetStylisticSet12(DependencyObject)

Returns the value of the StylisticSet12 attached property for a specified dependency object.

GetStylisticSet13(DependencyObject)

Returns the value of the StylisticSet13 attached property for a specified dependency object.

GetStylisticSet14(DependencyObject)

Returns the value of the StylisticSet14 attached property for a specified dependency object.

GetStylisticSet15(DependencyObject)

Returns the value of the StylisticSet15 attached property for a specified dependency object.

GetStylisticSet16(DependencyObject)

Returns the value of the StylisticSet16 attached property for a specified dependency object.

GetStylisticSet17(DependencyObject)

Returns the value of the StylisticSet17 attached property for a specified dependency object.

GetStylisticSet18(DependencyObject)

Returns the value of the StylisticSet18 attached property for a specified dependency object.

GetStylisticSet19(DependencyObject)

Returns the value of the StylisticSet19 attached property for a specified dependency object.

GetStylisticSet2(DependencyObject)

Returns the value of the StylisticSet2 attached property for a specified dependency object.

GetStylisticSet20(DependencyObject)

Returns the value of the StylisticSet20 attached property for a specified dependency object.

GetStylisticSet3(DependencyObject)

Returns the value of the StylisticSet3 attached property for a specified dependency object.

GetStylisticSet4(DependencyObject)

Returns the value of the StylisticSet4 attached property for a specified dependency object.

GetStylisticSet5(DependencyObject)

Returns the value of the StylisticSet5 attached property for a specified dependency object.

GetStylisticSet6(DependencyObject)

Returns the value of the StylisticSet6 attached property for a specified dependency object.

GetStylisticSet7(DependencyObject)

Returns the value of the StylisticSet7 attached property for a specified dependency object.

GetStylisticSet8(DependencyObject)

Returns the value of the StylisticSet8 attached property for a specified dependency object.

GetStylisticSet9(DependencyObject)

Returns the value of the StylisticSet8 attached property for a specified dependency object.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetVariants(DependencyObject)

Returns the value of the Variants attached property for a specified dependency object.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetAnnotationAlternates(DependencyObject, Int32)

Sets the value of the AnnotationAlternates attached property for a specified dependency object.

SetCapitals(DependencyObject, FontCapitals)

Sets the value of the Capitals attached property for a specified dependency object.

SetCapitalSpacing(DependencyObject, Boolean)

Sets the value of the CapitalSpacing attached property for a specified dependency object.

SetCaseSensitiveForms(DependencyObject, Boolean)

Sets the value of the CaseSensitiveForms attached property for a specified dependency object.

SetContextualAlternates(DependencyObject, Boolean)

Sets the value of the ContextualAlternates attached property for a specified dependency object.

SetContextualLigatures(DependencyObject, Boolean)

Sets the value of the ContextualLigatures attached property for a specified dependency object.

SetContextualSwashes(DependencyObject, Int32)

Sets the value of the ContextualSwashes attached property for a specified dependency object.

SetDiscretionaryLigatures(DependencyObject, Boolean)

Sets the value of the DiscretionaryLigatures attached property for a specified dependency object.

SetEastAsianExpertForms(DependencyObject, Boolean)

Sets the value of the EastAsianExpertForms attached property for a specified dependency object.

SetEastAsianLanguage(DependencyObject, FontEastAsianLanguage)

Sets the value of the EastAsianLanguage attached property for a specified dependency object.

SetEastAsianWidths(DependencyObject, FontEastAsianWidths)

Sets the value of the EastAsianWidths attached property for a specified dependency object.

SetFraction(DependencyObject, FontFraction)

Sets the value of the Fraction attached property for a specified dependency object.

SetHistoricalForms(DependencyObject, Boolean)

Sets the value of the HistoricalForms attached property for a specified dependency object.

SetHistoricalLigatures(DependencyObject, Boolean)

Sets the value of the HistoricalLigatures attached property for a specified dependency object.

SetKerning(DependencyObject, Boolean)

Sets the value of the Kerning attached property for a specified dependency object.

SetMathematicalGreek(DependencyObject, Boolean)

Sets the value of the MathematicalGreek attached property for a specified dependency object.

SetNumeralAlignment(DependencyObject, FontNumeralAlignment)

Sets the value of the NumeralAlignment attached property for a specified dependency object.

SetNumeralStyle(DependencyObject, FontNumeralStyle)

Sets the value of the NumeralStyle attached property for a specified dependency object.

SetSlashedZero(DependencyObject, Boolean)

Sets the value of the SlashedZero attached property for a specified dependency object.

SetStandardLigatures(DependencyObject, Boolean)

Sets the value of the StandardLigatures attached property for a specified dependency object.

SetStandardSwashes(DependencyObject, Int32)

Sets the value of the StandardSwashes attached property for a specified dependency object.

SetStylisticAlternates(DependencyObject, Int32)

Sets the value of the StylisticAlternates attached property for a specified dependency object.

SetStylisticSet1(DependencyObject, Boolean)

Sets the value of the StylisticSet1 attached property for a specified dependency object.

SetStylisticSet10(DependencyObject, Boolean)

Sets the value of the StylisticSet10 attached property for a specified dependency object.

SetStylisticSet11(DependencyObject, Boolean)

Sets the value of the StylisticSet11 attached property for a specified dependency object.

SetStylisticSet12(DependencyObject, Boolean)

Sets the value of the StylisticSet12 attached property for a specified dependency object.

SetStylisticSet13(DependencyObject, Boolean)

Sets the value of the StylisticSet13 attached property for a specified dependency object.

SetStylisticSet14(DependencyObject, Boolean)

Sets the value of the StylisticSet14 attached property for a specified dependency object.

SetStylisticSet15(DependencyObject, Boolean)

Sets the value of the StylisticSet15 attached property for a specified dependency object.

SetStylisticSet16(DependencyObject, Boolean)

Sets the value of the StylisticSet16 attached property for a specified dependency object.

SetStylisticSet17(DependencyObject, Boolean)

Sets the value of the StylisticSet17 attached property for a specified dependency object.

SetStylisticSet18(DependencyObject, Boolean)

Sets the value of the StylisticSet18 attached property for a specified dependency object.

SetStylisticSet19(DependencyObject, Boolean)

Sets the value of the StylisticSet19 attached property for a specified dependency object.

SetStylisticSet2(DependencyObject, Boolean)

Sets the value of the StylisticSet2 attached property for a specified dependency object.

SetStylisticSet20(DependencyObject, Boolean)

Sets the value of the StylisticSet20 attached property for a specified dependency object.

SetStylisticSet3(DependencyObject, Boolean)

Sets the value of the StylisticSet3 attached property for a specified dependency object.

SetStylisticSet4(DependencyObject, Boolean)

Sets the value of the StylisticSet4 attached property for a specified dependency object.

SetStylisticSet5(DependencyObject, Boolean)

Sets the value of the StylisticSet5 attached property for a specified dependency object.

SetStylisticSet6(DependencyObject, Boolean)

Sets the value of the StylisticSet6 attached property for a specified dependency object.

SetStylisticSet7(DependencyObject, Boolean)

Sets the value of the StylisticSet7 attached property for a specified dependency object.

SetStylisticSet8(DependencyObject, Boolean)

Sets the value of the StylisticSet8 attached property for a specified dependency object.

SetStylisticSet9(DependencyObject, Boolean)

Sets the value of the StylisticSet9 attached property for a specified dependency object.

SetVariants(DependencyObject, FontVariants)

Sets the value of the Variants attached property for a specified dependency object.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to