From 30a209de8b133b4e4b9a047d33f1ea5348fff9cb Mon Sep 17 00:00:00 2001 From: Uri Tauber Date: Tue, 12 May 2026 22:00:17 +0300 Subject: [PATCH] fix: Characters from unsupported characterset are overlapping (#1958) ## Summary * **What is the goal of this PR?** fix #1956. ## Additional Context [NixOS-and-Flakes-Book_ch3_p7_4pct_130044.bmp](https://github.com/user-attachments/files/27648392/NixOS-and-Flakes-Book_ch3_p7_4pct_130044.bmp) --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**< YES >**_ --- lib/EpdFont/SdCardFont.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/EpdFont/SdCardFont.cpp b/lib/EpdFont/SdCardFont.cpp index 2a3329da..7bd75baa 100644 --- a/lib/EpdFont/SdCardFont.cpp +++ b/lib/EpdFont/SdCardFont.cpp @@ -1097,13 +1097,17 @@ int SdCardFont::buildAdvanceTable(const char* utf8Text, uint8_t styleMask) { uint32_t needCount = 0; uint32_t missedThisStyle = 0; + const int32_t replacementIdx = findGlobalGlyphIndex(s, REPLACEMENT_GLYPH); for (uint32_t i = 0; i < cpCount; i++) { const uint32_t cp = codepoints[i]; if (advanceTableLookup(si, cp, nullptr)) continue; // already cached int32_t idx = findGlobalGlyphIndex(s, cp); if (idx < 0) { - missedThisStyle++; - continue; + if (replacementIdx < 0) { + missedThisStyle++; + continue; + } + idx = replacementIdx; } mappings[needCount].codepoint = cp; mappings[needCount].glyphIndex = idx;