bugThe FreeType Project - Bugs: bug #37182, Autohinting causes glyphs to...


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

bug #37182: Autohinting causes glyphs to overflow the bounding box

Submitted by:  Nicolas George <Cigaes>
Submitted on:  Fri 24 Aug 2012 04:32:29 PM UTC  
Severity:  3 - Normal Item Group:  Incorrect behaviour
Status:  Invalid Privacy:  Public
Assigned to:  Werner LEMBERG <wl> Open/Closed:  Closed
Planned Release:  None

Sun 26 Aug 2012 12:47:25 PM UTC, comment #3: 

No, this is not a bug in the font.  It is a `feature' of the auto-hinter that hinted glyphs can be larger by than the vertical space spanned up by the font's descent and ascent value, contrary to manual TT hints.  The auto-hinting results would be much worse otherwise.

IMHO, the vertical distance between lines in xterm (this is, the baseline-to-baseline distance) should be made configurable.  Additionally, xterm shouldn't cut off data which is below or above the descent and ascent values, respectively.

I would really like to hear the opinion of the xterm maintainers.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Sat 25 Aug 2012 06:19:21 PM UTC, comment #2: 

Indeed, that is convincing. Would you say the bug is in the font?

This is annoying because xterm, and possibly other programs, use the descent and ascent value to the letter. When autohinting is enabled, the underscore is completely invisible.

Thanks for looking into this. I had not realized that ftgrid could toggle the various rendering modes.

Nicolas George <Cigaes>
Sat 25 Aug 2012 01:40:30 PM UTC, comment #1: 

This is not a bug but expected behaviour.


  ftgrid -f 66 19 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

then press the `h' key repeatedly to disable and enable TT hinting.  Now press the `f' key, then again the `h' repeatedly to disable and enable auto-hinting.

It's easy to see that the auto-hinter's handling of the underscore is much nearer to the original shape's form and position than the manually added TT hints, which artificially make it far thicker.

Because at 19ppem the auto-hinter has decided to increase the x-height slightly to make it fit an integer, stuff below the baseline gets moved away from the baseline also.  This is the very reason that the lower horizontal edge of the underscore (which is originally almost exactly between two grid lines) gets moved down and not up.

Fortunately, FreeType doesn't cut off outlines which extend the ascender and descender values (contrary to Windows), so I don't see a big problem here.

Can you provide a documentation patch for freetype.h (or whereever you think it is appropriate) which better explains the issue?

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Fri 24 Aug 2012 04:32:29 PM UTC, original submission:  

With certain fonts at certain sizes, autohinting causes glyphs to overflow the ascent-descent boundaries, or oven to be completely outside of it.

For example, with DejaVuSansMono.ttf at pixel size 19, the underscore:

ftdump /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
EM size:         2048
descent:         -483

Which gives at size 19: descent =~ -4.48 =~ -4.

ftgrid -f 66 19 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

Shows the underscore by default between -2 and -4 vertically.

ftdiff -s 19 -f underscore.txt /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

Shows that the autohinted underscore is just one pixel thick and between -4 and -5.

Nicolas George <Cigaes>


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 Cigaes (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-08-25 wl StatusNone => Invalid
        Assigned toNone => wl
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.7