編集

次の方法で共有


Typeface Class

Definition

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

public ref class Typeface
public class Typeface
type Typeface = class
Public Class Typeface
Inheritance
Typeface

Examples

// 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;
' 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

Remarks

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.

Constructors

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.

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

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

Properties

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.

Methods

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

GetHashCode()

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

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

Retrieves the GlyphTypeface that corresponds to the Typeface.

Applies to