shithub: freetype+ttf2subf

Download patch

ref: a2da05c2c539c603aa3587a1acb07bff8cdab599
parent: ef3d2c234736bdd7359d51e1ad522ae5dc6698c5
author: Werner Lemberg <[email protected]>
date: Sun Jun 25 02:27:27 EDT 2006

Fix two hinting bugs as reported in
http://lists.nongnu.org/archive/html/freetype-devel/2006-06/msg00057.html.

* include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
`first_point' member.

* src/truetype/ttgload.c (tt_prepare_zone): Initialize
`first_point'.
(TT_Process_Composite_Glyph): Always untouch points.

* src/truetype/ttinterp.c (Ins_SHC): Fix computation of
`first_point' and `last_point' in case of composite glyphs.
(Ins_IUP): Fix computation of `end_point'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-06-24  Eugeniy Meshcheryakov  <[email protected]>
+
+	Fix two hinting bugs as reported in
+	http://lists.nongnu.org/archive/html/freetype-devel/2006-06/msg00057.html.
+
+	* include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
+	`first_point' member.
+
+	* src/truetype/ttgload.c (tt_prepare_zone): Initialize
+	`first_point'.
+	(TT_Process_Composite_Glyph): Always untouch points.
+
+	* src/truetype/ttinterp.c (Ins_SHC): Fix computation of
+	`first_point' and `last_point' in case of composite glyphs.
+	(Ins_IUP): Fix computation of `end_point'.
+
 2006-06-22  suzuki toshiya  <[email protected]>
 
 	Insert EndianS16_BtoN and EndianS32_BtoN as workaround for Intel
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1458,19 +1458,23 @@
   /*                                                                       */
   /*     contours     :: The contours end points.                          */
   /*                                                                       */
+  /*     first_point  :: Offset of the current subglyph's first point.     */
+  /*                                                                       */
   typedef struct  TT_GlyphZoneRec_
   {
     FT_Memory   memory;
     FT_UShort   max_points;
     FT_UShort   max_contours;
-    FT_UShort   n_points;   /* number of points in zone    */
-    FT_Short    n_contours; /* number of contours          */
+    FT_UShort   n_points;    /* number of points in zone    */
+    FT_Short    n_contours;  /* number of contours          */
 
-    FT_Vector*  org;        /* original point coordinates  */
-    FT_Vector*  cur;        /* current point coordinates   */
+    FT_Vector*  org;         /* original point coordinates  */
+    FT_Vector*  cur;         /* current point coordinates   */
 
-    FT_Byte*    tags;       /* current touch flags         */
-    FT_UShort*  contours;   /* contour end points          */
+    FT_Byte*    tags;        /* current touch flags         */
+    FT_UShort*  contours;    /* contour end points          */
+
+    FT_UShort   first_point; /* offset of first (#0) point  */
 
   } TT_GlyphZoneRec, *TT_GlyphZone;
 
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -578,6 +578,7 @@
     zone->cur        = load->outline.points + start_point;
     zone->tags       = (FT_Byte*)load->outline.tags + start_point;
     zone->contours   = (FT_UShort*)load->outline.contours + start_contour;
+    zone->first_point = start_point;
   }
 
 
@@ -938,6 +939,7 @@
   {
     FT_Error     error;
     FT_Outline*  outline;
+    FT_UInt      i;
 
 
     outline = &loader->gloader->base.outline;
@@ -995,6 +997,13 @@
 
     tt_prepare_zone( &loader->zone, &loader->gloader->base,
                      start_point, start_contour );
+
+    /* Some points are likely touched during execution of  */
+    /* instructions on components.  So let's untouch them. */
+    for ( i = start_point; i < loader->zone.n_points; i++ )
+      loader->zone.tags[i] &= ~( FT_CURVE_TAG_TOUCH_X |
+                                 FT_CURVE_TAG_TOUCH_Y );
+
     loader->zone.n_points += 4;
 
     return TT_Hint_Glyph( loader, 1 );
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -5379,9 +5379,10 @@
     if ( contour == 0 )
       first_point = 0;
     else
-      first_point = (FT_UShort)(CUR.pts.contours[contour - 1] + 1);
+      first_point = (FT_UShort)( CUR.pts.contours[contour - 1] + 1 -
+                                 CUR.pts.first_point );
 
-    last_point = CUR.pts.contours[contour];
+    last_point = CUR.pts.contours[contour] - CUR.pts.first_point;
 
     /* XXX: this is probably wrong... at least it prevents memory */
     /*      corruption when zp2 is the twilight zone              */
@@ -6315,7 +6316,7 @@
 
     do
     {
-      end_point   = CUR.pts.contours[contour];
+      end_point   = CUR.pts.contours[contour] - CUR.pts.first_point;
       first_point = point;
 
       while ( point <= end_point && (CUR.pts.tags[point] & mask) == 0 )