Fix markdown underline / strikethrough omission

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
jpirnay
2026-04-29 13:28:26 +02:00
co-authored by Copilot
parent cd030ab4ee
commit fea663ac64
2 changed files with 14 additions and 5 deletions
+4 -4
View File
@@ -37,13 +37,13 @@ void TextBlock::render(const GfxRenderer& renderer, const int fontId, const int
}
if ((currentStyle & EpdFontFamily::UNDERLINE) != 0) {
const int underlineY = y + renderer.getFontAscenderSize(fontId) + 2;
renderer.drawLine(startX, underlineY, startX + lineWidth, underlineY, true);
const int underlineY = y + renderer.getFontAscenderSize(fontId) + 3;
renderer.drawLine(startX, underlineY, startX + lineWidth, underlineY, 2, true);
}
if ((currentStyle & EpdFontFamily::STRIKETHROUGH) != 0) {
const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 1;
renderer.drawLine(startX, strikeY, startX + lineWidth, strikeY, true);
const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 2;
renderer.drawLine(startX, strikeY, startX + lineWidth, strikeY, 2, true);
}
}
}
+10 -1
View File
@@ -728,8 +728,17 @@ void MdReaderActivity::renderPage() {
// Render each span
for (const auto& span : line.spans) {
if (!span.text.empty()) {
const int spanWidth = renderer.getTextAdvanceX(cachedFontId, span.text.c_str(), span.style);
renderer.drawText(cachedFontId, x, y, span.text.c_str(), true, span.style);
x += renderer.getTextAdvanceX(cachedFontId, span.text.c_str(), span.style);
if ((span.style & EpdFontFamily::UNDERLINE) != 0) {
const int underlineY = y + renderer.getFontAscenderSize(cachedFontId) + 3;
renderer.drawLine(x, underlineY, x + spanWidth, underlineY, 2, true);
}
if ((span.style & EpdFontFamily::STRIKETHROUGH) != 0) {
const int strikeY = y + renderer.getFontAscenderSize(cachedFontId) / 2 + 2;
renderer.drawLine(x, strikeY, x + spanWidth, strikeY, 2, true);
}
x += spanWidth;
}
}
}