Commit b337fa25cf1ae602a9ba8ac11d2896cc004caa17

Werner Lemberg 2013-12-21T19:33:15

Fix Savannah bug #40975 (sort of). * src/truetype/ttinterp.c (Ins_IP): Fix sign typo to make FreeType behave the same as the Windows TrueType engine for the invalid case.

diff --git a/ChangeLog b/ChangeLog
index 7937534..4a1f1ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2013-12-21  Werner Lemberg  <wl@gnu.org>
 
+	Fix Savannah bug #40975 (sort of).
+
+	* src/truetype/ttinterp.c (Ins_IP): Fix sign typo to make FreeType
+	behave the same as the Windows TrueType engine for the invalid case.
+
+2013-12-21  Werner Lemberg  <wl@gnu.org>
+
 	[autofit] Make PIC mode work actually.
 
 	* src/autofit/afpic.h (AFModulePIC): Fix array sizes to fit the
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 3f110c2..4c384ec 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -7169,7 +7169,7 @@
         org_dist = CUR_fast_dualproj( &vec );
       }
 
-      cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
+      cur_dist = CUR_Func_project( &CUR.zp2.cur[point], cur_base );
 
       if ( org_dist )
       {
@@ -7180,14 +7180,20 @@
           /* This is the same as what MS does for the invalid case:  */
           /*                                                         */
           /*   delta = (Original_Pt - Original_RP1) -                */
-          /*           (Current_Pt - Current_RP1)                    */
+          /*           (Current_Pt - Current_RP1)         ;          */
           /*                                                         */
           /* In FreeType speak:                                      */
           /*                                                         */
-          /*   new_dist = cur_dist -                                 */
-          /*              org_dist - cur_dist;                       */
+          /*   delta = org_dist - cur_dist          .                */
+          /*                                                         */
+          /* We move `point' by `new_dist - cur_dist' after leaving  */
+          /* this block, thus we have                                */
+          /*                                                         */
+          /*   new_dist - cur_dist = delta                   ,       */
+          /*   new_dist - cur_dist = org_dist - cur_dist     ,       */
+          /*              new_dist = org_dist                .       */
 
-          new_dist = -org_dist;
+          new_dist = org_dist;
         }
       }
       else