TypesettingTools / Myaamori-Aegisub-Scripts

Overengineering is my middle name.
MIT License
37 stars 7 forks source link

Font Validator: Error #14

Closed maybecryptic closed 3 years ago

maybecryptic commented 3 years ago

Ran into a random error, not sure what's causing it. but 12/13 episodes worked fine for me. Let me know if you need anymore info.

Fonts Used: A-OTF-GothicMB101Pro-NazoKano.ttf / akbar.TTF / alike.regular.ttf / Baqa.otf / BurstMyBubble.ttf / cameronsans.medium.ttf / CrimsonText-Bold.ttf / FOT Rodin Pro EB.ttf / FOT-HummingStd-Accel-B.ttf / KGTenThousandReasonsAlt.ttf / Klarissa.ttf / Kingthings Clarity1.1.ttf / Raleway-Medium.ttf / Squiggly.ttf / billy.ttf

Error:

Traceback (most recent call last):
  File "Path\To\AppData\Roaming\Python\Python38\Scripts\fontvalidator-script.py", line 11, in <module>
    load_entry_point('fontvalidator==0.0.3', 'console_scripts', 'fontvalidator')()
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontvalidator.py", line 444, in main
    issues = issues or validate_fonts(doc, fonts, args.ignore_drawings, args.warn_fullname_mismatch)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontvalidator.py", line 251, in validate_fonts
    missing = font.missing_glyphs(text)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontvalidator.py", line 137, in missing_glyphs
    if (uniTable := self.font.getBestCmap()):
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontTools\ttLib\ttFont.py", line 695, in getBestCmap
    return self["cmap"].getBestCmap(cmapPreferences=cmapPreferences)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontTools\ttLib\ttFont.py", line 378, in __getitem__
    table = self._readTable(tag)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontTools\ttLib\ttFont.py", line 395, in _readTable
    table.decompile(data, self)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 96, in decompile
    table.decompileHeader(data[offset:offset+int(length)], ttFont)
  File "Path\To\AppData\Roaming\Python\Python38\site-packages\fontTools\ttLib\tables\_c_m_a_p.py", line 179, in decompileHeader
    assert len(data) == length, "corrupt cmap table format %d (data length: %d, header length: %d)" % (format, len(data), length)
AssertionError: corrupt cmap table format 0 (data length: 534, header length: 598)
Myaamori commented 3 years ago

Hi, this probably means that one of your fonts is corrupt or otherwise not well-formed. I'll see about adding more descriptive errors, but for now, try removing fonts from your font folder/list of attached files one at a time to see which one is causing the issue.

Myaamori commented 3 years ago

8239cff3a40e2a5c92fe773609d077881756b467 should give you a more informative warning if a font file couldn't be read properly. I'll close this issue for now. If you believe that the font file in question is actually a valid file, try opening an issue on the fonttools repository instead.

maybecryptic commented 3 years ago

Thanks! So it seems the font Squiggly.zip is causing the issue. It seems to work perfectly fine for me, but I don't really know much about fonts so I'll leave it here for you to decide if I should open an issue in the fonttools repository.

Myaamori commented 3 years ago

Yes, it looks like it's an issue with the actual font. You could run it by the fonttools devs, though it's likely that they'll give you the same response. Doesn't hurt to try, though. Either way there's nothing I can do on my end, unfortunately.

Here's a minimum working example demonstrating the issue:

from fontTools.ttLib import ttFont
font = ttFont.TTFont("Squiggly.ttf")
font.getBestCmap()