Bug TTX/fonttools: glyph position shifted

Skip to first unread message


Apr 15, 2021, 5:55:10 AM4/15/21
to fonttools

After editing my ttf with TTX I found that the resulting ttf was faulty:
  • Glyphs without nodes on the outer extreme (so it appeared) were shifted to the right
  • Metrics stayed intact
The attached screenshot shows this shift in the glyphs “u” and “U”.
  • Black letters: original ttf
  • Pink letters: ttf generated from TTX (with edited nameIDs)


Screenshot 2021-04-15 at 11.37.47.png

Cosimo Lupo

Apr 15, 2021, 6:18:10 AM4/15/21
to supertype.de, fonttools
You say your font contains glyphs without nodes at the outer extreme. 
Can you try to compile your edited ttx file using the -b option and see if that makes any difference?

From ttx --help:
> -b     Don't recalc glyph bounding boxes: use the values in the TTX file as-is.

How was the original TTF built? Did you build with fontmake? Or did you export the source from a font editor? If so which one?

You received this message because you are subscribed to the Google Groups "fonttools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fonttools+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fonttools/a3b44aa7-7433-4a26-9899-9bdf11861527n%40googlegroups.com.


Apr 15, 2021, 6:59:07 AM4/15/21
to fonttools
Hi Cosimo,

The -b does work, thanks.

Font was generated with with RoboFont 3.5

I was not aware that I have to set a an option for TTX to not do this. From my perspective that seems counter intuitive for there a so many cases where this can go wrong. Using TTX with any font with rounded corners for example would cause many unwanted shifts of glyphs unless -b is set. I do remember discussions about how to calculate the bounding box but I was not aware that it would be desirable to automatically change anything in a font that works, that could potentially cause such flawed results. What is the advantage?


Paul van der Laan

Apr 15, 2021, 7:14:11 AM4/15/21
to supertype.de, fonttools
Another strategy:

Whenever I need to edit particular data with TTX I always dump the table in question only:
$ ttx -t name myfont.ttf

After editing I can merge that table back into the font using:
$ ttx -m myfont.ttf nametable.ttx

That way only the table in question will be (de)compiled and nothing else.


Cosimo Lupo

Apr 15, 2021, 7:30:13 AM4/15/21
to Paul van der Laan, supertype.de, fonttools
Could you file an issue over at http://github.com/fonttools/fonttools with a minimal test font that reproduces this?
thank you

Cosimo Lupo

Apr 15, 2021, 7:32:20 AM4/15/21
to Paul van der Laan, supertype.de, fonttools
It might be that the way Robofont and FontTools calculate the glyf bounding boxes is different in the case of glyphs without nodes at extrema, but this is just a guess

Martin Wenzel

Apr 15, 2021, 10:46:06 AM4/15/21
to Cosimo Lupo, Paul van der Laan, supertype.de, fonttools
Cosimo, Paul,

Thanks for your feedback, much appreciated.


Martin Wenzel +49 1520 3545 006
instagram @supertype.de

Reply all
Reply to author
0 new messages