mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 15:47:39 +03:00
fix render issue
This commit is contained in:
parent
df99807bb0
commit
8d4cfde809
@ -83,6 +83,12 @@ 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,6 +75,8 @@ 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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user