test_UFO3.py 文件源码

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

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def testGetGlyphSets(self):
        self.makeUFO()
        # hack contents.plist
        path = os.path.join(self.ufoPath, "glyphs.layer 1", "contents.plist")
        with open(path, "wb") as f:
            writePlist(dict(b="a.glif"), f)
        path = os.path.join(self.ufoPath, "glyphs.layer 2", "contents.plist")
        with open(path, "wb") as f:
            writePlist(dict(c="a.glif"), f)
        # now test
        writer = UFOWriter(self.ufoPath)
        # default
        expected = ["a"]
        result = list(writer.getGlyphSet().keys())
        self.assertEqual(expected, result)
        # layer 1
        expected = ["b"]
        result = list(writer.getGlyphSet("layer 1", defaultLayer=False).keys())
        self.assertEqual(expected, result)
        # layer 2
        expected = ["c"]
        result = list(writer.getGlyphSet("layer 2", defaultLayer=False).keys())
        self.assertEqual(expected, result)

    # make a new font with two layers
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号