freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Kerning problem with capitals


From: Robert Clark
Subject: Re: [Devel] Kerning problem with capitals
Date: Fri, 10 Dec 2004 13:27:31 +0000

On Thu, 2004-12-09 at 23:54 +0100, Werner LEMBERG wrote:

> I've investigated this problem further, and I'm now sure that neither
> your nor my algorithm can work reliably.  The very problem is that
> kerning isn't simply a correction of the advance width of the left
> character but has something to do with glyph shapes.  Assuming that a
> font is well hinted for a particular size, the glyph shape has been
> properly moved and distorted so that its appearance within the given
> advance width yields optimal rendering for a particular ppem value.
> With other words, the advance width returned by the bytecode
> interpreter is the optimal one for the (distorted) glyph shape -- in
> such cases it is plain wrong to `correct' the kerning value.

  Yeah, I have to agree. I've been playing with a patch here as well
and, although it fixed the "Re" kerning, it caused too many other
problems ("xo" & "ox" were particularly strange).

  I've also tried a couple of other algorithms such as using the change
in the average advance width of the left and right glyphs when hinted,
but there were problems there as well.

> Anyway, there is a very simple solution to immediately improve the
> kerning for small ppem values, and which I've now implemented directly
> in the library: Never increase the kerning value by rounding!
> Instead, FreeType now handles kerning in a conservative way by always
> rounding towards zero if the FT_KERNING_DEFAULT flag is used.  Using
> your `Red Ken File Vera' string with ftstring, I get very pleasing
> results.

  That's much better.

  I don't know if you think it's worth bothering with but, at some
higher sizes like 20ppem, the "Re" kerning is around -0.9 and is being
rounded to 0. At that size, the glyph shapes are much closer to the
scalable outlines and I think the kerning does improve the layout. How
about rounding the kerning to 0 if it lies in the -0.75 -> 0.75 pixel
range? I've attached a patch against 2.1.9 which I'm using now.

  The value 0.75 is pretty arbitrary but seems to give good results for
me.

        Robert



reply via email to

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