Font class, external font files question

  • Thread starter Thread starter Karl Hungus
  • Start date Start date
K

Karl Hungus

Is there a way to use truetype fonts not installed on the system, but
existing as a file on the server? For example, if I have a true type file in
the same directory as my aspx file, can I use that to replace this
constructor somehow:
Font fontBanner = new Font("verdana", 35, FontStyle.Regular);

Im using gdi+ with asp.net (c#) to generate some simple images

Thanks in advace
 
Answered my own question:

String fontStr = Server.MapPath("KROE0553.TTF");
PrivateFontCollection pfc = new PrivateFontCollection();
pfc.AddFontFile(fontStr);

FontFamily fontFam = new FontFamily("kroeger 05_53", pfc);
Font fontBanner = new Font(fontFam, 35, FontStyle.Regular);
 
Back
Top