diff --git a/ChangeLog b/ChangeLog index 7345a46f2..45f527f25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,26 +6,36 @@ 2002-08-21 David Turner - * src/pshinter/pshalgo3.c, src/autohint/ahangles.c, - src/autohint/ahangles.h, src/autohint/ahglyph.c, src/autohint/ahhint.c, - src/autohint/ahtypes.h: the automatic and Postscript hinter now - automatically detect inflection points in glyph outlines and treats - them specially. This is very useful to prevent nasty effect like the - disappearing diagonals of "S" and "s" in many, many fonts.. + The automatic and Postscript hinter now automatically detect + inflection points in glyph outlines and treats them specially. This + is very useful to prevent nasty effect like the disappearing + diagonals of "S" and "s" in many, many fonts. - * src/tools/docmaker/docmaker.py, src/tools/docmaker/utils.py, - src/tools/docmaker/tohtml.py: updating the DocMaker tool + * src/autohint/ahtypes.h (ah_flag_inflection): New macro. + * src/autohint/ahangles.c (ah_angle_diff): New function. + * src/autohint/ahangles.h: Updated. + * src/autohint/ahglyph.c (ah_outline_compute_inflections): New + function. + (ah_outline_detect_features): Use it. + * src/autohint/ahhint.c (ah_hinter_align_strong_points) + [!AH_OPTION_NO_WEAK_INTERPOLATION]: Handle inflection. - * include/freetype/freetype.h, src/base/ftobjs.c: changing the type - of the "load_flags" parameter of FT_Load_Glyph and FT_Load_Char from - "FT_Int" to "FT_Int32", this in order to support more options. - - this should only break binary and/or source compatibility on - 16-bit platforms (Atari?) + * src/tools/docmaker/docmaker.py, src/tools/docmaker/utils.py, + src/tools/docmaker/tohtml.py: Updating the DocMaker tool. - * src/pshinter/pshalgo3.c, src/base/ftobjs.c, src/base/ftobject.c, - src/autohint/ahglyph.c, include/freetype/freetype.h: fixing typos - and removing compiler warnings + * include/freetype/freetype.h: Changing the type of the "load_flags" + parameter from "FT_Int" to "FT_Int32", this in order to support more + options. This should only break binary and/or source compatibility + on 16-bit platforms (Atari?). + (FT_LOAD_NO_AUTOHINT): New macro. + + * src/base/ftobjs.c (FT_Load_Glyph): Updated. + Handle FT_LOAD_NO_AUTOHINT. + (FT_Load_Char): Updated. + + * src/pshinter/pshalgo3.c, src/base/ftobjs.c, src/base/ftobject.c, + src/autohint/ahglyph.c, include/freetype/freetype.h: Fixing typos + and removing compiler warnings. 2002-08-20 Werner Lemberg diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 6293a01c4..aa1acd102 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1908,9 +1908,9 @@ FT_BEGIN_HEADER /* *not* the values in `face.glyph.metrics'. */ /* */ FT_EXPORT( FT_Error ) - FT_Load_Glyph( FT_Face face, - FT_UInt glyph_index, - FT_Int32 load_flags ); + FT_Load_Glyph( FT_Face face, + FT_UInt glyph_index, + FT_Int32 load_flags ); /*************************************************************************/ @@ -1968,7 +1968,7 @@ FT_BEGIN_HEADER /* the vector outline being loaded should not be scaled to 26.6 */ /* fractional pixels, but kept in notional units. */ /* */ -#define FT_LOAD_NO_SCALE 1 +#define FT_LOAD_NO_SCALE 0x1 /*************************************************************************/ @@ -1983,7 +1983,7 @@ FT_BEGIN_HEADER /* */ /* This flag is ignored if FT_LOAD_NO_SCALE is set. */ /* */ -#define FT_LOAD_NO_HINTING 2 +#define FT_LOAD_NO_HINTING 0x2 /*************************************************************************/ @@ -1999,7 +1999,7 @@ FT_BEGIN_HEADER /* Note that by default, @FT_Load_Glyph loads the glyph image in its */ /* native format. */ /* */ -#define FT_LOAD_RENDER 4 +#define FT_LOAD_RENDER 0x4 /*************************************************************************/ @@ -2014,7 +2014,7 @@ FT_BEGIN_HEADER /* bitmaps of scalable formats, as the native glyph image will be */ /* loaded, and can then be rendered through @FT_Render_Glyph. */ /* */ -#define FT_LOAD_NO_BITMAP 8 +#define FT_LOAD_NO_BITMAP 0x8 /*************************************************************************/ @@ -2030,7 +2030,7 @@ FT_BEGIN_HEADER /* advance width), and that the glyph image will translated to match */ /* the vertical bearings positions. */ /* */ -#define FT_LOAD_VERTICAL_LAYOUT 16 +#define FT_LOAD_VERTICAL_LAYOUT 0x10 /*************************************************************************/ @@ -2043,9 +2043,9 @@ FT_BEGIN_HEADER /* the function should try to auto-hint the glyphs, even if a driver */ /* specific hinter is available. */ /* */ - /* Note that it is ignored if @FT_LOAD_NO_AUTOHINT is also set */ + /* Note that it is ignored if @FT_LOAD_NO_AUTOHINT is also set. */ /* */ -#define FT_LOAD_FORCE_AUTOHINT 32 +#define FT_LOAD_FORCE_AUTOHINT 0x20 /*************************************************************************/ @@ -2059,7 +2059,7 @@ FT_BEGIN_HEADER /* space around its black bits) when loading it. For now, this */ /* really only works with embedded bitmaps in TrueType fonts. */ /* */ -#define FT_LOAD_CROP_BITMAP 64 +#define FT_LOAD_CROP_BITMAP 0x40 /*************************************************************************/ @@ -2075,7 +2075,7 @@ FT_BEGIN_HEADER /* error. Otherwise, errors are ignored by the loader, sometimes */ /* resulting in ugly glyphs. */ /* */ -#define FT_LOAD_PEDANTIC 128 +#define FT_LOAD_PEDANTIC 0x80 /*************************************************************************/ @@ -2090,7 +2090,7 @@ FT_BEGIN_HEADER /* X-TrueType font server, in order to deal correctly with the */ /* incorrect metrics contained in DynaLab's TrueType CJK fonts. */ /* */ -#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 512 +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200 /*************************************************************************/ @@ -2111,7 +2111,7 @@ FT_BEGIN_HEADER /* */ /* Note that the flag forces the load of unscaled glyphs. */ /* */ -#define FT_LOAD_NO_RECURSE 1024 +#define FT_LOAD_NO_RECURSE 0x400 /*************************************************************************/ @@ -2124,7 +2124,7 @@ FT_BEGIN_HEADER /* the glyph loader should not try to transform the loaded glyph */ /* image. */ /* */ -#define FT_LOAD_IGNORE_TRANSFORM 2048 +#define FT_LOAD_IGNORE_TRANSFORM 0x800 /*************************************************************************/ @@ -2138,7 +2138,7 @@ FT_BEGIN_HEADER /* glyph loader to use `ft_render_mode_mono' when calling */ /* @FT_Render_Glyph. */ /* */ -#define FT_LOAD_MONOCHROME 4096 +#define FT_LOAD_MONOCHROME 0x1000 /*************************************************************************/ @@ -2151,10 +2151,12 @@ FT_BEGIN_HEADER /* the function should return the linearly scaled metrics expressed */ /* in original font units, instead of the default 16.16 pixel values. */ /* */ -#define FT_LOAD_LINEAR_DESIGN 8192 +#define FT_LOAD_LINEAR_DESIGN 0x2000 + /* temporary hack! */ -#define FT_LOAD_SBITS_ONLY 16384 +#define FT_LOAD_SBITS_ONLY 0x4000 + /*************************************************************************/ /* */ @@ -2163,20 +2165,21 @@ FT_BEGIN_HEADER /* */ /* */ /* A bit field constant, used with @FT_Load_Glyph to indicate that */ - /* the auto-hinter should never be run. This can be important for */ + /* the auto-hinter should never be run. This can be important for */ /* certain fonts where un-hinted output is better than auto-hinted */ /* one. */ /* */ /* Note that this will _not_ prevent a native hinter to be run */ /* when available (i.e. for Postscript fonts, or for TrueType ones */ - /* when the bytecode interpreter was compiled in) */ + /* when the bytecode interpreter was compiled in). */ /* */ /* If you want to completely disable hinting, use @FT_LOAD_NO_HINTING */ /* instead. */ /* */ - /* The @FT_LOAD_FORCE_AUTOHINT flag will not work if this flag is set */ + /* The @FT_LOAD_FORCE_AUTOHINT flag will not work if this flag is */ + /* set. */ /* */ -#define FT_LOAD_NO_AUTOHINT 32768 +#define FT_LOAD_NO_AUTOHINT 0x8000U /*************************************************************************/ @@ -2190,7 +2193,7 @@ FT_BEGIN_HEADER /* embedded bitmaps are favored over outlines, vectors are always */ /* scaled and grid-fitted. */ /* */ -#define FT_LOAD_DEFAULT 0 +#define FT_LOAD_DEFAULT 0x0 /*************************************************************************/ diff --git a/src/autohint/ahangles.c b/src/autohint/ahangles.c index a4ef84299..ef5a88ee6 100644 --- a/src/autohint/ahangles.c +++ b/src/autohint/ahangles.c @@ -133,6 +133,7 @@ { AH_Angle delta; + delta = ( angle2 - angle1 ); if ( delta < 0 ) delta += AH_2PI; diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 601cf469c..1268ee079 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -674,12 +674,14 @@ } } - /* compute all inflex points in a given glyph */ + + /* compute all inflex points in a given glyph */ static void ah_outline_compute_inflections( AH_Outline* outline ) { - AH_Point** contour = outline->contours; - AH_Point** contour_limit = contour + outline->num_contours; + AH_Point** contour = outline->contours; + AH_Point** contour_limit = contour + outline->num_contours; + /* load original coordinates in (u,v) */ ah_setup_uv( outline, ah_uv_fxy ); @@ -698,8 +700,9 @@ AH_Angle diff_in, diff_out; FT_Int finished = 0; + /* compute first segment in contour */ - first = point; + first = point; start = end = first; do @@ -707,8 +710,8 @@ end = end->next; if ( end == first ) goto Skip; - } - while ( end->u == first->u && end->v == first->v ); + + } while ( end->u == first->u && end->v == first->v ); vec.x = end->u - start->u; vec.y = end->v - start->v; @@ -724,14 +727,14 @@ before = before->prev; if ( before == first ) goto Skip; - } - while ( before->u == start->u && before->v == start->v ); + + } while ( before->u == start->u && before->v == start->v ); vec.x = start->u - before->u; vec.y = start->v - before->v; angle_in = ah_angle( &vec ); - } - while ( angle_in == angle_seg ); + + } while ( angle_in == angle_seg ); first = start; diff_in = ah_angle_diff( angle_in, angle_seg ); @@ -749,14 +752,14 @@ after = after->next; if ( after == first ) finished = 1; - } - while ( end->u == after->u && end->v == after->v ); + + } while ( end->u == after->u && end->v == after->v ); vec.x = after->u - end->u; vec.y = after->v - end->v; angle_out = ah_angle( &vec ); - } - while ( angle_out == angle_seg ); + + } while ( angle_out == angle_seg ); diff_out = ah_angle_diff( angle_seg, angle_out ); @@ -769,8 +772,8 @@ { start->flags |= ah_flag_inflection; start = start->next; - } - while ( start != end ); + + } while ( start != end ); start->flags |= ah_flag_inflection; } @@ -779,8 +782,8 @@ end = after; angle_seg = angle_out; diff_in = diff_out; - } - while ( !finished ); + + } while ( !finished ); Skip: ; @@ -788,7 +791,6 @@ } - FT_LOCAL_DEF( void ) ah_outline_compute_segments( AH_Outline* outline ) { @@ -1401,9 +1403,9 @@ FT_LOCAL_DEF( void ) ah_outline_detect_features( AH_Outline* outline ) { - ah_outline_compute_segments( outline ); - ah_outline_link_segments ( outline ); - ah_outline_compute_edges ( outline ); + ah_outline_compute_segments ( outline ); + ah_outline_link_segments ( outline ); + ah_outline_compute_edges ( outline ); ah_outline_compute_inflections( outline ); } diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 0aa5f2e86..de23d12bb 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -612,8 +612,8 @@ #ifndef AH_OPTION_NO_WEAK_INTERPOLATION /* if this point is candidate to weak interpolation, we will */ /* interpolate it after all strong points have been processed */ - if ( (point->flags & ah_flag_weak_interpolation) && - !(point->flags & ah_flag_inflection) ) + if ( ( point->flags & ah_flag_weak_interpolation ) && + !( point->flags & ah_flag_inflection ) ) continue; #endif diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c index aa7b878ec..4bb495846 100644 --- a/src/pshinter/pshalgo3.c +++ b/src/pshinter/pshalgo3.c @@ -1438,7 +1438,7 @@ continue; if ( !psh3_point_is_extremum( point ) && - !psh3_point_is_inflection( point ) ) + !psh3_point_is_inflex( point ) ) continue; point->flags &= ~PSH3_POINT_SMOOTH;