def run(args): options = Options(args) # Set the current dir to the design space dir, so that relative paths in # the design space file will work. dsDir,dsFile = os.path.split(os.path.abspath(options.dsPath)) os.chdir(dsDir) options.dsPath = dsFile dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return version = 2 if len(newInstancesList) == 1: logMsg.log( "Building 1 instance..") else: logMsg.log("Building %s instances.." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version, roundGeometry=(not options.allowDecimalCoords)) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances.." % (len(newInstancesList))) if options.doAutoHint or options.doOverlapRemoval: logMsg.log( "Applying post-processing") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath) if not options.doOverlapRemoval: # checkOutlinesUFO does ufoTools.validateLayers() for instancePath in newInstancesList: # make sure that that there are no old glyphs left in the processed glyphs folder. ufoTools.validateLayers(instancePath)
def run(args): options = Options(args) dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return # Set the current dir to teh design space dir, so that relative paths in # the design space file will work. dsDir = os.path.dirname(os.path.abspath(options.dsPath)) os.chdir(dsDir) version = 2 if len(newInstancesList) == 1: logMsg.log("Building 1 instance..") else: logMsg.log("Building %s instances.." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances.." % (len(newInstancesList))) if options.doAutoHint or options.doOverlapRemoval: logMsg.log("Applying post-processing") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath)
def run(args): options = Options(args) dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return # Set the current dir to teh design space dir, so that relative paths in # the design space file will work. dsDir = os.path.dirname(os.path.abspath(options.dsPath)) os.chdir(dsDir) version = 2 if len(newInstancesList) == 1: logMsg.log( "Building 1 instance..") else: logMsg.log("Building %s instances.." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances.." % (len(newInstancesList))) if options.doAutoHint or options.doOverlapRemoval: logMsg.log( "Applying post-processing") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath)
def run(args): options = Options(args) # Set the current dir to the design space dir, so that relative paths in # the design space file will work. dsDir, dsFile = os.path.split(os.path.abspath(options.dsPath)) os.chdir(dsDir) options.dsPath = dsFile dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return version = 2 if len(newInstancesList) == 1: logMsg.log("Building 1 instance...") else: logMsg.log("Building %s instances..." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version, roundGeometry=(not options.allowDecimalCoords)) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances." % (len(newInstancesList))) # Remove glyph.lib and font.lib (except for "public.glyphOrder") for instancePath in newInstancesList: postProcessInstance(instancePath, options) if options.doNormalize: logMsg.log("Applying UFO normalization...") for instancePath in newInstancesList: normalizeUFO(instancePath, outputPath=None, onlyModified=True, writeModTimes=False) if options.doAutoHint or options.doOverlapRemoval: logMsg.log("Applying post-processing...") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath) # checkoutlinesufo does ufotools.validateLayers() if not options.doOverlapRemoval: for instancePath in newInstancesList: # make sure that that there are no old glyphs left in the # processed glyphs folder validateLayers(instancePath) # The defcon library renames glyphs. Need to fix them again if options.doOverlapRemoval or options.doAutoHint: for instancePath in newInstancesList: if options.doNormalize: normalizeUFO(instancePath, outputPath=None, onlyModified=False, writeModTimes=False)
def run(args): options = Options(args) # Set the current dir to the design space dir, so that relative paths in # the design space file will work. dsDir,dsFile = os.path.split(os.path.abspath(options.dsPath)) os.chdir(dsDir) options.dsPath = dsFile dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return version = 2 if len(newInstancesList) == 1: logMsg.log("Building 1 instance...") else: logMsg.log("Building %s instances..." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version, roundGeometry=(not options.allowDecimalCoords)) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances." % (len(newInstancesList))) # Remove glyph.lib and font.lib (except for "public.glyphOrder") for instancePath in newInstancesList: clearCustomLibs(instancePath) if options.doNormalize: logMsg.log("Applying UFO normalization...") for instancePath in newInstancesList: if haveUfONormalizer: ufonormalizerLib.normalizeUFO(instancePath, outputPath=None, onlyModified=True) if options.doAutoHint or options.doOverlapRemoval: logMsg.log("Applying post-processing...") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath) if not options.doOverlapRemoval: # checkOutlinesUFO does ufoTools.validateLayers() for instancePath in newInstancesList: # make sure that that there are no old glyphs left in the processed glyphs folder. ufoTools.validateLayers(instancePath) if options.doOverlapRemoval or options.doAutoHint: # The defcon library renames glyphs. Need to fix them again. for instancePath in newInstancesList: if haveUfONormalizer and options.doNormalize: ufonormalizerLib.normalizeUFO(instancePath, outputPath=None, onlyModified=False)
def run(args): options = Options(args) dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return version = 2 if len(newInstancesList) == 1: logMsg.log("Building 1 instance..") else: logMsg.log("Building %s instances.." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances.." % (len(newInstancesList))) if options.doAutoHint or options.doOverlapRemoval: logMsg.log("Applying post-processing") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath)
def run(args): options = Options(args) # Set the current dir to the design space dir, so that relative paths in # the design space file will work. dsDir, dsFile = os.path.split(os.path.abspath(options.dsPath)) os.chdir(dsDir) options.dsPath = dsFile dsPath, newInstancesList = readDesignSpaceFile(options) if not dsPath: return version = 2 if len(newInstancesList) == 1: logMsg.log("Building 1 instance..") else: logMsg.log("Building %s instances.." % (len(newInstancesList))) mutatorMathBuild(documentPath=dsPath, outputUFOFormatVersion=version, roundGeometry=(not options.allowDecimalCoords)) if (dsPath != options.dsPath) and os.path.exists(dsPath): os.remove(dsPath) logMsg.log("Built %s instances.." % (len(newInstancesList))) if options.doAutoHint or options.doOverlapRemoval: logMsg.log("Applying post-processing") # Apply autohint and checkoutlines, if requested. for instancePath in newInstancesList: # make new instance font. updateInstance(options, instancePath) if not options.doOverlapRemoval: # checkOutlinesUFO does ufoTools.validateLayers() for instancePath in newInstancesList: # make sure that that there are no old glyphs left in the processed glyphs folder. ufoTools.validateLayers(instancePath)
def main(args=None): if args is None: args = sys.argv[1:] if '-u' in args: print(__usage__) return if '-h' in args: print(__help__) return (dsPath, ) = args dsDirPath = os.path.dirname(dsPath) glyphSetsDiffer, master_paths = testGlyphSetsCompatible(dsPath) if glyphSetsDiffer: version = 2 allowDecimalCoords = False tempDSPath, master_paths = buldTempDesignSpace(dsPath) mutatorMathBuild(documentPath=tempDSPath, outputUFOFormatVersion=version, roundGeometry=(not allowDecimalCoords)) print("Building local otf's for master font paths...") tempT1 = "temp.pfa" curDir = os.getcwd() dsDir = os.path.dirname(dsPath) for master_path in master_paths: master_path = os.path.join(dsDir, master_path) masterDir = os.path.dirname(master_path) ufoName = os.path.basename(master_path) if glyphSetsDiffer: otfName = ufoName[:-len(kTempUFOExt)] else: otfName = os.path.splitext(ufoName)[0] otfName = otfName + ".otf" os.chdir(masterDir) cmd = "makeotf -f \"%s\" -o \"%s\" -r -nS 2>&1" % (ufoName, otfName) log = runShellCmd(cmd) if ("FATAL" in log) or ("Failed to build" in log): # If there is a FontMenuNameDB file, then not finding an entry # which matches the PS name is a fatal error. For this case, we # just try again, but without the FontMenuNameDB. if ("I can't find a Family name" in log) or ("not in Font Menu Name database" in log): cmd = "makeotf -f \"%s\" -o \"%s\" -mf None -r -nS 2>&1" % ( tempT1, otfName) log = runShellCmd(cmd) if "FATAL" in log: print(log) else: print("Building '%s' without FontMenuNameDB entry." % (master_path)) if not "Built" in str(log): print("Error building OTF font for", master_path, log) print("makeotf cmd was '%s' in %s." % (cmd, masterDir)) else: print("Built OTF font for", master_path) compatibilizePaths(otfName) if os.path.exists(tempT1): os.remove(tempT1) if os.path.exists(master_path) and glyphSetsDiffer: shutil.removetree(master_path) os.chdir(curDir) if os.path.exists(master_path) and glyphSetsDiffer: os.remove(tempDSPath)