Export (0) Print
Expand All

Typeface Class

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

System.Object
  System.Windows.Media.Typeface

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

public class Typeface

The Typeface type exposes the following members.

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

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

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

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

Supported in: 4.5.3, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft