Class FontCollection
Represents a collection of font families.
public sealed class FontCollection : IFontCollection, IReadOnlyFontCollection
- Inheritance
-
FontCollection
- Implements
- Inherited Members
- Extension Methods
Constructors
FontCollection()
Initializes a new instance of the FontCollection class.
public FontCollection()
Properties
Families
Gets the collection of FontFamily in this IReadOnlyFontCollection using the invariant culture.
public IEnumerable<FontFamily> Families { get; }
Property Value
Methods
Add(Stream)
Adds a font to the collection.
public FontFamily Add(Stream stream)
Parameters
streamStreamThe font stream.
Returns
- FontFamily
The new FontFamily.
Add(Stream, out FontDescription)
Adds a font to the collection.
public FontFamily Add(Stream stream, out FontDescription description)
Parameters
streamStreamThe font stream.
descriptionFontDescriptionThe description of the added font.
Returns
- FontFamily
The new FontFamily.
Add(string)
Adds a font to the collection.
public FontFamily Add(string path)
Parameters
pathstringThe filesystem path to the font file.
Returns
- FontFamily
The new FontFamily.
Add(string, out FontDescription)
Adds a font to the collection.
public FontFamily Add(string path, out FontDescription description)
Parameters
pathstringThe filesystem path to the font file.
descriptionFontDescriptionThe description of the added font.
Returns
- FontFamily
The new FontFamily.
AddCollection(Stream)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream)
Parameters
streamStreamThe font stream.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(Stream, CultureInfo)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream, CultureInfo culture)
Parameters
streamStreamThe font stream.
cultureCultureInfoThe culture of the fonts to add.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(Stream, CultureInfo, out ReadOnlyMemory<FontDescription>)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream, CultureInfo culture, out ReadOnlyMemory<FontDescription> descriptions)
Parameters
streamStreamThe font stream.
cultureCultureInfoThe culture of the fonts to add.
descriptionsReadOnlyMemory<FontDescription>The descriptions of the added fonts.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(Stream, out ReadOnlyMemory<FontDescription>)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(Stream stream, out ReadOnlyMemory<FontDescription> descriptions)
Parameters
streamStreamThe font stream.
descriptionsReadOnlyMemory<FontDescription>The descriptions of the added fonts.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(string)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(string path)
Parameters
pathstringThe font collection path.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(string, CultureInfo)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(string path, CultureInfo culture)
Parameters
pathstringThe font collection path.
cultureCultureInfoThe culture of the fonts to add.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(string, CultureInfo, out ReadOnlyMemory<FontDescription>)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(string path, CultureInfo culture, out ReadOnlyMemory<FontDescription> descriptions)
Parameters
pathstringThe font collection path.
cultureCultureInfoThe culture of the fonts to add.
descriptionsReadOnlyMemory<FontDescription>The descriptions of the added fonts.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddCollection(string, out ReadOnlyMemory<FontDescription>)
Adds a true type font collection (.ttc).
public ReadOnlyMemory<FontFamily> AddCollection(string path, out ReadOnlyMemory<FontDescription> descriptions)
Parameters
pathstringThe font collection path.
descriptionsReadOnlyMemory<FontDescription>The descriptions of the added fonts.
Returns
- ReadOnlyMemory<FontFamily>
A read-only memory region containing the new FontFamily values.
AddWithCulture(Stream, CultureInfo)
Adds a font to the collection.
public FontFamily AddWithCulture(Stream stream, CultureInfo culture)
Parameters
streamStreamThe font stream.
cultureCultureInfoThe culture of the font to add.
Returns
- FontFamily
The new FontFamily.
AddWithCulture(Stream, CultureInfo, out FontDescription)
Adds a font to the collection.
public FontFamily AddWithCulture(Stream stream, CultureInfo culture, out FontDescription description)
Parameters
streamStreamThe font stream.
cultureCultureInfoThe culture of the font to add.
descriptionFontDescriptionThe description of the added font.
Returns
- FontFamily
The new FontFamily.
AddWithCulture(string, CultureInfo)
Adds a font to the collection.
public FontFamily AddWithCulture(string path, CultureInfo culture)
Parameters
pathstringThe filesystem path to the font file.
cultureCultureInfoThe culture of the font to add.
Returns
- FontFamily
The new FontFamily.
AddWithCulture(string, CultureInfo, out FontDescription)
Adds a font to the collection.
public FontFamily AddWithCulture(string path, CultureInfo culture, out FontDescription description)
Parameters
pathstringThe filesystem path to the font file.
cultureCultureInfoThe culture of the font to add.
descriptionFontDescriptionThe description of the added font.
Returns
- FontFamily
The new FontFamily.
Get(string)
Gets the specified font family matching the invariant culture and font family name.
public 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 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 FontFamily GetByCulture(string name, CultureInfo culture)
Parameters
namestringThe font family name.
cultureCultureInfoThe 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 bool TryGet(string name, out FontFamily family)
Parameters
namestringThe font family name.
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
TryGetByCulture(string, CultureInfo, out FontFamily)
Gets the specified font family matching the given culture and font family name.
public bool TryGetByCulture(string name, CultureInfo culture, out FontFamily family)
Parameters
namestringThe font family name.
cultureCultureInfoThe 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