Typeface Class
.NET Framework 4
Represents a combination of FontFamily, FontWeight, FontStyle, and FontStretch.
Namespace:
System.Windows.Media
Assembly: PresentationCore (in PresentationCore.dll)
The Typeface type exposes the following members.
| Name | Description | |
|---|---|---|
|
Typeface(String) | Initializes a new instance of the Typeface class for the specified font family typeface name. |
|
Typeface(FontFamily, FontStyle, FontWeight, FontStretch) | Initializes a new instance of the Typeface class for the specified font family name, Style, Weight, and Stretch values. |
|
Typeface(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. |
| Name | Description | |
|---|---|---|
|
CapsHeight | Gets the distance from the baseline to the top of an English capital letter for the typeface. |
|
FaceNames | Gets a collection of culture-specific names for the Typeface. |
|
FontFamily | Gets the name of the font family from which the typeface was constructed. |
|
IsBoldSimulated | Determines whether to simulate a bold weight for the glyphs represented by the Typeface. |
|
IsObliqueSimulated | Determines whether to simulate an italic style for the glyphs represented by the Typeface. |
|
Stretch | Gets the stretch value for the Typeface. The stretch value determines whether a typeface is expanded or condensed when it is displayed. |
|
StrikethroughPosition | Gets a value that indicates the distance from the baseline to the strikethrough for the typeface. |
|
StrikethroughThickness | Gets a value that indicates the thickness of the strikethrough relative to the font em size. |
|
Style | Gets the style of the Typeface. |
|
UnderlinePosition | Gets a value that indicates the distance of the underline from the baseline for the typeface. |
|
UnderlineThickness | Gets a value that indicates the thickness of the underline relative to the font em size for the typeface. |
|
Weight | Gets the relative weight of the typeface. |
|
XHeight | Gets the distance from the baseline to the top of an English lowercase letter for a typeface. The distance excludes ascenders. |
| Name | Description | |
|---|---|---|
|
Equals | 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).) |
|
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
|
GetHashCode | 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().) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
ToString | Returns a string that represents the current object. (Inherited from Object.) |
|
TryGetGlyphTypeface | Retrieves the GlyphTypeface that corresponds to the Typeface. |
// 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;
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.