def testTwoUntitledFonts(self): font1 = NewFont() font2 = NewFont() font1.unitsPerEm = 1024 font2.unitsPerEm = 2048 self.assertNotEqual(font1.unitsPerEm, font2.unitsPerEm) font1.update() font2.update() font1.close(False) font2.close(False)
def testUFOVersusGlifImport(self): font = NewFont() font.readUFO(getDemoFontPath(), doProgress=False) d1 = getDigests(font) font.close(False) font = NewFont() importAllGlifFiles(font.naked(), getDemoFontGlyphSetPath(), doProgress=False) d2 = getDigests(font) self.assertEqual(d1, d2) font.close(False)
# robothon 2006 # batch interpolate import os from robofab.world import SelectFont, NewFont # ask for two masters to interpolate: font1 = SelectFont("Select font 1") font2 = SelectFont("Select font 2") # these are the interpolation factors: values = [.3, .6] for value in values: # make a new font destination = NewFont() # do the interpolation destination.interpolate(value, font1, font2, doProgress=True) destination.update() # make a new path + filename for the new font to be saved at: dir = os.path.dirname(font1.path) fileName = "Demo_%d.vfb" % (1000 * value) # save at this path and close the font destination.save(os.path.join(dir, fileName)) destination.close()
font1 = SelectFont("Select font 1") font2 = SelectFont("Select font 2") where = GetFolder("Select a folder to save the interpolations") instances = [ ("Light", 0), ("NotTooLight", 0.25), ("Regular", 0.5), ("Demi", 0.75), ("Medium", 1), ] for thing in instances: name, value = thing print "generating", name, value dst = NewFont() # this interpolates the glyphs dst.interpolate(value, font1, font2, doProgress=True) # this interpolates the kerning # comment this line out of you're just testing #dst.kerning.interpolate(font1.kerning, font2.kerning, value) dst.info.familyName = "MyBigFamily" dst.info.styleName = name dst.info.autoNaming() dst.update() fileName = dst.info.familyName + "-" + dst.info.styleName + ".vfb" path = os.path.join(where, fileName) print 'saving at', path dst.save(path) dst.close()
# robothon 2006 # batch interpolate import os from robofab.world import SelectFont, NewFont # ask for two masters to interpolate: font1 = SelectFont("Select font 1") font2 = SelectFont("Select font 2") # these are the interpolation factors: values = [.3, .6] for value in values: # make a new font destination = NewFont() # do the interpolation destination.interpolate(value, font1, font2, doProgress=True) destination.update() # make a new path + filename for the new font to be saved at: dir = os.path.dirname(font1.path) fileName = "Demo_%d.vfb" % (1000 * value) # save at this path and close the font destination.save(os.path.join(dir, fileName)) destination.close()