Smaller font size
This commit is contained in:
@@ -100,7 +100,13 @@ void RecentBooksActivity::render(RenderLock&&) {
|
|||||||
} else {
|
} else {
|
||||||
GUI.drawList(
|
GUI.drawList(
|
||||||
renderer, Rect{0, contentTop, pageWidth, contentHeight}, recentBooks.size(), selectorIndex,
|
renderer, Rect{0, contentTop, pageWidth, contentHeight}, recentBooks.size(), selectorIndex,
|
||||||
[this](int index) { return recentBooks[index].title; }, [this](int index) { return recentBooks[index].author; },
|
[this](int index) { return recentBooks[index].title; },
|
||||||
|
[this](int index) {
|
||||||
|
const auto& book = recentBooks[index];
|
||||||
|
if (!book.author.empty() && !book.series.empty()) return book.author + " \u2022 " + book.series;
|
||||||
|
if (!book.series.empty()) return book.series;
|
||||||
|
return book.author;
|
||||||
|
},
|
||||||
[this](int index) { return UITheme::getFileIcon(recentBooks[index].path); });
|
[this](int index) { return UITheme::getFileIcon(recentBooks[index].path); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ void BaseTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
|||||||
totalTextHeight += renderer.getLineHeight(UI_10_FONT_ID) * 3 / 2;
|
totalTextHeight += renderer.getLineHeight(UI_10_FONT_ID) * 3 / 2;
|
||||||
}
|
}
|
||||||
if (!lastBookSeries.empty()) {
|
if (!lastBookSeries.empty()) {
|
||||||
totalTextHeight += renderer.getLineHeight(UI_12_FONT_ID);
|
totalTextHeight += renderer.getLineHeight(UI_10_FONT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vertically center the title block within the card
|
// Vertically center the title block within the card
|
||||||
@@ -507,7 +507,7 @@ void BaseTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
|||||||
: renderer.truncatedText(UI_10_FONT_ID, lastBookAuthor.c_str(), bookWidth - 40);
|
: renderer.truncatedText(UI_10_FONT_ID, lastBookAuthor.c_str(), bookWidth - 40);
|
||||||
const auto truncatedSeries = lastBookSeries.empty()
|
const auto truncatedSeries = lastBookSeries.empty()
|
||||||
? std::string{}
|
? std::string{}
|
||||||
: renderer.truncatedText(UI_12_FONT_ID, lastBookSeries.c_str(), bookWidth - 40);
|
: renderer.truncatedText(UI_10_FONT_ID, lastBookSeries.c_str(), bookWidth - 40);
|
||||||
|
|
||||||
// If cover image was rendered, draw box behind title, author, and series
|
// If cover image was rendered, draw box behind title, author, and series
|
||||||
if (coverRendered) {
|
if (coverRendered) {
|
||||||
@@ -527,7 +527,7 @@ void BaseTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!truncatedSeries.empty()) {
|
if (!truncatedSeries.empty()) {
|
||||||
const int seriesWidth = renderer.getTextWidth(UI_12_FONT_ID, truncatedSeries.c_str());
|
const int seriesWidth = renderer.getTextWidth(UI_10_FONT_ID, truncatedSeries.c_str());
|
||||||
if (seriesWidth > maxTextWidth) {
|
if (seriesWidth > maxTextWidth) {
|
||||||
maxTextWidth = seriesWidth;
|
maxTextWidth = seriesWidth;
|
||||||
}
|
}
|
||||||
@@ -556,7 +556,7 @@ void BaseTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!truncatedSeries.empty()) {
|
if (!truncatedSeries.empty()) {
|
||||||
renderer.drawCenteredText(UI_12_FONT_ID, titleYStart, truncatedSeries.c_str(), !bookSelected);
|
renderer.drawCenteredText(UI_10_FONT_ID, titleYStart, truncatedSeries.c_str(), !bookSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Continue Reading" label at the bottom
|
// "Continue Reading" label at the bottom
|
||||||
|
|||||||
@@ -487,11 +487,11 @@ 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 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 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);
|
auto series = renderer.truncatedText(UI_10_FONT_ID, book.series.c_str(), textWidth);
|
||||||
const int titleLineHeight = renderer.getLineHeight(UI_12_FONT_ID);
|
const int titleLineHeight = renderer.getLineHeight(UI_12_FONT_ID);
|
||||||
const int titleBlockHeight = titleLineHeight * static_cast<int>(titleLines.size());
|
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 authorHeight = book.author.empty() ? 0 : (renderer.getLineHeight(UI_10_FONT_ID) * 3 / 2);
|
||||||
const int seriesHeight = book.series.empty() ? 0 : renderer.getLineHeight(UI_12_FONT_ID);
|
const int seriesHeight = book.series.empty() ? 0 : renderer.getLineHeight(UI_10_FONT_ID);
|
||||||
const int totalBlockHeight = titleBlockHeight + authorHeight + seriesHeight;
|
const int totalBlockHeight = titleBlockHeight + authorHeight + seriesHeight;
|
||||||
int titleY = tileY + tileHeight / 2 - totalBlockHeight / 2;
|
int titleY = tileY + tileHeight / 2 - totalBlockHeight / 2;
|
||||||
const int textX = tileX + hPaddingInSelection + coverWidth + LyraMetrics::values.verticalSpacing;
|
const int textX = tileX + hPaddingInSelection + coverWidth + LyraMetrics::values.verticalSpacing;
|
||||||
@@ -505,7 +505,7 @@ void LyraTheme::drawRecentBookCover(GfxRenderer& renderer, Rect rect, const std:
|
|||||||
titleY += renderer.getLineHeight(UI_10_FONT_ID);
|
titleY += renderer.getLineHeight(UI_10_FONT_ID);
|
||||||
}
|
}
|
||||||
if (!book.series.empty()) {
|
if (!book.series.empty()) {
|
||||||
renderer.drawText(UI_12_FONT_ID, textX, titleY, series.c_str(), true);
|
renderer.drawText(UI_10_FONT_ID, textX, titleY, series.c_str(), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drawEmptyRecents(renderer, rect);
|
drawEmptyRecents(renderer, rect);
|
||||||
|
|||||||
Reference in New Issue
Block a user