[cffLib]: add clear() method to Index class to empty in-place

This commit is contained in:
Cosimo Lupo 2019-02-07 01:58:22 +01:00
parent 97006a0d67
commit 8e8da97a4c
2 changed files with 4 additions and 3 deletions

View File

@ -607,6 +607,9 @@ class Index(object):
def getCompiler(self, strings, parent, isCFF2=None):
return self.compilerClass(self, strings, parent, isCFF2=isCFF2)
def clear(self):
del self.items[:]
class GlobalSubrsIndex(Index):

View File

@ -470,9 +470,7 @@ def desubroutinize(self):
del pd.Subrs
if 'Subrs' in pd.rawDict:
del pd.rawDict['Subrs']
# clear GlobalSubrsIndex
if cff.GlobalSubrs:
cff.GlobalSubrs.items = []
cff.GlobalSubrs.clear()
@_add_method(ttLib.getTableClass('CFF '))