Converting from VFB to UFO ↩
- Using UFO Central
- Using vfb2ufo
There are two main ways to convert between UFO and VFB formats:
- using Tal Leming’s UFO Central script
- using FontLab’s vfb2ufo command-line tool
Using UFO Central
UFO Central is a tool with many years of service to RoboFab+FontLab users in pre-RoboFont days. It can export VFBs to UFOs and import UFOs into VFBs.
- download the
UFOCentral.pyscript from GitHub
- save it inside your
Library/Application Support/FontLab/Studio 5/Macrosfolder
- restart FontLab
- UFO Central will appear in the list of scripts in the Macro toolbar
Select UFO Central from the drop-down list in the Macro toolbar, and press the Run button. A window with several options will appear:
The interface is simple and self-explaining. Use the Help button to get more information about each option.
Advantages / disadvantages
vfb2ufo is a command-line conversion utility provided by FontLab. It is able to convert both ways (from VFB to UFO, and from UFO to VFB), and is available for macOS and Windows users.
The tool can be downloaded for free here.
After you have installed
vfb2ufo, you can run it in Terminal:
vfb2ufo myFolder/myFont.vfb anotherFolder/myOuputFont.ufo
The destination path is optional – if it is omitted, the output files will be saved with the same name and in the same folder as the source files.
For the complete list of options, see the included documentation:
Calling vfb2ufo with Python
vfb2ufo is a C program, you can call it with Python using the
from subprocess import Popen # path to vfb2ufo on your machine ufo2vfbLocation = "/usr/local/bin/vfb2ufo" # path to input VFB file vfbPath = u"/myFolder/myFont.vfb" # path to output UFO file ufoPath = u"/anotherFolder/myFont.ufo" # call the vfb2ufo program p = Popen([ufo2vfbLocation, vfbPath, ufoPath]) # "-64", etc p.wait() # add a note to the converted UFO f = OpenFont(ufoPath, showInterface=False) f.info.note = 'converted from vfb with vfb2ufo' f.close(save=True)
Here is another example, showing how to convert a whole folder of VFBs into UFOs:
import os from subprocess import Popen # path to vfb2ufo on your machine ufo2vfbLocation = "/usr/local/bin/vfb2ufo" # path to folder with input VFBs vfbsFolder = u"/myVFBsFolder" # path to folder for output UFOs ufosFolder = u"/myUFOsFolder" # 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() # add a note to the converted UFO f = OpenFont(ufoPath, showInterface=False) f.info.note = 'converted from vfb with vfb2ufo' f.close(save=True)
Advantages / disadvantages
* Some known bugs in vfb2ufo:
- glyphs with overlapping components are decomposed
- unnamed guidelines get corrupted
- ghost hints are reversed
- OT classes are not written into features (remain as groups)