_p_o_s_t.py 文件源码

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

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def decode_format_4_0(self, data, ttFont):
        from fontTools import agl
        numGlyphs = ttFont['maxp'].numGlyphs
        indices = array.array("H")
        indices.fromstring(data)
        if sys.byteorder != "big":
            indices.byteswap()
        # In some older fonts, the size of the post table doesn't match
        # the number of glyphs. Sometimes it's bigger, sometimes smaller.
        self.glyphOrder = glyphOrder = [''] * int(numGlyphs)
        for i in range(min(len(indices),numGlyphs)):
            if indices[i] == 0xFFFF:
                self.glyphOrder[i] = ''
            elif indices[i] in agl.UV2AGL:
                self.glyphOrder[i] = agl.UV2AGL[indices[i]]
            else:
                self.glyphOrder[i] = "uni%04X" % indices[i]
        self.build_psNameMapping(ttFont)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号