[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] Kerning support in freetype
From: |
Dmitry Timoshkov |
Subject: |
Re: [ft-devel] Kerning support in freetype |
Date: |
Tue, 22 Aug 2006 23:59:23 +0900 |
"Russell Shaw" <address@hidden> wrote:
I need it to implement behaviour of a win32 API GetKerningPairs, which
is able to return total amount of kerning pairs available. I don't see
why that info shouldn't be available for an application which wants to
cache it for any reason.
If freetype has already loaded all the pairs from the file, then cacheing
wouldn't be needed (unless you really need them all to emulate some api).
Yes, that's needed for a GetKerningPairs implementation via freetype APIs.
face Arial Regular has kerning
kerning between 32 and 65 is -2:0
kerning between 32 and 84 is -1:0
kerning between 70 and 44 is -3:0
which is a bit small for a 1200 pixels font face.
Note that your printfs are dividing by 64 (>>6).
Which is correct to convert from a 26.6 format to an integer. And
now I see my mistake thanks to James, FT_Set_Char_Size takes a 26.6
value as well, not an integer.
Using Win32 API GetKerningPairsW I get:
wFirst 32, wSecond 65, iKernAmount -59
wFirst 32, wSecond 84, iKernAmount -19
wFirst 70, wSecond 44, iKernAmount -119
which looks reasonable for a 1200 pixel sized font face.
After taking out the >>6 in the printfs, i get:
face Arial Regular has kerning
kerning between 32 and 65 is -66:0
kerning between 32 and 84 is -22:0
kerning between 70 and 44 is -133:0
using: /usr/share/fonts/truetype/msttcorefonts/arial.ttf
The differences might be due to the screen resolution not
being set in FT_Set_Char_Size().
Many thanks for the hint. In my sample if I replace
if (FT_Set_Char_Size(ft_face, 0, 1200, 0, 0))
by
if (FT_Set_Char_Size(ft_face, 0, 1200 << 6, 64, 64))
I get the closest match to what Windows returns:
face Arial Regular has kerning
kerning between 32 and 65 is -59:0
kerning between 32 and 84 is -20:0
kerning between 70 and 44 is -119:0
But using 64 as a "magic" resolution confuses. Any idea what
might cause that behaviour?
Thanks.
--
Dmitry.
- [ft-devel] Kerning support in freetype, Dmitry Timoshkov, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, Russell Shaw, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, Dmitry Timoshkov, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, Russell Shaw, 2006/08/22
- Re: [ft-devel] Kerning support in freetype,
Dmitry Timoshkov <=
- Re: [ft-devel] Kerning support in freetype, Russell Shaw, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, Dmitry Timoshkov, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, Russell Shaw, 2006/08/22
- Re: [ft-devel] Kerning support in freetype, David Turner, 2006/08/24
- Re: [ft-devel] Kerning support in freetype, Dmitry Timoshkov, 2006/08/28