* src/autofit/aftypes.h, src/autofit/afhints.h, src/autofit/afmodule.c: adding support for disabling horizontal and vertical hinting for the purpose of debugging the auto-fitter
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
diff --git a/ChangeLog b/ChangeLog
index 0651c50..0bbf93a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-26 David Turner <david@freetype.org>
+
+ * src/autofit/aftypes.h, src/autofit/afhints.h,
+ src/autofit/afmodule.c: adding support for disabling
+ horizontal and vertical hinting for the purpose of debugging
+ the auto-fitter
+
2006-09-18 Garrick Meeker <garrick@digitalanarchy.com>
* src/base/ftmac.c (FT_New_Face_From_FOND): Fall back to SFNT if
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index cb27b8f..45cf513 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -213,6 +213,17 @@ FT_BEGIN_HEADER
#define AF_HINTS_TEST_SCALER( h, f ) ( (h)->scaler_flags & (f) )
#define AF_HINTS_TEST_OTHER( h, f ) ( (h)->other_flags & (f) )
+#ifdef AF_DEBUG
+#define AF_HINTS_DO_HORIZONTAL( h ) \
+ ( !_af_debug_disable_horz_hints && !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) )
+
+#define AF_HINTS_DO_VERTICAL( h ) \
+ ( !_af_debug_disable_vert_hints && !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) )
+
+#define AF_HINTS_DO_ADVANCE( h ) \
+ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
+
+#else /* !AF_DEBUG */
#define AF_HINTS_DO_HORIZONTAL( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL )
@@ -222,6 +233,7 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
+#endif /* !AF_DEBUG */
FT_LOCAL( AF_Direction )
af_direction_compute( FT_Pos dx,
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index ee6bc1a..c94ee87 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -19,6 +19,11 @@
#include "afmodule.h"
#include "afloader.h"
+#ifdef AF_DEBUG
+ int _af_debug_disable_horz_hints;
+ int _af_debug_disable_vert_hints;
+#endif
+
#include FT_INTERNAL_OBJECTS_H
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 078bc82..5ab78d3 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -54,19 +54,21 @@ FT_BEGIN_HEADER
/*************************************************************************/
#define xxAF_USE_WARPER /* only define to use warp hinting */
-#define xxAF_DEBUG
+#define AF_DEBUG
#ifdef AF_DEBUG
-#include <stdio.h>
+# include <stdio.h>
+# define AF_LOG( x ) printf x
-#define AF_LOG( x ) printf x
+extern int _af_debug_disable_horz_hints;
+extern int _af_debug_disable_vert_hints;
-#else
+#else /* !AF_DEBUG */
-#define AF_LOG( x ) do ; while ( 0 ) /* nothing */
+# define AF_LOG( x ) do ; while ( 0 ) /* nothing */
-#endif /* AF_DEBUG */
+#endif /* !AF_DEBUG */
/*************************************************************************/
@@ -149,7 +151,7 @@ FT_BEGIN_HEADER
FT_Pos y_out );
/*
- * Return -1, 0, or +1, depending on the orientation of a given corner.
+ * Return -1, 0, or +1, depending on the orientation of a given corner.
* We use the Cartesian coordinate system, with positive vertical values
* going upwards. The function returns +1 when the corner turns to the
* left, -1 to the right, and 0 for undecided.