Fonttools: Assertion in compiling GPOS table built by feaLib

Created on 14 Apr 2016  Â·  11Comments  Â·  Source: fonttools/fonttools

I’m not sure if this is a feaLib bug, ttLib bug or a bug in my font. I’m getting this assertion error which I suspect is related to table splitting:

Parsing 'GlyphOrder' table...
Parsing 'head' table...
Parsing 'hhea' table...
Parsing 'maxp' table...
Parsing 'OS/2' table...
Parsing 'name' table...
Parsing 'cmap' table...
Parsing 'post' table...
Parsing 'CFF ' table...
Parsing 'BASE' table...
Parsing 'GDEF' table...
Parsing 'GPOS' table...
Parsing 'GSUB' table...
Parsing 'hmtx' table...
Attempting to fix OTLOffsetOverflowError ('GPOS', 'LookupIndex:', 11, 'SubTableIndex:', None, 'ItemName:', None, 'ItemIndex:', None)
Attempting to fix OTLOffsetOverflowError ('GPOS', 'LookupIndex:', 10, 'SubTableIndex:', 1, 'ItemName:', 'Coverage', 'ItemIndex:', None)
Attempting to fix OTLOffsetOverflowError ('GPOS', 'LookupIndex:', 10, 'SubTableIndex:', 1, 'ItemName:', 'Coverage', 'ItemIndex:', None)
Traceback (most recent call last):
  File "/fonttools/Lib/fontTools/ttx.py", line 383, in main
    process(jobs, options)
  File "/fonttools/Lib/fontTools/ttx.py", line 356, in process
    action(input, output, options)
  File "/fonttools/Lib/fontTools/misc/loggingTools.py", line 369, in wrapper
    return func(*args, **kwds)
  File "/fonttools/Lib/fontTools/ttx.py", line 277, in ttCompile
    ttf.save(output)
  File "/fonttools/Lib/fontTools/ttLib/__init__.py", line 216, in save
    self._writeTable(tag, writer, done)
  File "/fonttools/Lib/fontTools/ttLib/__init__.py", line 648, in _writeTable
    tabledata = self.getTableData(tag)
  File "/fonttools/Lib/fontTools/ttLib/__init__.py", line 659, in getTableData
    return self.tables[tag].compile(self)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 90, in compile
    self.table.compile(writer, font)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 660, in compile
    conv.write(writer, font, table, value)
  File "/fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 358, in write
    value.compile(subWriter, font)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 635, in compile
    conv.write(writer, font, table, value, i)
  File "/fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 358, in write
    value.compile(subWriter, font)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 635, in compile
    conv.write(writer, font, table, value, i)
  File "/fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 358, in write
    value.compile(subWriter, font)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 618, in compile
    writer['LookupType'].setValue(self.__class__.LookupType)
  File "/fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 514, in setValue
    assert table[name] == value, (name, table[name], value)
AssertionError: (('LookupType', 9, 2), 'PairPos[2]', 'Lookup[10]', 'LookupList')

When compiling the attached ttx file (which was created by from https://github.com/khaledhosny/mada. I had to save a ttx file since compiling directly was failing with the same assert).
Mada-Light.ttx.zip

bug

Most helpful comment

Ok, took a while to debug. But should be fixed. Please test and report. Thanks!

All 11 comments

Looks like a table splitting issue. I wonder if feaLib should perhaps implement the subtable keyword, at least for kerning tables (like makeotf). Then, users could work around such bugs in the automatic table splitting code. @behdad, what do you think?

Implementing the subtable keyword is fine with me. It just should not be required...

I'll try to debug this later this week.

Any progress on this front? We are also hitting this issue here.
Maybe, in the short term, we could have the forced subtable break statement implemented, and then also work towards making the compiler smarter so the user doesn't need to do it manually?

AssertionError: (('LookupType', 9, 2), 'PairPos[2]', 'Lookup[10]', 'LookupList')

Humm. This means that one of the subtables were upgraded to Extension, but not other ones in the same lookup. That's wrong. Let me reproduce and try a fix.

Khaled: I cloned mada. How do I reproduce?

Ah, didn't see the attached ttx. Thanks. Also, mada has no BUILD file :). I did have luck running fontmake -m on it after modifying the designspace file.

The build is “evolving” as I move things away from FontForge, but there is a Makefile so you just do make :) (the thing is needlessly complicated as I need to merge the Latin font in before I compile the UFO. it would have nice if pyftmerge supported CFF table, I would have then generated each font separately then merged them, I wouldn’t even hit the current bug if I did it that way).

Ok, took a while to debug. But should be fixed. Please test and report. Thanks!

Thank you Behdad! It seems to be working now 👏

Was this page helpful?
0 / 5 - 0 ratings