Files
xiaozhi-esp32/main/display/lvgl_display/lvgl_font.h
T
3dea6e7f84 Migrate to xiaozhi-fonts 2.0.0 (#2125)
* feat: migrate firmware to xiaozhi-fonts 2.0.0

* fix: restart scrolling subtitles on text change

* docs: add AGENTS.md for project overview, architecture, rules, and commands

- Introduced AGENTS.md to document the XiaoZhi voice-assistant firmware architecture, required rules for development, board configuration process, and validation steps.
- Included detailed sections on project structure, commands for building and testing, and authoritative documentation references.

* feat: finalize glyph push protocol

* fix: remove stale emoji font include

* build: use xiaozhi-fonts 2.0.0

* fix: decouple custom fonts from glyph push

* refactor: improve wake word invocation handling

- Introduced BeginWakeWordInvoke method to streamline the wake word processing flow.
- Updated HandleWakeWordDetectedEvent to utilize the new method, ensuring proper state transitions and scheduling.
- Enhanced error handling to prevent the device from getting stuck in the connecting state.
- Refactored audio channel management to improve responsiveness during wake word detection.

---------

Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
2026-07-18 21:29:00 +08:00

43 lines
1.1 KiB
C++

#pragma once
#include <lvgl.h>
class LvglFont {
public:
virtual const lv_font_t* font() const = 0;
virtual void SetFallback(const lv_font_t* fallback) = 0;
virtual ~LvglFont() = default;
};
// Built-in font
class LvglBuiltInFont : public LvglFont {
public:
LvglBuiltInFont(const lv_font_t* font) : font_(*font) {}
virtual const lv_font_t* font() const override { return &font_; }
virtual void SetFallback(const lv_font_t* fallback) override { font_.fallback = fallback; }
private:
lv_font_t font_{};
};
class LvglCBinFont : public LvglFont {
public:
LvglCBinFont(void* data);
virtual ~LvglCBinFont();
virtual const lv_font_t* font() const override { return font_; }
uint8_t bpp() const {
if (font_ == nullptr || font_->dsc == nullptr) {
return 0;
}
return static_cast<const lv_font_fmt_txt_dsc_t*>(font_->dsc)->bpp;
}
virtual void SetFallback(const lv_font_t* fallback) override {
if (font_ != nullptr) {
font_->fallback = fallback;
}
}
private:
lv_font_t* font_;
};