@@ -0,0 +1,2612 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport logging%0Aimport os%0Aimport sys%0A%0Afrom fontTools.ttLib import TTFont%0A%0A%0Adef ProcessTable(table):%0A    found = set()%0A%0A    for rec in table.ScriptList.ScriptRecord:%0A        if rec.ScriptTag == %22DFLT%22 and rec.Script.LangSysCount != 0:%0A            tags = %5Br.LangSysTag for r in rec.Script.LangSysRecord%5D%0A            logging.info(%22Removing %25d extraneous LangSys records: %25s%22,%0A                         rec.Script.LangSysCount, %22 %22.join(tags))%0A            rec.Script.LangSysRecord = %5B%5D%0A            rec.Script.LangSysCount = 0%0A            found.update(tags)%0A%0A    if not found:%0A        logging.info(%22All fine%22)%0A        return False%0A    else:%0A        for rec in table.ScriptList.ScriptRecord:%0A            tags = set(%5Br.LangSysTag for r in rec.Script.LangSysRecord%5D)%0A            found -= tags%0A%0A        if found:%0A            logging.warning(%22Records are missing from non-DFLT scripts: %25s%22,%0A                            %22 %22.join(found))%0A        return True%0A%0A%0Adef ProcessFont(font):%0A    found = False%0A    for tag in (%22GSUB%22, %22GPOS%22):%0A        if tag in font:%0A            logging.info(%22Processing %25s table%22, tag)%0A            if ProcessTable(font%5Btag%5D.table):%0A                found = True%0A            else:%0A                # Unmark the table as loaded so that it is read from disk when%0A                # writing the font, to avoid any unnecessary changes caused by%0A                # decompiling then recompiling again.%0A                del font.tables%5Btag%5D%0A%0A    return found%0A%0A%0Adef ProcessFiles(filenames):%0A    for filename in filenames:%0A        logging.info(%22Processing %25s%22, filename)%0A        font = TTFont(filename)%0A        name, ext = os.path.splitext(filename)%0A        fixedname = name + %22.fixed%22 + ext%0A        if ProcessFont(font):%0A            logging.info(%22Saving fixed font to %25s%5Cn%22, fixedname)%0A            font.save(fixedname)%0A        else:%0A            logging.info(%22Font file is fine, nothing to fix%5Cn%22)%0A%0A%0Adef main():%0A    parser = argparse.ArgumentParser(%0A            description=%22Fix LangSys records for DFLT script%22)%0A    parser.add_argument(%22files%22, metavar=%22FILE%22, type=str, nargs=%22+%22,%0A                        help=%22input font to process%22)%0A    parser.add_argument(%22-s%22, %22--silent%22, action='store_true',%0A                        help=%22suppress normal messages%22)%0A%0A    args = parser.parse_args()%0A%0A    logformat = %22%25(levelname)s: %25(message)s%22%0A    if args.silent:%0A        logging.basicConfig(format=logformat, level=logging.DEBUG)%0A    else:%0A        logging.basicConfig(format=logformat, level=logging.INFO)%0A%0A    ProcessFiles(args.files)%0A%0Aif __name__ == %22__main__%22:%0A    sys.exit(main())%0A

Add a snippet to remove LangSys from DFLT script