Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by default. * src/autofit/afloader.c (af_loader_load_glyph): Use AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code.
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
diff --git a/ChangeLog b/ChangeLog
index 4e2e717..1aae6ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-27 Werner Lemberg <wl@gnu.org>
+
+ Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option.
+
+ * include/freetype/config/ftoption.h
+ (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by
+ default.
+
+ * src/autofit/afloader.c (af_loader_load_glyph): Use
+ AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code.
+
2017-04-26 Werner Lemberg <wl@gnu.org>
* include/freetype/freetype.h (FT_Render_Mode): Fix order.
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index ff393a8..69d30a4 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -886,7 +886,9 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* Compile autofit module with Indic script support. */
+ /* Compile autofit module with fallback Indic script support, covering */
+ /* some scripts that the `latin' submodule of the autofit module doesn't */
+ /* (yet) handle. */
/* */
#define AF_CONFIG_OPTION_INDIC
@@ -905,6 +907,22 @@ FT_BEGIN_HEADER
/* */
#define AF_CONFIG_OPTION_USE_WARPER
+ /*************************************************************************/
+ /* */
+ /* Use TrueType-like size metrics for `light' auto-hinting. This option */
+ /* exists mainly for backwards compatibility with GNU/Linux */
+ /* distributions like Fedora that did not un-patch the following change */
+ /* (which was present in FreeType between versions 2.4.6 and 2.7.1, */
+ /* inclusive). */
+ /* */
+ /* 2011-07-16 Steven Chu <steven.f.chu@gmail.com> */
+ /* */
+ /* [truetype] Fix metrics on size request for scalable fonts. */
+ /* */
+ /* This problematic commit is now reverted (more or less). */
+ /* */
+/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */
+
/* */
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index e309100..2094382 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2933,27 +2933,34 @@ FT_BEGIN_HEADER
* rendering. For monochrome output, use @FT_LOAD_TARGET_MONO
* instead.
*
- * FT_LOAD_TARGET_LIGHT ::
- * A lighter hinting algorithm for gray-level modes. Many generated
+ * FT_LOAD_TARGET_SLIGHT ::
+ * A slight hinting algorithm for gray-level modes. Many generated
* glyphs are fuzzier but better resemble their original shape. This
* is achieved by snapping glyphs to the pixel grid only vertically
- * (Y-axis), as is done by Microsoft's ClearType and Adobe's
- * proprietary font renderer. This preserves inter-glyph spacing in
+ * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's
+ * ClearType font renderer. This preserves inter-glyph spacing in
* horizontal text. The snapping is done either by the native font
* driver, if the driver itself and the font support it, or by the
* auto-hinter.
*
- * Use this hinting mode if you mainly need integer advance widths
- * and want to avoid sub-pixel rendering.
+ * Advance widths are not rounded to integer values; instead, metrics
+ * are based on linearly scaled values. In particular this implies
+ * that you have to apply sub-pixel rendering.
*
- * FT_LOAD_TARGET_SLIGHT ::
- * This is similar to @FT_LOAD_TARGET_LIGHT with a main difference:
- * Advance widths are not rounded to integer values; instead, the
- * linearly scaled values are used. In particular this implies that
- * you have to apply sub-pixel rendering.
- *
- * In general, this mode yields better results than
- * @FT_LOAD_TARGET_LIGHT.
+ * FT_LOAD_TARGET_LIGHT ::
+ * This is similar to @FT_LOAD_TARGET_SLIGHT with a main difference:
+ * It uses integer advance widths.
+ *
+ * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active,
+ * TrueType-like metrics are used to make this mode behave similarly
+ * as in unpatched FreeType versions between 2.4.6 and 2.7.1
+ * (inclusive).
+ *
+ * This hinting mode is deprecated. In general,
+ * @FT_LOAD_TARGET_SLIGHT always yields better results; additionally,
+ * FT_LOAD_TARGET_LIGHT suffers from backwards compatibility issues
+ * (see the documentation of AF_CONFIG_OPTION_TT_SIZE_METRICS in
+ * `ftoption.h' for more details).
*
* FT_LOAD_TARGET_MONO ::
* Strong hinting algorithm that should only be used for monochrome
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index d90c217..b3269d1 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -252,6 +252,7 @@
size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags );
size_internal->autohint_metrics = size->metrics;
+#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS
if ( size_internal->autohint_mode != FT_RENDER_MODE_SLIGHT )
{
FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics;
@@ -278,6 +279,7 @@
FT_MulFix( face->max_advance_width,
size_metrics->x_scale ) );
}
+#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */
}
/*