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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
diff --git a/ChangeLog b/ChangeLog
index 503b764..cb83ca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 11a9bcf..871dfe6 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 1ab6e1e..79b6036 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 f3b1067..0fcee4d 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 a68ce42..75c2c33 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 f3cf819..5d5feda 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 1d9e9ea..488d546 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 <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
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 310af8d..116c6c5 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 55a05bd..6011fde 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 755e30b..23753ff 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 801ff31..67f936a 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 83b613e..bda2ab0 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