0

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?

Alen Šimunic
  • 555
  • 1
  • 7
  • 19

1 Answers1

0

I have found a solution using MapPath:

PrivateFontCollection privateFontCollection = new PrivateFontCollection();
privateFontCollection.AddFontFile(HttpContext.Current.Server.MapPath("~/fonts/open-sans/OpenSans-Light.ttf"));
Alen Šimunic
  • 555
  • 1
  • 7
  • 19