ref: 4919dc7cf81eb95737c8d8441303d137dc3a0cd6
parent: f79a7ae0b06de1c33758ff9fad433fa24d8cff4a
author: Werner Lemberg <[email protected]>
date: Wed May 28 01:52:05 EDT 2003
* 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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-28 Werner Lemberg <[email protected]>
+
+ * src/pshinter/pshalgo3.c (psh3_glyph_compute_extrema): Skip
+ contours with only a single point to avoid segfault.
+
+2003-05-24 Werner Lemberg <[email protected]>
+
+ * src/autohint/ahtypes.h (AH_OPTION_NO_STRONG_INTERPOLATION):
+ Removed since unused.
+
2003-05-21 Werner Lemberg <[email protected]>
* include/freetype/config/ftstdlib.h (ft_strcat): New wrapper macro
--- 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;
--- 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;
--- 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 */
}
}
}
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -78,16 +78,6 @@
/*************************************************************************/
/* */
- /* 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 */
/* no reason to do this (at least for non-CJK scripts), except for */
/* experimentation. */
--- 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;