diff --git a/ChangeLog b/ChangeLog index b212572b5..d1897d891 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-06-24 Eugeniy Meshcheryakov + + 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 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 6a62a36c5..1cd789358 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 039649e8d..55f75718b 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 bb08a5ae2..c94714491 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 )