googlefonts / shaperglot

Test font files for language support
Apache License 2.0
29 stars 4 forks source link

Struct error when trying to run the bulk script on the entire GF library #15

Closed NeilSureshPatel closed 1 year ago

NeilSureshPatel commented 1 year ago

I attempted to run `bulk-sg-run.py' on the full GF library and the process quit with the following stack trace after processing a number of fonts. I am not sure if it is related to a specific font or not.

analyzing fontsfull/novamono/NovaMono.ttf
analyzing fontsfull/yomogi/Yomogi-Regular.ttf
analyzing fontsfull/assistant/Assistant[wght].ttf
analyzing fontsfull/notosanselbasan/NotoSansElbasan-Regular.ttf
analyzing fontsfull/fasterone/FasterOne-Regular.ttf
analyzing fontsfull/notoseriflao/NotoSerifLao[wdth,wght].ttf
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/home/neilspatel/Shaperglot/shaperglot-env/bulk-sg-run.py", line 116, in check_one
    results_for_font[tag] = checker.check(gflangs[item])
  File "/home/neilspatel/.local/lib/python3.9/site-packages/shaperglot/checker.py", line 58, in check
    skip_reason = check_object.should_skip(self)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/shaperglot/checks/common.py", line 86, in should_skip
    checker.ttfont.get(table)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/ttFont.py", line 455, in get
    return self[tag]
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/ttFont.py", line 406, in __getitem__
    table = self._readTable(tag)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/ttFont.py", line 423, in _readTable
    table.decompile(data, self)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/tables/otBase.py", line 77, in decompile
    self.table.decompile(reader, font)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/tables/otBase.py", line 908, in decompile
    table[conv.name] = conv.read(reader, font, table)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/tables/otConverters.py", line 479, in read
    value = reader.readLong()
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/tables/otBase.py", line 288, in readLong
    return self.readValue("i", staticSize=4)
  File "/home/neilspatel/.local/lib/python3.9/site-packages/fontTools/ttLib/tables/otBase.py", line 266, in readValue
    value, = struct.unpack(f">{typecode}", self.data[pos:newpos])
struct.error: ('unpack requires a buffer of 4 bytes', 'Version')
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/neilspatel/Shaperglot/shaperglot-env/bulk-sg-run.py", line 169, in <module>
    main()
  File "/home/neilspatel/Shaperglot/shaperglot-env/bulk-sg-run.py", line 146, in main
    all_font_results = p.starmap(check_one, args)
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
struct.error: ('unpack requires a buffer of 4 bytes', 'Version')
[1]+  Killed                  python bulk-sg-run.py ./fonts/
NeilSureshPatel commented 1 year ago

This may no longer be an issue. After making the changes in 910aeda9f0f62187d690eecb9214eda250b177bf, I don't get this error anymore. It may have been related to my resource issue.