PDA

View Full Version : Custom fonts



fortikur
08-03-2004, 01:19 AM
I'm using the NeHe code (or something like a mixture of it) to write text on the screen. My code looks like this:

HFONT font;
HFONT oldfont;

font = CreateFont( fontsize, 0,0,0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
fontname);

SelectObject(DCvalue, font);
wglUseFontOutlines( DCvalue, 0,
224, base,
0.0f, 0.2f, WGL_FONT_POLYGONS, gmf);

GetCharWidth(DCvalue,0,224,char_sizes);

oldfont = (HFONT)SelectObject(DCvalue, font);
if(!wglUseFontBitmaps(DCvalue, 32, 224, base)) exit(1);
SelectObject(DCvalue, oldfont); DeleteObject(font);

I am able to load Times New Roman and an Arial looking font, but I downloaded some better looking fonts from the net (all of them are .ttf), installed them, but I got only these two above mentioned fonts.
What I want to do is, to have my own, 'hand drawn' font in my app folder and display it. I don't want to install my font into the fonts dir of Windows.
Can anybody tell me how to display my own font?

Thank you