This documentation is archived and is not being maintained.

Typeface.Typeface(FontFamily, FontStyle, FontWeight, FontStretch) Constructor

Initializes a new instance of the Typeface class for the specified font family name, Style, Weight, and Stretch values.

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

public Typeface (
	FontFamily fontFamily,
	FontStyle style,
	FontWeight weight,
	FontStretch stretch
)
public Typeface (
	FontFamily fontFamily, 
	FontStyle style, 
	FontWeight weight, 
	FontStretch stretch
)
public function Typeface (
	fontFamily : FontFamily, 
	style : FontStyle, 
	weight : FontWeight, 
	stretch : FontStretch
)
You cannot use constructors in XAML.

Parameters

fontFamily

The font family of the typeface.

style

The style of the typeface.

weight

The relative weight of the typeface.

stretch

The degree to which the typeface is stretched.

// 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"));

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: