c# - System.Drawing.FontFamily does not accept Uri-based Font -


is there way define external font new system.drawing.fontfamily? tried using code:

 fontfamily robotolight = new fontfamily(new uri("pack://application:,,,/"),                                           "./fonts/#roboto light"); 

and shows error:

cannot convert system.uri string

i realized i've been using different reference , 1 accepts uri system.windows.media.fontfamily, not work.

i researched , saw define custom fonts use privatefontcollection.addfontfile, it's using absolute path font, answered here.

my fonts resides in fonts folder inside project, , built included in .exe file, absolute path no-go me.

and need use system.drawing , not system.windows.media because i'm creating customized messagebox

system.drawing.fontfamily doesn't understand pack uris. please refer following question example of how use embedded font system.drawing.fontfamily class:

how , embed fonts in winforms app in c#


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -