[]
Represents a collection of system fonts.
public class SystemFontCollection : ReadOnlyCollection<Font>, IList, ICollection, IReadOnlyList<Font>, IReadOnlyCollection<Font>, IFontCollection, IList<Font>, ICollection<Font>, IEnumerable<Font>, IEnumerable
Gets or sets the default system font.
If no system fonts were found, this value will be null. You can test for this condition at program startup, and assign a font to it if it is null.
public Font DefaultFont { get; set; }
Gets or sets a value indicating whether the automatic loading of system fonts is to be omitted in the static constructor of the FontCollection class.
The default is false, and the FontCollection's static constructor loads all fonts installed in the system. This is usually fast and does not consume significant resources, but sometimes may cause problems (e.g. if an installed font file is corrupt). In such cases set this property to true at program startup, before accessing any members of the FontCollection class.
public static bool NoSystemFonts { get; set; }
Appends one or more font family names to the internal list of fallback font families.
public void AppendFallbackFontFamilies(params string[] fontFamilyNames)
fontFamilyNames string[]Appends one or more fonts to the internal fallback font list.
public void AppendFallbackFonts(params Font[] fonts)
fonts Font[]Searches for a fallback font containing the given code point that looks similar to the source font.
public Font ChooseFallbackFont(int codePoint, Font baseFont, bool bold, bool italic, bool vertical = false, bool embeddable = false, bool allowEudc = false)
codePoint intThe code point (in UTF-32 format) missing in the source font.
baseFont FontThe source font to be replaced by a fallback font.
bold boolIndicates if the font should be embolded.
italic boolIndicates if the font should contain italic characters.
vertical boolIndicates if the font should be vertical.
embeddable boolIndicates if the searched font should support embedding.
allowEudc boolIndicates if the linked EUDC fonts can be searched as well.
Clears the internal list of fallback font families.
public void ClearFallbackFontFamilies()
Clears the internal list of fallback fonts.
public void ClearFallbackFonts()
Searches for a font with the specified family name and style.
public Font FindFamilyName(string fontFamilyName, bool bold = false, bool italic = false)
fontFamilyName stringThe font family name. Up to four fonts can share the same font family name.
bold boolIndicates if the font should be embolded.
italic boolIndicates if the font should contain Italic characters.
Searches for a font from the set of allowable font family names and the specified style.
public Font FindFamilyName(string[] fontFamilyNames, bool bold = false, bool italic = false)
fontFamilyNames string[]The array of allowable font family name.
bold boolIndicates if the font should be embolded.
italic boolIndicates if the font should contain Italic characters.
Searches for the first font having the specified file name.
public Font FindFileName(string fontFileName)
fontFileName stringSearches for the first font having the specified font path.
public Font FindFontPath(string fontPath)
fontPath stringSearches for the first font with specified full name.
Full font name that reflects all family and relevant subfamily descriptors.
public Font FindFullName(string fullFontName)
fullFontName stringGets a snapshot of the internal list of fallback font families.
public string[] GetFallbackFontFamilies()
Gets a snapshot of the internal fallback font list.
public Font[] GetFallbackFonts()
Removes one or more font family names from the internal list of fallback font families.
public void RemoveFallbackFontFamilies(params string[] fontFamilyNames)
fontFamilyNames string[]Removes one or more fonts from the internal fallback font list.
public void RemoveFallbackFonts(params Font[] fonts)
fonts Font[]Collects the fonts with the specified family name.
public void SelectByFamilyName(string fontFamilyName, List<Font> res)
fontFamilyName stringres System.Collections.Generic.List<T><Font>Returns the list of fonts with the specified family name.
public List<Font> SelectByFamilyName(string fontFamilyName)
fontFamilyName stringCollects the fonts having the same specified file name.
public void SelectByFileName(string fontFileName, List<Font> res)
fontFileName stringres System.Collections.Generic.List<T><Font>Returns the list of fonts having the same specified file name.
public List<Font> SelectByFileName(string fontFileName)
fontFileName stringCollects the fonts having the same specified font path.
public void SelectByFontPath(string fontPath, List<Font> res)
fontPath stringres System.Collections.Generic.List<T><Font>Returns the list of fonts having the same specified font path.
public List<Font> SelectByFontPath(string fontPath)
fontPath stringCollects the fonts with the specified full name.
Full font name that reflects all family and relevant subfamily descriptors.
public void SelectByFullName(string fullFontName, List<Font> res)
fullFontName stringres System.Collections.Generic.List<T><Font>Returns the list of fonts with the specified full name.
Full font name that reflects all family and relevant subfamily descriptors.
public List<Font> SelectByFullName(string fullFontName)
fullFontName stringCollects the fonts with the specified typographic family name.
The typographic family grouping doesn't impose any constraints on the number of faces within it, in contrast with the 4-style family grouping.
public void SelectByTypographicFamilyName(string typographicFamilyName, List<Font> res)
typographicFamilyName stringres System.Collections.Generic.List<T><Font>Returns the list of fonts with the specified typographic family name.
The typographic family grouping doesn't impose any constraints on the number of faces within it, in contrast with the 4-style family grouping.
public List<Font> SelectByTypographicFamilyName(string typographicFamilyName)
typographicFamilyName string