freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 335528e: Improve auto-hinter handling of bitmap fonts


From: Werner LEMBERG
Subject: [freetype2] master 335528e: Improve auto-hinter handling of bitmap fonts (#54681).
Date: Fri, 21 Sep 2018 06:13:35 -0400 (EDT)

branch: master
commit 335528e11e690fb38042d7edcda209d500c05d3c
Author: Ben Wagner <address@hidden>
Commit: Werner Lemberg <address@hidden>

    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.
---
 ChangeLog         | 18 ++++++++++++++++++
 src/base/ftobjs.c |  5 ++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b89e838..584f860 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2018-09-21  Ben Wagner  <address@hidden>
+
+       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  <address@hidden>
 
        [raster] Fix disappearing vertical lines (#54589).
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 608c478..34aedbf 100644
--- 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 &&



reply via email to

[Prev in Thread] Current Thread [Next in Thread]