Commit 1127b2bf3ff6c78911da3258a31640c88bb02938

David Turner 2001-12-30T01:30:11

improving the computation of the advance widths of auto-hinted glyphs, in order to produce better letter spacing..

diff --git a/ChangeLog b/ChangeLog
index 0bfe4fa..db2ef99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-30  David Turner <david@freetype.org>
+
+	* src/autohint/ahhint.c (ah_hinter_load): improving advance width
+	computation of auto-hinted glyphs. This noticeably improves the
+	spacing of letters in KDE and Gnome :o)
+
 2001-12-25  Antoine Leca <Antoine-Freetype@Leca-Marti.org>
 
         * builds/dos/detect.mk: Correcting the order for Borland compilers:
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index 82589cf..3b798b0 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1111,20 +1111,23 @@
       /* we now need to hint the metrics according to the change in */
       /* width/positioning that occured during the hinting process  */
       {
-        FT_Pos    old_advance;
-        FT_Pos    old_lsb, new_lsb;
+        FT_Pos    old_advance, old_rsb, old_lsb, new_lsb;
         AH_Edge*  edge1 = outline->vert_edges;     /* leftmost edge  */
         AH_Edge*  edge2 = edge1 +
                           outline->num_vedges - 1; /* rightmost edge */
 
 
         old_advance = hinter->pp2.x;
+        old_rsb     = old_advance - edge2->opos;
         old_lsb     = edge1->opos;
         new_lsb     = edge1->pos;
 
-        hinter->pp1.x = ( ( new_lsb - old_lsb ) + 32 ) & -64;
-        hinter->pp2.x = ( ( edge2->pos +
-                            ( old_advance - edge2->opos ) ) + 32 ) & -64;
+        hinter->pp1.x = ( ( new_lsb    - old_lsb ) + 32 ) & -64;
+        hinter->pp2.x = ( ( edge2->pos + old_rsb ) + 32 ) & -64;
+
+        /* try to fix certain bad advance computations */
+        if ( hinter->pp2.x + hinter->pp1.x == edge2->pos && old_rsb > 4 )
+          hinter->pp2.x += 64;
       }
 
       /* good, we simply add the glyph to our loader's base */