From 1a7acd91bb311c77b6281f09cc71e56dace9e2d2 Mon Sep 17 00:00:00 2001 From: pablohc Date: Sun, 29 Mar 2026 22:03:28 +0200 Subject: [PATCH] fix: align overlay textBlockHeight with actual rendering transitions --- src/activities/boot_sleep/SleepActivity.cpp | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/activities/boot_sleep/SleepActivity.cpp b/src/activities/boot_sleep/SleepActivity.cpp index 8f4b52d6..cf26e648 100644 --- a/src/activities/boot_sleep/SleepActivity.cpp +++ b/src/activities/boot_sleep/SleepActivity.cpp @@ -316,9 +316,23 @@ void SleepActivity::renderBitmapSleepScreen(const Bitmap& bitmap) const { const int availableWidth = pageWidth - 20; int textBlockHeight = 0; - if (hasTitle) textBlockHeight += lineHeight12; - if (hasAuthor) textBlockHeight += lineSpacing + lineHeight10; - if (hasProgress) textBlockHeight += sectionSpacing + lineHeight10; + if (hasTitle) { + textBlockHeight += lineHeight12; + if (hasAuthor) { + textBlockHeight += lineSpacing; + } else if (hasProgress) { + textBlockHeight += sectionSpacing; + } + } + if (hasAuthor) { + textBlockHeight += lineHeight10; + if (hasProgress) { + textBlockHeight += sectionSpacing; + } + } + if (hasProgress) { + textBlockHeight += lineHeight10; + } const bool textBlack = (overlayMode != 2); const int topPadding = lineHeight12 / 3; @@ -338,7 +352,8 @@ void SleepActivity::renderBitmapSleepScreen(const Bitmap& bitmap) const { const std::string titleStr = renderer.truncatedText(BOOKERLY_12_FONT_ID, overlayInfo.title.c_str(), availableWidth, EpdFontFamily::BOLD); renderer.drawCenteredText(BOOKERLY_12_FONT_ID, currentY, titleStr.c_str(), textBlack, EpdFontFamily::BOLD); - currentY += lineHeight12 + lineSpacing; + const int spacingAfterTitle = hasAuthor ? lineSpacing : (hasProgress ? sectionSpacing : lineSpacing); + currentY += lineHeight12 + spacingAfterTitle; } if (hasAuthor) {