bugThe FreeType Project - Bugs: bug #54681, FT_Load_Glyph and autohinter...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #54681: FT_Load_Glyph and autohinter create empty outline glyph when there is no outline.

Submitter:  bungeman <bungeman>
Submitted:  Tue 18 Sep 2018 05:50:59 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.10.0

Fri 21 Sep 2018 10:14:24 AM UTC, comment #1: 

You reasoning sounds sensible, I've thus applied your patch, thanks!

Werner LEMBERG <wl>
Group administrator
Tue 18 Sep 2018 05:50:59 PM UTC, original submission:  

While investigating an issue I ended up with some test code something like


FT_Face face = ... // a CBDT or sbix font
FT_UInt glyphId = ... // a glyph in 'face'
FT_Int32 flags = FT_LOAD_NO_BITMAP | FT_LOAD_COLOR | FT_LOAD_FORCE_AUTOHINT;
FT_Error err = FT_Load_Glyph(face, glyphId, flags);

assert(err || face->glyph->format != FT_GLYPH_FORMAT_OUTLINE);


It is expected that the assert would not fire since it is assumed that FT_Load_Glyph on a CBDT font 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 autohinter 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 autohinter should not be called when the face doesn't have outlines. The current test for using the autohinter in FT_Load_Glyph checks if the driver supports scalable outlines, but not if the face supports scalable outlines. As a result, I propose the following patch


diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index f3d82992b..ec2af8d76 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -857,8 +857,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 &&


bungeman <bungeman>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by bungeman (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-21 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.10.0

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code