compreffor icon indicating copy to clipboard operation
compreffor copied to clipboard

Desubroutinize if needed

Open roozbehp opened this issue 9 years ago • 3 comments

For example, running it on Noto's third_party/noto_cjk/NotoSansKR-Regular.otf results in:

roozbeh@machine-name:~/compreffor/compreffor$ ./cxxCompressor.py NotoSansKR-Regular.otf 
Warning: There are subrs in NotoSansKR-Regular.otf
Traceback (most recent call last):
  File "./cxxCompressor.py", line 387, in <module>
    main(**kwargs)
  File "./cxxCompressor.py", line 342, in main
    handle_font(filename)
  File "./cxxCompressor.py", line 320, in handle_font
    font.save(out_name)
  File "/home/roozbeh/fonttools/Lib/fontTools/ttLib/__init__.py", line 214, in save
    self._writeTable(tag, writer, done)
  File "/home/roozbeh/fonttools/Lib/fontTools/ttLib/__init__.py", line 629, in _writeTable
    tabledata = self.getTableData(tag)
  File "/home/roozbeh/fonttools/Lib/fontTools/ttLib/__init__.py", line 642, in getTableData
    return self.tables[tag].compile(self)
  File "/home/roozbeh/fonttools/Lib/fontTools/ttLib/tables/C_F_F_.py", line 20, in compile
    self.cff.compile(f, otFont)
  File "/home/roozbeh/fonttools/Lib/fontTools/cffLib.py", line 72, in compile
    for child in topCompiler.getChildren(strings):
  File "/home/roozbeh/fonttools/Lib/fontTools/cffLib.py", line 243, in getChildren
    children.extend(topDict.getChildren(strings))
  File "/home/roozbeh/fonttools/Lib/fontTools/cffLib.py", line 1422, in getChildren
    charStringsComp = CharStringsCompiler(items, strings, self)
  File "/home/roozbeh/fonttools/Lib/fontTools/cffLib.py", line 180, in __init__
    self.items = self.getItems(items, strings)
  File "/home/roozbeh/fonttools/Lib/fontTools/cffLib.py", line 286, in getItems
    cs.compile()
  File "/home/roozbeh/fonttools/Lib/fontTools/misc/psCharStrings.py", line 289, in compile
    "seac"), "illegal CharString"
AssertionError: illegal CharString

roozbehp avatar Jun 02 '15 23:06 roozbehp

Apparently you need to desubroutinize first. Let me see how you can do that.

behdad avatar Jun 02 '15 23:06 behdad

I believe we came up with a patch to fonttools last summer to desubroutinize but I don't think it ever got merged.

On Tue, Jun 2, 2015 at 7:47 PM, Behdad Esfahbod [email protected] wrote:

Apparently you need to desubroutinize first. Let me see how you can do that.

— Reply to this email directly or view it on GitHub https://github.com/googlei18n/compreffor/issues/1#issuecomment-108133777 .

samfishman avatar Jun 03 '15 05:06 samfishman

Ah nice, I didn't see you already linked to it.

samfishman avatar Jun 03 '15 06:06 samfishman