freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Kerning support in freetype


From: James Cloos
Subject: Re: [ft-devel] Kerning support in freetype
Date: Tue, 22 Aug 2006 09:50:40 -0400
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.0 (gnu/linux)

>>>>> "Dmitry" == Dmitry Timoshkov <address@hidden> writes:

Dmitry> I'm attaching my test program. Using FreeType from CVS it prints:

Dmitry> face Arial Regular has kerning
Dmitry> kerning between 32 and 65 is -2:0
Dmitry> kerning between 32 and 84 is -1:0
Dmitry> kerning between 70 and 44 is -3:0

Dmitry> which is a bit small for a 1200 pixels font face.

You call:

,----
| if (FT_Set_Char_Size(ft_face, 0, 1200, 0, 0))
`----

which requests a 1200/64.0 point font at 72 dpi, because the
resolution parameters default to 72 if 0 is passed, and the
char_width and char_height parameters are 26.6.

An 18.75 pt font at 72 dpi yields a pixelsize of 18.75 if you use
72pt/in, as PostScript does┬╣.

If you edit your example to print out:

,----
| printf("kerning between 32 and 65 is %f:%f\n", (double) ft_kern.x / 64.0, 
(double) ft_kern.y / 64.0);
`----

instead of %ld on ft_kern.x >> 6, you get as output:

,----
| face Arial Regular has kerning
| kerning between 32 and 65 is -1.031250:0.000000
| kerning between 32 and 84 is -0.343750:0.000000
| kerning between 70 and 44 is -2.078125:0.000000
`----

So, given your 18.75 pixel font instance, one to two pixels of kerning
seems reasonable.

Chaning the example to target a 1200 pixel font, by s/1200/1200<<6/,
gives this output:

,----
| face Arial Regular has kerning
| kerning between 32 and 65 is -66.218750:0.000000
| kerning between 32 and 84 is -21.687500:0.000000
| kerning between 70 and 44 is -133.015625:0.000000
`----

Not quite -60,-20,-120, but close.

-JimC

┬╣ rather than 72.27pt/in as TeX does, or the traditional point TeX's is rounded 
from

-- 
James Cloos <address@hidden>         OpenPGP: 0xED7DAEA6




reply via email to

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