shithub: freetype+ttf2subf

Download patch

ref: 40633205287c8e9ea80e9b8824d8ca5ab651edf1
parent: fba917d0e70da17eb1807b16363cb7d1a6ecef39
author: Werner Lemberg <[email protected]>
date: Fri Feb 1 07:55:44 EST 2013

[truetype] Fix Savannah bug #38211.

* src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical
to other interpreters if rp1 == rp2 (which is invalid).

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-02-01  Werner Lemberg  <[email protected]>
+
+	[truetype] Fix Savannah bug #38211.
+
+	* src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical
+	to other interpreters if rp1 == rp2 (which is invalid).
+
 2013-01-28  Alexei Podtelezhnikov  <[email protected]>
 
 	[base] Small optimization of BBox calculation.
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -6974,9 +6974,18 @@
       cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
 
       if ( org_dist )
-        new_dist = ( old_range != 0 )
-                     ? FT_MulDiv( org_dist, cur_range, old_range )
-                     : cur_dist;
+      {
+        if ( old_range )
+          new_dist = FT_MulDiv( org_dist, cur_range, old_range );
+        else
+        {
+          /* use the middle position */
+          new_dist = cur_dist -
+                     CUR_fast_dualproj( &CUR.zp2.cur[point] ) +
+                     ( CUR_fast_dualproj( &CUR.zp1.cur[CUR.GS.rp1] ) +
+                       CUR_fast_dualproj( &CUR.zp1.cur[CUR.GS.rp2] ) ) / 2;
+        }
+      }
       else
         new_dist = 0;