1

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?

Broots Waymb
  • 4,713
  • 3
  • 28
  • 51
  • Companies battling over trademark names, Linotype claims they own "Helvetica". Microsoft avoided getting sued by picking "Arial". The registry on your machine automatically maps it. Start Regedit.exe and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes to see it. While you're there, add another one for "Helvetica Neue" and set it to "Segoe UI" to make SO pages easier on the eyes. – Hans Passant Sep 21 '15 at 19:44
  • 1
    Basically, "Arial" is Microsoft's "Helvetica" – PC Luddite Sep 21 '15 at 19:53

1 Answers1

3

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
mkautzm
  • 1,086
  • 2
  • 18
  • 34