diff --git a/ChangeLog b/ChangeLog index 503b7641c..cb83ca874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-02-27 Werner Lemberg + + Add AF_CONFIG_OPTION_USE_WARPER to control the autofit warper. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_USE_WARPER): New macro. + * src/autofit/aftypes.h (AF_USE_WARPER): Remove. + + * src/autofit/*: s/AF_USE_WARPER/AF_CONFIG_OPTION_USE_WARPER/. + + * src/autofit/afwarp.c [!AF_CONFIG_OPTION_USE_WARPER]: Replace dummy + variable assignment with a typedef. + 2011-02-26 Werner Lemberg [autofit] Slight simplifications. diff --git a/devel/ftoption.h b/devel/ftoption.h index 11a9bcf32..871dfe619 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -4,8 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -692,6 +691,19 @@ FT_BEGIN_HEADER /* */ #define AF_CONFIG_OPTION_INDIC + /*************************************************************************/ + /* */ + /* Compile autofit module with warp hinting. The idea of the warping */ + /* code is to slightly scale and shift a glyph within a single dimension */ + /* so that as much of its segments are aligned (more or less) on the */ + /* grid. To find out the optimal scaling and shifting value, various */ + /* parameter combinations are tried and scored. */ + /* */ + /* This experimental option is only active if the render mode is */ + /* FT_RENDER_MODE_LIGHT. */ + /* */ +#define AF_CONFIG_OPTION_USE_WARPER + /* */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 1ab6e1e4b..79b6036fd 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -4,8 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -692,6 +691,19 @@ FT_BEGIN_HEADER /* */ #define AF_CONFIG_OPTION_INDIC + /*************************************************************************/ + /* */ + /* Compile autofit module with warp hinting. The idea of the warping */ + /* code is to slightly scale and shift a glyph within a single dimension */ + /* so that as much of its segments are aligned (more or less) on the */ + /* grid. To find out the optimal scaling and shifting value, various */ + /* parameter combinations are tried and scored. */ + /* */ + /* This experimental option is only active if the render mode is */ + /* FT_RENDER_MODE_LIGHT. */ + /* */ +/* #define AF_CONFIG_OPTION_USE_WARPER */ + /* */ diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index f3b1067ed..0fcee4d8a 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (body). */ /* */ -/* Copyright 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2006-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,7 +32,7 @@ #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif @@ -623,7 +623,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; #endif @@ -1397,7 +1397,7 @@ ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) { -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL ) { @@ -1410,7 +1410,7 @@ af_glyph_hints_scale_dim( hints, dim, scale, delta ); continue; } -#endif /* AF_USE_WARPER */ +#endif /* AF_CONFIG_OPTION_USE_WARPER */ af_cjk_hint_edges( hints, (AF_Dimension)dim ); af_cjk_align_edge_points( hints, (AF_Dimension)dim ); diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index a68ce4238..75c2c3312 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -1150,7 +1150,7 @@ } -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER /* Apply (small) warp scale and warp delta for given dimension. */ @@ -1177,6 +1177,6 @@ } } -#endif /* AF_USE_WARPER */ +#endif /* AF_CONFIG_OPTION_USE_WARPER */ /* END */ diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index f3cf81917..5d5fedaa0 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -440,7 +440,7 @@ FT_BEGIN_HEADER af_glyph_hints_align_weak_points( AF_GlyphHints hints, AF_Dimension dim ); -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER FT_LOCAL( void ) af_glyph_hints_scale_dim( AF_GlyphHints hints, AF_Dimension dim, diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c index 1d9e9eafb..488d546ce 100644 --- a/src/autofit/afindic.c +++ b/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic scripts (body). */ /* */ -/* Copyright 2007 by */ +/* Copyright 2007, 2011 by */ /* Rahul Bhalerao , . */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,7 +27,7 @@ #include "afcjk.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 310af8d52..116c6c551 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -23,7 +23,7 @@ #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif @@ -1428,7 +1428,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#if 0 /* #ifdef AF_USE_WARPER */ +#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; @@ -2174,7 +2174,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || AF_HINTS_DO_HORIZONTAL( hints ) ) #else @@ -2198,7 +2198,7 @@ /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) { diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 55a05bdef..6011fded0 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -23,7 +23,7 @@ #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif @@ -1472,7 +1472,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#if 0 /* #ifdef AF_USE_WARPER */ +#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; @@ -2269,7 +2269,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || AF_HINTS_DO_HORIZONTAL( hints ) ) #else @@ -2293,7 +2293,7 @@ /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) { diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index 755e30bf1..23753ff0e 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -53,7 +53,6 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ -#define xxAF_USE_WARPER /* only define to use warp hinting */ #define xxAF_DEBUG #ifdef AF_DEBUG diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c index 801ff3122..67f936a65 100644 --- a/src/autofit/afwarp.c +++ b/src/autofit/afwarp.c @@ -25,7 +25,7 @@ #include "afwarp.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ /* values around a half pixel (which means exactly between two grid */ @@ -354,10 +354,11 @@ } } -#else /* !AF_USE_WARPER */ +#else /* !AF_CONFIG_OPTION_USE_WARPER */ - char af_warper_dummy = 0; /* make compiler happy */ + /* ANSI C doesn't like empty source files */ + typedef int _af_warp_dummy; -#endif /* !AF_USE_WARPER */ +#endif /* !AF_CONFIG_OPTION_USE_WARPER */ /* END */ diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c index 83b613e79..bda2ab086 100644 --- a/src/autofit/autofit.c +++ b/src/autofit/autofit.c @@ -34,7 +34,7 @@ #include "afloader.c" #include "afmodule.c" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.c" #endif