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'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/ChangeLog b/ChangeLog
index b212572..d1897d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-06-24 Eugeniy Meshcheryakov <eugen@univ.kiev.ua>
+
+ 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 <mpsuzuki@hiroshima-u.ac.jp>
Insert EndianS16_BtoN and EndianS32_BtoN as workaround for Intel
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 6a62a36..1cd7893 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1458,19 +1458,23 @@ FT_BEGIN_HEADER
/* */
/* 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;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 039649e..55f7571 100644
--- 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 );
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index bb08a5a..c947144 100644
--- 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 )