How to use the fontmake.errors.TTFAError function in fontmake

To help you get started, we’ve selected a few fontmake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / fontmake / Lib / fontmake / ttfautohint.py View on Github external
def ttfautohint(in_file, out_file, args=None, **kwargs):
    """Thin wrapper around the ttfautohint command line tool.

    Can take in command line arguments directly as a string, or spelled out as
    Python keyword arguments.
    """

    arg_list = ["ttfautohint"]
    file_args = [in_file, out_file]

    if args is not None:
        if kwargs:
            raise TypeError("Should not provide both cmd args and kwargs.")
        rv = subprocess.call(arg_list + args.split() + file_args)
        if rv != 0:
            raise TTFAError(rv)
        return

    boolean_options = (
        "debug",
        "composites",
        "dehint",
        "help",
        "ignore_restrictions",
        "detailed_info",
        "no_info",
        "adjust_subglyphs",
        "symbol",
        "ttfa_table",
        "verbose",
        "version",
        "windows_compatibility",
github googlefonts / fontmake / Lib / fontmake / font_project.py View on Github external
continue

            if output_path is not None:
                hinted_otf_path = output_path
            else:
                hinted_otf_path = self._output_path(
                    ufo,
                    ext,
                    is_instance,
                    interpolatable,
                    autohinted=True,
                    output_dir=output_dir,
                )
            try:
                ttfautohint(otf_path, hinted_otf_path, args=autohint)
            except TTFAError:
                # copy unhinted font to destination before re-raising error
                shutil.copyfile(otf_path, hinted_otf_path)
                raise
            finally:
                # must clean up temp file
                os.remove(otf_path)