Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- test all open fonts on compatibility
- create temp designspace file
- align all fonts on a temp axis
- order does not matter
- run designspaceProblems
- present the data somehow
- Result:
- comparing:
- geometryMaster2.ufo
- geometryMaster1.ufo
- geometryMaster1_no_kerning.ufo
- geometryMaster3.ufo
- glyphs:
- broken_component
- different components in glyph
- different number of contours in glyph
- incompatible constructions for glyph
- extra.glyph.for.neutral
- default glyph is empty
- glyphFive
- incompatible constructions for glyph
- glyph_with_many_contours
- different anchors in glyph
- different number of contours in glyph
- incompatible constructions for glyph
- narrow.component
- different components in glyph
- incompatible constructions for glyph
- """
- import os
- import designspaceProblems
- from designspaceProblems import DesignSpaceChecker
- from designspaceProblems.problems import DesignSpaceProblem
- from ufoProcessor import DesignSpaceProcessor, getUFOVersion, AxisDescriptor, SourceDescriptor
- doc = DesignSpaceProcessor()
- a1 = AxisDescriptor()
- a1.name = "snap"
- a1.minimum = 0
- a1.maximum = 1000
- a1.default = 0
- a1.tag = 'snap'
- masters = []
- print('comparing:')
- for i, f in enumerate(AllFonts()):
- print('\t', os.path.basename(f.path))
- s1 = SourceDescriptor()
- s1.location = dict(snap=i*100)
- s1.path = os.path.join(f.path)
- doc.addSource(s1)
- a1.maximum += 100
- doc.addAxis(a1)
- #tp = "prrr.designspace"
- #doc.write(tp)
- dc = DesignSpaceChecker(doc)
- dc.checkEverything()
- print('glyphs:')
- glyphs = {}
- for p in dc.problems:
- if p.category == 4:
- if not p.data['glyphName'] in glyphs:
- glyphs[p.data['glyphName']] = []
- glyphs[p.data['glyphName']].append('\t\t{}'.format(p.getDescription()[1]))
- problemGlyphs = list(glyphs.keys())
- problemGlyphs.sort()
- for name in problemGlyphs:
- print('\t{}'.format(name))
- for desc in glyphs[name]:
- print(desc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement