Improve docs and metadata

This commit is contained in:
elpekenin 2024-02-17 19:22:37 +01:00
parent 20a4e11742
commit 3903c70035
3 changed files with 9 additions and 11 deletions

View File

@ -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.

View File

@ -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

View File

@ -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",