If I run the code below, I get the following values ββfor the tm and gm structures with the font "cambria Math":
tm.tmHeight = 161 tm.tmAscent = 90 tm.tmDescent = 71
and
gm.gmBlackBoxY = 14
The values ββin tm clearly wrong ! gmBlackBoxY seems correct.
Now, if I run the code using
lfFaceName = "Arial"
I get for tm and gm following values ββthat are correct:
tm.tmHeight = 33 tm.tmAscent = 27 tm.tmDescent = 6
and
gm.gmBlackBoxY = 15
the code:
int iLogPixelsY; iLogPixelsY = GetDeviceCaps(hdc,LOGPIXELSY); LOGFONT lf; int iPts; iPts = 22; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = -iPts * iLogPixelsY / 72; lf.lfWeight = FW_NORMAL; lf.lfItalic = 0; lf.lfCharSet = 0; lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; wcscpy(lf.lfFaceName, L"Cambria Math"); HFONT hFont; hFont = CreateFontIndirect(&lf); hFont = (HFONT)SelectObject(hdc, hFont); TCHAR tx; tx = 'a'; TEXTMETRIC tm; GetTextMetrics(hdc, &tm); GLYPHMETRICS gm; GetGlyphOutline(hdc, tx, GGO_METRICS, &gm, 0, NULL, &gmat);
Can someone explain the apparent incorrectness in obtaining the TEXTMETRIC structure for the Cambria Math font?
source share