Ken Van Hoeylandt 7ea8c346b0
Various improvements (#673)
Graphics & rendering

- Implement `binfont-module` to generate bitmap fonts on the device itself
- Remove lodepng support from LVGL library and create `Modules/lodepng-module` to make the feature re-usable in non-LVGL apps too. Add binding functions for LVGL support.
- Implement large icons for boot screen (Tactility and USB logos)
- Remove unused asset files in `Data/`

Boot

- Split up `Tactility.cpp` and its `run()` function into various `Init*.cpp` files.
- Re-implement `Boot.cpp` app as non-LVGL app
- Boot app now has a `BootSequence.cpp` for the init code.
- LVGL is now started when the Boot app finishes
- Move more init logic into Boot app

BLE

- Don't allocate scan result buffers unless BLE is on
- Allocate scan results in external memory if possible

UX & UI

- USB Settings app: remove border from the button container
2026-10-04 18:09:21 +02:00

55 lines
2.1 KiB
C

// SPDX-License-Identifier: Apache-2.0
#include <lvgl.h>
#include <lvgl/fonts.h>
#include <tactility/check.h>
// The preprocessor definitions that are used below are defined in the CMakeLists.txt from this module.
extern const lv_font_t TT_LVGL_TEXT_FONT_SMALL_SYMBOL;
extern const lv_font_t TT_LVGL_TEXT_FONT_DEFAULT_SYMBOL;
extern const lv_font_t TT_LVGL_TEXT_FONT_LARGE_SYMBOL;
static const lv_font_t* icon_fonts[LVGL_ICON_FONT_SHARED_2X + 1];
void lvgl_set_icon_font(enum LvglIconFont icon_font, const lv_font_t* font) {
icon_fonts[icon_font] = font;
}
static const lv_font_t* get_icon_font(enum LvglIconFont icon_font) {
const lv_font_t* font = icon_fonts[icon_font];
return font != NULL ? font : &TT_LVGL_TEXT_FONT_DEFAULT_SYMBOL;
}
uint32_t lvgl_get_text_font_height(enum LvglFontSize font_size) {
switch (font_size) {
case FONT_SIZE_SMALL: return TT_LVGL_TEXT_FONT_SMALL_SIZE;
case FONT_SIZE_DEFAULT: return TT_LVGL_TEXT_FONT_DEFAULT_SIZE;
case FONT_SIZE_LARGE: return TT_LVGL_TEXT_FONT_LARGE_SIZE;
default: check(false);
}
}
const lv_font_t* lvgl_get_text_font(enum LvglFontSize font_size) {
switch (font_size) {
case FONT_SIZE_SMALL: return &TT_LVGL_TEXT_FONT_SMALL_SYMBOL;
case FONT_SIZE_DEFAULT: return &TT_LVGL_TEXT_FONT_DEFAULT_SYMBOL;
case FONT_SIZE_LARGE: return &TT_LVGL_TEXT_FONT_LARGE_SYMBOL;
default: check(false);
}
}
uint32_t lvgl_get_shared_icon_font_height() { return TT_LVGL_SHARED_FONT_ICON_SIZE; }
const lv_font_t* lvgl_get_shared_icon_font() { return get_icon_font(LVGL_ICON_FONT_SHARED); }
uint32_t lvgl_get_shared_icon_font_2x_height() { return TT_LVGL_SHARED_FONT_ICON_SIZE * 2; }
const lv_font_t* lvgl_get_shared_icon_font_2x() { return get_icon_font(LVGL_ICON_FONT_SHARED_2X); }
uint32_t lvgl_get_launcher_icon_font_height() { return TT_LVGL_LAUNCHER_FONT_ICON_SIZE; }
const lv_font_t* lvgl_get_launcher_icon_font() { return get_icon_font(LVGL_ICON_FONT_LAUNCHER); }
uint32_t lvgl_get_statusbar_icon_font_height() { return TT_LVGL_STATUSBAR_FONT_ICON_SIZE; }
const lv_font_t* lvgl_get_statusbar_icon_font() { return get_icon_font(LVGL_ICON_FONT_STATUSBAR); }