Skip to content

Commit

Permalink
[EBDT/EBLC] Make them work with TTVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Aug 18, 2022
1 parent 18d2d9f commit 2a15c45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Lib/fontTools/ttLib/tables/E_B_D_T_.py
Expand Up @@ -398,12 +398,17 @@ def __getattr__(self, attr):
# Allow lazy decompile.
if attr[:2] == '__':
raise AttributeError(attr)
if not hasattr(self, "data"):
if attr == "data":
raise AttributeError(attr)
self.decompile()
del self.data
return getattr(self, attr)

def ensureDecompiled(self, recurse=False):
if hasattr(self, "data"):
self.decompile()
del self.data

# Not a fan of this but it is needed for safer safety checking.
def getFormat(self):
return safeEval(self.__class__.__name__[len(_bitmapGlyphSubclassPrefix):])
Expand Down
6 changes: 5 additions & 1 deletion Lib/fontTools/ttLib/tables/E_B_L_C_.py
Expand Up @@ -338,11 +338,15 @@ def __getattr__(self, attr):
# Allow lazy decompile.
if attr[:2] == '__':
raise AttributeError(attr)
if not hasattr(self, "data"):
if attr == "data":
raise AttributeError(attr)
self.decompile()
return getattr(self, attr)

def ensureDecompiled(self, recurse=False):
if hasattr(self, "data"):
self.decompile()

# This method just takes care of the indexSubHeader. Implementing subclasses
# should call it to compile the indexSubHeader and then continue compiling
# the remainder of their unique format.
Expand Down

0 comments on commit 2a15c45

Please sign in to comment.