Skip to content

Instantly share code, notes, and snippets.

@jenskutilek
Created June 26, 2022 17:18
Show Gist options
  • Save jenskutilek/edebfe32006519ae1db6e528fca24b62 to your computer and use it in GitHub Desktop.
Save jenskutilek/edebfe32006519ae1db6e528fca24b62 to your computer and use it in GitHub Desktop.
from pathlib import Path
from defcon import Font
from os import utime
path = Path(__file__).parent
for ufo_path in path.rglob('*.ufo'):
vfb_path = ufo_path.with_suffix(".vfb")
print(vfb_path)
if vfb_path.exists:
f = Font(ufo_path)
if not (ufo_path / "layercontents.plist").exists:
print("Converting to UFO 3")
f.save(formatVersion=3)
try:
stat = vfb_path.stat()
utime(ufo_path, (stat.st_mtime, stat.st_mtime))
except FileNotFoundError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment