I'm using the following code to load a font into memory for generating an image with GDI+:
var fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(Server.MapPath("~/fonts/abraham-webfont.ttf"));
fontCollection.Families.Count(); // => This line tells me, that the collection has 0 items.
There are no exceptions, but the fontCollection Families property is empty after the AddFontFile
method has run without any exceptions.
I've verified that the path is valid (File.Exists
returns true
):
Response.Write(System.IO.File.Exists(Server.MapPath("~/fonts/abraham-webfont.ttf"))); // # => Renders "True"
The TTF-file seems to work fine, when I open the file, so it's not an invalid TTF-file:
Any suggestions?