diff options
author | David Turner <david@freetype.org> | 2002-09-08 21:29:11 +0000 |
---|---|---|
committer | David Turner <david@freetype.org> | 2002-09-08 21:29:11 +0000 |
commit | 00d9f40cf7ec068286792eb352971cd7ed53fc73 (patch) | |
tree | adb026e18205aa16d56610af8b816348416c8614 /src/autohint | |
parent | 6b5c669b7b300ef3dea4ad956885d0d5f5a25920 (diff) | |
download | freetype2-00d9f40cf7ec068286792eb352971cd7ed53fc73.tar.gz |
* src/smooth/ftsmooth.c, src/base/ftobjs.c,
include/freetype/config/ftmodule.h: updated to correctly support
sub-pixel rendering
* include/freetype/cache/ftcimage.h, include/freetype/cache/ftcsbits.h,
src/cache/ftcimage.c, src/cache/ftcsbit.c: updated to support sub-pixel
rendering correctly. Definition of FTC_ImageTypeRec that replaces the
obsolete FTC_ImageDesc, and has slightly different fields. The
image type is now determined directly by "load_flags" values.
* src/autohint/ahtypes.h, src/autohint/ahhint.c,
src/pshinter/pshalgo3.c, src/pshinter/pshalgo3.h: various enhancements
to the automatic and Postscript hinters !! and sub-pixel hinting now
works correctly (see demo programs)
Diffstat (limited to 'src/autohint')
-rw-r--r-- | src/autohint/ahhint.c | 58 | ||||
-rw-r--r-- | src/autohint/ahtypes.h | 8 |
2 files changed, 33 insertions, 33 deletions
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 7e967afc1..14981122d 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -104,42 +104,42 @@ sign = 1; } - if ( ( vertical && hinter->no_vert_snapping ) || - ( !vertical && hinter->no_horz_snapping ) ) + if ( ( vertical && !hinter->do_vert_snapping ) || + ( !vertical && !hinter->do_horz_snapping ) ) { /* smooth hinting process, very lightly quantize the stem width */ /* */ if ( dist < 64 ) dist = 64; - + { FT_Pos delta = dist - globals->stds[vertical]; - - + + if ( delta < 0 ) delta = -delta; - + if ( delta < 40 ) { dist = globals->stds[vertical]; - if ( dist < 32 ) - dist = 32; + if ( dist < 48 ) + dist = 48; } - + if ( dist < 3 * 64 ) { delta = ( dist & 63 ); dist &= -64; - + if ( delta < 10 ) dist += delta; - + else if ( delta < 32 ) dist += 10; - + else if ( delta < 54 ) dist += 54; - + else dist += delta; } @@ -154,7 +154,7 @@ if ( vertical ) { dist = ah_snap_width( globals->heights, globals->num_heights, dist ); - + /* in the case of vertical hinting, always round */ /* the stem heights to integer pixels */ if ( dist >= 64 ) @@ -165,7 +165,7 @@ else { dist = ah_snap_width( globals->widths, globals->num_widths, dist ); - + if ( hinter->flags & AH_HINTER_MONOCHROME ) { /* monochrome horizontal hinting: snap widths to integer pixels */ @@ -182,7 +182,7 @@ /* is between 1 and 2 pixels to an integer, otherwise nothing */ if ( dist < 48 ) dist = ( dist + 64 ) >> 1; - + else if ( dist < 128 ) dist = ( dist + 22 ) & -64; else @@ -285,10 +285,10 @@ int has_serifs = 0; - if ( hinter->no_horz_hints && !dimension ) + if ( !hinter->do_horz_hints && !dimension ) goto Next_Dimension; - if ( hinter->no_vert_hints && dimension ) + if ( !hinter->do_vert_hints && dimension ) goto Next_Dimension; /* we begin by aligning all stems relative to the blue zone */ @@ -1169,7 +1169,7 @@ /* perform feature detection */ ah_outline_detect_features( outline ); - if ( !hinter->no_vert_hints ) + if ( hinter->do_vert_hints ) { ah_outline_compute_blue_edges( outline, hinter->globals ); ah_outline_scale_blue_edges( outline, hinter->globals ); @@ -1439,23 +1439,23 @@ ah_loader_rewind( hinter->loader ); /* reset hinting flags according to load flags and current render target */ - hinter->no_horz_hints = FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT ); - hinter->no_vert_hints = FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT ); - + hinter->do_horz_hints = !FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT ); + hinter->do_vert_hints = !FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT ); + #ifdef DEBUG_HINTER - hinter->no_horz_hints = ah_debug_disable_vert; /* not a bug, the meaning */ - hinter->no_vert_hints = ah_debug_disable_horz; /* of h/v is inverted! */ -#endif + hinter->do_horz_hints = !ah_debug_disable_vert; /* not a bug, the meaning */ + hinter->do_vert_hints = !ah_debug_disable_horz; /* of h/v is inverted! */ +#endif /* we snap the width of vertical stems for the monochrome and */ /* horizontal LCD rendering targets only. Corresponds to X snapping. */ - hinter->no_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_NORMAL || - hint_mode == FT_RENDER_MODE_LCD_V ); + hinter->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO || + hint_mode == FT_RENDER_MODE_LCD ); /* we snap the width of horizontal stems for the monochrome and */ /* vertical LCD rendering targets only. Corresponds to Y snapping. */ - hinter->no_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_NORMAL || - hint_mode == FT_RENDER_MODE_LCD ); + hinter->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO || + hint_mode == FT_RENDER_MODE_LCD_V ); #if 1 load_flags = FT_LOAD_NO_SCALE diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index c967975aa..a893e8421 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -492,10 +492,10 @@ FT_BEGIN_HEADER FT_Vector trans_delta; FT_Matrix trans_matrix; - FT_Bool no_horz_hints; /* disable X hinting */ - FT_Bool no_vert_hints; /* disable Y hinting */ - FT_Bool no_horz_snapping; /* disable X stem size snapping */ - FT_Bool no_vert_snapping; /* disable Y stem size snapping */ + FT_Bool do_horz_hints; /* disable X hinting */ + FT_Bool do_vert_hints; /* disable Y hinting */ + FT_Bool do_horz_snapping; /* disable X stem size snapping */ + FT_Bool do_vert_snapping; /* disable Y stem size snapping */ } AH_HinterRec, *AH_Hinter; |