otTables.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号