1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-25 17:25:14 +03:00

[FONTS] Add font metadata and simplify the font build process

Instead of using a Makefile with multiple arguments that must be
passed via the command line, replace it with a newer version of
max7456tool that allows managing a set of fonts with a single
yaml configuration file.
This commit is contained in:
Alberto García Hierro 2020-06-13 11:37:38 +01:00
parent ee4bde7f65
commit 686e1dcdd1
20 changed files with 409 additions and 304 deletions

View file

@ -1,26 +0,0 @@
# max7456tool: https://github.com/fiam/max7456tool
# Minimum version required: 0.4
.PHONY: all clean
FONT_VERSION = 1
FONTS = default vision impact impact_mini clarity clarity_medium bold large
CHARMAPS = $(addsuffix .mcm, $(FONTS))
PREVIEWS = $(addsuffix .png, $(FONTS))
# 'I', 'N', 'A', 'V', 1
INAV_METADATA = lu8:73,lu8:78,lu8:65,lu8:86,lu8:1
FONT_VERSION_METADATA = lu8:${FONT_VERSION}
CHAR_METADATA = ${INAV_METADATA},${FONT_VERSION_METADATA}
METADATA = 255=${CHAR_METADATA}-256=${CHAR_METADATA}
all: $(CHARMAPS) $(PREVIEWS)
%.mcm: % %/*.png
max7456tool -f build -md ${METADATA} $< $@
%.png: %.mcm
max7456tool -f png $< $@
clean:
$(RM) $(CHARMAPS) $(PREVIEWS)

View file

@ -2,25 +2,33 @@
This directory contains one directory per font. In each
directory, each character is named `%d%d%d.png`, where
the digits represent the character number found in the
filename.
the digits represent the decimal character number found
in the filename without the extension.
Don't alter the .mcm files directly, those should be
only modified by altering the .png files found in its
Don't alter the `.mcm` files directly, those should be
only modified by altering the `.png` files found in its
correspondant font directory.
Character map files (.mcm) are built from the .png files
representing the characters using
Character map files (`.mcm`) are built from the `.png` files
in each directory representing the font, using
[max7456toool](https://github.com/fiam/max7456tool).
The Makefile found in this directory can be used to
re-generate all character maps. It only requires
max7456toool to be found in ${PATH}. After modifying,
deleting or altering a character .png file, just run
`make` and it will automatically rebuild the affected
character sets as well as generate a preview file
named `$charset_name.png`.
After changing any source `.png` files, run:
Note that .mcm files MUST be manually added and committed
to the repo, while .png files MUST NOT (.gitignore is
set up to ignore them to help avoid mistakes).
```sh
max7456tool -f generate fonts.yaml
```
to update the `.mcm` files.
Note that `.mcm` files MUST be manually regenerated with
the aforementioned command, added and committed to the
repo, while preview `.png` files (the ones contained directly
in this directory, not the ones in the source subdirectories)
MUST NOT, they're generated only for convenience to quickly
review fonts at a glance (.gitignore is set up to ignore them
to help avoid mistakes).
To add a new font, create its directory with source `.png` files,
add it to the list in `fonts.yaml` and rerun `max7456tool` to
regenerate the `.mcm`.

7
resources/osd/all.yaml Normal file
View file

@ -0,0 +1,7 @@
# These are used in all fonts to indicate the
# INAV font version.
255: &fontmeta
data:
- s: "INAV"
- u8: 1
256: *fontmeta

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

4
resources/osd/bold.yaml Normal file
View file

@ -0,0 +1,4 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
00000010
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: 2 # y offset

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
00000001
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8 # actually it's 7, but we can't draw half pixels
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: 1 # y offset

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
11111111
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: -1 # y offset

33
resources/osd/fonts.yaml Normal file
View file

@ -0,0 +1,33 @@
# Generate preview a png file as a preview
# for every generated font unless it comes
# from a png already
previews: true
# Shared extra data for all fonts
extra:
- all.yaml
# Default font comes from from this directory
# (could be a .png too). Missing characters
# from other fonts will be filled from this one
default: default
# List of all fonts (no need to repeat the default one)
# if nonext(font).yaml exist, it will be interpreted as
# extra data for the font and added to it.
fonts:
- source: bold
extra: true
- source: clarity
extra: true
- source: clarity_medium
extra: true
- source: default
extra: true
- source: impact
extra: true
- source: impact_mini
extra: true
- source: large
extra: true
- source: vision
extra: true

View file

@ -521,6 +521,8 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -534,8 +536,14 @@ MAX7456
01010101
01010101
01010101
00000000
00000101
01010101
10101010
10100101
01010101
00000000
00000101
01010101
01010101
01010101
@ -549,6 +557,8 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -574,19 +584,44 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010000
01010101
01010101
01010010
00010101
01010101
01010010
10000101
01010101
01010010
10100001
01010101
01010010
10101000
01010101
01010010
10101010
00010101
01010010
10101000
01010101
01010010
10100001
01010101
01010010
10000101
01010101
01010010
00010101
01010101
01010000
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -614,19 +649,44 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
00000101
01010101
01010100
10000101
01010101
01010010
10000101
01010101
01001010
10000101
01010101
00101010
10000101
01010100
10101010
10000101
01010101
00101010
10000101
01010101
01001010
10000101
01010101
01010010
10000101
01010101
01010100
10000101
01010101
01010101
00000101
01010101
01011010
10100101
01010101
01010101
01010101
@ -644,10 +704,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -662,10 +725,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -680,10 +746,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -719,95 +788,26 @@ MAX7456
01010101
01010101
01010101
01010100
01000101
01010101
01010010
00100001
01010101
01001000
10001000
01010101
01001000
10001000
01010101
01001000
00001000
01010101
01001000
01001000
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010001
01010001
01010101
01010101
01010101
@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
00000001
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: 1 # y offset

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000001
00000000
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8 # it's actually 7, but we can't draw half pixels
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 1 # x offset
- i8: 0 # y offset

View file

@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
00000000
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101

9
resources/osd/large.yaml Normal file
View file

@ -0,0 +1,9 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8 # it's actually 7, but we can't draw half pixels
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: 0 # y offset

View file

@ -521,6 +521,8 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -534,8 +536,14 @@ MAX7456
01010101
01010101
01010101
00000000
00000101
01010101
10101010
10100101
01010101
00000000
00000101
01010101
01010101
01010101
@ -549,6 +557,8 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -574,19 +584,44 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010000
01010101
01010101
01010010
00010101
01010101
01010010
10000101
01010101
01010010
10100001
01010101
01010010
10101000
01010101
01010010
10101010
00010101
01010010
10101000
01010101
01010010
10100001
01010101
01010010
10000101
01010101
01010010
00010101
01010101
01010000
01010101
01010101
01011010
10100101
01010101
01010101
01010101
@ -614,19 +649,44 @@ MAX7456
01010101
01010101
01010101
01011010
10100101
01010101
01010101
00000101
01010101
01010100
10000101
01010101
01010010
10000101
01010101
01001010
10000101
01010101
00101010
10000101
01010100
10101010
10000101
01010101
00101010
10000101
01010101
01001010
10000101
01010101
01010010
10000101
01010101
01010100
10000101
01010101
01010101
00000101
01010101
01011010
10100101
01010101
01010101
01010101
@ -644,10 +704,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -662,10 +725,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -680,10 +746,13 @@ MAX7456
01010101
01010101
01010101
01000001
01010101
01010101
00101000
01010101
01010101
01000001
01010101
01010101
01010101
@ -719,95 +788,26 @@ MAX7456
01010101
01010101
01010101
01010100
01000101
01010101
01010010
00100001
01010101
01001000
10001000
01010101
01001000
10001000
01010101
01001000
00001000
01010101
01001000
01001000
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010001
01010001
01010101
01010101
01010101
@ -2933,8 +2933,8 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01110011
00001000
01010101
01010101
01010101
@ -2997,9 +2997,9 @@ MAX7456
01010101
01010101
01010101
01010101
01010101
01010101
01101111
00000000
00000001
01010101
01010101
01010101
@ -9653,16 +9653,16 @@ MAX7456
01010101
00000000
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01110010
00000101
00000100
00000011
00001100
01101111
00000000
11111111
01100011
00000010
01010101
01010101
01010101
@ -16324,7 +16324,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -16388,7 +16388,7 @@ MAX7456
01000001
01010110
00000001
00000001
01010101
01010101
01010101
01010101
@ -26583,6 +26583,15 @@ MAX7456
01010101
01010101
01010101
01010100
00000000
00010101
01010100
10101010
00000000
01010100
00000000
00010101
01010101
01010101
01010101
@ -26618,10 +26627,13 @@ MAX7456
01010101
01010101
01010101
01010001
01010101
01010101
01010001
01010101
01010101
01010001
01010101
01010101
01010101
@ -26630,14 +26642,25 @@ MAX7456
01010101
01010101
01010101
01010001
01010101
01010101
01001000
01010101
01010101
00101010
00010101
00010100
10100010
10000101
01010101
00101010
00010101
01010101
01001000
01010101
01010101
01010001
01010101
01010101
01010101
@ -26646,10 +26669,13 @@ MAX7456
01010101
01010101
01010101
01010001
01010101
01010101
01010001
01010101
01010101
01010001
01010101
01010101
01010101
@ -26686,40 +26712,14 @@ MAX7456
01010101
01010101
01010101
00000000
00000101
00000000
00101010
10000101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
00000000
00000101
01010101
01010101
01010101

25
resources/osd/vision.yaml Normal file
View file

@ -0,0 +1,25 @@
45: # Width of the '-' character in pixels
metadata:
- s: s
- u8: 8
46: # Offset of the '.' character to align it with other digits
metadata:
- s: o
- i8: 0 # x offset
- i8: 1 # y offset
150:
metadata:
# Rectangle to fill with battery percentage
- s: r
- u8: 5
- u8: 4
- u8: 3
- u8: 12
# Offset to indicate the direction of the
# rectangle to full
- s: o
- i8: 0
- i8: -1
# Colors to use the for the filled/unfilled region
- s: c
- c: WHITE, BLACK