Formatting.

This commit is contained in:
Werner Lemberg 2002-08-22 08:49:42 +00:00
parent ec810f8c6a
commit edbcbde703
6 changed files with 81 additions and 65 deletions

View File

@ -6,26 +6,36 @@
2002-08-21 David Turner <david@freetype.org> 2002-08-21 David Turner <david@freetype.org>
* src/pshinter/pshalgo3.c, src/autohint/ahangles.c, The automatic and Postscript hinter now automatically detect
src/autohint/ahangles.h, src/autohint/ahglyph.c, src/autohint/ahhint.c, inflection points in glyph outlines and treats them specially. This
src/autohint/ahtypes.h: the automatic and Postscript hinter now is very useful to prevent nasty effect like the disappearing
automatically detect inflection points in glyph outlines and treats diagonals of "S" and "s" in many, many fonts.
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/autohint/ahtypes.h (ah_flag_inflection): New macro.
src/tools/docmaker/tohtml.py: updating the DocMaker tool * 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 * src/tools/docmaker/docmaker.py, src/tools/docmaker/utils.py,
of the "load_flags" parameter of FT_Load_Glyph and FT_Load_Char from src/tools/docmaker/tohtml.py: Updating the DocMaker tool.
"FT_Int" to "FT_Int32", this in order to support more options.
this should only break binary and/or source compatibility on * include/freetype/freetype.h: Changing the type of the "load_flags"
16-bit platforms (Atari?) 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/pshinter/pshalgo3.c, src/base/ftobjs.c, src/base/ftobject.c, * src/base/ftobjs.c (FT_Load_Glyph): Updated.
src/autohint/ahglyph.c, include/freetype/freetype.h: fixing typos Handle FT_LOAD_NO_AUTOHINT.
and removing compiler warnings (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 <wl@gnu.org> 2002-08-20 Werner Lemberg <wl@gnu.org>

View File

@ -1908,9 +1908,9 @@ FT_BEGIN_HEADER
/* *not* the values in `face.glyph.metrics'. */ /* *not* the values in `face.glyph.metrics'. */
/* */ /* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Load_Glyph( FT_Face face, FT_Load_Glyph( FT_Face face,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Int32 load_flags ); FT_Int32 load_flags );
/*************************************************************************/ /*************************************************************************/
@ -1968,7 +1968,7 @@ FT_BEGIN_HEADER
/* the vector outline being loaded should not be scaled to 26.6 */ /* the vector outline being loaded should not be scaled to 26.6 */
/* fractional pixels, but kept in notional units. */ /* 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. */ /* 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 */ /* Note that by default, @FT_Load_Glyph loads the glyph image in its */
/* native format. */ /* 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 */ /* bitmaps of scalable formats, as the native glyph image will be */
/* loaded, and can then be rendered through @FT_Render_Glyph. */ /* 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 */ /* advance width), and that the glyph image will translated to match */
/* the vertical bearings positions. */ /* 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 */ /* the function should try to auto-hint the glyphs, even if a driver */
/* specific hinter is available. */ /* 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 */ /* space around its black bits) when loading it. For now, this */
/* really only works with embedded bitmaps in TrueType fonts. */ /* 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 */ /* error. Otherwise, errors are ignored by the loader, sometimes */
/* resulting in ugly glyphs. */ /* 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 */ /* X-TrueType font server, in order to deal correctly with the */
/* incorrect metrics contained in DynaLab's TrueType CJK fonts. */ /* 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. */ /* 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 */ /* the glyph loader should not try to transform the loaded glyph */
/* image. */ /* 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 */ /* glyph loader to use `ft_render_mode_mono' when calling */
/* @FT_Render_Glyph. */ /* @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 */ /* the function should return the linearly scaled metrics expressed */
/* in original font units, instead of the default 16.16 pixel values. */ /* 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! */ /* temporary hack! */
#define FT_LOAD_SBITS_ONLY 16384 #define FT_LOAD_SBITS_ONLY 0x4000
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -2163,20 +2165,21 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A bit field constant, used with @FT_Load_Glyph to indicate that */ /* 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 */ /* certain fonts where un-hinted output is better than auto-hinted */
/* one. */ /* one. */
/* */ /* */
/* Note that this will _not_ prevent a native hinter to be run */ /* Note that this will _not_ prevent a native hinter to be run */
/* when available (i.e. for Postscript fonts, or for TrueType ones */ /* 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 */ /* If you want to completely disable hinting, use @FT_LOAD_NO_HINTING */
/* instead. */ /* 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 */ /* embedded bitmaps are favored over outlines, vectors are always */
/* scaled and grid-fitted. */ /* scaled and grid-fitted. */
/* */ /* */
#define FT_LOAD_DEFAULT 0 #define FT_LOAD_DEFAULT 0x0
/*************************************************************************/ /*************************************************************************/

View File

@ -133,6 +133,7 @@
{ {
AH_Angle delta; AH_Angle delta;
delta = ( angle2 - angle1 ); delta = ( angle2 - angle1 );
if ( delta < 0 ) if ( delta < 0 )
delta += AH_2PI; delta += AH_2PI;

View File

@ -674,12 +674,14 @@
} }
} }
/* compute all inflex points in a given glyph */
/* compute all inflex points in a given glyph */
static void static void
ah_outline_compute_inflections( AH_Outline* outline ) ah_outline_compute_inflections( AH_Outline* outline )
{ {
AH_Point** contour = outline->contours; AH_Point** contour = outline->contours;
AH_Point** contour_limit = contour + outline->num_contours; AH_Point** contour_limit = contour + outline->num_contours;
/* load original coordinates in (u,v) */ /* load original coordinates in (u,v) */
ah_setup_uv( outline, ah_uv_fxy ); ah_setup_uv( outline, ah_uv_fxy );
@ -698,8 +700,9 @@
AH_Angle diff_in, diff_out; AH_Angle diff_in, diff_out;
FT_Int finished = 0; FT_Int finished = 0;
/* compute first segment in contour */ /* compute first segment in contour */
first = point; first = point;
start = end = first; start = end = first;
do do
@ -707,8 +710,8 @@
end = end->next; end = end->next;
if ( end == first ) if ( end == first )
goto Skip; 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.x = end->u - start->u;
vec.y = end->v - start->v; vec.y = end->v - start->v;
@ -724,14 +727,14 @@
before = before->prev; before = before->prev;
if ( before == first ) if ( before == first )
goto Skip; 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.x = start->u - before->u;
vec.y = start->v - before->v; vec.y = start->v - before->v;
angle_in = ah_angle( &vec ); angle_in = ah_angle( &vec );
}
while ( angle_in == angle_seg ); } while ( angle_in == angle_seg );
first = start; first = start;
diff_in = ah_angle_diff( angle_in, angle_seg ); diff_in = ah_angle_diff( angle_in, angle_seg );
@ -749,14 +752,14 @@
after = after->next; after = after->next;
if ( after == first ) if ( after == first )
finished = 1; 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.x = after->u - end->u;
vec.y = after->v - end->v; vec.y = after->v - end->v;
angle_out = ah_angle( &vec ); angle_out = ah_angle( &vec );
}
while ( angle_out == angle_seg ); } while ( angle_out == angle_seg );
diff_out = ah_angle_diff( angle_seg, angle_out ); diff_out = ah_angle_diff( angle_seg, angle_out );
@ -769,8 +772,8 @@
{ {
start->flags |= ah_flag_inflection; start->flags |= ah_flag_inflection;
start = start->next; start = start->next;
}
while ( start != end ); } while ( start != end );
start->flags |= ah_flag_inflection; start->flags |= ah_flag_inflection;
} }
@ -779,8 +782,8 @@
end = after; end = after;
angle_seg = angle_out; angle_seg = angle_out;
diff_in = diff_out; diff_in = diff_out;
}
while ( !finished ); } while ( !finished );
Skip: Skip:
; ;
@ -788,7 +791,6 @@
} }
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
ah_outline_compute_segments( AH_Outline* outline ) ah_outline_compute_segments( AH_Outline* outline )
{ {
@ -1401,9 +1403,9 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
ah_outline_detect_features( AH_Outline* outline ) ah_outline_detect_features( AH_Outline* outline )
{ {
ah_outline_compute_segments( outline ); ah_outline_compute_segments ( outline );
ah_outline_link_segments ( outline ); ah_outline_link_segments ( outline );
ah_outline_compute_edges ( outline ); ah_outline_compute_edges ( outline );
ah_outline_compute_inflections( outline ); ah_outline_compute_inflections( outline );
} }

View File

@ -612,8 +612,8 @@
#ifndef AH_OPTION_NO_WEAK_INTERPOLATION #ifndef AH_OPTION_NO_WEAK_INTERPOLATION
/* if this point is candidate to weak interpolation, we will */ /* if this point is candidate to weak interpolation, we will */
/* interpolate it after all strong points have been processed */ /* interpolate it after all strong points have been processed */
if ( (point->flags & ah_flag_weak_interpolation) && if ( ( point->flags & ah_flag_weak_interpolation ) &&
!(point->flags & ah_flag_inflection) ) !( point->flags & ah_flag_inflection ) )
continue; continue;
#endif #endif

View File

@ -1438,7 +1438,7 @@
continue; continue;
if ( !psh3_point_is_extremum( point ) && if ( !psh3_point_is_extremum( point ) &&
!psh3_point_is_inflection( point ) ) !psh3_point_is_inflex( point ) )
continue; continue;
point->flags &= ~PSH3_POINT_SMOOTH; point->flags &= ~PSH3_POINT_SMOOTH;