def run_from_ufos( self, ufos, output=(), designspace_path=None, mti_source=None, remove_overlaps=True, reverse_direction=True, conversion_error=None, **kwargs): """Run toolchain from UFO sources to OpenType binaries.""" if set(output) == set(['ufo']): return if hasattr(ufos[0], 'path'): ufo_paths = [ufo.path for ufo in ufos] else: if isinstance(ufos, str): ufo_paths = glob.glob(ufos) else: ufo_paths = ufos ufos = [Font(path) for path in ufo_paths] mti_paths = None if mti_source: mti_paths = {} mti_paths = plistlib.readPlist(mti_source) src_dir = os.path.dirname(mti_source) for paths in mti_paths.values(): for tag in paths.keys(): paths[tag] = os.path.join(src_dir, paths[tag]) need_reload = False if 'otf' in output: self.build_otfs( ufos, remove_overlaps, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_ttfs( ufos, remove_overlaps, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf-interpolatable' in output or 'variable' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_interpolatable_ttfs( ufos, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) if 'variable' in output: if designspace_path is None: raise TypeError('Need designspace to build variable font.') varLib.main((designspace_path,))
from fontTools.misc.py23 import * import sys from fontTools.varLib import main if __name__ == '__main__': sys.exit(main())
def run_from_ufos( self, ufos, output=(), designspace_path=None, mti_source=None, remove_overlaps=True, reverse_direction=True, conversion_error=None, **kwargs): """Run toolchain from UFO sources. Args: ufos: List of UFO sources, as either paths or opened objects. output: List of output formats to generate. designspace_path: Path to a MutatorMath designspace, used to generate variable font if requested. mti_source: MTI layout source to be parsed and passed to save_otfs. remove_overlaps: If True, remove overlaps in glyph shapes. reverse_direction: If True, reverse contour directions when compiling TrueType outlines. conversion_error: Error to allow when converting cubic CFF contours to quadratic TrueType contours. kwargs: Arguments passed along to save_otfs. Raises: TypeError: 'variable' specified in output formats but designspace path not provided. """ if set(output) == set(['ufo']): return if hasattr(ufos[0], 'path'): ufo_paths = [ufo.path for ufo in ufos] else: if isinstance(ufos, str): ufo_paths = glob.glob(ufos) else: ufo_paths = ufos ufos = [Font(path) for path in ufo_paths] mti_paths = None if mti_source: mti_paths = {} mti_paths = plistlib.readPlist(mti_source) src_dir = os.path.dirname(mti_source) for paths in mti_paths.values(): for tag in paths.keys(): paths[tag] = os.path.join(src_dir, paths[tag]) need_reload = False if 'otf' in output: self.build_otfs( ufos, remove_overlaps, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_ttfs( ufos, remove_overlaps, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf-interpolatable' in output or 'variable' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_interpolatable_ttfs( ufos, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) if 'variable' in output: if designspace_path is None: raise TypeError('Need designspace to build variable font.') varLib.main((designspace_path,))
def run_from_ufos(self, ufos, output=(), designspace_path=None, mti_source=None, remove_overlaps=True, reverse_direction=True, conversion_error=None, **kwargs): """Run toolchain from UFO sources. Args: ufos: List of UFO sources, as either paths or opened objects. output: List of output formats to generate. designspace_path: Path to a MutatorMath designspace, used to generate variable font if requested. mti_source: MTI layout source to be parsed and passed to save_otfs. remove_overlaps: If True, remove overlaps in glyph shapes. reverse_direction: If True, reverse contour directions when compiling TrueType outlines. conversion_error: Error to allow when converting cubic CFF contours to quadratic TrueType contours. kwargs: Arguments passed along to save_otfs. Raises: TypeError: 'variable' specified in output formats but designspace path not provided. """ if set(output) == set(['ufo']): return if hasattr(ufos[0], 'path'): ufo_paths = [ufo.path for ufo in ufos] else: if isinstance(ufos, str): ufo_paths = glob.glob(ufos) else: ufo_paths = ufos ufos = [Font(path) for path in ufo_paths] mti_paths = None if mti_source: mti_paths = {} mti_paths = plistlib.readPlist(mti_source) src_dir = os.path.dirname(mti_source) for paths in mti_paths.values(): for tag in paths.keys(): paths[tag] = os.path.join(src_dir, paths[tag]) need_reload = False if 'otf' in output: self.build_otfs(ufos, remove_overlaps, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_ttfs(ufos, remove_overlaps, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) need_reload = True if 'ttf-interpolatable' in output or 'variable' in output: if need_reload: ufos = [Font(path) for path in ufo_paths] self.build_interpolatable_ttfs(ufos, reverse_direction, conversion_error, mti_paths=mti_paths, **kwargs) if 'variable' in output: if designspace_path is None: raise TypeError('Need designspace to build variable font.') varLib.main((designspace_path, ))
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.varLib import main if __name__ == '__main__': main()
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * import sys from fontTools.varLib import main if __name__ == '__main__': sys.exit(main())