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: plistlib.dump(metaInfo, f)
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: plistlib.dump(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: plistlib.dump(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: plistlib.dump(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: plistlib.dump(groups, f) # font info fontInfo = { "familyName" : "Test" } path = os.path.join(self.ufoPath, "fontinfo.plist") with open(path, "wb") as f: plistlib.dump(fontInfo, f)
def _writeInfoToPlist(self, info): path = os.path.join(self.dstDir, "fontinfo.plist") with open(path, "wb") as f: plistlib.dump(info, f)
def makeUFO(self, formatVersion): self.clearUFO() if not os.path.exists(self.ufoPath): os.mkdir(self.ufoPath) # glyphs glyphsPath = os.path.join(self.ufoPath, "glyphs") if not os.path.exists(glyphsPath): os.mkdir(glyphsPath) glyphFile = "X_.glif" glyphsContents = dict(X=glyphFile) path = os.path.join(glyphsPath, "contents.plist") with open(path, "wb") as f: plistlib.dump(glyphsContents, f) path = os.path.join(glyphsPath, glyphFile) with open(path, "w") as f: f.write('<?xml version="1.0" encoding="UTF-8"?>\n') # metainfo.plist metaInfo = dict(creator="test", formatVersion=formatVersion) path = os.path.join(self.ufoPath, "metainfo.plist") with open(path, "wb") as f: plistlib.dump(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 }, "X": { "A": 13, "CGroup": 14 } } path = os.path.join(self.ufoPath, "kerning.plist") with open(path, "wb") as f: plistlib.dump(kerning, f) # groups groups = { "BGroup": ["B"], "CGroup": ["C", "Ccedilla"], "DGroup": ["D"], "Not A Kerning Group": ["A"], "X": ["X", "X.sc"] # a group with a name that is also a glyph name } path = os.path.join(self.ufoPath, "groups.plist") with open(path, "wb") as f: plistlib.dump(groups, f) # font info fontInfo = {"familyName": "Test"} path = os.path.join(self.ufoPath, "fontinfo.plist") with open(path, "wb") as f: plistlib.dump(fontInfo, f)