ref: 58f48f0ddcff3eec125e8a72bfc14e41c9da7c6f
parent: 792db0b9a9d60c32f18ba7df58ba5395348ab650
author: Werner Lemberg <[email protected]>
date: Thu Apr 16 16:11:49 EDT 2015
[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'.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2015-04-16 Werner Lemberg <[email protected]>
+
+ [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 <[email protected]>
[cff] Update advance width handling to OpenType 1.7.
--- 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;
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -387,6 +387,10 @@
#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 ) \
@@ -399,6 +403,9 @@
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
#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 */
--- 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 ) ) )
--- 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 ) ) )
--- 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];
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -59,6 +59,7 @@
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 @@
#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_