コード例 #1
0
def test_roundtrip():
    if sys.platform != "darwin":
        pytest.skip("Needs to be run on OS X")
    font = Babelfont.open("tests/data/Test1.glyphs")
    Babelfont.save(font, "tests/data/Test1.roundtrip.glyphs")
    pl1_json = subprocess.run(
        ["plutil", "-convert", "xml1", "-o", "-", "tests/data/Test1.glyphs"],
        capture_output=True,
    )
    pl2_json = subprocess.run(
        [
            "plutil", "-convert", "xml1", "-o", "-",
            "tests/data/Test1.roundtrip.glyphs"
        ],
        capture_output=True,
    )
    pl1 = plistlib.load(BytesIO(pl1_json.stdout))
    pl2 = plistlib.load(BytesIO(pl2_json.stdout))
    assert pl1 == pl2
コード例 #2
0
def test_ufo_roundtrip():
    font = Babelfont.open("tests/data/Test1.ufo")
    Babelfont.save(font, "tests/data/Test1.roundtrip.ufo")
    dc1 = defcon.Font("tests/data/Test1.ufo")
    dc2 = defcon.Font("tests/data/Test1.roundtrip.ufo")
    assert dc1.getDataForSerialization() == dc2.getDataForSerialization()
コード例 #3
0
 def _save(self, path=None, **kwargs):
     if not path:
         path = self._path
     if not path:
         raise ValueError
     Babelfont.save(self, path)
コード例 #4
0
def test_ufo_to_glyphs():
    font = Babelfont.open("tests/data/Test1.ufo")
    Babelfont.save(font, "tests/data/Test1-from-ufo.glyphs")
コード例 #5
0
def test_glyphs_to_ufo():
    font = Babelfont.open("tests/data/Test1.glyphs")
    Babelfont.save(font, "tests/data/Test1-from-glyphs.ufo")