次のコードを使用して、フォントをメモリにロードし、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.
AddFontFile
例外はありませんが、メソッドが例外なく実行された後、fontCollection Families プロパティは空になります。
パスが有効であることを確認しました (File.Exists
戻り値true
):
Response.Write(System.IO.File.Exists(Server.MapPath("~/fonts/abraham-webfont.ttf"))); // # => Renders "True"
ファイルを開くと、TTF ファイルは正常に動作しているように見えるため、無効な TTF ファイルではありません。
助言がありますか?