Typeface Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a combination of FontFamily, FontWeight, FontStyle, and FontStretch.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

System.Object
  System.Windows.Media.Typeface

public class Typeface

NameDescription
System_CAPS_pubmethodTypeface(FontFamily, FontStyle, FontWeight, FontStretch)

Initializes a new instance of the Typeface class for the specified font family name, Style, Weight, and Stretch values.

System_CAPS_pubmethodTypeface(FontFamily, FontStyle, FontWeight, FontStretch, FontFamily)

Initializes a new instance of the Typeface class for the specified font family name, Style, Weight, and Stretch values. In addition, a fallback font family is specified.

System_CAPS_pubmethodTypeface(String)

Initializes a new instance of the Typeface class for the specified font family typeface name.

NameDescription
System_CAPS_pubpropertyCapsHeight

Gets the distance from the baseline to the top of an English capital letter for the typeface.

System_CAPS_pubpropertyFaceNames

Gets a collection of culture-specific names for the Typeface.

System_CAPS_pubpropertyFontFamily

Gets the name of the font family from which the typeface was constructed.

System_CAPS_pubpropertyIsBoldSimulated

Determines whether to simulate a bold weight for the glyphs represented by the Typeface.

System_CAPS_pubpropertyIsObliqueSimulated

Determines whether to simulate an italic style for the glyphs represented by the Typeface.

System_CAPS_pubpropertyStretch

Gets the stretch value for the Typeface. The stretch value determines whether a typeface is expanded or condensed when it is displayed.

System_CAPS_pubpropertyStrikethroughPosition

Gets a value that indicates the distance from the baseline to the strikethrough for the typeface.

System_CAPS_pubpropertyStrikethroughThickness

Gets a value that indicates the thickness of the strikethrough relative to the font em size.

System_CAPS_pubpropertyStyle

Gets the style of the Typeface.

System_CAPS_pubpropertyUnderlinePosition

Gets a value that indicates the distance of the underline from the baseline for the typeface.

System_CAPS_pubpropertyUnderlineThickness

Gets a value that indicates the thickness of the underline relative to the font em size for the typeface.

System_CAPS_pubpropertyWeight

Gets the relative weight of the typeface.

System_CAPS_pubpropertyXHeight

Gets the distance from the baseline to the top of an English lowercase letter for a typeface. The distance excludes ascenders.

NameDescription
System_CAPS_pubmethodEquals(Object)

Gets a value that indicates whether the current typeface and the specified typeface have the same FontFamily, Style, Weight, Stretch, and fallback font values. (Overrides Object.Equals(Object).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as a hash function for Typeface. It is suitable for use in hashing algorithms and data structures such as a hash table.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTryGetGlyphTypeface(GlyphTypeface)

Retrieves the GlyphTypeface that corresponds to the Typeface.

A typeface is a single variation of a font within the same font family. An example of a typeface is an italic version of the "Times New Roman" font family. Typeface defines the weight, style and stretching features of a font.

// Return the typeface collection for the fonts in the selected URI location.
System.Collections.Generic.ICollection<Typeface> typefaces = Fonts.GetTypefaces("file:///C:\\Windows\\Fonts\\#Georgia");

// Enumerate the typefaces in the collection.
foreach (Typeface face in typefaces)
{
    // Separate the URI directory source info from the font family name.
    string[] familyName = face.FontFamily.Source.Split('#');

    // Add the font family name, weight, and style values to the typeface combo box.
    comboBoxTypeface.Items.Add(familyName[familyName.Length - 1] + " " + face.Weight + " " + face.Style);
}

comboBoxTypeface.SelectedIndex = 0;

.NET Framework
Available since 3.0
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 7.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: