diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-06-20 08:20:12 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-20 08:20:12 +0000 |
commit | 9468e1b93ed9b724f5a3ceb7b3d543b965fbf6ec (patch) | |
tree | 169b9428ecebb7e6bbe0cb600bdf0be729f98c47 /firmware/drivers/lcd.c | |
parent | f855a5797693f264dfe063565f441ee103e8393c (diff) |
Magnus Oman brought a test set proportional font
#define LCD_PROPFONTS to try
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1112 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r-- | firmware/drivers/lcd.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index 9ed24fdb22..d09d7ed1a5 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c @@ -488,6 +488,50 @@ void lcd_setmargins(int x, int y) ymargin = y; } +#ifdef LCD_PROPFONTS + +extern unsigned char char_dw_8x8_prop[][9]; + +/* + * Put a string at specified bit position + */ + +void lcd_putspropxy(int x, int y, char *str, int thisfont) +{ + int ch; + int nx; + int ny=8; + unsigned char *src; + int lcd_x = x; + int lcd_y = y; + + (void)thisfont; + + while (((ch = *str++) != '\0') && (lcd_x + nx < LCD_WIDTH)) + { + if (lcd_y + ny > LCD_HEIGHT) + return; + + /* Limit to char generation table */ + if ((ch < ASCII_MIN) || (ch > 0x7a)) + /* replace unsupported letters with question marks */ + ch = ' '-ASCII_MIN; + else + ch -= ASCII_MIN; + + src = char_dw_8x8_prop[ch]; + + nx = char_dw_8x8_prop[ch][8] >> 4; + + lcd_bitmap (src, lcd_x, lcd_y, nx, ny, true); + + lcd_x += nx+1; + + } +} + +#endif + /* * Put a string at specified character position */ @@ -507,9 +551,15 @@ void lcd_puts(int x, int y, char *str) ymargin = 8; #endif +#ifdef LCD_PROPFONTS + lcd_putspropxy( xmargin + x*fonts[font], + ymargin + y*fontheight[font], + str, font ); +#else lcd_putsxy( xmargin + x*fonts[font], ymargin + y*fontheight[font], str, font ); +#endif #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) /* this function is being used when simulating a charcell LCD and then we update immediately */ @@ -517,6 +567,7 @@ void lcd_puts(int x, int y, char *str) #endif } + /* * Put a string at specified bit position */ |