[subset] Remove _NonrecursingT2Decompiler

First, it was wrong because not recursing has implications in hintmasks.

Second, it wasn't needed, because all _used subroutines were already
decompiled anyway.

Fixes this test:

$ pyftsubset SemplicitaPro-Light.otf three
This commit is contained in:
Behdad Esfahbod 2013-09-05 19:00:53 -04:00
parent 9316a90e32
commit fbb9fc1b47

View File

@ -1365,19 +1365,6 @@ def prune_post_subset(self, options):
self.globalSubrs._used.add(self.operandStack[-1]+self.globalBias) self.globalSubrs._used.add(self.operandStack[-1]+self.globalBias)
fontTools.misc.psCharStrings.SimpleT2Decompiler.op_callgsubr(self, index) fontTools.misc.psCharStrings.SimpleT2Decompiler.op_callgsubr(self, index)
class _NonrecursingT2Decompiler(fontTools.misc.psCharStrings.SimpleT2Decompiler):
def __init__(self, localSubrs, globalSubrs):
fontTools.misc.psCharStrings.SimpleT2Decompiler.__init__(self,
localSubrs,
globalSubrs)
def op_callsubr(self, index):
self.pop()
def op_callgsubr(self, index):
self.pop()
for fontname in cff.keys(): for fontname in cff.keys():
font = cff[fontname] font = cff[fontname]
cs = font.CharStrings cs = font.CharStrings
@ -1421,11 +1408,8 @@ def prune_post_subset(self, options):
# Renumber subroutines themselves # Renumber subroutines themselves
for subrs in all_subrs: for subrs in all_subrs:
if not subrs: continue if not subrs: continue
decompiler = _NonrecursingT2Decompiler(subrs, font.GlobalSubrs)
for i in xrange (subrs.count): for i in xrange (subrs.count):
if i not in subrs._used: continue if i not in subrs._used: continue
decompiler.reset()
decompiler.execute(subrs[i])
if subrs == font.GlobalSubrs: if subrs == font.GlobalSubrs:
if not hasattr(font, 'FDSelect') and hasattr(font.Private, 'Subrs'): if not hasattr(font, 'FDSelect') and hasattr(font.Private, 'Subrs'):
local_subrs = font.Private.Subrs local_subrs = font.Private.Subrs