测试是否安装了字体 [英] Test if a Font is installed
本文介绍了测试是否安装了字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法(在 .Net 中)来测试当前机器上是否安装了字体?
Is there an easy way (in .Net) to test if a Font is installed on the current machine?
推荐答案
string fontName = "Consolas";
float fontSize = 12;
using (Font fontTester = new Font(
fontName,
fontSize,
FontStyle.Regular,
GraphicsUnit.Pixel))
{
if (fontTester.Name == fontName)
{
// Font exists
}
else
{
// Font doesn't exist
}
}
这篇关于测试是否安装了字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文