From 9468e1b93ed9b724f5a3ceb7b3d543b965fbf6ec Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 20 Jun 2002 08:20:12 +0000 Subject: 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 --- firmware/drivers/lcd.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'firmware/drivers') 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 */ -- cgit v1.2.3