Prev: Activesync server on wince platform
Next: embedded pie
From: Steffen R. Steffen on 1 Mar 2010 03:55 Hey there! I have a question about how GDI calculates the sizes for font rendering. I use a LOGFONT object and set lfHeight to 19, for example. LOGFONT lf = {0}; lf.lfHeight = 19; // other values... HFONT hFont = ::CreateFontIndirect(&lf); HDC dc = CreateCompatibleDC(NULL); ::SelectObject(dc, hFont); ::DrawTextW(dc, text, -1, rectangle, formatFlags); The documentation states that a positive value for lfHeight will transform the value into device units, which would be (if I understand this correctly) (19*72/96) where 96 is the logical resolution. This gives me a result of 14.25 points as a font size, but measuring it on a screen with a pixel ruler shows me a size of approx. 12 points, which makes a huge difference in my application. Can anyone explain this to me so that I can know in advance the exact size in which my text will be rendered? Any help is highly appreciated. Steffen
|
Pages: 1 Prev: Activesync server on wince platform Next: embedded pie |