Rockbox mail archiveSubject: Re: lcd_puts_scroll -- why are X and Y so odd?
Re: lcd_puts_scroll -- why are X and Y so odd?
From: Bill Janssen <janssen_at_parc.com>
Date: Tue, 11 Jul 2006 21:26:31 PDT
> Can anyone explain why things work this way?
Let me try :-).
The formula (in lcd-16bit.c)
lcd_getstringsize(str, &w, &h);
xpos = xmargin + x*w / utf8length(str);
ypos = ymargin + y*h;
seems to be a way of trying to come up with an average character cell
width the display. However, it's going to vary widely for different
strings. Perhaps a better formula would be
struct font *f = font_get(curfont);
xpos = xmargin + x * f->maxwidth;
ypos = ymargin + y * f->height;
This would be a more faithful replication of a character-cell layout.
Received on 2006-07-12
Page was last modified "Sat May 23 08:12:40 2020" The Rockbox Crew