def testDocument(docPath): # make the test fonts and a test document testFontPath = os.path.join(os.getcwd(), "automatic_testfonts") m1, m2, i1, i2, i3 = makeTestFonts(testFontPath) d = DesignSpaceProcessor() a = AxisDescriptor() a.name = "pop" a.minimum = 50 a.maximum = 1000 a.default = 0 a.tag = "pop*" d.addAxis(a) s1 = SourceDescriptor() s1.path = m1 s1.location = dict(pop=a.minimum) s1.name = "test.master.1" s1.copyInfo = True s1.copyFeatures = True s1.copyLib = True d.addSource(s1) s2 = SourceDescriptor() s2.path = m2 s2.location = dict(pop=1000) s2.name = "test.master.2" #s2.copyInfo = True d.addSource(s2) for counter in range(3): factor = counter / 2 i = InstanceDescriptor() v = a.minimum + factor * (a.maximum - a.minimum) i.path = i1 % v i.familyName = "TestFamily" i.styleName = "TestStyle_pop%3.3f" % (v) i.name = "%s-%s" % (i.familyName, i.styleName) i.location = dict(pop=v) i.info = True i.kerning = True if counter == 2: i.glyphs['glyphTwo'] = dict(name="glyphTwo", mute=True) i.copyLib = True if counter == 2: i.glyphs['narrow'] = dict(instanceLocation=dict(pop=400), unicodes=[0x123, 0x124, 0x125]) d.addInstance(i) d.write(docPath)
doc.addSource(s2) s3 = SourceDescriptor() s3.path = "MutatorSansBoldWide.ufo" s3.name = "master.MutatorMathTest.BoldWide.3" s3.familyName = familyName s3.styleName = "BoldWide" s3.location = dict(weight=1000, width=1000) doc.addSource(s3) #----------- # instances #----------- i0 = InstanceDescriptor() i0.name = 'instance_LightCondensed' i0.familyName = familyName i0.styleName = "Medium" i0.path = os.path.join(root, "instances", "MutatorSansTest-Medium.ufo") i0.location = dict(weight=500, width=327) i0.kerning = True i0.info = True doc.addInstance(i0) #------- # rules #------- # TODO: add rules to match the contents of `MutatorSans.designspace` # http://github.com/LettError/mutatorSans/blob/master/MutatorSans.designspace