diff -r -u cvs/firmware/drivers/lcd.c build/firmware/drivers/lcd.c --- cvs/firmware/drivers/lcd.c Fri Aug 23 16:17:16 2002 +++ build/firmware/drivers/lcd.c Sun Aug 25 15:00:18 2002 @@ -119,6 +119,10 @@ int startx; int starty; int space; +#ifdef LCD_PROPFONTS + int soft_ofs; + int soft_cwidth; +#endif }; static void scroll_thread(void); @@ -819,7 +823,7 @@ * Put a string at specified bit position */ -void lcd_putspropxy(int x, int y, unsigned char *str, int thisfont) +void lcd_putspropxy(int x, int y, int ofs, unsigned char *str, int thisfont) { unsigned int ch; int nx; @@ -841,17 +845,37 @@ nx = char_dw_8x8_prop[ch][8] >> 4; - if(lcd_x + nx > LCD_WIDTH) + if (ofs != 0) + { + ofs %= nx + 1; + nx -= ofs; + } + + if (lcd_x + nx > LCD_WIDTH) break; - src = char_dw_8x8_prop[ch]; lcd_clearrect (lcd_x+nx, lcd_y, 1, ny); - lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true); + if (nx > 0) + { + src = char_dw_8x8_prop[ch] + ofs; + lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true); + } lcd_x += nx+1; + ofs = 0; } } +int lcd_getpropcwidth(unsigned int ch) +{ + if (ch < ASCII_MIN) + ch = ' '-ASCII_MIN; + else + ch -= ASCII_MIN; + + return (char_dw_8x8_prop[ch][8] >> 4); +} + #endif /* @@ -879,7 +903,7 @@ #ifdef LCD_PROPFONTS lcd_putspropxy( xmargin + x*fonts[font], ymargin + y*fontheight[font], - str, font ); + 0, str, font ); #elif LOADABLE_FONTS { int w,h; @@ -905,7 +929,7 @@ void lcd_putsxy(int x, int y, unsigned char *str, int thisfont) { #ifdef LCD_PROPFONTS - lcd_putspropxy(x,y,str,thisfont); + lcd_putspropxy(x,y,0,str,thisfont); #else int nx = fonts[thisfont]; @@ -1291,6 +1315,10 @@ strncpy(s->line,string,sizeof s->line); s->line[sizeof s->line - 1] = 0; scroll_count = 1; +#ifdef LCD_PROPFONTS + s->soft_ofs = 0; + s->soft_cwidth = lcd_getpropcwidth(string[0]); +#endif } } @@ -1354,20 +1382,26 @@ if ( scroll_count < scroll_speed/2 ) scroll_count++; else { - int i; - for ( i=0; ispace-1; i++ ) - s->line[i] = s->line[i+1]; - - if ( s->offset < s->textlen ) { - s->line[(int)s->space - 1] = s->text[(int)s->offset]; - s->offset++; - } - else { - s->line[s->space - 1] = ' '; - if ( s->offset < s->textlen + scroll_spacing - 1 ) + s->soft_ofs++; + if (s->soft_ofs > s->soft_cwidth) + { + int i; + for ( i=0; ispace-1; i++ ) + s->line[i] = s->line[i+1]; + + if ( s->offset < s->textlen ) { + s->line[(int)s->space - 1] = s->text[(int)s->offset]; s->offset++; - else - s->offset = 0; + } + else { + s->line[s->space - 1] = ' '; + if ( s->offset < s->textlen + scroll_spacing - 1 ) + s->offset++; + else + s->offset = 0; + } + s->soft_ofs = 0; + s->soft_cwidth = lcd_getpropcwidth(s->line[0]); } #ifdef LCD_PROPFONTS @@ -1385,7 +1419,13 @@ h); } #endif +#ifndef LCD_PROPFONTS lcd_puts(s->startx,s->starty,s->line); +#else + lcd_putspropxy(xmargin + s->startx * fonts[font], + ymargin + s->starty * fontheight[font], + s->soft_ofs, s->line, font ); +#endif lcd_update(); } sleep(HZ/scroll_speed);