def postRead(self, rawTable, font):
mapping = {}
input = _getGlyphsFromCoverageTable(rawTable["Coverage"])
lenMapping = len(input)
if self.Format == 1:
delta = rawTable["DeltaGlyphID"]
inputGIDS = [ font.getGlyphID(name) for name in input ]
outGIDS = [ (glyphID + delta) % 65536 for glyphID in inputGIDS ]
outNames = [ font.getGlyphName(glyphID) for glyphID in outGIDS ]
list(map(operator.setitem, [mapping]*lenMapping, input, outNames))
elif self.Format == 2:
assert len(input) == rawTable["GlyphCount"], \
"invalid SingleSubstFormat2 table"
subst = rawTable["Substitute"]
list(map(operator.setitem, [mapping]*lenMapping, input, subst))
else:
assert 0, "unknown format: %s" % self.Format
self.mapping = mapping
评论列表
文章目录