cjtype’s avatarcjtype’s Twitter Archive—№ 3,066

    1. …in reply to @w__h_
      w__h_ I think you need to use importXML() which is part of TTFont github.com/fonttools/fonttools/blob/master/Lib/fontTools/ttLib/ttFont.py Something like: from fontTools.ttLib import TTFont path = "path/to/font.ttx" newFont = TTFont() ttxFont = newFont.importXML(path)
  1. …in reply to @cjtype
    w__h_ Or inline: from fontTools.ttLib import TTFont import tempfile ttx = """<?xml version="1.0" ?> <ttFont> … </ttFont> """ xmlPath = tempfile.mkstemp()[1] with open(xmlPath, "w") as temp: temp.write(ttx) f = TTFont() f.importXML(xmlPath) p = "x.otf" f.save(p)