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 >**_
This commit is contained in:
Uri Tauber
2026-05-12 14:00:17 -05:00
committed by GitHub
parent 3c34a8310e
commit 30a209de8b
+6 -2
View File
@@ -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;