1
0
Fork 0
forked from len0rd/rockbox

more proportional font fixes

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1137 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-06-24 07:38:27 +00:00
parent 4acb1a3083
commit c66efb702e

View file

@ -504,7 +504,7 @@ int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
while((ch = *str++)) { while((ch = *str++)) {
/* Limit to char generation table */ /* Limit to char generation table */
if ((ch < ASCII_MIN) || (ch > 0xda)) if (ch < ASCII_MIN)
/* replace unsupported letters with question marks */ /* replace unsupported letters with question marks */
ch = ' '-ASCII_MIN; ch = ' '-ASCII_MIN;
else else
@ -526,10 +526,10 @@ int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
* Put a string at specified bit position * Put a string at specified bit position
*/ */
void lcd_putspropxy(int x, int y, char *str, int thisfont) void lcd_putspropxy(int x, int y, unsigned char *str, int thisfont)
{ {
int ch; unsigned int ch;
int nx = char_dw_8x8_prop[(int)*str][8] >> 4; int nx;
int ny=8; int ny=8;
unsigned char *src; unsigned char *src;
int lcd_x = x; int lcd_x = x;
@ -537,26 +537,24 @@ void lcd_putspropxy(int x, int y, char *str, int thisfont)
(void)thisfont; (void)thisfont;
while (((ch = *str++) != '\0') && (lcd_x + nx < LCD_WIDTH)) while (((ch = *str++) != '\0'))
{ {
if (lcd_y + ny > LCD_HEIGHT)
return;
/* Limit to char generation table */ /* Limit to char generation table */
if ((ch < ASCII_MIN) || (ch > 0xda)) if (ch < ASCII_MIN)
/* replace unsupported letters with question marks */ /* replace unsupported letters with question marks */
ch = ' '-ASCII_MIN; ch = ' '-ASCII_MIN;
else else
ch -= ASCII_MIN; ch -= ASCII_MIN;
src = char_dw_8x8_prop[ch];
nx = char_dw_8x8_prop[ch][8] >> 4; nx = char_dw_8x8_prop[ch][8] >> 4;
if(lcd_x + nx > LCD_WIDTH)
break;
src = char_dw_8x8_prop[ch];
lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true); lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true);
lcd_x += nx+1; lcd_x += nx+1;
} }
} }
@ -933,10 +931,10 @@ void lcd_puts_scroll(int x, int y, char* string )
ch[0] = string[0]; ch[0] = string[0];
width = 0; width = 0;
for (s->space = 0; for (s->space = 0;
string[(int)s->space] && ch[0] &&
(width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8)); (width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8));
) { ) {
width += lcd_getstringsize(ch, 0, &w, &h); width += w;
ch[0]=string[(int)++s->space]; ch[0]=string[(int)++s->space];
} }
#endif #endif