- FontFamily Class
- Inheritance Hierarchy
- Syntax
- XAML Values
- Constructors
- Properties
- Methods
- Remarks
- Default Font Set
- Portable User Interface
- Commas in Font Family Names
- Using Other Font Families
- Non-System Font Files Must Come From Assembly Resources
- XAML Syntax Notes
- FontSource
- Fonts. Get Font Families Метод
- Определение
- Перегрузки
- GetFontFamilies(String)
- Параметры
- Возвращаемое значение
- Исключения
- Примеры
- Применяется к
- GetFontFamilies(Uri)
- Параметры
- Возвращаемое значение
- Примеры
- Применяется к
- GetFontFamilies(Uri, String)
- Параметры
- Возвращаемое значение
- Примеры
FontFamily Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents a family of related fonts.
Inheritance Hierarchy
System.Object
В В System.Windows.Media.FontFamily
Namespace: В System.Windows.Media
Assembly: В System.Windows (in System.Windows.dll)
Syntax
XAML Values
fontFamilyName
A string that names the primary font.
fallbackFontFamilyName
Following the fontFamilyName and a comma, a string that names an optional fallback font. More than one fallback can be specified, each fallback separated by more commas. See Remarks.
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.
The FontFamily type exposes the following members.
Constructors
В | Name | Description |
---|---|---|
FontFamily | Initializes a new instance of the FontFamily class from the specified font family string. |
Properties
В | Name | Description |
---|---|---|
Source | Gets the font family name that is used to construct the FontFamily object. |
Methods
В | Name | Description |
---|---|---|
Equals | Gets a value that indicates whether the current font family object and the specified font family object are the same. (Overrides Object.Equals(Object).) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for FontFamily. (Overrides Object.GetHashCode().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string representation of this FontFamily. (Overrides Object.ToString().) |
Remarks
A font family is a set of typefaces that share the same family name, such as «Times New Roman», but that differ in features. These font family feature differences typically include font style, such as italic, and font weight, such as bold.
Default Font Set
Silverlight supports a list of font family values that are supported in the initial, default Silverlight font set for non-East Asian cultures. This list is documented in the topic Text and Fonts.В
For a list of the East Asian fonts, see Text and Fonts.
Portable User Interface
The default value for a referenced FontFamily is initialized with the value Portable User Interface. For non-East Asian cultures, this value is an alias for the font family value (shown here as a string) of «Lucida Sans Unicode, Lucida Grande». Lucida Grande and Lucida Sans Unicode in turn are aliases for the same font and are specified as a pair for compatibility reasons.
Note that the Portable User Interface value is not always the apparent default value when a given object is referenced at run time, even if your user code made no changes to the value. Controls, even the default Silverlight controls, will generally apply a template that defines their appearance. These templates frequently change the values of properties such as Control.FontFamily to be different than the pure code default value. The templates also might be written differently for different locales. Also, your own application might apply different templates or styles to a control.
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.
Commas in Font Family Names
You can specify a font family either as a single font family name, or as a series of font family names that describe a fallback sequence. The separator between fallbacks (both for XAML, and for the string used to construct a FontFamily in code) is a comma. To avoid ambiguity, if a supplied font family name contains a comma in its internal value, then each single comma in the supplied font family name must be replaced with a double comma (,,).
Using Other Font Families
If you specify a font family that is not typically present on a user’s system, you may have to redistribute the font. Restrictions apply when specifying a font file or a zip containing font files.