[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] Freetype / Microsoft GDI size mismatch
From: |
Steffen R |
Subject: |
Re: [ft] Freetype / Microsoft GDI size mismatch |
Date: |
Wed, 3 Mar 2010 10:59:35 -0800 (PST) |
I think I might have found the answer. From MSDN "Background on Fonts"
> When we refer to a font as being 8-point or 12-point, we're talking about
> the height of the font less internal leading. The diacritics on certain
> capital letters are considered to occupy the space that normally separates
> lines of type. The tmHeight value of the TEXTMETRIC structure thus
> actually refers to line spacing rather than the font point size. The point
> size can be derived from tmHeight minus tmInternalLeading.
>
In my example, the font created with a size of 19 had an internal leading of
3. So the actual size was 16, which multiplied by 72 and divided by 96
yields 12, which is actually what I measured on my screen.
Steffen
Steffen R wrote:
>
> 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-tp27716380p27772212.html
Sent from the Freetype - User mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [ft] Freetype / Microsoft GDI size mismatch,
Steffen R <=