shithub: freetype+ttf2subf

Download patch

ref: 335528e11e690fb38042d7edcda209d500c05d3c
parent: c168cc3b1bf13e5f3ca77c238dcb204ea821c56d
author: Ben Wagner <[email protected]>
date: Fri Sep 21 07:26:37 EDT 2018

Improve auto-hinter handling of bitmap fonts (#54681).

For bitmap fonts, `FT_Load_Glyph' should either return an error or
not set the format to `FT_GLYPH_FORMAT_OUTLINE'.  However, in this
case `FT_Load_Glyph' calls into the auto-hinter which calls back
into `FT_Load_Glyph' with `FT_LOAD_NO_SCALE' in the flags, which
marks the glyph as `FT_GLYPH_FORMAT_OUTLINE' with an empty path
(even though it doesn't have any path).  It appears that the
auto-hinter should not be called when the face doesn't have
outlines.  The current test for using the auto-hinter in
`FT_Load_Glyph' checks if the driver supports scalable outlines, but
not if the face supports scalable outlines.

* src/base/ftobjs.c (FT_Load_Glyph): Directly check whether we have
scalable outlines.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2018-09-21  Ben Wagner  <[email protected]>
+
+	Improve auto-hinter handling of bitmap fonts (#54681).
+
+	For bitmap fonts, `FT_Load_Glyph' should either return an error or
+	not set the format to `FT_GLYPH_FORMAT_OUTLINE'.  However, in this
+	case `FT_Load_Glyph' calls into the auto-hinter which calls back
+	into `FT_Load_Glyph' with `FT_LOAD_NO_SCALE' in the flags, which
+	marks the glyph as `FT_GLYPH_FORMAT_OUTLINE' with an empty path
+	(even though it doesn't have any path).  It appears that the
+	auto-hinter should not be called when the face doesn't have
+	outlines.  The current test for using the auto-hinter in
+	`FT_Load_Glyph' checks whether the driver supports scalable
+	outlines, but not if the face supports scalable outlines.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Directly check whether we have
+	scalable outlines.
+
 2018-09-21  Werner Lemberg  <[email protected]>
 
 	[raster] Fix disappearing vertical lines (#54589).
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -846,7 +846,7 @@
      * - Do only auto-hinting if we have
      *
      *   - a hinter module,
-     *   - a scalable font format dealing with outlines,
+     *   - a scalable font,
      *   - not a tricky font, and
      *   - no transforms except simple slants and/or rotations by
      *     integer multiples of 90 degrees.
@@ -864,8 +864,7 @@
     if ( hinter                                           &&
          !( load_flags & FT_LOAD_NO_HINTING )             &&
          !( load_flags & FT_LOAD_NO_AUTOHINT )            &&
-         FT_DRIVER_IS_SCALABLE( driver )                  &&
-         FT_DRIVER_USES_OUTLINES( driver )                &&
+         FT_IS_SCALABLE( face )                           &&
          !FT_IS_TRICKY( face )                            &&
          ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM )    ||
            ( face->internal->transform_matrix.yx == 0 &&