shithub: freetype+ttf2subf

Download patch

ref: bad0160c1612ac48c94f490ac33318ccccb535e4
parent: b91e78530803fbc5e73b56f0280823e09deadc72
author: Werner Lemberg <[email protected]>
date: Fri Aug 12 15:50:13 EDT 2011

[truetype] Fix degenerate case in S{P,F,DP}VTL opcodes.

* src/truetype/ttinterp.c (Ins_SxVTL): Handle p1 == p2 specially.
(Ins_SDPVTL): Handle v1 == v2 specially.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-12  Werner Lemberg  <[email protected]
+
+	[truetype] Fix degenerate case in S{P,F,DP}VTL opcodes.
+
+	* src/truetype/ttinterp.c (Ins_SxVTL): Handle p1 == p2 specially.
+	(Ins_SDPVTL): Handle v1 == v2 specially.
+
 2011-08-09  Werner Lemberg  <[email protected]>
 
 	Fix Savannah bug #33975.
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -2845,6 +2845,17 @@
     A = p1->x - p2->x;
     B = p1->y - p2->y;
 
+    /* If p1 == p2, SPVTL and SFVTL behave the same as */
+    /* SPVTCA[X] and SFVTCA[X], respectively.          */
+    /*                                                 */
+    /* Confirmed by Greg Hitchcock.                    */
+
+    if ( A == 0 && B == 0 )
+    {
+      A    = 0x4000;
+      aOpc = 0;
+    }
+
     if ( ( aOpc & 1 ) != 0 )
     {
       C =  B;   /* counter clockwise rotation */
@@ -5181,7 +5192,8 @@
   Ins_SDPVTL( INS_ARG )
   {
     FT_Long    A, B, C;
-    FT_UShort  p1, p2;   /* was FT_Int in pas type ERROR */
+    FT_UShort  p1, p2;            /* was FT_Int in pas type ERROR */
+    FT_Int     aOpc = CUR.opcode;
 
 
     p1 = (FT_UShort)args[1];
@@ -5202,9 +5214,20 @@
 
       A = v1->x - v2->x;
       B = v1->y - v2->y;
+
+      /* If v1 == v2, SDPVTL behaves the same as */
+      /* SVTCA[X], respectively.                 */
+      /*                                         */
+      /* Confirmed by Greg Hitchcock.            */
+
+      if ( A == 0 && B == 0 )
+      {
+        A    = 0x4000;
+        aOpc = 0;
+      }
     }
 
-    if ( ( CUR.opcode & 1 ) != 0 )
+    if ( ( aOpc & 1 ) != 0 )
     {
       C =  B;   /* counter clockwise rotation */
       B =  A;
@@ -5222,7 +5245,7 @@
       B = v1->y - v2->y;
     }
 
-    if ( ( CUR.opcode & 1 ) != 0 )
+    if ( ( aOpc & 1 ) != 0 )
     {
       C =  B;   /* counter clockwise rotation */
       B =  A;