This documentation is archived and is not being maintained.

Typeface Class

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


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

Public Class Typeface

The Typeface type exposes the following members.

Public methodTypeface(String)Initializes a new instance of the Typeface class for the specified font family typeface name.
Public methodTypeface(FontFamily, FontStyle, FontWeight, FontStretch)Initializes a new instance of the Typeface class for the specified font family name, Style, Weight, and Stretch values.
Public methodTypeface(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.

Public propertyCapsHeightGets the distance from the baseline to the top of an English capital letter for the typeface.
Public propertyFaceNamesGets a collection of culture-specific names for the Typeface.
Public propertyFontFamilyGets the name of the font family from which the typeface was constructed.
Public propertyIsBoldSimulatedDetermines whether to simulate a bold weight for the glyphs represented by the Typeface.
Public propertyIsObliqueSimulatedDetermines whether to simulate an italic style for the glyphs represented by the Typeface.
Public propertyStretchGets the stretch value for the Typeface. The stretch value determines whether a typeface is expanded or condensed when it is displayed.
Public propertyStrikethroughPositionGets a value that indicates the distance from the baseline to the strikethrough for the typeface.
Public propertyStrikethroughThicknessGets a value that indicates the thickness of the strikethrough relative to the font em size.
Public propertyStyleGets the style of the Typeface.
Public propertyUnderlinePositionGets a value that indicates the distance of the underline from the baseline for the typeface.
Public propertyUnderlineThicknessGets a value that indicates the thickness of the underline relative to the font em size for the typeface.
Public propertyWeightGets the relative weight of the typeface.
Public propertyXHeightGets the distance from the baseline to the top of an English lowercase letter for a typeface. The distance excludes ascenders.

Public methodEqualsGets 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).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes 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.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTryGetGlyphTypefaceRetrieves 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.
			Dim typefaces As System.Collections.Generic.ICollection(Of Typeface) = Fonts.GetTypefaces("file:///C:\Windows\Fonts\#Georgia")

			' Enumerate the typefaces in the collection.
			For Each face As Typeface In typefaces
				' Separate the URI directory source info from the font family name.
				Dim familyName() As String = face.FontFamily.Source.Split("#"c)

				' Add the font family name, weight, and style values to the typeface combo box.
                comboBoxTypeface.Items.Add(familyName(familyName.Length - 1) & " " & face.Weight.ToString & " " & face.Style.ToString)
			Next face

			comboBoxTypeface.SelectedIndex = 0

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

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