Reputation: 553
I have OpenSans-Light.ttf in the this folder from root: ~/fonts/open-sans/OpenSans-Light.ttf
PrivateFontCollection privateFontCollection = new PrivateFontCollection();
privateFontCollection.AddFontFile("~/fonts/open-sans/OpenSans-Light.ttf");
but I get "System.IO.FileNotFoundException: File not found"
How do I target that font file?
Upvotes: 0
Views: 518
Reputation: 553
I have found a solution using MapPath:
PrivateFontCollection privateFontCollection = new PrivateFontCollection();
privateFontCollection.AddFontFile(HttpContext.Current.Server.MapPath("~/fonts/open-sans/OpenSans-Light.ttf"));
Upvotes: 0