Class SystemFonts
Provides a collection of fonts.
public static class SystemFonts
- Inheritance
-
SystemFonts
- Inherited Members
Properties
Collection
Gets the collection containing the globally installed system fonts.
public static IReadOnlySystemFontCollection Collection { get; }
Property Value
Families
Gets the collection of FontFamilys installed on current system.
public static IEnumerable<FontFamily> Families { get; }
Property Value
Methods
CreateFont(string, CultureInfo, float)
Create a new instance of the Font for the named font family with regular styling.
public static Font CreateFont(string name, CultureInfo culture, float size)
Parameters
namestringThe font family name.
cultureCultureInfoThe font culture.
sizefloatThe size of the font in PT units.
Returns
CreateFont(string, CultureInfo, float, FontStyle)
Create a new instance of the Font for the named font family.
public static Font CreateFont(string name, CultureInfo culture, float size, FontStyle style)
Parameters
namestringThe font family name.
cultureCultureInfoThe font culture.
sizefloatThe size of the font in PT units.
styleFontStyleThe font style.
Returns
CreateFont(string, float)
Create a new instance of the Font for the named font family with regular styling.
public static Font CreateFont(string name, float size)
Parameters
Returns
CreateFont(string, float, FontStyle)
Create a new instance of the Font for the named font family.
public static Font CreateFont(string name, float size, FontStyle style)
Parameters
namestringThe font family name.
sizefloatThe size of the font in PT units.
styleFontStyleThe font style.
Returns
Get(string)
Gets the specified font family matching the invariant culture and font family name.
public static FontFamily Get(string name)
Parameters
namestringThe font family name.
Returns
- FontFamily
The first FontFamily matching the given name.
Exceptions
- ArgumentNullException
nameis null- FontFamilyNotFoundException
The collection contains no matches.
GetByCulture(CultureInfo)
Gets the collection of FontFamily in this FontCollection using the given culture.
public static IEnumerable<FontFamily> GetByCulture(CultureInfo culture)
Parameters
cultureCultureInfoThe culture of the families to return.
Returns
GetByCulture(string, CultureInfo)
Gets the specified font family matching the given culture and font family name.
public static FontFamily GetByCulture(string fontFamily, CultureInfo culture)
Parameters
fontFamilystringcultureCultureInfoThe culture to use when searching for a match.
Returns
- FontFamily
The first FontFamily matching the given name.
Exceptions
- ArgumentNullException
nameis null- FontFamilyNotFoundException
The collection contains no matches.
TryGet(string, out FontFamily)
Gets the specified font family matching the invariant culture and font family name.
public static bool TryGet(string fontFamily, out FontFamily family)
Parameters
fontFamilystringfamilyFontFamilyWhen this method returns, contains the family associated with the specified name, if the name is found; otherwise, the default value for the type of the family parameter. This parameter is passed uninitialized.
Returns
- bool
true if the IReadOnlyFontCollection contains a family with the specified name; otherwise, false.
Exceptions
- ArgumentNullException
nameis null
TryGetByCulture(string, CultureInfo, out FontFamily)
Gets the specified font family matching the given culture and font family name.
public static bool TryGetByCulture(string fontFamily, CultureInfo culture, out FontFamily family)
Parameters
fontFamilystringcultureCultureInfoThe culture to use when searching for a match.
familyFontFamilyWhen this method returns, contains the family associated with the specified name, if the name is found; otherwise, the default value for the type of the family parameter. This parameter is passed uninitialized.
Returns
- bool
true if the IReadOnlyFontCollection contains a family with the specified name; otherwise, false.
Exceptions
- ArgumentNullException
nameis null