Use and populate metadata

This commit is contained in:
jpirnay
2026-03-07 18:02:21 +01:00
parent 87e5cc4fe1
commit 3ed96a7e49
8 changed files with 43 additions and 13 deletions
+7 -1
View File
@@ -487,10 +487,12 @@ void LyraTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
auto titleLines = renderer.wrappedText(UI_12_FONT_ID, book.title.c_str(), textWidth, 3, EpdFontFamily::BOLD);
auto author = renderer.truncatedText(UI_10_FONT_ID, book.author.c_str(), textWidth);
auto series = renderer.truncatedText(UI_12_FONT_ID, book.series.c_str(), textWidth);
const int titleLineHeight = renderer.getLineHeight(UI_12_FONT_ID);
const int titleBlockHeight = titleLineHeight * static_cast<int>(titleLines.size());
const int authorHeight = book.author.empty() ? 0 : (renderer.getLineHeight(UI_10_FONT_ID) * 3 / 2);
const int totalBlockHeight = titleBlockHeight + authorHeight;
const int seriesHeight = book.series.empty() ? 0 : renderer.getLineHeight(UI_12_FONT_ID);
const int totalBlockHeight = titleBlockHeight + authorHeight + seriesHeight;
int titleY = tileY + tileHeight / 2 - totalBlockHeight / 2;
const int textX = tileX + hPaddingInSelection + coverWidth + LyraMetrics::values.verticalSpacing;
for (const auto& line : titleLines) {
@@ -500,6 +502,10 @@ void LyraTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
if (!book.author.empty()) {
titleY += renderer.getLineHeight(UI_10_FONT_ID) / 2;
renderer.drawText(UI_10_FONT_ID, textX, titleY, author.c_str(), true);
titleY += renderer.getLineHeight(UI_10_FONT_ID);
}
if (!book.series.empty()) {
renderer.drawText(UI_12_FONT_ID, textX, titleY, series.c_str(), true);
}
} else {
drawEmptyRecents(renderer, rect);