(root)
| 94 | |
| 95 | |
| 96 | def batchCheckOutlines(root): |
| 97 | from afdko.checkoutlinesufo import run as checkoutlinesufo |
| 98 | from contextlib import redirect_stdout, redirect_stderr |
| 99 | import re |
| 100 | |
| 101 | files = getFiles(root, "ufo") |
| 102 | |
| 103 | skips = ["uni000D has no contours\n", |
| 104 | "uniE0A0 has no contours\n", ] |
| 105 | |
| 106 | outputFile = os.path.join(root, "checkoutlines.txt") |
| 107 | if os.path.exists(outputFile): |
| 108 | os.remove(outputFile) |
| 109 | |
| 110 | print("🏗 Running checkoutlinesUFO on files") |
| 111 | printProgressBar(0, len(files), prefix=' ', suffix='Complete', length=50) |
| 112 | for i, file in enumerate(files): |
| 113 | with open(outputFile, "a") as f: |
| 114 | with redirect_stdout(f), redirect_stderr(f): |
| 115 | print(f"Checking {file}") |
| 116 | checkoutlinesufo([file, "--all"]) |
| 117 | print("\n\n") |
| 118 | printProgressBar(i + 1, len(files), prefix=' ', |
| 119 | suffix='Complete', length=50) |
| 120 | |
| 121 | log = [] |
| 122 | with open(outputFile, "r") as f: |
| 123 | for line in f: |
| 124 | if not line.startswith("Checking"): |
| 125 | pass1 = re.sub(r'[\.]{2,}', '', line) |
| 126 | pass2 = re.sub(r' Flat curve at \([0-9,\.]+, [0-9,\.]+\)\.', |
| 127 | '', pass1) |
| 128 | if len(pass2.split()) > 1: |
| 129 | if pass2 not in skips: |
| 130 | log.append(pass2) |
| 131 | elif line.startswith("Checking"): |
| 132 | log.append("\n\n" + line) |
| 133 | |
| 134 | with open(outputFile, "w") as f: |
| 135 | f.write("".join(log)) |
| 136 | |
| 137 | |
| 138 | def make_mark_mkmk_gdef_feature(font, GDEF_Classes=True): |
no test coverage detected