Fix sd card font performance for txt + md
This commit is contained in:
@@ -613,6 +613,12 @@ bool MdReaderActivity::loadPageAtOffset(size_t offset, bool startInCodeBlock, st
|
||||
}
|
||||
}
|
||||
|
||||
if (renderer.isSdCardFont(cachedFontId)) {
|
||||
std::string flatText;
|
||||
for (const auto& span : flatLine.spans) flatText += span.text;
|
||||
renderer.ensureSdCardFontReady(cachedFontId, flatText.c_str());
|
||||
}
|
||||
|
||||
size_t linesBefore = outLines.size();
|
||||
int remainingLines = linesPerPage - static_cast<int>(outLines.size());
|
||||
bool fullyConsumed = wordWrapParsedLine(flatLine, 0, outLines, remainingLines);
|
||||
|
||||
@@ -45,6 +45,8 @@ size_t parseAndWrapLines(const uint8_t* buffer, size_t chunkSize, size_t fileOff
|
||||
std::string line(reinterpret_cast<const char*>(buffer + pos), displayLen);
|
||||
size_t lineBytePos = 0;
|
||||
|
||||
renderer.ensureSdCardFontReady(fontId, line.c_str());
|
||||
|
||||
while (!line.empty() && static_cast<int>(outLines.size()) < linesPerPage) {
|
||||
if (renderer.getTextWidth(fontId, line.c_str()) <= vw) {
|
||||
outLines.push_back(line);
|
||||
|
||||
Reference in New Issue
Block a user