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
This commit is contained in:
Rasmus Andersson 2022-10-07 17:39:15 -07:00
parent c81a0abf02
commit 7cc0ab62e6
4 changed files with 118 additions and 83 deletions

View file

@ -0,0 +1,28 @@
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)