From fbb9fc1b4787e561711797b9f25e86073250bb82 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Sep 2013 19:00:53 -0400 Subject: [PATCH] [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 --- Lib/fontTools/subset.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Lib/fontTools/subset.py b/Lib/fontTools/subset.py index db4998ddf..d88650a16 100644 --- a/Lib/fontTools/subset.py +++ b/Lib/fontTools/subset.py @@ -1365,19 +1365,6 @@ def prune_post_subset(self, options): self.globalSubrs._used.add(self.operandStack[-1]+self.globalBias) 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(): font = cff[fontname] cs = font.CharStrings @@ -1421,11 +1408,8 @@ def prune_post_subset(self, options): # Renumber subroutines themselves for subrs in all_subrs: if not subrs: continue - decompiler = _NonrecursingT2Decompiler(subrs, font.GlobalSubrs) for i in xrange (subrs.count): if i not in subrs._used: continue - decompiler.reset() - decompiler.execute(subrs[i]) if subrs == font.GlobalSubrs: if not hasattr(font, 'FDSelect') and hasattr(font.Private, 'Subrs'): local_subrs = font.Private.Subrs