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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -