Merge branch 'master' into feat-supsub

This commit is contained in:
jpirnay
2026-05-15 20:54:49 +02:00
committed by GitHub
12 changed files with 179 additions and 69 deletions
@@ -1064,6 +1064,28 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
self->preUntilDepth = std::min(self->preUntilDepth, self->depth);
}
}
} else if (strcmp(name, "hr") == 0) {
if (self->partWordBufferIndex > 0) {
if (!self->flushPartWordBuffer()) return;
}
self->makePages();
if (!self->currentPage) {
self->currentPage.reset(new Page());
self->currentPageNextY = 0;
}
const int lineHeight = static_cast<int>(self->renderer.getLineHeight(self->fontId) * self->lineCompression + 0.5f);
const int16_t marginV = static_cast<int16_t>(lineHeight / 2);
self->currentPageNextY += marginV;
if (self->currentPageNextY + 1 + marginV > self->viewportHeight) {
self->emitPage(self->lastBodyChildByteOffset);
self->currentPage.reset(new Page());
self->currentPageNextY = 0;
}
self->currentPage->elements.push_back(
std::make_shared<PageHR>(0, self->currentPageNextY, static_cast<int16_t>(self->viewportWidth)));
self->currentPageNextY += 1 + marginV;
BlockStyle emptyStyle;
self->startNewTextBlock(emptyStyle);
} else if (matches(name, UNDERLINE_TAGS, NUM_UNDERLINE_TAGS) ||
matches(name, STRIKETHROUGH_TAGS, NUM_STRIKETHROUGH_TAGS)) {
// Flush buffer before style change so preceding text gets current style