#45 TT glyph programs get mangled

Feature request
closed-fixed
TrueType (18)
5
2013-06-22
2012-01-02
Jens Kutilek
No

When you disassemble and assemble TrueType instruction with fontTools, under some circumstances the code gets mangled and thus the TT instructions become invalid.

When I go from the font to XML and back via ttx, everything works fine.

But when I disassemble and assemble the program from a glyph like this:

glyf = font["glyf"]
for name in glyf.keys():
glyph = glyf[name]
if hasattr(glyph, "program"):
asm = glyph.program.getAssembly()
p = fontTools.ttLib.tables.ttProgram.Program()
p.fromAssembly(asm)
glyph.program = p

and save the font and dump it to XML again, the effect is that the white space between consecutive numerical values is stripped:

PUSHW[ ] /* 2 values pushed */
33 14
MIAP[0]

turns into:

PUSHW[ ] /* 1 values pushed */
3314
MIAP[0]

which not the expected result ;)

Likewise the test at the end of ttProgram.py returns False, which I think is also not intended.

Discussion

  • Jens Kutilek
    Jens Kutilek
    2012-01-02

    A code snippet that will trigger the bug, depending on the actual TT instructions

     
    Attachments
  • fixed in revision 606, which is in the delft-sprint-2012 branch, so I'll leave this open for now.

     
    • status: open --> open-fixed
     
  • Paul Wise
    Paul Wise
    2013-06-22

    • status: open-fixed --> closed-fixed
    • assigned_to: Just van Rossum
    • Group: --> Feature request
     
  • Paul Wise
    Paul Wise
    2013-06-22

    Fixed in SVN trunk.