diff options
Diffstat (limited to 'src/displayapp/fonts/generate.py')
| -rwxr-xr-x | src/displayapp/fonts/generate.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/displayapp/fonts/generate.py b/src/displayapp/fonts/generate.py index 401d47ab..89810614 100755 --- a/src/displayapp/fonts/generate.py +++ b/src/displayapp/fonts/generate.py @@ -18,8 +18,8 @@ class Source(object): self.symbols = d.get('symbols') -def gen_lvconv_line(dest: str, size: int, bpp: int, sources: typing.List[Source], compress:bool=False): - args = ['lv_font_conv', '--size', str(size), '--output', dest, '--bpp', str(bpp), '--format', 'lvgl'] +def gen_lvconv_line(lv_font_conv: str, dest: str, size: int, bpp: int, sources: typing.List[Source], compress:bool=False): + args = [lv_font_conv, '--size', str(size), '--output', dest, '--bpp', str(bpp), '--format', 'lvgl'] if not compress: args.append('--no-compress') for source in sources: @@ -35,9 +35,10 @@ def main(): ap = argparse.ArgumentParser(description='auto generate LVGL font files from fonts') ap.add_argument('config', type=str, help='config file to use') ap.add_argument('-f', '--font', type=str, action='append', help='Choose specific fonts to generate (default: all)', default=[]) + ap.add_argument('--lv-font-conv', type=str, help='Path to "lv_font_conf" executable', default="lv_font_conv") args = ap.parse_args() - if not shutil.which('lv_font_conv'): + if not shutil.which(args.lv_font_conv): sys.exit(f'Missing lv_font_conv. (make sure it is installed and in PATH)') if not os.path.exists(args.config): sys.exit(f'Error: the config file {args.config} does not exist.') @@ -62,7 +63,7 @@ def main(): sources = font.pop('sources') patches = font.pop('patches') if 'patches' in font else [] font['sources'] = [Source(thing) for thing in sources] - line = gen_lvconv_line(f'{name}.c', **font) + line = gen_lvconv_line(args.lv_font_conv, f'{name}.c', **font) subprocess.check_call(line) if patches: for patch in patches: |
