語言

Typeface 類別

定義

代表 、 FontFamilyFontWeightFontStyle的組合FontStretch

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

備註

字體是同一字型家族中字型的單一變體。 字體的例子是「Times New Roman」字型家族的斜體版本。 字體定義字型的粗細、樣式及伸展特性。

建構函式

名稱 Description
Typeface(FontFamily, FontStyle, FontWeight, FontStretch, FontFamily)

初始化該類別的新實例 Typeface ,針對指定的字型族名稱、 StyleWeightStretch 值。 此外,還指定了備用字型家族。

Typeface(FontFamily, FontStyle, FontWeight, FontStretch)

初始化該類別的新實例 Typeface ,針對指定的字型族名稱、 StyleWeightStretch 值。

Typeface(String)

初始化指定字型家族字型名稱的新類別實例 Typeface

屬性

名稱 Description
CapsHeight

計算該字體從基線到英文大寫字母頂端的距離。

FaceNames

獲得一組文化特定的名稱。Typeface

FontFamily

取得該字體所用字型家族的名稱。

IsBoldSimulated

決定是否要為由 Typeface所代表的字形模擬粗體權重。

IsObliqueSimulated

決定是否要模擬斜體風格來表示的字形 Typeface

Stretch

得到 的拉伸值。Typeface 拉伸值決定字體在顯示時是展開還是壓縮。

StrikethroughPosition

會得到一個表示該字體從基準線到劃線距離的值。

StrikethroughThickness

會得到一個表示劃線厚度相對於字體大小的值。

Style

Typeface得 .

UnderlinePosition

會得到一個值,表示底線與該字體基線的距離。

UnderlineThickness

會得到一個值,表示底線相對於字體大小的粗細。

Weight

能取得字體的相對重量。

XHeight

計算字體從基線到英文小寫字母頂部的距離。 距離不包括上升器。

方法

名稱 Description
Equals(Object)

會取得一個值,表示目前字體與指定字體是否有相同的 FontFamilyStyleWeightStretch,以及備用字型值。

GetHashCode()

作為 的 Typeface雜湊函數。 它適合用於雜湊演算法和資料結構,例如雜湊表。

GetType()

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)
TryGetGlyphTypeface(GlyphTypeface)

GlyphTypeface 回對應於 的 Typeface

適用於