summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-24 06:41:19 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-24 06:41:19 +0000
commit848c2cd7338490b2237b0ef86528f2bea2020f47 (patch)
treeb7947e47cdd063741e1522f702edfb950ef977ab
parentc5ddb150d9565dfd460d43255c2458fb56072180 (diff)
downloadrockbox-848c2cd7338490b2237b0ef86528f2bea2020f47.tar.gz
rockbox-848c2cd7338490b2237b0ef86528f2bea2020f47.zip
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
-rw-r--r--firmware/drivers/lcd.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index e1e27c8f39..e77fd56b56 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -495,7 +495,7 @@ extern unsigned char char_dw_8x8_prop[][9];
495/* 495/*
496 * Return width and height of a given font. 496 * Return width and height of a given font.
497 */ 497 */
498void lcd_getstringsize(char *str, unsigned int font, int *w, int *h) 498int lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
499{ 499{
500 int width=0; 500 int width=0;
501 int height=0; 501 int height=0;
@@ -518,6 +518,8 @@ void lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
518 } 518 }
519 *w = width; 519 *w = width;
520 *h = height; 520 *h = height;
521
522 return width;
521} 523}
522 524
523/* 525/*
@@ -527,7 +529,7 @@ void lcd_getstringsize(char *str, unsigned int font, int *w, int *h)
527void lcd_putspropxy(int x, int y, char *str, int thisfont) 529void lcd_putspropxy(int x, int y, char *str, int thisfont)
528{ 530{
529 int ch; 531 int ch;
530 int nx = char_dw_8x8_prop[*str][8] >> 4; 532 int nx = char_dw_8x8_prop[(int)*str][8] >> 4;
531 int ny=8; 533 int ny=8;
532 unsigned char *src; 534 unsigned char *src;
533 int lcd_x = x; 535 int lcd_x = x;
@@ -914,21 +916,30 @@ void lcd_getfontsize(unsigned int font, int *width, int *height)
914void lcd_puts_scroll(int x, int y, char* string ) 916void lcd_puts_scroll(int x, int y, char* string )
915{ 917{
916 struct scrollinfo* s = &scroll; 918 struct scrollinfo* s = &scroll;
917 char *ch;
918#ifdef HAVE_LCD_CHARCELLS 919#ifdef HAVE_LCD_CHARCELLS
919 s->space = 11 - x; 920 s->space = 11 - x;
920#else 921#else
922
923#ifdef LCD_PROPFONTS
924 unsigned char ch[2];
925 int w, h;
926#endif
921 int width, height; 927 int width, height;
922 lcd_getfontsize(font, &width, &height); 928 lcd_getfontsize(font, &width, &height);
923#ifndef LCD_PROPFONTS 929#ifndef LCD_PROPFONTS
924 s->space = (LCD_WIDTH - xmargin - x*width) / width; 930 s->space = (LCD_WIDTH - xmargin - x*width) / width;
925#else 931#else
926 ch = string; 932 ch[1] = 0; /* zero terminate */
933 ch[0] = string[0];
927 width = 0; 934 width = 0;
928 for (s->space = 0; width + (char_dw_8x8_prop[*ch][8]>>4) < LCD_WIDTH - x; 935 for (s->space = 0;
929 width += (char_dw_8x8_prop[*ch][8]>>4), ch++, s->space++); 936 width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8); ) {
937 width += lcd_getstringsize(ch, 0, &w, &h);
938 ch[0]=string[(int)++s->space];
939 }
930#endif 940#endif
931#endif 941#endif
942
932 lcd_puts(x,y,string); 943 lcd_puts(x,y,string);
933 s->textlen = strlen(string); 944 s->textlen = strlen(string);
934 if ( s->textlen > s->space ) { 945 if ( s->textlen > s->space ) {