def setUp(self): self.dstDir = tempfile.mktemp() os.mkdir(self.dstDir) metaInfo = {"creator": "test", "formatVersion": 1} path = os.path.join(self.dstDir, "metainfo.plist") with open(path, "wb") as f: writePlist(metaInfo, f)
def test_writePlist_to_file(tmpdir, pl_no_builtin_types): testpath = tmpdir / "test.plist" with testpath.open("wb") as fp: plistlib.writePlist(pl_no_builtin_types, fp) with testpath.open("rb") as fp: pl2 = plistlib.load(fp, use_builtin_types=False) assert pl2 == pl_no_builtin_types
def setUp(self): self.dstDir = tempfile.mktemp() os.mkdir(self.dstDir) metaInfo = { "creator": "test", "formatVersion": 1 } path = os.path.join(self.dstDir, "metainfo.plist") with open(path, "wb") as f: writePlist(metaInfo, f)
def makeUFO(self, formatVersion): self.clearUFO() if not os.path.exists(self.ufoPath): os.mkdir(self.ufoPath) # metainfo.plist metaInfo = dict(creator="test", formatVersion=formatVersion) path = os.path.join(self.ufoPath, "metainfo.plist") with open(path, "wb") as f: writePlist(metaInfo, f) # kerning kerning = { "A": {"A": 1, "B": 2, "CGroup": 3, "DGroup": 4}, "BGroup": {"A": 5, "B": 6, "CGroup": 7, "DGroup": 8}, "CGroup": {"A": 9, "B": 10, "CGroup": 11, "DGroup": 12}, } path = os.path.join(self.ufoPath, "kerning.plist") with open(path, "wb") as f: writePlist(kerning, f) # groups groups = {"BGroup": ["B"], "CGroup": ["C", "Ccedilla"], "DGroup": ["D"], "Not A Kerning Group": ["A"]} path = os.path.join(self.ufoPath, "groups.plist") with open(path, "wb") as f: writePlist(groups, f) # font info fontInfo = {"familyName": "Test"} path = os.path.join(self.ufoPath, "fontinfo.plist") with open(path, "wb") as f: writePlist(fontInfo, f)
def makeUFO(self, formatVersion): self.clearUFO() if not os.path.exists(self.ufoPath): os.mkdir(self.ufoPath) # metainfo.plist metaInfo = dict(creator="test", formatVersion=formatVersion) path = os.path.join(self.ufoPath, "metainfo.plist") with open(path, "wb") as f: writePlist(metaInfo, f) # kerning kerning = { "A": { "A": 1, "B": 2, "CGroup": 3, "DGroup": 4 }, "BGroup": { "A": 5, "B": 6, "CGroup": 7, "DGroup": 8 }, "CGroup": { "A": 9, "B": 10, "CGroup": 11, "DGroup": 12 } } path = os.path.join(self.ufoPath, "kerning.plist") with open(path, "wb") as f: writePlist(kerning, f) # groups groups = { "BGroup": ["B"], "CGroup": ["C", "Ccedilla"], "DGroup": ["D"], "Not A Kerning Group": ["A"] } path = os.path.join(self.ufoPath, "groups.plist") with open(path, "wb") as f: writePlist(groups, f) # font info fontInfo = {"familyName": "Test"} path = os.path.join(self.ufoPath, "fontinfo.plist") with open(path, "wb") as f: writePlist(fontInfo, f)
def _writeInfoToPlist(self, info): path = os.path.join(self.dstDir, "fontinfo.plist") with open(path, "wb") as f: writePlist(info, f)