vfb2ufo
-
Hi guys!
I'm generating UFOs files from old VFBs files.
I'm using this script:from mojo.UI import GetFolder import os from subprocess import Popen import fontParts.world as fpw # path to vfb2ufo on your machine ufo2vfbLocation = "/usr/local/bin/vfb2ufo" # path to folder with input VFBs vfbsFolder = GetFolder(message="get source folder with *.vfb files") # path to folder for output UFOs ufosFolder = vfbsFolder+'_vfb2ufo' if not os.path.exists(ufosFolder): os.mkdir(ufosFolder) # collect all VFBs in VFBs folder vfbs = [f for f in os.listdir(vfbsFolder) if os.path.splitext(f)[-1] == '.vfb'] # batch convert VFBs to UFO for vfb in vfbs: # make file paths vfbPath = os.path.join(vfbsFolder, vfb) ufoPath = os.path.join(ufosFolder, vfb.replace('.vfb', '.ufo')) # call the vfb2ufo program p = Popen([ufo2vfbLocation, vfbPath, ufoPath]) # "-64", etc p.wait() font = OpenFont(ufoPath, False) font.save(formatVersion=3)
It is failing to open the font in RF with OpenFont function.
This is what I get in the output:Traceback (most recent call last): File "lib/fontObjects/fontPartsWrappers.pyc", line 1430, in __init__ File "lib/fontObjects/__init__.pyc", line 440, in createFontObject File "lib/fontObjects/doodleFont.pyc", line 36, in __init__ File "lib/fontObjects/ufo2.pyc", line 530, in normalizeUFO File "lib/fontObjects/ufo2.pyc", line 506, in _normalizeUFO File "/Applications/RoboFont.app/Contents/Resources/lib/python3.6/defcon/objects/font.py", line 529, in _get_features File "/Applications/RoboFont.app/Contents/Resources/lib/python3.6/fontTools/ufoLib/__init__.py", line 580, in readFeatures File "codecs.pyc", line 321, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 72: invalid start byte During handling of the above exception, another exception occurred: Traceback (most recent call last): File "vfb2ufo.py", line 29, in <module> File "lib/fontObjects/fontPartsWrappers.pyc", line 1932, in OpenFont File "lib/fontObjects/fontPartsWrappers.pyc", line 1438, in __init__ lib.tools.misc.RoboFontError: The file /path/to/file.ufo can not be read by RoboFont.
Is there maybe better way to generate UFO3 files out of VFBs?
-
sidetone: if
vfb2ufo
is installed and accessible in terminal, then RoboFont can open and generate vfb files. Butvfb2ufo
has lots of issues... there are combos possible with ufoCentral and eventually generating binaries and converting those...good luck anyhow!
-
Thanks guys! I will experiment with those scripts
-
This old repo might come in handy. I haven't used it in a long time but I assume that it still works with the simple py3 adjustments.
-
I assume these VFBs are coming from FL5?
We've had a little more luck with Tal's old UFO Central script than vfb2ufo... https://github.com/typesupply/fontlab-scripts/blob/master/UFOCentral.py
(Generates UFO2, but then saving them up to UFO3 is trivial)
Needs to be run from within FontLab5, though. If you're stuck without access to FL5 then vfb2ufo might be the best way.
As for your error, it seems like it's having an issue with the feature file of one of your fonts. Maybe stop it half way and see what the file looks like?