PDA

View Full Version : Bizarre text width



fortikur
07-24-2004, 05:26 AM
I tried to measure the width of a charater. I used the NeHe code:


HFONT font;
GLYPHMETRICSFLOAT gmf[256];

base = glGenLists(256);

font = CreateFont(-24,0,0,0,FW_BOLD,
FALSE,FALSE,FALSE, EASTEUROPE_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
"Arial");

SelectObject(DCvalue, font);

wglUseFontOutlines( DCvalue, 0, 256, base,
0.0f, 0.2f, WGL_FONT_POLYGONS, gmf);

test=gmf[65].gmfCellIncX;

65 should be the ASCII code of 'A'. The value of 'test' is 0.46. Some chars even have a width of 0.
What is the problem? Pls. help me