Why do I seem to get TEXTMETRIC structure's tmHeight member's size in pixel, but not in logical units?

  • Thread starter Thread starter oleksijp
  • Start date Start date
O

oleksijp

Guest
Windows GDI documentation clearly states that

> All sizes are specified in logical units; that is, they depend on the current mapping mode of the display context.

When I do such thing inside WndProc:

HDC hdc = GetDC(hwnd);
TEXTMETRIC textmetric;
GetTextMetrics(hdc, &textmetric);

tmHeight is equal to 16 points, which is

16 * GetDeviceCaps(hdc, LOGPIXELSY) / 72

pixels. Of course, if I understand article about DPI and Device-Independent Pixels correctly.

But when I create static edit control with some text and specify control height to be 16 pixel it strangely matches text font height.

My question is why does this font actually fit in 16 pixels when it should have a size of 16 * 96 / 72 pixels?

PS. Unfortunately, I can't attach an image here. But you can easily find my original question on stackoverflow with the same title.

Continue reading...
 
Back
Top