Test if a Font is installed

前端 未结 7 1391
日久生厌
日久生厌 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:10

    Going off of GvS' answer:

        private static bool IsFontInstalled(string fontName)
        {
            using (var testFont = new Font(fontName, 8))
                return fontName.Equals(testFont.Name, StringComparison.InvariantCultureIgnoreCase);
        }
    

提交回复
热议问题