fix: overlap in download font list layout (#1900)

## Summary

Fix font download list layout overlap in Classic and RoundedRaff themes.
The font description was shown as a right-aligned value, causing text to
overlap with the font name on narrow screens.

### Changes
- Move font description from `rowValue` to `rowSubtitle` (second line)
- Show only status ("Installed"/"Update Available") as `rowValue`
- Fix Classic and RoundedRaff themes `rowValue` truncation (was fixed
60px, now dynamic)

## Screenshots

### Classic
| RC 1.3.0 | #1900 |
|-|-|
|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/534434d6-d7a6-4f73-9d80-8fe5d060907c"
/>|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/e616c4b7-43b9-49a8-8aa6-ab19f29865f1"
/>|

### Lyra
| RC 1.3.0 | #1900 |
|-|-|
|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/5b42bad4-2860-4863-a025-5292aa391c1a"
/>|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/4c27dcbb-8e8e-4ef0-8771-f92975210f11"
/>|

### RoundedRaff
| RC 1.3.0 | #1900 |
|-|-|
|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/f0510c6f-7712-4cec-8fc8-4386951b1795"
/>|<img width="480" height="800" alt="image"
src="https://github.com/user-attachments/assets/017596b8-fe95-4541-884b-5de034c24193"
/>|

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**<YES>**_
This commit is contained in:
pablohc
2026-05-09 22:11:13 +02:00
committed by GitHub
parent ceb3fed392
commit bf30964982
4 changed files with 40 additions and 17 deletions
+28 -12
View File
@@ -268,16 +268,29 @@ void BaseTheme::drawList(const GfxRenderer& renderer, Rect rect, int itemCount,
if (selectedIndex >= 0) {
renderer.fillRect(0, rect.y + selectedIndex % pageItems * rowHeight - 2, rect.width, rowHeight);
}
constexpr int maxValueWidth = 200;
constexpr int minValueGap = 10;
// Draw all items
const auto pageStartIndex = selectedIndex / pageItems * pageItems;
for (int i = pageStartIndex; i < itemCount && i < pageStartIndex + pageItems; i++) {
const int itemY = rect.y + (i % pageItems) * rowHeight;
int textWidth = contentWidth - BaseMetrics::values.contentSidePadding * 2 - (rowValue != nullptr ? 60 : 0);
// Draw name
int rowTextWidth = contentWidth - BaseMetrics::values.contentSidePadding * 2;
std::string valueText;
if (rowValue != nullptr) {
valueText = rowValue(i);
if (!valueText.empty()) {
int maxValW = std::max(0, rowTextWidth - 40 - minValueGap);
valueText = renderer.truncatedText(UI_10_FONT_ID, valueText.c_str(), maxValW);
int valueWidth = renderer.getTextWidth(UI_10_FONT_ID, valueText.c_str()) + minValueGap;
rowTextWidth -= valueWidth;
}
}
auto itemName = rowTitle(i);
auto font = (rowSubtitle != nullptr) ? UI_12_FONT_ID : UI_10_FONT_ID;
auto item = renderer.truncatedText(font, itemName.c_str(), textWidth);
auto font = UI_10_FONT_ID;
auto item = renderer.truncatedText(font, itemName.c_str(), rowTextWidth);
renderer.drawText(font, rect.x + BaseMetrics::values.contentSidePadding, itemY, item.c_str(), i != selectedIndex);
// Apply checkerboard dither to create gray text effect for dimmed items
@@ -291,19 +304,22 @@ void BaseTheme::drawList(const GfxRenderer& renderer, Rect rect, int itemCount,
}
if (rowSubtitle != nullptr) {
// Draw subtitle
std::string subtitleText = rowSubtitle(i);
auto subtitle = renderer.truncatedText(UI_10_FONT_ID, subtitleText.c_str(), textWidth);
renderer.drawText(UI_10_FONT_ID, rect.x + BaseMetrics::values.contentSidePadding, itemY + 30, subtitle.c_str(),
i != selectedIndex);
if (!subtitleText.empty()) {
auto subtitle = renderer.truncatedText(SMALL_FONT_ID, subtitleText.c_str(), rowTextWidth);
renderer.drawText(SMALL_FONT_ID, rect.x + BaseMetrics::values.contentSidePadding, itemY + 22, subtitle.c_str(),
i != selectedIndex);
}
}
if (rowValue != nullptr) {
// Draw value
std::string valueText = rowValue(i);
if (!valueText.empty()) {
const auto valueTextWidth = renderer.getTextWidth(UI_10_FONT_ID, valueText.c_str());
int valueY = itemY;
if (rowSubtitle != nullptr) {
valueY = itemY + 10;
}
renderer.drawText(UI_10_FONT_ID, rect.x + contentWidth - BaseMetrics::values.contentSidePadding - valueTextWidth,
itemY, valueText.c_str(), i != selectedIndex);
valueY, valueText.c_str(), i != selectedIndex);
}
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 15,
.verticalSpacing = 10,
.contentSidePadding = 20,
.listRowHeight = 30,
.listWithSubtitleRowHeight = 65,
.listWithSubtitleRowHeight = 50,
.menuRowHeight = 45,
.menuSpacing = 8,
.tabSpacing = 10,
+5 -1
View File
@@ -301,8 +301,12 @@ void LyraTheme::drawList(const GfxRenderer& renderer, Rect rect, int itemCount,
valueWidth + hPaddingInSelection, rowHeight, cornerRadius, Color::Black);
}
int valueY = itemY + 6;
if (rowSubtitle != nullptr) {
valueY = itemY + 16;
}
renderer.drawText(UI_10_FONT_ID, rect.x + contentWidth - LyraMetrics::values.contentSidePadding - valueWidth,
itemY + 6, valueText.c_str(), !(i == selectedIndex && highlightValue));
valueY, valueText.c_str(), !(i == selectedIndex && highlightValue));
}
}
}