This repository has been archived on 2025-10-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
inter-font/misc/tools/postprocess_instance_ufo.py
Rasmus Andersson 7cc0ab62e6 patch UFO files with WWS entries and simplify UFO generation
Patches UFO files to contain WWS entries.
Also simplify UFO generation by moving the hard-coded make rules from the makefile into a shell script.

Related to #498 and https://github.com/googlefonts/glyphsLib/issues/820
2022-10-07 17:39:22 -07:00

28 lines
707 B
Python

import sys
import defcon
def ufo_set_wws(ufo):
# Fix missing WWS entries for Display fonts:
# See https://github.com/googlefonts/glyphsLib/issues/820
subfamily = ufo.info.styleName
if subfamily.find("Display") == -1:
return
subfamily = subfamily[len("Display"):].strip()
if subfamily == "":
# "Display" -> "Regular"
subfamily = "Regular"
ufo.info.openTypeNameWWSFamilyName = "Inter Display"
ufo.info.openTypeNameWWSSubfamilyName = subfamily
def main(argv):
ufo_file = argv[1]
if ufo_file.find("Display") == -1:
return # skip fonts of "default" family
ufo = defcon.Font(ufo_file)
ufo_set_wws(ufo)
ufo.save(ufo_file)
if __name__ == '__main__':
main(sys.argv)