question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ttx] AttributeError "isCFF2" from T2CharString when dumping CFF2 toXML()

See original GitHub issue

Dumping “SourceSerifVariable-Roman.otf” with ttx yields an AttributeError from T2CharString.toXML method:

$ ttx ~/Downloads/SourceSerifVariable-Roman.otf 
Dumping "/home/clupo/Downloads/SourceSerifVariable-Roman.otf" to "/home/clupo/Downloads/SourceSerifVariable-Roman.ttx"...
Dumping 'GlyphOrder' table...
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'maxp' table...
Dumping 'OS/2' table...
Dumping 'hmtx' table...
Dumping 'cmap' table...
Dumping 'name' table...
Dumping 'post' table...
Dumping 'BASE' table...
Dumping 'CFF2' table...
ERROR: Unhandled exception has occurred
Traceback (most recent call last):
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttx.py", line 398, in main
    process(jobs, options)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttx.py", line 372, in process
    action(input, output, options)
  File "/home/clupo/Github/fonttools/Lib/fontTools/misc/loggingTools.py", line 375, in wrapper
    return func(*args, **kwds)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttx.py", line 269, in ttDump
    newlinestr=options.newlinestr)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttLib/ttFont.py", line 228, in saveXML
    self._saveXML(writer, **kwargs)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttLib/ttFont.py", line 283, in _saveXML
    self._tableToXML(tableWriter, tag, splitGlyphs=splitGlyphs)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttLib/ttFont.py", line 314, in _tableToXML
    table.toXML(writer, self)
  File "/home/clupo/Github/fonttools/Lib/fontTools/ttLib/tables/C_F_F_.py", line 42, in toXML
    self.cff.toXML(writer)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 156, in toXML
    font.toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 2330, in toXML
    BaseDict.toXML(self, xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 2272, in toXML
    conv.xmlWrite(xmlWriter, name, value)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 1175, in xmlWrite
    value.toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 722, in toXML
    self[i].toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 2272, in toXML
    conv.xmlWrite(xmlWriter, name, value)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 1175, in xmlWrite
    value.toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 2272, in toXML
    conv.xmlWrite(xmlWriter, name, value)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 1175, in xmlWrite
    value.toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/cffLib/__init__.py", line 652, in toXML
    subr.toXML(xmlWriter)
  File "/home/clupo/Github/fonttools/Lib/fontTools/misc/psCharStrings.py", line 1091, in toXML
    if self.isCFF2:
AttributeError: 'T2CharString' object has no attribute 'isCFF2'

If we need to parametrize the toXML method depending on whether isCFF2 or not, then we need to have an extra isCFF2=False parameter in the top-level CFFFontSet class, and set that to True from the table_C_F_F__2.toXML

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
justvanrossumcommented, Jan 17, 2019

Found it, making PR.

0reactions
anthrotypecommented, Jan 17, 2019

Fixed by #1456

Read more comments on GitHub >

github_iconTop Results From Across the Web

[CFF2] 'T2CharString' object has no attribute 'isCFF2' · Issue #1479 ...
Dumping 'CFF2' table... ERROR: Unhandled exception has occurred Traceback (most recent call last): File "fontTools/ttx.py", line 398, in main pro...
Read more >
Source code for fontTools.cffLib
This module parses both original CFF and CFF2. """ from fontTools.misc import sstruct ... offSize)) if not isCFF2: fontNames = Index() for name...
Read more >
Diff - 79019a0^! - platform/external/fonttools - Git at Google
In both cases, they are not CFF2 charstrings - isCFF2 = False - else: - isCFF2 ... diff --git a/Lib/fontTools/ttx.py b/Lib/fontTools/ttx.py index ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found