Export (0) Print
Expand All

FontFamily Constructor

Initializes a new instance of the FontFamily class from the specified font family string.

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

public FontFamily(
	string familyName
)

Parameters

familyName
Type: System.String
The family name or names that comprise the new FontFamily. See "Font Family Grammar" in Remarks.

Constructing a FontFamily in code uses a string for initialization, with a grammar that parallels how you define a FontFamily value in XAML.

Font Family Grammar

fontFamilyName[,fallbackFontFamilyName]*
-or-
[uri]fontFamilyName[,[uri]fallbackFontFamilyName]*

fontFamilyName

A string that names the primary font.

fallbackFontFamilyName

A string that names the fallback font. More than one fallback can be specified, each fallback separated by more commas. In this grammar, commas separate each font family string. To avoid ambiguity, if a fontFamilyName contains a comma (,) in its internal value then each single comma in the supplied fontFamilyName must be replaced with a double comma (,,).

uri

A URI that is evaluated either as a relative path in the assembly, or as a component; qualified assembly reference that starts the path from a specified assembly's root. See Remarks in FontFamily.

The default value for a referenced FontFamily is initialized with the value Portable User Interface. This value is an alias. For information about the Portable User Interface concept, and information about which font families are considered default system fonts for Silverlight for either Western or East Asian character sets, see Text and Fonts.

If you specify a FontFamily that does not exist, even if it is the only font family value available, Silverlight will still provide fallback to the Portable User Interface value for rendering purposes.

To restore the default behavior through XAML, set the attribute that requires a FontFamily value to the string Portable User Interface.

NoteNote:

   As with most types of software, font files are licensed, rather than sold, and licenses that govern the use of fonts vary from vendor to vendor. As a developer it is your responsibility to ensure that you have the required license rights for any font you embed within a document or application, or otherwise redistribute.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft