[ttx] AttributeError "isCFF2" from T2CharString when dumping CFF2 toXML()
See original GitHub issueDumping “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:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found it, making PR.
Fixed by #1456