Can't open UFO: ValueError
Hi Robofont forum!
I'm new to the game so this might be a very basic question:
I'm trying to open a .UFO font exported from Glyphs but Robofont won't accept its format. The error displayed in output is:
Can't open UFO: ValueError Invalid value ('1') for attribute postscriptBlueFuzz.
Can anybody help me understand what the problem is here?
Thanks in advance!
He Morula Type!!!
the UFO has a string (text) entry for the
postscriptBlueFuzzinfo value. Which is not allowed. This value must be a
This is not good, where did you get the UFO from?
run this inside RoboFont to get it fixed!
from fontParts.ui import GetFile # get the path to the file path = GetFile() print("fixing ufo:", path) # import the ufo reader/writer from fontTools.ufoLib import UFOReaderWriter # create a dummy simple info class to store the info class SimpleInfo(dict): def __setattr__(self, key, value): self[key] = value def __getattr__(self, key): return self.get(key, None) # if we have a path if path: # read the ufo, but dont validate reader = UFOReaderWriter(path, validate=False) # create a info object info = SimpleInfo() # read the info from the ufo reader.readInfo(info) # change the postscriptBlueFuzz to an integer info.postscriptBlueFuzz = int(info.postscriptBlueFuzz) # write it back into the ufo reader.writeInfo(info) # DONE!
@Morula-Type you can also fix the XML in
- open the UFO package in Finder (right click + Show Package Contents)
- open the file
fontinfo.plistin a code editor
- look for
- in the line below, replace the
this approach can help you understand how the UFO format works. if you need to do it multiple times, use the script :)
First of all, thank you very much for the fast reply! Both solutions work perfectly.
To answer @frederik's question: I generated the UFO myself from a font made from scratch in Glyphs. Any idea what parameter or option I could have set wrong to get string instead of integer?
No idea, I guess it is a bug in Glyphs...