SHARE
TWEET

Untitled

a guest Sep 17th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2.  
  3.     test all open fonts on compatibility
  4.     create temp designspace file
  5.     align all fonts on a temp axis
  6.     order does not matter
  7.     run designspaceProblems
  8.     present the data somehow
  9.  
  10. Result:
  11.    
  12. comparing:
  13.      geometryMaster2.ufo
  14.      geometryMaster1.ufo
  15.      geometryMaster1_no_kerning.ufo
  16.      geometryMaster3.ufo
  17. glyphs:
  18.     broken_component
  19.         different components in glyph
  20.         different number of contours in glyph
  21.         incompatible constructions for glyph
  22.     extra.glyph.for.neutral
  23.         default glyph is empty
  24.     glyphFive
  25.         incompatible constructions for glyph
  26.     glyph_with_many_contours
  27.         different anchors in glyph
  28.         different number of contours in glyph
  29.         incompatible constructions for glyph
  30.     narrow.component
  31.         different components in glyph
  32.         incompatible constructions for glyph
  33.  
  34. """
  35.  
  36. import os
  37. import designspaceProblems
  38. from designspaceProblems import DesignSpaceChecker
  39. from designspaceProblems.problems import DesignSpaceProblem
  40. from ufoProcessor import DesignSpaceProcessor, getUFOVersion, AxisDescriptor, SourceDescriptor
  41.  
  42. doc = DesignSpaceProcessor()
  43.  
  44. a1 = AxisDescriptor()
  45. a1.name = "snap"
  46. a1.minimum = 0
  47. a1.maximum = 1000
  48. a1.default = 0
  49. a1.tag = 'snap'
  50.  
  51. masters = []
  52. print('comparing:')
  53. for i, f in enumerate(AllFonts()):
  54.     print('\t', os.path.basename(f.path))
  55.     s1 = SourceDescriptor()
  56.     s1.location = dict(snap=i*100)
  57.     s1.path = os.path.join(f.path)
  58.     doc.addSource(s1)
  59.     a1.maximum += 100
  60.  
  61. doc.addAxis(a1)
  62. #tp = "prrr.designspace"
  63. #doc.write(tp)
  64. dc = DesignSpaceChecker(doc)
  65. dc.checkEverything()
  66. print('glyphs:')
  67. glyphs = {}
  68. for p in dc.problems:
  69.     if p.category == 4:
  70.         if not p.data['glyphName'] in glyphs:
  71.             glyphs[p.data['glyphName']] = []
  72.         glyphs[p.data['glyphName']].append('\t\t{}'.format(p.getDescription()[1]))
  73. problemGlyphs = list(glyphs.keys())
  74. problemGlyphs.sort()
  75. for name in problemGlyphs:
  76.     print('\t{}'.format(name))
  77.     for desc in glyphs[name]:
  78.        
  79.         print(desc)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top