Fix markdown underline / strikethrough omission
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -37,13 +37,13 @@ void TextBlock::render(const GfxRenderer& renderer, const int fontId, const int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((currentStyle & EpdFontFamily::UNDERLINE) != 0) {
|
if ((currentStyle & EpdFontFamily::UNDERLINE) != 0) {
|
||||||
const int underlineY = y + renderer.getFontAscenderSize(fontId) + 2;
|
const int underlineY = y + renderer.getFontAscenderSize(fontId) + 3;
|
||||||
renderer.drawLine(startX, underlineY, startX + lineWidth, underlineY, true);
|
renderer.drawLine(startX, underlineY, startX + lineWidth, underlineY, 2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((currentStyle & EpdFontFamily::STRIKETHROUGH) != 0) {
|
if ((currentStyle & EpdFontFamily::STRIKETHROUGH) != 0) {
|
||||||
const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 1;
|
const int strikeY = y + renderer.getFontAscenderSize(fontId) / 2 + 2;
|
||||||
renderer.drawLine(startX, strikeY, startX + lineWidth, strikeY, true);
|
renderer.drawLine(startX, strikeY, startX + lineWidth, strikeY, 2, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -728,8 +728,17 @@ void MdReaderActivity::renderPage() {
|
|||||||
// Render each span
|
// Render each span
|
||||||
for (const auto& span : line.spans) {
|
for (const auto& span : line.spans) {
|
||||||
if (!span.text.empty()) {
|
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);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user