freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Getting accurate advances


From: Werner LEMBERG
Subject: Re: [Devel] Getting accurate advances
Date: Sat, 15 Nov 2003 18:14:17 +0100 (CET)

> So I tried linearHoriAdvance which was better but, despite what the
> tutorial says, still not accurate enough - because it is calculated
> using x_ppem (ftobjs.c line 554) which has been rounded to the
> nearest pixel (x_scale is similarly rounded). The cumulative error
> can be several mm with a text string of 15cm or so.

This is definitely a bug.

> Perhaps the tutorial could be changed so that it doesn't claim that
> linearHoriAdvance is accurate to 1/65536th of a pixel - or, better,
> linearHoriAdvance could be calculated accurately (I can't see how to
> do this without storing an additional unrounded value in a new
> field).

The necessary data is already available in metrics->x_scale, with
sufficient accuracy I think.  We have to say

  slot->linearHoriAdvance =
    FT_MulDiv( slot->linearHoriAdvance, metrics->x_scale, 64 );

instead of

  slot->linearHoriAdvance =
    FT_MulDiv( slot->linearHoriAdvance,
               (FT_Long)metrics->x_ppem << 16, EM );

in function FT_Load_Glyph.

Please test.  If this works as expected I'll apply the change to the
CVS.


    Werner



reply via email to

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