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.uristring
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:
Comments
Post a Comment