freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Freetype / Microsoft GDI size mismatch


From: Steffen R
Subject: [ft] Freetype / Microsoft GDI size mismatch
Date: Fri, 26 Feb 2010 01:57:22 -0800 (PST)

Hi everyone,

I'm not sure if this is the correct forum for me to post, but I certainly
won't get much help from Microsoft for this ;-)

My problem is as follows: I have an application that uses MS GDI font
rendering, which shall be replaced by freetype while still keeping the
option to use GDI. Thus, layouting must be as close to the old version as
possible.
When I use freetype to render a text in a given size, the results look
pretty much the same as in programs such as Word or WordPad, so obviously
that is correct.
When I use GDIs functions, the results look much smaller. For GDI, the fonts
are created with a LOGFONT struct:

LOGFONT lf = {0};
lf.lfHeight = m_pointSize;
// other values...
HFONT hFont = ::CreateFontIndirect(&lf);
HDC dc = CreateCompatibleDC(NULL);
::SelectObject(dc, hFont);
::DrawTextW(dc, text, -1, rectangle, formatFlags);

The results look noticably smaller rendered with this code. I don't find
many hints for the reason apart from the logical vs. physical resolution
issue, but that does not solve it entirely. For example, with a given size
of 19, multiplication with 72 and division by 96 yields 14.25 as a font
size. Using a pixel ruler on my screen shows 12 or at most 13 pixels when
rendered with GDI, which makes a big difference in my application.

Does anyone know the reason for this? Any hints are highly appreciated.

Regards,
Steffen
-- 
View this message in context: 
http://old.nabble.com/Freetype---Microsoft-GDI-size-mismatch-tp27716380p27716380.html
Sent from the Freetype - User mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]