add custom __init__ in favor of setting .data externally
This commit is contained in:
parent
a0af5727e1
commit
a32a92e6d7
@ -39,6 +39,10 @@ GVAR_HEADER_FORMAT = """
|
|||||||
GVAR_HEADER_SIZE = sstruct.calcsize(GVAR_HEADER_FORMAT)
|
GVAR_HEADER_SIZE = sstruct.calcsize(GVAR_HEADER_FORMAT)
|
||||||
|
|
||||||
class _LazyDict(UserDict):
|
class _LazyDict(UserDict):
|
||||||
|
def __init__(self, data):
|
||||||
|
super().__init__()
|
||||||
|
self.data = data
|
||||||
|
|
||||||
def __getitem__(self, k):
|
def __getitem__(self, k):
|
||||||
v = self.data[k]
|
v = self.data[k]
|
||||||
if callable(v):
|
if callable(v):
|
||||||
@ -120,8 +124,7 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
|
|||||||
for gid in range(self.glyphCount):
|
for gid in range(self.glyphCount):
|
||||||
glyphName = glyphs[gid]
|
glyphName = glyphs[gid]
|
||||||
variations[glyphName] = partial(decompileVarGlyph, glyphName, gid)
|
variations[glyphName] = partial(decompileVarGlyph, glyphName, gid)
|
||||||
self.variations = _LazyDict()
|
self.variations = _LazyDict(variations)
|
||||||
self.variations.data = variations
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def decompileOffsets_(data, tableFormat, glyphCount):
|
def decompileOffsets_(data, tableFormat, glyphCount):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user