Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: 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: 2006-07-12

> 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.

Bill
Received on Wed Jul 12 06:29:37 2006


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa