0
votes

I did find this Why is my FontFamily "Arial"? but it doesn't go into what to do if there is anything you can do.

I tried modifying the registry which I hate and consider that a hack.

I'm trying to use Helvetica and Helvetica Black in code C# new Font(familyName, emSize, FontStyle, GraphicsUnit)

I do have those fonts installed.

EDIT: I didn't include any code because it's just the new Font method on System.Drawing.

var font = new Font("Helvetica", 10, FontStyle.Regular, GraphicsUnit.Millimeter);

Although Helvetica and Helvetica Black are installed the above method call returns Arial which I believe is because that's what the Registry says to do and if I ask for Helvetica Black it returns Microsoft Sans Serif which the registry says "Helv" so I'm guessing it's picking up on that.

Even if I tell the registry not to do that I'm still getting those values.

The ultimate goal was to display to the user a list of installed fonts and then allow them to pick ones to use.

Something else I just noticed

System.Drawing.FontFamily.Families

Returns 237 fonts but Helvetica and Helvetica Black are not listed.

You might look at How to manage custom fonts in web application (system.drawing) It says "web application" but I don't see anything that requires a web application in the code. - Heretic Monkey
Show the code you use! - TaW
It is an OpenType font, the kind you can only use in a WPF or UWP app. Winforms requires TrueType fonts. - Hans Passant