Is there a way to define an external font as a new System.Drawing.FontFamily
? I tried using this code:
FontFamily robotoLight = new FontFamily(new Uri("pack://application:,,,/"),
"./Fonts/#Roboto Light");
And shows this error:
Cannot convert from
System.Uri
tostring
I realized that I've been using a different reference and the one that accepts Uri
is the System.Windows.Media.FontFamily
, so it does not work.
I researched and saw that to define custom fonts is to use the PrivateFontCollection.AddFontFile
, but it's using an absolute path for the font, as answered here.
My fonts currently resides in a fonts
folder inside the project, and is built to be included in the .exe
file, so an absolute path is no-go for me.
And I need to use System.Drawing
and not System.Windows.Media
because I'm creating a customized MessageBox