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

Bill
Received on 2006-07-12

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy