From this post, Let's say I want to calculate the textwidth in point of "Meet".
I use the following code:
HFONT hFont, hOldFont;
double fontheight = 12; <--font height in point
HDC hDC = GetDC(0);
// get a 12-point font and select it into the DC
int currentY = MulDiv((int)fontheight, GetDeviceCaps(hDC, LOGPIXELSY), 72);
hFont = CreateFont(-currentY, 0, 0, 0, FW_NORMAL, 0, 0, 0, 0,
0, 0, 0, 0, L"Arial"));
hOldFont = SelectFont(hDC, hFont);
TEXTMETRIC textMetric;
GetTextMetrics(hDC, &textMetric); <--this function return char height=18/charwidth=7
double fontwidth = fontheight/textMetric.tmHeight* textMetric.tmAveCharWidth; //rescale font width base on font height
CString t = L"Meet";
fontwidth =(double) (fontwidth* t.GetLength()); <-fontwidth*4.
Where am I going wrong, because based on the actual image it is quite small?