MCPcopy
hub / github.com/arrowtype/recursive / makeCompatible

Function makeCompatible

mastering/prep_fonts.py:494–520  ·  view source on GitHub ↗

Checks all glyphs in *fonts* for compatibility. Removes any glyphs that aren't compatible from all of the fonts. *fonts* is a `list` of font objects (Defcon or FontParts).

(fonts)

Source from the content-addressed store, hash-verified

492
493
494def makeCompatible(fonts):
495 """
496 Checks all glyphs in *fonts* for compatibility. Removes any glyphs that
497 aren't compatible from all of the fonts.
498
499 *fonts* is a `list` of font objects (Defcon or FontParts).
500 """
501
502 local_report = report.get("Removed non-compatible glyphs", [])
503 nonCompatible = []
504
505 for glyph in fonts[0]:
506 for font in fonts[1:]:
507 if glyph.name in font.keys():
508 compatibility = glyph.isCompatible(font[glyph.name])
509 if not compatibility[0]:
510 nonCompatible.append((glyph.name, str(compatibility)))
511 else:
512 nonCompatible.append((glyph.name, "Missing in font"))
513
514 for font in fonts:
515 removeGlyphs(font, [name for name, _ in nonCompatible])
516
517 if nonCompatible != []:
518 local_report.append(nonCompatible)
519
520 report["Removed non-compatible glyphs"] = local_report
521
522
523def prep(designspacePath, version):

Callers 1

prepFunction · 0.85

Calls 1

removeGlyphsFunction · 0.70

Tested by

no test coverage detected