Reputation: 76
I'm loading the font from application's directory path. It works good on Win10 but it doesn't "see" the file on Win7.
private static PrivateFontCollection myFonts = new PrivateFontCollection();
myFonts.AddFontFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\font.otf");
How to solve this problem?
Upvotes: 3
Views: 1458
Reputation: 404
Taken from the MSDN https://msdn.microsoft.com/en-us/library/system.drawing.text.privatefontcollection.addfontfile.aspx
FileNotFoundException: The specified font is not supported or the font file cannot be found.
It also states
Windows Forms applications support TrueType fonts and have limited support for OpenType fonts.
So, try using a TTF file instead of an OTF file.
Upvotes: 4