diff --git a/docs/cli_commands.md b/docs/cli_commands.md index fd041ef2dc1..147888f718c 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -796,3 +796,4 @@ This command converts a TTF font to an intermediate format for editing, before c ## `qmk painter-convert-font-image` This command converts an intermediate font image to the QFF File Format. See the [Quantum Painter](quantum_painter.md?id=quantum-painter-cli) documentation for more information on this command. + diff --git a/docs/quantum_painter.md b/docs/quantum_painter.md index 5e1c2d0051b..a4536714e43 100644 --- a/docs/quantum_painter.md +++ b/docs/quantum_painter.md @@ -115,8 +115,7 @@ This command converts a TTF font to a QFF File Format. **Usage**: ``` -usage: qmk painter-convert-font [-h] [-w] [-u UNICODE_GLYPHS] [-s SIZE] [-o OUTPUT] [-i INPUT] -f FORMAT - [-r] [-n] [-a] +usage: qmk painter-convert-font [-h] [-w] [-u UNICODE_GLYPHS] [-s SIZE] [-o OUTPUT] [-i INPUT] -f FORMAT [-r] [-n] [-a] options: -h, --help show this help message and exit @@ -129,8 +128,7 @@ options: -i INPUT, --input INPUT Specify input font file. -f FORMAT, --format FORMAT - Output format, valid types: rgb888, rgb565, pal256, pal16, pal4, pal2, mono256, - mono16, mono4, mono2 + Output format, valid types: rgb888, rgb565, pal256, pal16, pal4, pal2, mono256, mono16, mono4, mono2 -r, --no-rle Disable the use of RLE to minimise converted image size. -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified. @@ -159,8 +157,7 @@ options: -a, --no-aa Disable anti-aliasing on fonts. -u UNICODE_GLYPHS, --unicode-glyphs UNICODE_GLYPHS Also generate the specified unicode glyphs. - -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the - glyphs specified. + -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified. -s SIZE, --size SIZE Specify font size. Default 12. -o OUTPUT, --output OUTPUT Specify output image path. @@ -197,16 +194,14 @@ This command expects an image that conforms to the following format: **Usage**: ``` -usage: qmk painter-convert-font-image [-h] [-w] [-r] -f FORMAT [-u UNICODE_GLYPHS] [-n] [-o OUTPUT] - [-i INPUT] +usage: qmk painter-convert-font-image [-h] [-w] [-r] -f FORMAT [-u UNICODE_GLYPHS] [-n] [-o OUTPUT] [-i INPUT] options: -h, --help show this help message and exit -w, --raw Writes out the QFF file as raw data instead of c/h combo. -r, --no-rle Disable the use of RLE to minimise converted image size. -f FORMAT, --format FORMAT - Output format, valid types: rgb888, rgb565, pal256, pal16, pal4, pal2, mono256, - mono16, mono4, mono2 + Output format, valid types: rgb888, rgb565, pal256, pal16, pal4, pal2, mono256, mono16, mono4, mono2 -u UNICODE_GLYPHS, --unicode-glyphs UNICODE_GLYPHS Also generate the specified unicode glyphs. -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the diff --git a/lib/python/qmk/painter.py b/lib/python/qmk/painter.py index 5784e1daed4..66ebe4ec8ef 100644 --- a/lib/python/qmk/painter.py +++ b/lib/python/qmk/painter.py @@ -3,6 +3,7 @@ import datetime import math import re +import sys from string import Template from PIL import Image, ImageOps @@ -151,10 +152,11 @@ def generate_subs(cli, out_bytes, *, font_metadata=None, image_metadata=None): } if font_metadata is not None: + command = sys.argv[1] # extract whether we are in `painter-convert-font` or `painter-convert-font-image` subs.update({ "generated_type": "font", "var_prefix": "font", - "generator_command": f"qmk painter-convert-font-image -i {cli.args.input.name} -f {cli.args.format}{' --no-ascii' if cli.args.no_ascii else ''}", + "generator_command": f"qmk {command} -i {cli.args.input.name} -f {cli.args.format}{' --no-ascii' if cli.args.no_ascii else ''}", # not using triple quotes to avoid extra indentation/weird formatted code "metadata": "\n".join([ "// Font's metadata",