From dbf50c2a8232bfbe5726d1dc4ab3a6025db52050 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 29 Apr 2026 14:12:59 +0200 Subject: [PATCH] aAdjust strikethrough offset Co-authored-by: Copilot --- lib/Epub/Epub/blocks/TextBlock.cpp | 3 ++- src/activities/reader/MdReaderActivity.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Epub/Epub/blocks/TextBlock.cpp b/lib/Epub/Epub/blocks/TextBlock.cpp index f7fde4b2..cce06692 100644 --- a/lib/Epub/Epub/blocks/TextBlock.cpp +++ b/lib/Epub/Epub/blocks/TextBlock.cpp @@ -42,7 +42,8 @@ void TextBlock::render(const GfxRenderer& renderer, const int fontId, const int } if ((currentStyle & EpdFontFamily::STRIKETHROUGH) != 0) { - const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 2; + // Arbitrary vertical offset of 4px from the font midline to avoid colliding with typical diacritics; adjust as needed + const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 4; renderer.drawLine(startX, strikeY, startX + lineWidth, strikeY, 2, true); } } diff --git a/src/activities/reader/MdReaderActivity.cpp b/src/activities/reader/MdReaderActivity.cpp index 376d740b..af4ccc79 100644 --- a/src/activities/reader/MdReaderActivity.cpp +++ b/src/activities/reader/MdReaderActivity.cpp @@ -735,7 +735,8 @@ void MdReaderActivity::renderPage() { renderer.drawLine(x, underlineY, x + spanWidth, underlineY, 2, true); } if ((span.style & EpdFontFamily::STRIKETHROUGH) != 0) { - const int strikeY = y + renderer.getFontAscenderSize(cachedFontId) / 2 + 2; + // Arbitrary vertical offset of 4px from the font midline to avoid colliding with typical diacritics; adjust as needed + const int strikeY = y + renderer.getFontAscenderSize(cachedFontId) / 2 + 4; renderer.drawLine(x, strikeY, x + spanWidth, strikeY, 2, true); } x += spanWidth;