mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-07 16:17:38 +03:00
updated text
This commit is contained in:
parent
8d4cfde809
commit
3ec8c1f23a
@ -83,12 +83,6 @@ void GfxRenderer::drawCenteredText(const int fontId, const int y, const char* te
|
|||||||
drawText(fontId, x, y, text, black, style);
|
drawText(fontId, x, y, text, black, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxRenderer::drawCenteredText(const int fontId, const int y, const char* text, const bool black, const int x,
|
|
||||||
const int width, const EpdFontFamily::Style style) const {
|
|
||||||
const int text_x = x + (width - getTextWidth(fontId, text, style)) / 2;
|
|
||||||
drawText(fontId, text_x, y, text, black, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GfxRenderer::drawText(const int fontId, const int x, const int y, const char* text, const bool black,
|
void GfxRenderer::drawText(const int fontId, const int x, const int y, const char* text, const bool black,
|
||||||
const EpdFontFamily::Style style) const {
|
const EpdFontFamily::Style style) const {
|
||||||
const int yPos = y + getFontAscenderSize(fontId);
|
const int yPos = y + getFontAscenderSize(fontId);
|
||||||
|
|||||||
@ -75,8 +75,6 @@ class GfxRenderer {
|
|||||||
int getTextWidth(int fontId, const char* text, EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
int getTextWidth(int fontId, const char* text, EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
||||||
void drawCenteredText(int fontId, int y, const char* text, bool black = true,
|
void drawCenteredText(int fontId, int y, const char* text, bool black = true,
|
||||||
EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
||||||
void drawCenteredText(int fontId, int y, const char* text, bool black, int x, int width,
|
|
||||||
EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
|
||||||
void drawText(int fontId, int x, int y, const char* text, bool black = true,
|
void drawText(int fontId, int x, int y, const char* text, bool black = true,
|
||||||
EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
EpdFontFamily::Style style = EpdFontFamily::REGULAR) const;
|
||||||
int getSpaceWidth(int fontId) const;
|
int getSpaceWidth(int fontId) const;
|
||||||
|
|||||||
@ -491,8 +491,10 @@ void MyLibraryActivity::renderRecentAsBookCoverList() const {
|
|||||||
} else {
|
} else {
|
||||||
// Draw a placeholder if no cover
|
// Draw a placeholder if no cover
|
||||||
renderer.drawRect(LEFT_MARGIN, y, coverWidth, itemHeight - 10);
|
renderer.drawRect(LEFT_MARGIN, y, coverWidth, itemHeight - 10);
|
||||||
renderer.drawCenteredText(UI_10_FONT_ID, y + (itemHeight - 10) / 2 - 10, "No cover", false,
|
const char* noCoverText = "No cover";
|
||||||
LEFT_MARGIN, coverWidth);
|
const int textWidth = renderer.getTextWidth(UI_10_FONT_ID, noCoverText);
|
||||||
|
const int textX = LEFT_MARGIN + (coverWidth - textWidth) / 2;
|
||||||
|
renderer.drawText(UI_10_FONT_ID, textX, y + (itemHeight - 10) / 2 - 10, noCoverText, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Draw text ---
|
// --- Draw text ---
|
||||||
@ -577,7 +579,10 @@ void MyLibraryActivity::renderRecentAsBookCoverGrid() const {
|
|||||||
} else {
|
} else {
|
||||||
// Draw a placeholder if no cover
|
// Draw a placeholder if no cover
|
||||||
renderer.drawRect(x, y, itemWidth, itemHeight);
|
renderer.drawRect(x, y, itemWidth, itemHeight);
|
||||||
renderer.drawCenteredText(UI_10_FONT_ID, y + itemHeight / 2 - 10, "No cover", false, x, itemWidth);
|
const char* noCoverText = "No cover";
|
||||||
|
const int textWidth = renderer.getTextWidth(UI_10_FONT_ID, noCoverText);
|
||||||
|
const int textX = x + (itemWidth - textWidth) / 2;
|
||||||
|
renderer.drawText(UI_10_FONT_ID, textX, y + itemHeight / 2 - 10, noCoverText, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Draw selection highlight ---
|
// --- Draw selection highlight ---
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user