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.
This commit is contained in:
Ben Wagner 2018-09-21 11:26:37 +02:00 committed by Werner Lemberg
parent c168cc3b1b
commit 335528e11e
2 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,21 @@
2018-09-21 Ben Wagner <bungeman@google.com>
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 <wl@gnu.org>
[raster] Fix disappearing vertical lines (#54589).

View File

@ -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 &&