Compare commits

...

2 Commits

Author SHA1 Message Date
martin brook
d59e9dbdab
Merge 3982f249a8 into da4d3b5ea5 2026-01-28 19:36:14 +00:00
Martin Brook
3982f249a8 fix: allow images to share first chapter page with title
Only force a page break before an image when it won't fit in the
remaining page space, instead of unconditionally breaking whenever
the page has any content.
2026-01-28 19:35:42 +00:00

View File

@ -176,8 +176,9 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
Serial.printf("[%lu] [EHP] Display size: %dx%d (scale %.2f)\n", millis(), displayWidth, displayHeight,
scale);
// Create page for image
if (self->currentPage && !self->currentPage->elements.empty()) {
// Create page for image - only break if image won't fit remaining space
if (self->currentPage && !self->currentPage->elements.empty() &&
(self->currentPageNextY + displayHeight > self->viewportHeight)) {
self->completePageFn(std::move(self->currentPage));
self->currentPage.reset(new Page());
if (!self->currentPage) {