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.
This commit is contained in:
Werner Lemberg 2011-03-02 03:52:36 +01:00
parent e547a656a5
commit 576fc2c06e
12 changed files with 65 additions and 28 deletions

View File

@ -1,3 +1,16 @@
2011-02-27 Werner Lemberg <wl@gnu.org>
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 <wl@gnu.org>
[autofit] Slight simplifications.

View File

@ -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
/* */

View File

@ -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 */
/* */

View File

@ -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 );

View File

@ -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 */

View File

@ -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,

View File

@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for Indic scripts (body). */
/* */
/* Copyright 2007 by */
/* Copyright 2007, 2011 by */
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
/* */
/* 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

View File

@ -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 )
{

View File

@ -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 ) )
{

View File

@ -53,7 +53,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
#define xxAF_USE_WARPER /* only define to use warp hinting */
#define xxAF_DEBUG
#ifdef AF_DEBUG

View File

@ -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 */

View File

@ -34,7 +34,7 @@
#include "afloader.c"
#include "afmodule.c"
#ifdef AF_USE_WARPER
#ifdef AF_CONFIG_OPTION_USE_WARPER
#include "afwarp.c"
#endif