Exemplo n.º 1
0
def doit(args):
    levels = ["WARNING", "INFO", "DEBUG"]
    configLogger(level=levels[min(len(levels) - 1, args.verbose)])

    font = TTFont(args.input_font)
    builder = Builder(font, args.input_fea)
    builder.build()
    if args.lookupmap:
        with open(args.lookupmap, "w") as outf:
            for n, l in sorted(builder.named_lookups_.items()):
                outf.write("{},{},{}\n".format(n, l.table, l.lookup_index))
    font.save(args.output)
Exemplo n.º 2
0
 def saveOTF(self, filename):
     try:
         self.font.save(filename)
         ttfont = TTFont(filename)
         featurefile = UnicodeIO(self.fontfeatures.asFea())
         builder = Builder(ttfont, featurefile)
         catmap = {"base": 1, "ligature": 2, "mark": 3, "component": 4}
         for g in self.font:
             if g.category in catmap:
                 builder.setGlyphClass_(None, g.name, catmap[g.category])
         builder.build()
         ttfont.save(filename)
     except Exception as e:
         print(e)
         return str(e)