Typeface 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 Typeface 類別的新實例。
多載
Typeface(String) |
針對指定的字型系列字樣名稱,初始化 Typeface 類別的新實例。 |
Typeface(FontFamily, FontStyle, FontWeight, FontStretch) | |
Typeface(FontFamily, FontStyle, FontWeight, FontStretch, FontFamily) |
針對指定的字型系列名稱、Style、Weight和 Stretch 值,初始化 Typeface 類別的新實例。 此外,會指定後援字型系列。 |
Typeface(String)
針對指定的字型系列字樣名稱,初始化 Typeface 類別的新實例。
public:
Typeface(System::String ^ typefaceName);
public Typeface (string typefaceName);
new System.Windows.Media.Typeface : string -> System.Windows.Media.Typeface
Public Sub New (typefaceName As String)
參數
- typefaceName
- String
指定字型系列的類型名稱。
範例
// Return the typeface for the selected font family name.
Typeface typeface1 = new Typeface("Verdana");
// Return the typeface for the selected font family name and font values.
Typeface typeface2 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles Light"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed);
// Return the typeface for the selected font family name, font values, and fallback font family name.
Typeface typeface3 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed,
new FontFamily("Arial"));
' Return the typeface for the selected font family name.
Dim typeface1 As New Typeface("Verdana")
' Return the typeface for the selected font family name and font values.
Dim typeface2 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles Light"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed)
' Return the typeface for the selected font family name, font values, and fallback font family name.
Dim typeface3 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed, New FontFamily("Arial"))
適用於
Typeface(FontFamily, FontStyle, FontWeight, FontStretch)
public:
Typeface(System::Windows::Media::FontFamily ^ fontFamily, System::Windows::FontStyle style, System::Windows::FontWeight weight, System::Windows::FontStretch stretch);
public Typeface (System.Windows.Media.FontFamily fontFamily, System.Windows.FontStyle style, System.Windows.FontWeight weight, System.Windows.FontStretch stretch);
new System.Windows.Media.Typeface : System.Windows.Media.FontFamily * System.Windows.FontStyle * System.Windows.FontWeight * System.Windows.FontStretch -> System.Windows.Media.Typeface
Public Sub New (fontFamily As FontFamily, style As FontStyle, weight As FontWeight, stretch As FontStretch)
參數
- fontFamily
- FontFamily
字型的字型系列。
- style
- FontStyle
字樣樣式。
- weight
- FontWeight
字樣的相對粗細。
- stretch
- FontStretch
字樣延伸至的程度。
範例
// Return the typeface for the selected font family name.
Typeface typeface1 = new Typeface("Verdana");
// Return the typeface for the selected font family name and font values.
Typeface typeface2 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles Light"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed);
// Return the typeface for the selected font family name, font values, and fallback font family name.
Typeface typeface3 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed,
new FontFamily("Arial"));
' Return the typeface for the selected font family name.
Dim typeface1 As New Typeface("Verdana")
' Return the typeface for the selected font family name and font values.
Dim typeface2 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles Light"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed)
' Return the typeface for the selected font family name, font values, and fallback font family name.
Dim typeface3 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed, New FontFamily("Arial"))
適用於
Typeface(FontFamily, FontStyle, FontWeight, FontStretch, FontFamily)
public:
Typeface(System::Windows::Media::FontFamily ^ fontFamily, System::Windows::FontStyle style, System::Windows::FontWeight weight, System::Windows::FontStretch stretch, System::Windows::Media::FontFamily ^ fallbackFontFamily);
public Typeface (System.Windows.Media.FontFamily fontFamily, System.Windows.FontStyle style, System.Windows.FontWeight weight, System.Windows.FontStretch stretch, System.Windows.Media.FontFamily fallbackFontFamily);
new System.Windows.Media.Typeface : System.Windows.Media.FontFamily * System.Windows.FontStyle * System.Windows.FontWeight * System.Windows.FontStretch * System.Windows.Media.FontFamily -> System.Windows.Media.Typeface
Public Sub New (fontFamily As FontFamily, style As FontStyle, weight As FontWeight, stretch As FontStretch, fallbackFontFamily As FontFamily)
參數
- fontFamily
- FontFamily
字型的字型系列。
- style
- FontStyle
字樣樣式。
- weight
- FontWeight
字樣的相對粗細。
- stretch
- FontStretch
字樣延伸至的程度。
- fallbackFontFamily
- FontFamily
遇到主要字型系列(由 fontFamily
參數指定)無法顯示時所使用的字型系列。
範例
// Return the typeface for the selected font family name.
Typeface typeface1 = new Typeface("Verdana");
// Return the typeface for the selected font family name and font values.
Typeface typeface2 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles Light"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed);
// Return the typeface for the selected font family name, font values, and fallback font family name.
Typeface typeface3 = new Typeface(new FontFamily("file:///C:\\MyFonts\\#Pericles"),
FontStyles.Italic,
FontWeights.ExtraBold,
FontStretches.Condensed,
new FontFamily("Arial"));
' Return the typeface for the selected font family name.
Dim typeface1 As New Typeface("Verdana")
' Return the typeface for the selected font family name and font values.
Dim typeface2 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles Light"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed)
' Return the typeface for the selected font family name, font values, and fallback font family name.
Dim typeface3 As New Typeface(New FontFamily("file:///C:\MyFonts\#Pericles"), FontStyles.Italic, FontWeights.ExtraBold, FontStretches.Condensed, New FontFamily("Arial"))
備註
針對 fallbackFontFamily
參數傳遞 null
,會導致主要字型系列中未包含的字元顯示方塊字元。