Test if a Font is installed

前端 未结 7 1406
日久生厌
日久生厌 2020-11-30 08:34

Is there an easy way (in .Net) to test if a Font is installed on the current machine?

7条回答
  •  感情败类
    2020-11-30 09:18

    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.

    MSDN:
    Enumerating Installed Fonts

提交回复
热议问题