From 4919dc7cf81eb95737c8d8441303d137dc3a0cd6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 28 May 2003 05:52:05 +0000 Subject: [PATCH] * src/pshinter/pshalgo3.c (psh3_glyph_compute_extrema): Skip contours with only a single point to avoid segfault. * src/autohint/ahtypes.h (AH_OPTION_NO_STRONG_INTERPOLATION): Removed since unused. --- ChangeLog | 10 ++++++++++ src/autohint/ahglobal.c | 7 +++++-- src/autohint/ahglyph.c | 9 +++++---- src/autohint/ahhint.c | 12 ++++++++---- src/autohint/ahtypes.h | 10 ---------- src/pshinter/pshalgo3.c | 3 +++ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 086ade969..4d88cb446 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-05-28 Werner Lemberg + + * src/pshinter/pshalgo3.c (psh3_glyph_compute_extrema): Skip + contours with only a single point to avoid segfault. + +2003-05-24 Werner Lemberg + + * src/autohint/ahtypes.h (AH_OPTION_NO_STRONG_INTERPOLATION): + Removed since unused. + 2003-05-21 Werner Lemberg * include/freetype/config/ftstdlib.h (ft_strcat): New wrapper macro diff --git a/src/autohint/ahglobal.c b/src/autohint/ahglobal.c index 120c4a212..4183b0109 100644 --- a/src/autohint/ahglobal.c +++ b/src/autohint/ahglobal.c @@ -27,6 +27,8 @@ #define MAX_TEST_CHARACTERS 12 + /* cf. AH_BLUE_XXX constants in ahtypes.h */ + static const char* blue_chars[AH_BLUE_MAX] = { @@ -93,8 +95,8 @@ goto Exit; /* we compute the blues simply by loading each character from the */ - /* 'blue_chars[blues]' string, then compute its top-most and */ - /* bottom-most points */ + /* 'blue_chars[blues]' string, then compute its top-most or */ + /* bottom-most points (depending on `AH_IS_TOP_BLUE') */ AH_LOG(( "blue zones computation\n" )); AH_LOG(( "------------------------------------------------\n" )); @@ -103,6 +105,7 @@ { const char* p = blue_chars[blue]; const char* limit = p + MAX_TEST_CHARACTERS; + FT_Pos *blue_ref, *blue_shoot; diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 91f3b72b6..85c3b380e 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -996,8 +996,8 @@ /* we do this by inserting fake segments when needed */ if ( dimension == 0 ) { - AH_Point point = outline->points; - AH_Point point_limit = point + outline->num_points; + AH_Point point = outline->points; + AH_Point point_limit = point + outline->num_points; FT_Pos min_pos = 32000; FT_Pos max_pos = -32000; @@ -1067,6 +1067,7 @@ segments = outline->vert_segments; major_dir = AH_DIR_UP; p_num_segments = &outline->num_vsegments; + ah_setup_uv( outline, AH_UV_FXY ); } } @@ -1485,7 +1486,7 @@ edge->dir = up_dir; else if ( ups < downs ) - edge->dir = - up_dir; + edge->dir = -up_dir; else if ( ups == downs ) edge->dir = 0; /* both up and down! */ @@ -1579,7 +1580,7 @@ return; } - /* compute for each horizontal edge, which blue zone is closer */ + /* for each horizontal edge search the blue zone which is closest */ for ( ; edge < edge_limit; edge++ ) { AH_Blue blue; diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index c17baa611..177be4775 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -699,6 +699,10 @@ /* glyph is not an m), so the potential for unwanted distortion is */ /* relatively low. */ + /* We don't handle horizontal edges since we can't easily assure that */ + /* the third (lowest) stem aligns with the base line; it might end up */ + /* one pixel higher or lower. */ + n_edges = edge_limit - edges; if ( !dimension && ( n_edges == 6 || n_edges == 12 ) ) { @@ -1580,7 +1584,7 @@ FT_SubGlyph subglyph; - start_point = gloader->base.outline.n_points; + start_point = gloader->base.outline.n_points; /* first of all, copy the subglyph descriptors in the glyph loader */ error = ah_loader_check_subglyphs( gloader, num_subglyphs ); @@ -1663,8 +1667,8 @@ FT_Vector* p2; - if ( start_point + k >= num_base_points || - l >= (FT_UInt)num_new_points ) + if ( start_point + k >= num_base_points || + l >= (FT_UInt)num_new_points ) { error = AH_Err_Invalid_Composite; goto Exit; @@ -1822,7 +1826,7 @@ /* adust x_scale */ if ( fitted < scaled ) - x_scale -= x_scale/50; /* x_scale*0.98 with integers */ + x_scale -= x_scale / 50; /* x_scale*0.98 with integers */ } } } diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index 947ee6241..c748b6613 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -76,16 +76,6 @@ FT_BEGIN_HEADER #undef AH_OPTION_NO_WEAK_INTERPOLATION - /*************************************************************************/ - /* */ - /* If this option is defined, only weak interpolation will be used to */ - /* place the points between edges. Otherwise, `strong' points are */ - /* detected and later hinted through strong interpolation to correct */ - /* some unpleasant artefacts. */ - /* */ -#undef AH_OPTION_NO_STRONG_INTERPOLATION - - /*************************************************************************/ /* */ /* Undefine this macro if you don't want to hint the metrics. There is */ diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c index 28ffd1a53..6d5aca4d5 100644 --- a/src/pshinter/pshalgo3.c +++ b/src/pshinter/pshalgo3.c @@ -1261,6 +1261,9 @@ PSH3_Point point, before, after; + if ( glyph->contours[n].count == 0 ) + continue; + point = first; before = point; after = point;