Copies all the mastering files from cff_root to ttf_root, save the ufo. Then compilies the source ufo into a source ttf for mastering. *cff_root* `string` path to the root of the CFF files *ttf_root* `string` path to the root of the TTF files
(cff_root, ttf_root)
| 130 | |
| 131 | |
| 132 | def buildTTFfiles(cff_root, ttf_root): |
| 133 | """ |
| 134 | Copies all the mastering files from cff_root to ttf_root, save the ufo. |
| 135 | Then compilies the source ufo into a source ttf for mastering. |
| 136 | |
| 137 | *cff_root* `string` path to the root of the CFF files |
| 138 | *ttf_root* `string` path to the root of the TTF files |
| 139 | """ |
| 140 | |
| 141 | if os.path.exists(ttf_root): |
| 142 | shutil.rmtree(ttf_root) |
| 143 | |
| 144 | ignore = shutil.ignore_patterns("*.ufo",) |
| 145 | print("🏗 Copying files") |
| 146 | shutil.copytree(cff_root, ttf_root, ignore=ignore) |
| 147 | |
| 148 | files = getFiles(cff_root, "ufo") |
| 149 | print("🏗 Making TTF sources") |
| 150 | |
| 151 | outputFile = os.path.join(ttf_root, "make_ttf_source_output.txt") |
| 152 | if os.path.exists(outputFile): |
| 153 | os.remove(outputFile) |
| 154 | |
| 155 | printProgressBar(0, len(files), prefix=' ', suffix='Complete', length=50) |
| 156 | for i, file in enumerate(files): |
| 157 | oldPath = splitall(file) |
| 158 | newPath = [] |
| 159 | for p in oldPath: |
| 160 | if p == "CFF": |
| 161 | p = "TTF" |
| 162 | newPath.append(p) |
| 163 | out = os.path.join(*newPath) |
| 164 | out = out[:-4] + ".ttf" |
| 165 | with open(outputFile, "a") as f: |
| 166 | with redirect_stdout(f), redirect_stderr(f): |
| 167 | ufo = DFont(file) |
| 168 | ttf = compileTTF(ufo, useProductionNames=False) |
| 169 | ttf.save(out) |
| 170 | printProgressBar(i + 1, len(files), prefix=' ', |
| 171 | suffix='Complete', length=50) |
| 172 | |
| 173 | |
| 174 | def fixStandardStems(font): |
no test coverage detected