Fix img layout bug

This commit is contained in:
jpirnay
2026-03-20 17:15:08 +01:00
parent 9c8e64402d
commit a068f76074
@@ -397,6 +397,16 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
LOG_DBG("EHP", "Display size: %dx%d (scale %.2f)", displayWidth, displayHeight, scale); LOG_DBG("EHP", "Display size: %dx%d (scale %.2f)", displayWidth, displayHeight, scale);
} }
// Flush any pending text block so it appears before the image
if (self->partWordBufferIndex > 0) {
self->flushPartWordBuffer();
}
if (self->currentTextBlock && !self->currentTextBlock->isEmpty()) {
self->makePages();
self->currentTextBlock.reset();
self->wordsExtractedInBlock = 0;
}
// Create page for image - only break if image won't fit remaining space // Create page for image - only break if image won't fit remaining space
if (self->currentPage && !self->currentPage->elements.empty() && if (self->currentPage && !self->currentPage->elements.empty() &&
(self->currentPageNextY + displayHeight > self->viewportHeight)) { (self->currentPageNextY + displayHeight > self->viewportHeight)) {