Preserve continuation boundaries when building SD prewarm text

This commit is contained in:
jpirnay
2026-04-28 18:40:37 +02:00
parent 2694081af9
commit 1f10e91c23
+6 -4
View File
@@ -156,13 +156,15 @@ void ParsedText::layoutAndExtractLines(
// (advanceX only, no bitmaps) for all unique codepoints in this paragraph so
// that calculateWordWidths() can measure text without on-demand SD I/O.
if (renderer.isSdCardFont(fontId)) {
size_t totalSize = 1; // reserve room for a possible hyphen fallback
if (!words.empty()) totalSize += words.size() - 1; // inter-word spaces
for (const auto& w : words) totalSize += w.size();
size_t totalSize = 1; // reserve room for a possible hyphen fallback
for (size_t i = 0; i < words.size(); i++) {
if (i > 0 && !wordContinues[i]) totalSize += 1;
totalSize += words[i].size();
}
std::string allText;
allText.reserve(totalSize);
for (size_t i = 0; i < words.size(); i++) {
if (i > 0) allText += ' ';
if (i > 0 && !wordContinues[i]) allText += ' ';
allText += words[i];
}
allText += '-';