forked from len0rd/rockbox
puzzles: fix text centering when zooming in
For some reason lcd_getstringsize was occasionally reverting to the system font, rather than the loaded font. This was leading to improper font sizes being reported. Change-Id: Ie5fc31de9a6a7af739beb22efc3ec1383206eaea
This commit is contained in:
parent
5a45e96f4d
commit
e666a7aea8
1 changed files with 5 additions and 3 deletions
|
@ -550,11 +550,13 @@ static void rb_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
{
|
{
|
||||||
(void) fontsize;
|
(void) fontsize;
|
||||||
|
|
||||||
|
LOGF("rb_draw_text(%d %d \"%s\" size=%d)", x, y, text, fontsize);
|
||||||
|
|
||||||
rb_color(color);
|
rb_color(color);
|
||||||
rb_setfont(fonttype, fontsize); /* size will be clamped if too large */
|
rb_setfont(fonttype, fontsize); /* size will be clamped if too large */
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
rb->lcd_getstringsize(text, &w, &h);
|
rb->font_getstringsize(text, &w, &h, cur_font);
|
||||||
|
|
||||||
if(align & ALIGN_VNORMAL)
|
if(align & ALIGN_VNORMAL)
|
||||||
y -= h;
|
y -= h;
|
||||||
|
@ -566,10 +568,10 @@ static void rb_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
else if(align & ALIGN_HRIGHT)
|
else if(align & ALIGN_HRIGHT)
|
||||||
x -= w;
|
x -= w;
|
||||||
|
|
||||||
|
LOGF("calculated origin: (%d, %d) size: (%d, %d)", x, y, w, h);
|
||||||
|
|
||||||
if(!zoom_enabled)
|
if(!zoom_enabled)
|
||||||
{
|
{
|
||||||
LOGF("rb_draw_text(%d %d %s)", x, y, text);
|
|
||||||
|
|
||||||
offset_coords(&x, &y);
|
offset_coords(&x, &y);
|
||||||
|
|
||||||
rb->lcd_set_drawmode(DRMODE_FG);
|
rb->lcd_set_drawmode(DRMODE_FG);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue