Test if a Font is installed
How do you get a list of all the installed fonts?
var fontsCollection = new InstalledFontCollection();foreach (var fontFamily in fontsCollection.Families){ if (fontFamily.Name == fontName) {...} \\ check if font is installed}
See InstalledFontCollection class for details.
Thanks to Jeff, I have better read the documentation of the Font class:
If the familyName parameter specifies a font that is not installed on the machine running the application or is not supported, Microsoft Sans Serif will be substituted.
The result of this knowledge:
private bool IsFontInstalled(string fontName) { using (var testFont = new Font(fontName, 8)) { return 0 == string.Compare( fontName, testFont.Name, StringComparison.InvariantCultureIgnoreCase); } }