问题
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"
Fine... but, according to the MDSN documentation:
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.
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?
回答1:
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
来源:https://stackoverflow.com/questions/32702528/why-is-my-fontfamily-arial