Error in Graphics.Drawing.Font

I’m using Graphics.Drawing.Font. It works when I use the preset values for FontFamily like ‘monospace’ or ‘serif’. However when I try to specify a font family via ‘FontFamily “Times New Roman”’ or whatever, I get “Unknown data constructor FontFamily.”

I am importing it using the form FontFamily(…) and it doesn’t complain about the import.

Importing via FontFamily(..) gives you all the exported constructors (but there are none! code)

You’re supposed to use customFont instead, which lets you pass in a String:

1 Like

FWIW, I think the compiler should warn when (..) does not result in any imports (it’s equivalent to an unused import).


Thanks, it works. Not sure how I missed that.

1 Like