wpf获取系统安装的字体很简单,
foreach (FontFamily fontfamily in Fonts.SystemFontFamilies)
{
//代码
}
获取中文字体
foreach (FontFamily fontfamily in Fonts.SystemFontFamilies)
{
LanguageSpecificStringDictionary fontdics = fontfamily.FamilyNames;
//判断该字体是不是中文字体
if (fontdics.ContainsKey(XmlLanguage.GetLanguage("zh-cn")))
{
string fontfamilyname = null;
if (fontdics.TryGetValue(XmlLanguage.GetLanguage("zh-cn"), out fontfamilyname))
{
systemFontsNamesList.Add(fontfamilyname);
}
}
//英文字体
else
{
string fontfamilyname = null;
if (fontdics.TryGetValue(XmlLanguage.GetLanguage("en-us"), out fontfamilyname))
{
systemFontsNamesList.Add(fontfamilyname);
}
}
}
原文:http://www.cnblogs.com/renpeng/p/4364194.html