summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2017-04-27 13:02:24 +0200
committerWerner Lemberg <wl@gnu.org>2017-04-27 13:02:24 +0200
commit0a5315d141e698253603170595c655132d9baff2 (patch)
tree20bf724626bb3eff493b144d3def664f3771f1cc
parentab10ffcdd55f289fc0d335cf752acbf68edff172 (diff)
downloadfreetype2-0a5315d141e698253603170595c655132d9baff2.tar.gz
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.
-rw-r--r--ChangeLog11
-rw-r--r--include/freetype/config/ftoption.h20
-rw-r--r--include/freetype/freetype.h35
-rw-r--r--src/autofit/afloader.c2
4 files changed, 53 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e2e717d9..1aae6ad8f 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 ff393a87d..69d30a498 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 e30910045..2094382a8 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 d90c217fb..b3269d10b 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 */
}
/*