subset: fix issue subsetting Context{Subst,Pos}Format3
Fixes https://github.com/fonttools/fonttools/issues/1879 In ChainContext{Subst,Pos}Format3, the array of input coverages is called InputCoverage, whereas in non-Chain Context{Subst,Pos}Format3 subtables it is called simply Coverage.
This commit is contained in:
parent
b81d13952a
commit
890c5061b5
@ -894,6 +894,8 @@ def __subset_classify_context(self):
|
|||||||
self.ClassDef = 'InputClassDef' if Chain else 'ClassDef'
|
self.ClassDef = 'InputClassDef' if Chain else 'ClassDef'
|
||||||
self.ClassDefIndex = 1 if Chain else 0
|
self.ClassDefIndex = 1 if Chain else 0
|
||||||
self.Input = 'Input' if Chain else 'Class'
|
self.Input = 'Input' if Chain else 'Class'
|
||||||
|
elif Format == 3:
|
||||||
|
self.Input = 'InputCoverage' if Chain else 'Coverage'
|
||||||
|
|
||||||
if self.Format not in [1, 2, 3]:
|
if self.Format not in [1, 2, 3]:
|
||||||
return None # Don't shoot the messenger; let it go
|
return None # Don't shoot the messenger; let it go
|
||||||
@ -976,6 +978,7 @@ def closure_glyphs(self, s, cur_glyphs):
|
|||||||
if not all(x.intersect(s.glyphs) for x in c.RuleData(self)):
|
if not all(x.intersect(s.glyphs) for x in c.RuleData(self)):
|
||||||
return []
|
return []
|
||||||
r = self
|
r = self
|
||||||
|
input_coverages = getattr(r, c.Input)
|
||||||
chaos = set()
|
chaos = set()
|
||||||
for ll in getattr(r, c.LookupRecord):
|
for ll in getattr(r, c.LookupRecord):
|
||||||
if not ll: continue
|
if not ll: continue
|
||||||
@ -987,11 +990,11 @@ def closure_glyphs(self, s, cur_glyphs):
|
|||||||
if seqi == 0:
|
if seqi == 0:
|
||||||
pos_glyphs = frozenset(cur_glyphs)
|
pos_glyphs = frozenset(cur_glyphs)
|
||||||
else:
|
else:
|
||||||
pos_glyphs = frozenset(r.InputCoverage[seqi].intersect_glyphs(s.glyphs))
|
pos_glyphs = frozenset(input_coverages[seqi].intersect_glyphs(s.glyphs))
|
||||||
lookup = s.table.LookupList.Lookup[ll.LookupListIndex]
|
lookup = s.table.LookupList.Lookup[ll.LookupListIndex]
|
||||||
chaos.add(seqi)
|
chaos.add(seqi)
|
||||||
if lookup.may_have_non_1to1():
|
if lookup.may_have_non_1to1():
|
||||||
chaos.update(range(seqi, len(r.InputCoverage)+1))
|
chaos.update(range(seqi, len(input_coverages)+1))
|
||||||
lookup.closure_glyphs(s, cur_glyphs=pos_glyphs)
|
lookup.closure_glyphs(s, cur_glyphs=pos_glyphs)
|
||||||
else:
|
else:
|
||||||
assert 0, "unknown format: %s" % self.Format
|
assert 0, "unknown format: %s" % self.Format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user