Writing an UFO with ufoLib #2887
-
I don’t get exactly how to write an UFO with ufoLib. path = pathlib.Path("whatever.ufo")
writer = UFOWriter(path)
# Add the glyph set
glyphs_path = path / "glyphs"
glyphs_path.mkdir()
gs = GlyphSet(glyphs_path)
# Add a glyph
g = Glyph("myGlyph", gs)
gs.writeGlyph("myGlyph", g)
gs.writeContents() So far, so good, but how do I write the layer info? I'm trying this: gs.writeLayerInfo(["public.default", "glyphs"])
writer.writeLayerContents()
writer.close() This way I end up with an empty layercontents.plist: <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist> ... and the resulting UFO is invalid when trying to open it in RoboFont. If I try to pass something to gs.writeLayerInfo(["public.default", "glyphs"])
writer.writeLayerContents(["public.default", "glyphs"]) ... it complains that
The docs don't say anything about what the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think you need to use |
Beta Was this translation helpful? Give feedback.
I think you need to use
writer.getGlyphSet()