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;