Class FontCollection
Provides a collection of fonts.
Inherited Members
Namespace: SixLabors.Fonts
Assembly: SixLabors.Fonts.dll
Syntax
public sealed class FontCollection : IFontCollection, IReadOnlyFontCollection
Constructors
| Improve this Doc View SourceFontCollection()
Initializes a new instance of the FontCollection class.
Declaration
public FontCollection()
Properties
| Improve this Doc View SourceFamilies
Gets the collection of FontFamily objects associated with this FontCollection in the invariant culture.
Declaration
public IEnumerable<FontFamily> Families { get; }
Property Value
Type | Description |
---|---|
IEnumerable<FontFamily> | The families. |
Methods
| Improve this Doc View SourceFamiliesByCulture(CultureInfo)
Gets the collection of FontFamily objects associated with this FontCollection.
Declaration
public IEnumerable<FontFamily> FamiliesByCulture(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | The culture to use while getting the family name from the installed set of fonts. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The set of fonts families using the fonts culture aware font name |
Find(String)
Finds the specified font family using the invariant culture font family name.
Declaration
public FontFamily Find(string fontFamily)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family. |
Returns
Type | Description |
---|---|
FontFamily | The family if installed otherwise throws FontFamilyNotFoundException |
Find(String, CultureInfo)
Finds the specified font family.
Declaration
public FontFamily Find(string fontFamily, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | fontFamily | The font family. |
CultureInfo | culture | The culture to use while getting the family name from the installed set of fonts. |
Returns
Type | Description |
---|---|
FontFamily | The family if installed otherwise throws FontFamilyNotFoundException |
Install(Stream)
Installs the specified font stream.
Declaration
public FontFamily Install(Stream fontStream)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontStream | The font stream. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(Stream, out FontDescription)
Installs the specified font stream.
Declaration
public FontFamily Install(Stream fontStream, out FontDescription fontDescription)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontStream | The font stream. |
FontDescription | fontDescription | The font description of the installed font. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(Stream, CultureInfo)
Installs the specified font stream.
Declaration
public FontFamily Install(Stream fontStream, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontStream | The font stream. |
CultureInfo | culture | The culture of the retuend font family |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(Stream, CultureInfo, out FontDescription)
Installs the specified font stream.
Declaration
public FontFamily Install(Stream fontStream, CultureInfo culture, out FontDescription fontDescription)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontStream | The font stream. |
CultureInfo | culture | The culture of the retuend font family |
FontDescription | fontDescription | The font description of the installed font. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(String)
Installs a font from the specified path.
Declaration
public FontFamily Install(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(String, out FontDescription)
Installs a font from the specified path.
Declaration
public FontFamily Install(string path, out FontDescription fontDescription)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path. |
FontDescription | fontDescription | The font description of the installed font. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(String, CultureInfo)
Installs a font from the specified path.
Declaration
public FontFamily Install(string path, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path. |
CultureInfo | culture | The culture of the retuend font family |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
Install(String, CultureInfo, out FontDescription)
Installs a font from the specified path.
Declaration
public FontFamily Install(string path, CultureInfo culture, out FontDescription fontDescription)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path. |
CultureInfo | culture | The culture of the retuend font family |
FontDescription | fontDescription | The font description of the installed font. |
Returns
Type | Description |
---|---|
FontFamily | the description of the font just loaded. |
InstallCollection(Stream, out IEnumerable<FontDescription>)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(Stream fontCollectionStream, out IEnumerable<FontDescription> fontDescriptions)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontCollectionStream | The font stream. |
IEnumerable<FontDescription> | fontDescriptions | The descriptions of fonts installed from the collection. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
InstallCollection(Stream, CultureInfo, out IEnumerable<FontDescription>)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(Stream fontCollectionStream, CultureInfo culture, out IEnumerable<FontDescription> fontDescriptions)
Parameters
Type | Name | Description |
---|---|---|
Stream | fontCollectionStream | The font stream. |
CultureInfo | culture | The culture of the retuend font families |
IEnumerable<FontDescription> | fontDescriptions | The descriptions of fonts installed from the collection. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
InstallCollection(String)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(string fontCollectionPath)
Parameters
Type | Name | Description |
---|---|---|
String | fontCollectionPath | The font collection path (should be typically a .ttc file like simsun.ttc). |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
InstallCollection(String, out IEnumerable<FontDescription>)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(string fontCollectionPath, out IEnumerable<FontDescription> fontDescriptions)
Parameters
Type | Name | Description |
---|---|---|
String | fontCollectionPath | The font collection path (should be typically a .ttc file like simsun.ttc). |
IEnumerable<FontDescription> | fontDescriptions | The descriptions of fonts installed from the collection. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
InstallCollection(String, CultureInfo)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(string fontCollectionPath, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | fontCollectionPath | The font collection path (should be typically a .ttc file like simsun.ttc). |
CultureInfo | culture | The culture of the retuend font families |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
InstallCollection(String, CultureInfo, out IEnumerable<FontDescription>)
Installs a true type font collection (.ttc) from the specified font collection stream.
Declaration
public IEnumerable<FontFamily> InstallCollection(string fontCollectionPath, CultureInfo culture, out IEnumerable<FontDescription> fontDescriptions)
Parameters
Type | Name | Description |
---|---|---|
String | fontCollectionPath | The font collection path (should be typically a .ttc file like simsun.ttc). |
CultureInfo | culture | The culture of the retuend font families |
IEnumerable<FontDescription> | fontDescriptions | The descriptions of fonts installed from the collection. |
Returns
Type | Description |
---|---|
IEnumerable<FontFamily> | The font descriptions of the installed fonts. |
TryFind(String, out FontFamily)
Finds the specified font family using the invariant culture font family name.
Declaration
public 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 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 use while getting the family name from the installed set of fonts. |
FontFamily | family | The found family. |
Returns
Type | Description |
---|---|
Boolean | true if a font of that family has been installed into the font collection. |