From 48aaf821a5758d7e0f03c4f726927d45c6db6761 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Mon, 4 May 2026 15:33:47 +0200 Subject: [PATCH] Clear cache on prewarm --- lib/EpdFont/FontDecompressor.h | 2 +- lib/GfxRenderer/FontCacheManager.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/EpdFont/FontDecompressor.h b/lib/EpdFont/FontDecompressor.h index 8f574dba..afb9c61c 100644 --- a/lib/EpdFont/FontDecompressor.h +++ b/lib/EpdFont/FontDecompressor.h @@ -7,7 +7,7 @@ class FontDecompressor { public: static constexpr uint16_t MAX_PAGE_GLYPHS = 512; - static constexpr uint8_t MAX_PAGE_SLOTS = 4; // One per font style (R/B/I/BI) + static constexpr uint8_t MAX_PAGE_SLOTS = 8; // Provide enough slots for heavily stylized HTML pages FontDecompressor() = default; ~FontDecompressor(); diff --git a/lib/GfxRenderer/FontCacheManager.cpp b/lib/GfxRenderer/FontCacheManager.cpp index b55fdf08..36620f2e 100644 --- a/lib/GfxRenderer/FontCacheManager.cpp +++ b/lib/GfxRenderer/FontCacheManager.cpp @@ -24,6 +24,8 @@ void FontCacheManager::clearCache() { } void FontCacheManager::prewarmCache(int fontId, const char* utf8Text, uint8_t styleMask) { + clearCache(); + // SD card font prewarm path: prewarm all requested styles in one call auto sdIt = sdCardFonts_.find(fontId); if (sdIt != sdCardFonts_.end()) {