[autofit] Add debugging hook to disable warper. * src/autofit/afmodule.c (_af_debug_disable_warper) [FT_DEBUG_AUTOFIT]: New global variable. * src/autofit/aftypes.h: Updated. (AF_SCALER_FLAG_NO_WARPER): New macro (not actively used yet). * src/autofit/afhints.h (AF_HINTS_DO_WARP): New macro. * src/autofi/aflatin.c (af_latin_hints_apply) [AF_CONFIG_OPTION_USE_WARPER]: Use `AF_HINTS_DO_WARP' to control use of warper. * src/autofit/afcjk.c (af_cjk_hints_init, af_cjk_hints_apply) [AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'. * src/autofit/aflatin2.c (af_latin2_hints_apply) [AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.
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
diff --git a/ChangeLog b/ChangeLog
index ad0c031..8c37e9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2015-04-16 Werner Lemberg <wl@gnu.org>
+
+ [autofit] Add debugging hook to disable warper.
+
+ * src/autofit/afmodule.c (_af_debug_disable_warper)
+ [FT_DEBUG_AUTOFIT]: New global variable.
+
+ * src/autofit/aftypes.h: Updated.
+ (AF_SCALER_FLAG_NO_WARPER): New macro (not actively used yet).
+
+ * src/autofit/afhints.h (AF_HINTS_DO_WARP): New macro.
+
+ * src/autofi/aflatin.c (af_latin_hints_apply)
+ [AF_CONFIG_OPTION_USE_WARPER]: Use `AF_HINTS_DO_WARP' to control use
+ of warper.
+
+ * src/autofit/afcjk.c (af_cjk_hints_init, af_cjk_hints_apply)
+ [AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.
+
+ * src/autofit/aflatin2.c (af_latin2_hints_apply)
+ [AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.
+
2015-04-10 Werner Lemberg <wl@gnu.org>
[cff] Update advance width handling to OpenType 1.7.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 4792c20..31fe2cc 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1301,7 +1301,7 @@
/* compute flags depending on render mode, etc. */
mode = metrics->root.scaler.render_mode;
-#ifdef AF_CONFIG_OPTION_USE_WARPER
+#if 0 /* 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
@@ -2190,7 +2190,13 @@
goto Exit;
/* analyze glyph outline */
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) ) ||
+ AF_HINTS_DO_HORIZONTAL( hints ) )
+#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
+#endif
{
error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ );
if ( error )
@@ -2216,8 +2222,9 @@
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index cfb107d..3a6dc6c 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -387,6 +387,10 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
+#define AF_HINTS_DO_WARP( h ) \
+ ( !_af_debug_disable_warper && \
+ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER ) )
+
#else /* !FT_DEBUG_AUTOFIT */
#define AF_HINTS_DO_HORIZONTAL( h ) \
@@ -400,6 +404,9 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_BLUES( h ) 1
+#define AF_HINTS_DO_WARP( h ) \
+ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_WARPER )
+
#endif /* !FT_DEBUG_AUTOFIT */
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index a6e2541..61d8724 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1996,6 +1996,9 @@
/*
* In `light' hinting mode we disable horizontal hinting completely.
* We also do it if the face is italic.
+ *
+ * However, if warping is enabled (which only works in `light' hinting
+ * mode), advance widths get adjusted, too.
*/
if ( mode == FT_RENDER_MODE_LIGHT ||
( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
@@ -2812,8 +2815,9 @@
/* analyze glyph outline */
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
+ if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) ) ||
+ AF_HINTS_DO_HORIZONTAL( hints ) )
#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
#endif
@@ -2845,7 +2849,8 @@
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT )
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
@@ -2858,7 +2863,7 @@
scale, delta );
continue;
}
-#endif
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index 3e9360d..d23c65a 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -1513,9 +1513,7 @@
#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;
- }
#endif
scaler_flags = hints->scaler_flags;
@@ -2310,8 +2308,9 @@
/* analyze glyph outline */
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
+ if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) ) ||
+ AF_HINTS_DO_HORIZONTAL( hints ) )
#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
#endif
@@ -2334,8 +2333,9 @@
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
@@ -2346,7 +2346,7 @@
af_glyph_hints_scale_dim( hints, dim, scale, delta );
continue;
}
-#endif
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 5b82f66..06b05ce 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -26,6 +26,7 @@
int _af_debug_disable_horz_hints;
int _af_debug_disable_vert_hints;
int _af_debug_disable_blue_hints;
+ int _af_debug_disable_warper;
/* we use a global object instead of a local one for debugging */
AF_GlyphHintsRec _af_debug_hints_rec[1];
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index e105dc8..0a40860 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -59,6 +59,7 @@ FT_BEGIN_HEADER
extern int _af_debug_disable_horz_hints;
extern int _af_debug_disable_vert_hints;
extern int _af_debug_disable_blue_hints;
+extern int _af_debug_disable_warper;
extern void* _af_debug_hints;
#endif /* FT_DEBUG_AUTOFIT */
@@ -170,6 +171,7 @@ extern void* _af_debug_hints;
#define AF_SCALER_FLAG_NO_HORIZONTAL 1U /* disable horizontal hinting */
#define AF_SCALER_FLAG_NO_VERTICAL 2U /* disable vertical hinting */
#define AF_SCALER_FLAG_NO_ADVANCE 4U /* disable advance hinting */
+#define AF_SCALER_FLAG_NO_WARPER 8U /* disable warper */
typedef struct AF_ScalerRec_