freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Freetype2 Type1 Glyph Character Advancement Loss of Precision


From: mly
Subject: [Devel] Freetype2 Type1 Glyph Character Advancement Loss of Precision
Date: Wed, 20 Feb 2002 19:53:27 +0100

Hi,

For some reason or another, Freetype2 discards the fractional value of the
horizontal and vertical glyph advance as computed by T1_Load_Glyph if
hinting is enabled.  The code shown below, which is found in T1_Load_Glyph
() in the t1gload.c module, intentionally discards the fractional part:

          if ( hinting )
          {
            metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64;
            metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64;

            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;
            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;
          }

It seems rather quite sensible to discard the fractional portion of the
vertical and horizontal bearing to avoid baseline alignment rounding
errors.  But, why is the fractional portion of the horizontal and vertical
discarded?  We have experienced signifcant advancement errors due to
accumulated imprecision.  In our case, the coordinate system uses a unit
size of 7200 points per inch even though characters glyphs are rendered at
600 DPI.

Our suggestion is to remove the two source lines that modify the
metrics->horiAdvance and metrics->vertAdvance variables so that the result
is:

          if ( hinting )
          {
            metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64;
            metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64;
          }

The CID and CFF font drivers functions identically.  The problem may be
apparant elsewhere in Freetype.


Sincerely,

Claus Dolleris & Mikael Lyngvig
LCI Intermate A/S





reply via email to

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