forked from len0rd/rockbox
slightly improved fix for proportional font scrolling, but it still isn't
really as good as it should be git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1134 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c5ddb150d9
commit
848c2cd733
1 changed files with 17 additions and 6 deletions
|
|
@ -495,7 +495,7 @@ extern unsigned char char_dw_8x8_prop[][9];
|
||||||
/*
|
/*
|
||||||
* Return width and height of a given font.
|
* Return width and height of a given font.
|
||||||
*/
|
*/
|
||||||
void lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
|
int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
|
||||||
{
|
{
|
||||||
int width=0;
|
int width=0;
|
||||||
int height=0;
|
int height=0;
|
||||||
|
|
@ -518,6 +518,8 @@ void lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
|
||||||
}
|
}
|
||||||
*w = width;
|
*w = width;
|
||||||
*h = height;
|
*h = height;
|
||||||
|
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -527,7 +529,7 @@ void lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
|
||||||
void lcd_putspropxy(int x, int y, char *str, int thisfont)
|
void lcd_putspropxy(int x, int y, char *str, int thisfont)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
int nx = char_dw_8x8_prop[*str][8] >> 4;
|
int nx = char_dw_8x8_prop[(int)*str][8] >> 4;
|
||||||
int ny=8;
|
int ny=8;
|
||||||
unsigned char *src;
|
unsigned char *src;
|
||||||
int lcd_x = x;
|
int lcd_x = x;
|
||||||
|
|
@ -914,21 +916,30 @@ void lcd_getfontsize(unsigned int font, int *width, int *height)
|
||||||
void lcd_puts_scroll(int x, int y, char* string )
|
void lcd_puts_scroll(int x, int y, char* string )
|
||||||
{
|
{
|
||||||
struct scrollinfo* s = &scroll;
|
struct scrollinfo* s = &scroll;
|
||||||
char *ch;
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
s->space = 11 - x;
|
s->space = 11 - x;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef LCD_PROPFONTS
|
||||||
|
unsigned char ch[2];
|
||||||
|
int w, h;
|
||||||
|
#endif
|
||||||
int width, height;
|
int width, height;
|
||||||
lcd_getfontsize(font, &width, &height);
|
lcd_getfontsize(font, &width, &height);
|
||||||
#ifndef LCD_PROPFONTS
|
#ifndef LCD_PROPFONTS
|
||||||
s->space = (LCD_WIDTH - xmargin - x*width) / width;
|
s->space = (LCD_WIDTH - xmargin - x*width) / width;
|
||||||
#else
|
#else
|
||||||
ch = string;
|
ch[1] = 0; /* zero terminate */
|
||||||
|
ch[0] = string[0];
|
||||||
width = 0;
|
width = 0;
|
||||||
for (s->space = 0; width + (char_dw_8x8_prop[*ch][8]>>4) < LCD_WIDTH - x;
|
for (s->space = 0;
|
||||||
width += (char_dw_8x8_prop[*ch][8]>>4), ch++, s->space++);
|
width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8); ) {
|
||||||
|
width += lcd_getstringsize(ch, 0, &w, &h);
|
||||||
|
ch[0]=string[(int)++s->space];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_puts(x,y,string);
|
lcd_puts(x,y,string);
|
||||||
s->textlen = strlen(string);
|
s->textlen = strlen(string);
|
||||||
if ( s->textlen > s->space ) {
|
if ( s->textlen > s->space ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue