forked from len0rd/rockbox
make use of font_getstringsize
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6322 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c6ec0f48a5
commit
c3d0a229cc
1 changed files with 1 additions and 18 deletions
|
@ -367,24 +367,7 @@ void lcd_setfont(int newfont)
|
||||||
|
|
||||||
int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
int lcd_getstringsize(const unsigned char *str, int *w, int *h)
|
||||||
{
|
{
|
||||||
struct font* pf = font_get(curfont);
|
return font_getstringsize(str, w, h, curfont);
|
||||||
int ch;
|
|
||||||
int width = 0;
|
|
||||||
|
|
||||||
while((ch = *str++)) {
|
|
||||||
/* check input range*/
|
|
||||||
if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
|
|
||||||
ch = pf->defaultchar;
|
|
||||||
ch -= pf->firstchar;
|
|
||||||
|
|
||||||
/* get proportional width and glyph bits*/
|
|
||||||
width += pf->width? pf->width[ch]: pf->maxwidth;
|
|
||||||
}
|
|
||||||
if ( w )
|
|
||||||
*w = width;
|
|
||||||
if ( h )
|
|
||||||
*h = pf->height;
|
|
||||||
return width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put a string at a given char position */
|
/* put a string at a given char position */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue