Class SystemFonts
Provides a collection of fonts.
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public static class SystemFonts
Properties
| Improve this Doc View SourceCollection
Gets the collection containing the globaly installled system fonts.
Declaration
public static IReadOnlyFontCollection Collection { get; }
Property Value
Type | Description |
---|---|
IReadOnlyFontCollection | The system fonts. |
Families
Gets the collection of FontFamilys installed on current system.
Declaration
public static IEnumerable<FontFamily> Families { get; }
Property Value
Type | Description |
---|---|
IEnumerable<FontFamily> | The families. |
Methods
| Improve this Doc View SourceCreateFont(String, Single)
Create a new instance of the Font for the named font family with regular styling.
Declaration
public static Font CreateFont(string fontFamily, float size)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The family. |
Single | size | The size. |
Returns
Type | Description |
---|---|
Font | Returns instance of the Font from the current collection. |
CreateFont(String, Single, FontStyle)
Create a new instance of the Font for the named font family.
Declaration
public static Font CreateFont(string fontFamily, float size, FontStyle style)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The family. |
Single | size | The size. |
FontStyle | style | The style. |
Returns
Type | Description |
---|---|
Font | Returns instance of the Font from the current collection. |
FamiliesByCulture(CultureInfo)
Gets the collection of FontFamily objects associated with this FontCollection in the current threads culture.
Declaration
public static IEnumerable<FontFamily> FamiliesByCulture(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | The culture to find the list of font familes for. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The set of fonts families using the fonts culture aware font name |
Find(String)
Finds the specified font family from the system font store.
Declaration
public static FontFamily Find(string fontFamily)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family. |
Returns
Type | Description |
---|---|
FontFamily | The found family. |
Exceptions
Type | Condition |
---|---|
FontFamilyNotFoundException | Thrown when the font family is not found. |
Find(String, CultureInfo)
Finds the specified font family.
Declaration
public static FontFamily Find(string fontFamily, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family. |
CultureInfo | culture | The culture to find the font from of font family for. |
Returns
Type | Description |
---|---|
FontFamily | The family if installed otherwise throws FontFamilyNotFoundException |
TryFind(String, out FontFamily)
Finds the specified font family from the system font store.
Declaration
public static bool TryFind(string fontFamily, out FontFamily family)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family to find. |
FontFamily | family | The found family. |
Returns
Type | Description |
---|---|
Boolean | True if a font of that family has been installed into the font collection. |
TryFind(String, CultureInfo, out FontFamily)
Finds the specified font family.
Declaration
public static bool TryFind(string fontFamily, CultureInfo culture, out FontFamily family)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family to find. |
CultureInfo | culture | The culture to find the font from of font family for. |
FontFamily | family | The found family. |
Returns
Type | Description |
---|---|
Boolean | true if a font of that family has been installed into the font collection. |