Font class, external font files question

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
 
K

Karl Hungus

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top