shithub: freetype+ttf2subf

Download patch

ref: 555258fffe183fb2da2b2e84981d9284b505d6c7
parent: 011d111218afae2f0abb06cf27b83e4740a51f85
author: Werner Lemberg <[email protected]>
date: Sun Jan 21 04:46:37 EST 2007

* docs/CHANGES: Document SHZ fix.

* src/truetype/ttinterp.c (Ins_SHZ): SHZ doesn't move phantom
points.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2007-01-21  Werner Lemberg  <[email protected]>
 
+	* docs/CHANGES: Document SHZ fix.
+
+2007-01-21  George Williams  <[email protected]>
+
+	* src/truetype/ttinterp.c (Ins_SHZ): SHZ doesn't move phantom
+	points.
+
+2007-01-21  Werner Lemberg  <[email protected]>
+
 	* src/sfnt/ttmtx.c (tt_face_get_metrics)
 	[!FT_CONFIG_OPTION_OLD_INTERNALS]: Fix limit check.
 
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,3 +1,13 @@
+CHANGES BETWEEN 2.3.0 and 2.3.1
+
+  I. IMPORTANT BUG FIXES
+
+    - The TrueType interpreter sometimes returned incorrect horizontal
+      metrics due to a bug in the handling of the SHZ instruction.
+
+
+======================================================================
+
 CHANGES BETWEEN 2.3.0 and 2.2.1
 
   I. IMPORTANT BUG FIXES
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -2769,12 +2769,12 @@
     CUR.GS.single_width_cutin = (FT_F26Dot6)args[0];
 
 
-    /* XXX: UNDOCUMENTED! or bug in the Windows engine? */
-    /*                                                  */
-    /* It seems that the value that is read here is     */
-    /* expressed in 16.16 format rather than in font    */
-    /* units.                                           */
-    /*                                                  */
+    /* XXX: UNDOCUMENTED! or bug in the Windows engine?   */
+    /*                                                    */
+    /*      It seems that the value that is read here is  */
+    /*      expressed in 16.16 format rather than in font */
+    /*      units.                                        */
+    /*                                                    */
 #define DO_SSW                                                 \
     CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 );
 
@@ -5430,7 +5430,7 @@
         last_point = 0;
     }
 
-    /* XXX: UNDOCUMENTED! SHC does touch the points */
+    /* XXX: UNDOCUMENTED! SHC touches the points */
     for ( i = first_point; i <= last_point; i++ )
     {
       if ( zp.cur != CUR.zp2.cur || refp != i )
@@ -5466,8 +5466,14 @@
     if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) )
       return;
 
-    if ( CUR.zp2.n_points > 0 )
-      last_point = (FT_UShort)(CUR.zp2.n_points - 1);
+    /* XXX: UNDOCUMENTED! SHZ doesn't move the phantom points.  */
+    /*      Twilight zone has no contours, so use `n_points'.   */
+    /*      Normal zone's `n_points' includes phantoms, so must */
+    /*      use end of last contour.                            */
+    if ( CUR.GS.gep2 == 0 && CUR.zp2.n_points > 0 )
+      last_point = (FT_UShort)( CUR.zp2.n_points - 1 );
+    else if ( CUR.GS.gep2 == 1 && CUR.zp2.n_contours > 0 )
+      last_point = (FT_UShort)( CUR.zp2.contours[CUR.zp2.n_contours - 1] );
     else
       last_point = 0;