为什么我的FontFamily是"Arial"? [英] Why is my FontFamily "Arial"?

查看:252
本文介绍了为什么我的FontFamily是"Arial"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码段,在其中我试图将字体设置为8号Helvetica.我意识到我的系统上没有安装此字体,所以我的 FontFamily 却得到了"Arial".

I have the following chunk of code in which I was trying to set a font to size 8 Helvetica. I realized I don't have this font installed on my system so instead I get "Arial" for my FontFamily instead.

string family = "Helvetica";
Font font = new Font(family, 8f);
//font.FontFamily is now "Arial"

很好...但是,根据MDSN文档:

Fine... but, according to the MDSN documentation:

如果familyName参数指定的字体未安装在运行该应用程序的计算机上或不受支持,则将替换Microsoft Sans Serif.

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.

我想念Microsoft Sans Serif,但我不是(我可以指定"Microsoft Sans Serif",并且可以使用),这对我来说很有意义.我只是得到Arial而已.为什么会这样?

It would sort of make sense to me of I was missing Microsoft Sans Serif, but I am not (I can specify "Microsoft Sans Serif" and that works). I'm simply getting Arial instead. Why is that?

推荐答案

原因是因为某些流行的但不是通用的字体将替换为接近的特定字体.在您的情况下,Helvetica默认情况下会交换为Arial.您可以在以下位置查看这些交换的完整列表:

The reason is because certain popular, but not universally available fonts will get substituted for specific fonts that are close. In your case, Helvetica will by default be swapped to Arial. You can see a complete list of these swaps at:

HKLM/Software/Microsoft/Windows NT/CurrentVersion/FontSubstitutes

这篇关于为什么我的FontFamily是"Arial"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆