fix(epub): preserve word continuation when splitting CJK text on MAX_WORD_SIZE (#2652)

This commit is contained in:
Phạm Bình An
2026-07-20 15:02:08 +03:00
committed by GitHub
parent 3dfbc0383f
commit 3319aa1720
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ namespace {
// v30: Arabic shaping changed both drawing and measurement (getTextAdvanceX now
// measures the shaped visual text); cached word positions from v29 no longer
// match what drawText renders.
constexpr uint8_t SECTION_FILE_VERSION = 30;
constexpr uint8_t SECTION_FILE_VERSION = 31;
// Written into the version field while a build is in progress; patched to
// SECTION_FILE_VERSION only when the build is finalized. An abandoned /
// crash-interrupted .bin therefore carries version 0, which loadSectionFile rejects
@@ -1154,12 +1154,14 @@ void XMLCALL ChapterHtmlSlimParser::characterData(void* userData, const XML_Char
}
self->partWordBufferIndex = safeLen;
self->flushPartWordBuffer();
self->nextWordContinues = true;
for (int j = 0; j < overflow; j++) {
self->partWordBuffer[j] = saved[j];
}
self->partWordBufferIndex = overflow;
} else {
self->flushPartWordBuffer();
self->nextWordContinues = true;
}
}