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

Function prep

mastering/prep_fonts.py:523–590  ·  view source on GitHub ↗

Runs all of the checks and corrections and generates the report. Uses https://github.com/LettError/DesignspaceProblems to check and report on issues with the design space. *designspacePath* is a `string` of the path to the designspace file *version* is a `string` that is the v

(designspacePath, version)

Source from the content-addressed store, hash-verified

521
522
523def prep(designspacePath, version):
524 """
525 Runs all of the checks and corrections and generates the report.
526
527 Uses https://github.com/LettError/DesignspaceProblems to check and
528 report on issues with the design space.
529
530 *designspacePath* is a `string` of the path to the designspace file
531 *version* is a `string` that is the version to set the font to
532 """
533
534 # Checking to see if there are any large issues with the designspace
535 # file before doing anything
536 dsc = DesignSpaceChecker(designspacePath)
537 assert not dsc.hasStructuralProblems()
538
539 ds = DesignSpaceDocument.fromfile(designspacePath)
540 sources = [source.path for source in ds.sources]
541
542 print("🏗 Opening sources")
543 fonts = [Font(path) for path in sources]
544
545 print("🏗 Checking family name")
546 assert checkFamilyName(fonts)
547
548 print("🏗 Removing non-exporting glyphs")
549 decomposeNonExportingGlyphs(fonts)
550
551 print("🏗 Decomposing scaled, flipped, and nested components")
552 decomposeScaledNested(fonts)
553
554 print("🏗 Clearing guides")
555 for font in fonts:
556 clearGuides(font)
557
558 print("🏗 Removing glyphs that aren't in every font")
559 makeSourceFontsGlyphCompatible(fonts)
560
561 print("🏗 Removing non-compatible glyphs")
562 makeCompatible(fonts)
563
564 print("🏗 Making kerning compatible")
565 kerningCompatibility(fonts)
566
567 print("🏗 Sorting glyph order to be common")
568 sortGlyphOrder(fonts)
569
570 print("🏗 Setting production names")
571 setProductionNames(fonts)
572
573 print("🏗 Setting version")
574 if version:
575 setVersion(fonts, version)
576
577 print("🏗 Closing and saving sources")
578 for font in fonts:
579 font.close(save=True)
580

Callers 2

makeSourcesFunction · 0.90
prep_fonts.pyFile · 0.85

Calls 11

checkFamilyNameFunction · 0.85
decomposeScaledNestedFunction · 0.85
makeCompatibleFunction · 0.85
kerningCompatibilityFunction · 0.85
sortGlyphOrderFunction · 0.85
setProductionNamesFunction · 0.85
setVersionFunction · 0.85
writeReportFunction · 0.85
clearGuidesFunction · 0.70

Tested by

no test coverage detected