Skip to content

Commit f23bb25

Browse files
benlumleybri3d
andauthored
Switch to using PNG fonts, add support for more font pages (#138)
* add libspng 0.7.3 * working PNG support * cleanup * split font code into own file * add font converter * swap to PNG fonts * swap ipk to contain png * builds * Fix comparison error * bump version for testing * Rework font loading: - No longer require whitelist of fonts; take FC identifier and use that directly. Avoids needing to release a version to support a new FC; users could put fonts on an SD and away they go. - Also, to support the above - fall back to default font variant if no FC specific variant found (previously impossible as we bundled a font for all supported FCs) - Support fallback to bf as a font name; betaflight uses BTFL as it's identifier; we used bf in it's font filenames previously * debugs * convert quicksilver font * Switch to sneaky europa and switch to preferred font names (fc identifier for bf/ultra - btfl/ultr) * Add fallback for ultra * Fix comparisons * reorder font loading - /blackbox before the bundled fonts; means you can put fonts (via adb push) into /blackbox and then not need to worry about putting them on SD * font convert debugging + load order amend so BTFL/ULTR fallback works * Fix infinite reloading of fonts caused by lowercasing the FC variant * Fix debug * latest ver of sneakyfpv fonts * update ardu and generic font * revert accidental gtar * revise fonts section in readme * Remove -dev from version ahead of release --------- Co-authored-by: bri3d <brian@brianledbetter.com>
1 parent acbfec9 commit f23bb25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7954
-246
lines changed

Makefile.dji

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ LIB_SHIMS = libshims/libduml_hal.so
99

1010
#this doesn't work by default
1111
#an extra duss_result_t(frame_pop_handler)
12-
#is generated that the compiler doesn't like
12+
#is generated that the compiler doesn't like
1313
libshims/%.c: %.h
1414
stubgen -g -e .c -l -N -t libshims -p "../" -n $<
1515

1616
libshims/lib%.so: libshims/%.c
1717
$(CC) -Wno-c2x-extensions -O2 -shared -Wl,-soname,libduml_hal.so -o $@ $< $(CFLAGS)
18-
18+
1919
libshims: $(LIB_SHIMS)
2020

2121
all: jni/*
22-
ndk-build
22+
ndk-build
2323

2424
install: all
2525
install -d ipk/goggle/build/data/opt/fonts/
26-
install fonts/*.bin ipk/goggle/build/data/opt/fonts/
26+
install fonts/*.png ipk/goggle/build/data/opt/fonts/
2727
install -d ipk/goggle/build/data/opt/mspdictionaries/
2828
install dictionaries/*.bin ipk/goggle/build/data/opt/mspdictionaries/
2929
install -d ipk/goggle/build/data/opt/etc/preload.d/
@@ -69,7 +69,7 @@ repo: ipk
6969
cp ipk/*.ipk repo/
7070
../opkg-utils-0.5.0/opkg-make-index ./repo/ > repo/Packages
7171
http-server -p 8042 ./repo/
72-
72+
7373
clean:
7474
rm -rf **/*.o
7575
rm -rf *.o

README.md

+14-31
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ A diagram to help...
102102

103103
Visit https://fpv.wtf/package/fpv-wtf/msp-osd with your goggles connected, and check "Fake HD"
104104

105-
Optionally, place custom fonts in the root of your sd card, using the names `font_bf_hd.bin` / `font_bf_hd_2.bin` (NB: FakeHD no longer uses font_hd.bin / font_hd_2.bin)
105+
Optionally, place custom fonts in the root of your sd card, using the names `font_bf_hd.png`
106106

107107
Configuration of the grid is also possible; see below.
108108

@@ -220,53 +220,36 @@ Configure the UART under Digital VTX - see https://docs.bosshobby.com/Configurin
220220

221221
## Fonts
222222

223-
We bundle in default fonts for the flight controller variants we support. [Preview images are available here](docs/fonts). Or you can use a custom one...
223+
We bundle in default fonts for Betaflight, Ardupilot, INAV, Quicksilver, and KISS ULTRA (font is SNEAKYFPV's Europa - thanks to SNEAKYFPV for allowing us to use these - https://sites.google.com/view/sneaky-fpv/home). Since 0.12 we use a PNG font format, the same as Walksnail. [Default fonts can be viewed here](fonts). You may also upload your own fonts to the SD card.
224224

225225
* Download a font package. See below for known community fonts.
226-
* Rename the files for your desired font to `font_<fc variant>` - see table below for examples or take a look at the `fonts` directory for a template for how the file names should look. (If your FC firmware is not listed below, use the generic filenames)
227-
* Place these four files on the root of your Goggles SD card.
226+
* Rename the files for your desired font to `font_<fc variant>.png` - see table below for examples or take a look at the `fonts` directory for a template for how the file names should look. (If your FC firmware is not listed below, use the generic filenames)
227+
* Place these two PNG files on the root of your Goggles SD card.
228228
* Reboot.
229229

230230
### FC Specific Font File Names
231231

232232
| Flight controller | SD | HD |
233233
| ----------------- | -- | -- |
234-
| Betaflight | `font_bf.bin`, `font_bf_2.bin` | `font_bf_hd.bin`, `font_bf_hd_2.bin` |
235-
| INAV | `font_inav.bin`, `font_inav_2.bin` | `font_inav_hd.bin`, `font_inav_hd_2.bin`|
236-
| Ardupilot | `font_ardu.bin`, `font_ardu_2.bin` | `font_ardu_hd.bin`, `font_ardu_hd_2.bin`|
237-
| KISS Ultra | `font_ultra.bin`, `font_ultra_2.bin` | `font_ultra_hd.bin`, `font_ultra_hd_2.bin`|
238-
| QUICKSILVER | `font_quic.bin`, `font_quic_2.bin` | `font_quic_hd.bin`, `font_quic_hd_2.bin`|
239-
| Generic/Fallback | `font.bin`, `font_2.bin` | `font_hd.bin`, `font_hd_2.bin`|
234+
| Betaflight | `font_btfl.png` | `font_btfl_hd.png` |
235+
| INAV | `font_inav.png` | `font_inav_hd.png`|
236+
| Ardupilot | `font_ardu.png` | `font_ardu_hd.png`|
237+
| KISS Ultra | `font_ultr.png` | `font_ulta_hd.png`|
238+
| QUICKSILVER | `font_quic.png` | `font_quic_hd.png`|
239+
| Generic/Fallback | `font.png` | `font_hd.png`|
240240

241-
VTx (AU/Vista) which have not had their msp-osd upgraded, as well as flight controllers which do not respond to the Variant request, like old Ardupilot versions, will fall back to the Generic/Fallback font.
241+
Airside VTx (AU/Vista) which have a very old version of msp-osd on, as well as flight controllers which do not respond to the Variant request, like old Ardupilot versions, will fall back to the Generic/Fallback font.
242+
243+
You can also add fonts for firmwares not in this list; using the generic filename, or put the MSP identifier in (lower case it) the filename - ```font_<fc_variant>.png / font_<fc_variant>_hd.png```
242244

243245
### Suggested Third Party Fonts
244246

245-
- [KNIFA's Material](https://github.com/Knifa/material-osd/releases)
247+
- [KNIFA's Material](https://github.com/Knifa/material-osd/releases) - use the Walksnail version for MSP-OSD >= 0.12
246248
- [SNEAKY_FPV's colour fonts for INAV, ARDU and BF](https://sites.google.com/view/sneaky-fpv/home)
247249
- [VICEWIZE Italic](https://github.com/vicewize/vicewizeosdfontset)
248250
- [Kw0ngk4n's Neue OSD](https://github.com/Kw0ngk4n/WTF-Neue-OSD)
249251
- [EVilm1's OSD Font](https://github.com/EVilm1/EVilm1-OSD-Font)
250252

251-
### Generate your own Font from an analog font (advanced)
252-
253-
* Download [mcm2img](https://github.com/bri3d/mcm2img) and set up a working Python environment to run it.
254-
255-
* Locate the font you'd like to install - it will be a `.mcm` file, in the source code repository or configurator for your Flight Controller.
256-
257-
* For Betaflight: https://github.com/betaflight/betaflight-configurator/tree/master/resources/osd/2
258-
* For INAV: https://github.com/iNavFlight/inav-configurator/blob/master/resources/osd/
259-
* For Ardupilot: https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_OSD/fonts
260-
261-
* Run `python3 mcm2img.py mcmfile.mcm font RGBA 255 255 255`
262-
263-
* Place the 4 files this makes (font.bin, font_2.bin, font_hd.bin, font_hd_2.bin) on the root of the SD card in the goggles.
264-
265-
* Reboot
266-
267-
You can customize the font color by changing the 255 255 255 RGB values.
268-
269-
Useful tool for working with fonts: https://github.com/shellixyz/hd_fpv_osd_font_tool
270253

271254
## Modify / Move original DJI OSD elements
272255

fonts/font.bin

-1.9 MB
Binary file not shown.

fonts/font.png

54.9 KB
Loading

fonts/font_ardu.bin

-1.9 MB
Binary file not shown.

fonts/font_ardu.png

203 KB
Loading

fonts/font_ardu_2.bin

-1.9 MB
Binary file not shown.

fonts/font_ardu_hd.bin

-864 KB
Binary file not shown.

fonts/font_ardu_hd.png

176 KB
Loading

fonts/font_ardu_hd_2.bin

-864 KB
Binary file not shown.

fonts/font_bf_hd.bin

-864 KB
Binary file not shown.

fonts/font_btfl.png

303 KB
Loading

fonts/font_btfl_hd.png

258 KB
Loading

fonts/font_hd.bin

-864 KB
Binary file not shown.

fonts/font_hd.png

38.2 KB
Loading

fonts/font_inav.bin

-1.9 MB
Binary file not shown.

fonts/font_inav.png

344 KB
Loading

fonts/font_inav_2.bin

-1.9 MB
Binary file not shown.

fonts/font_inav_hd.bin

-864 KB
Binary file not shown.

fonts/font_inav_hd.png

287 KB
Loading

fonts/font_inav_hd_2.bin

-864 KB
Binary file not shown.

fonts/font_quic.bin

-1.9 MB
Binary file not shown.

fonts/font_quic.png

164 KB
Loading

fonts/font_quic_2.bin

-1.9 MB
Binary file not shown.

fonts/font_quic_hd.bin

-864 KB
Binary file not shown.

fonts/font_quic_hd.png

166 KB
Loading

fonts/font_quic_hd_2.bin

-864 KB
Binary file not shown.

fonts/font_ultr.png

461 KB
Loading

fonts/font_ultr_hd.png

273 KB
Loading

fonts/font_ultra.bin

-1.9 MB
Binary file not shown.

fonts/font_ultra_2.bin

-1.9 MB
Binary file not shown.

fonts/font_ultra_hd.bin

-864 KB
Binary file not shown.

fonts/font_ultra_hd_2.bin

-864 KB
Binary file not shown.

ipk/goggle/control/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: msp-osd
2-
Version: 0.11.1
2+
Version: 0.12.0
33
Maintainer: bri3d
44
Description: MSP OSD service for the DJI HD FPV goggles.
55
Architecture: pigeon-glasses

jni/Android.mk

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ include $(CLEAR_VARS)
99

1010
LOCAL_CFLAGS += -fPIC -std=c99 -O3
1111
LOCAL_LDFLAGS += -fPIC
12-
LOCAL_LDLIBS := -llog
12+
LOCAL_LDLIBS := -llog -lz
1313
LOCAL_ARM_NEON := true
1414
LOCAL_MODULE := displayport_osd_shim
1515
LOCAL_SHARED_LIBRARIES := duml_hal
1616
LOCAL_SRC_FILES := \
1717
displayport_osd_shim.c \
1818
fakehd/fakehd.c \
19+
font/font.c \
1920
hw/dji_display.c \
2021
hw/dji_radio_shm.c \
2122
hw/dji_services.c \
@@ -31,7 +32,8 @@ LOCAL_SRC_FILES := \
3132
rec/rec_util.c \
3233
rec/rec.c \
3334
toast/toast.c \
34-
util/fs_util.c
35+
util/fs_util.c \
36+
libspng/spng.c
3537
include $(BUILD_SHARED_LIBRARY)
3638

3739
include $(CLEAR_VARS)

0 commit comments

Comments
 (0)