Typeface 类

定义

表示 、FontFamilyFontWeightFontStyleFontStretch的组合。

public ref class Typeface
public class Typeface
type Typeface = class
Public Class Typeface
继承
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;
' 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

注解

字样是同一字体系列中字体的单个变体。 字样的示例是“时代新罗马”字体系列的斜体版本。 字样定义字体的粗细、样式和拉伸功能。

构造函数

名称 说明
Typeface(FontFamily, FontStyle, FontWeight, FontStretch, FontFamily)

为指定的字体系列名称、StyleWeight值和Stretch值初始化类的新实例Typeface。 此外,还指定了回退字体系列。

Typeface(FontFamily, FontStyle, FontWeight, FontStretch)

为指定的字体系列名称、StyleWeight值和Stretch值初始化类的新实例Typeface

Typeface(String)

为指定的字体系列字样名称初始化类的新实例 Typeface

属性

名称 说明
CapsHeight

获取字样从基线到英文大写字母顶部的距离。

FaceNames

获取特定于区域性的名称的 Typeface集合。

FontFamily

获取从中构造字形的字体系列的名称。

IsBoldSimulated

确定是否模拟由 <a0/> 表示的字形的粗体粗细。

IsObliqueSimulated

确定是否模拟由该标志符号表示的 Typeface斜体样式。

Stretch

获取 . 的 Typeface拉伸值。 拉伸值确定在显示字样时是展开还是压缩。

StrikethroughPosition

获取一个值,该值指示从基线到字面删除线之间的距离。

StrikethroughThickness

获取一个值,该值指示相对于字体 em 大小的删除线粗细。

Style

获取 . 的 Typeface样式。

UnderlinePosition

获取一个值,该值指示下划线与字面基线之间的距离。

UnderlineThickness

获取一个值,该值指示下划线相对于字形的字体 em 大小的粗细。

Weight

获取字形的相对权重。

XHeight

获取字样从基线到英文小写字母顶部的距离。 距离不包括升序。

方法

名称 说明
Equals(Object)

获取一个值,该值指示当前字样和指定的字样是否具有相同 FontFamily的字体、 StyleWeightStretch回退字体值。

GetHashCode()

用作 . 的 Typeface哈希函数。 它适用于哈希算法和数据结构,如哈希表。

GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)
TryGetGlyphTypeface(GlyphTypeface)

GlyphTypeface检索与 .Typeface.

适用于