varLib.merger: use dict comprehension and zip iterator

This commit is contained in:
Cosimo Lupo 2019-06-18 16:30:24 +01:00
parent 93b303ffd3
commit 4e4f37aa21
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -816,10 +816,10 @@ def merge(merger, self, lst):
glyphs = singlePosTable.Coverage.glyphs
# We know that singlePosTable is Format 2, as this is set
# in _Lookup_SinglePos_subtables_flatten.
recs = singlePosTable.Value
numRecs = len(recs)
recList = [ (glyphs[i], recs[i]) for i in range(numRecs)]
singlePosMapping = {gname: valRecord for gname, valRecord in recList}
singlePosMapping = {
gname: valRecord
for gname, valRecord in zip(glyphs, singlePosTable.Value)
}
self.SubTable = buildSinglePos(singlePosMapping, merger.font.getReverseGlyphMap())
merger.mergeObjects(self, lst, exclude=['SubTable', 'SubTableCount'])