INNER CODE UNIT · Python

font

utopia-rise/godot-jvm · logo/export.py:104

def font(name, size):
    """Load a font by file name from the platform font directories, searched recursively."""
    for directory in font_directories():
        if not directory.is_dir():
            continue
        for path in directory.rglob(name):
            return ImageFont.truetype(str(path), size)
    sys.exit(f'Font {name} not found in {", ".join(str(d) for d in font_directories())}.\n'
             'Download Rubik and Source Sans Pro from https://fonts.google.com/ and install them, '
             'or set GODOT_JVM_FONT_DIR to a directory that contains the .ttf files.')

def inkscape_export(inkscape, svg, png, width):
    try:
        subprocess.run([str(inkscape), str(svg), f'--export-filename={png}', f'--export-width={width}'], check=True)
    except subprocess.CalledProcessError as error:
        sys.exit(f'Inkscape failed with exit code {error.returncode} while rendering {svg.name}')
    if not png.is_file():
        sys.exit(f'{inkscape} returned without writing {png}. Point PATH at the real Inkscape executable, '

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…