I draw the text using this two functions: https://pastebin.com/JVc5xFFT
I draw the text - GlText(dc, "Test", ERGB{ 155, 179, 0 }, 5, 220);
I build a font to uint with this function
GLvoid BuildFont(HDC hDC, UINT* FontBase, int PointerWidth)
{
HFONT font;
HFONT oldfont;
*FontBase = glGenLists(96);
font = CreateFontW(-MulDiv(PointerWidth, GetDeviceCaps(hDC, LOGPIXELSY), 72),
0,
0,
0,
FW_BOLD,
FALSE,
FALSE,
FALSE,
ANSI_CHARSET,
OUT_OUTLINE_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
VARIABLE_PITCH | FF_SWISS,
L"Trebuchet MS");
oldfont = (HFONT)SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 32, 96, *FontBase);
SelectObject(hDC, oldfont);
DeleteObject(font);
}
How can I find out the height and width of a given text?
Function for calculating(badly code. but working):