Anybody knows how I can get to the data inside the glyph.lib?
from robofab.world import * f = CurrentFont() for glyph in f: print glyph.lib
Anybody knows how I can get to the data inside the glyph.lib?
from robofab.world import * f = CurrentFont() for glyph in f: print glyph.lib
Yes I did, but that didnât work; I get the following error:
Error in File ~/Library/Application Support/Glyphs/Scripts/objectsGS.py
line 676, in get_lib
return self.object.userData.objectForKey(âorg.robofab.ufoLibâ)
AttributeError: âobjc.native_selectorâ object has no attribute 'objectForKeyâ
The implementation of the RoboFab wrapper and the saving and loading .ufos was not complete. I fixed both.
For now, you can use the Glyphs Python API:
Font = Glyphs.currentDocument.font
Glyph = Font.glyphs["B"]
if Glyph.userData() == None:
Glyph.setUserData_({})
Glyph.userData()["Test"] = "!!!!!!"
print Glyph.userData()["Test"]
Hi Georg,
Thanks for your reply, did you test the script above? It does not save anything to glyph.lib or anywhere in the font as it is only valid in session.
I was not clear about what I wanted but I need to read existing data from Glyph.lib