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 | |
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
-rw-r--r-- | firmware/chartables.c | 102 | ||||
-rw-r--r-- | firmware/drivers/lcd.c | 51 |
2 files changed, 153 insertions, 0 deletions
diff --git a/firmware/chartables.c b/firmware/chartables.c index 0e61291b4d..e1f2c73b10 100644 --- a/firmware/chartables.c +++ b/firmware/chartables.c @@ -306,4 +306,106 @@ const unsigned char char_gen_12x16[][22] = { 0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0xff,0x3f,0x00,0x00 } }; +#ifdef LCD_PROPFONTS +unsigned char char_dw_8x8_prop[][9] = { + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x17}, /* 20 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 21 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 22 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 23 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 24 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 25 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 26 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 27 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 28 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 29 */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2a */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2b */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2c */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2d */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2e */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 2f */ + + { 0x7c,0x82,0x8a,0x7c,0x0,0x0,0x0,0x0,0x47 /* 0 0x30 */ }, + { 0x84,0xfe,0x80,0x0,0x0,0x0,0x0,0x0,0x37 /* 1 */ }, + { 0xe4,0x92,0x92,0x8c,0x0,0x0,0x0,0x0,0x47 /* 2 */ }, + { 0x44,0x92,0x92,0x6c,0x0,0x0,0x0,0x0,0x47 /* 3 */ }, + { 0x1e,0x10,0x10,0xfe,0x0,0x0,0x0,0x0,0x47 /* 4 */ }, + { 0x4e,0x92,0x92,0x62,0x0,0x0,0x0,0x0,0x47 /* 5 */ }, + { 0x7c,0x92,0x92,0x60,0x0,0x0,0x0,0x0,0x47 /* 6 */ }, + { 0x2,0x12,0x12,0xfe,0x0,0x0,0x0,0x0,0x47 /* 7 */ }, + { 0x6c,0x92,0x92,0x6c,0x0,0x0,0x0,0x0,0x47 /* 8 */ }, + { 0xc,0x92,0x92,0x7c,0x0,0x0,0x0,0x0,0x47 /* 9 */ }, + + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3a */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3b */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3c */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3d */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3e */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 3f */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 40 */ + + { 0xfc,0x22,0x22,0xfc,0x0,0x0,0x0,0x0,0x47 /* A */ }, + { 0xfe,0x92,0x92,0x6c,0x0,0x0,0x0,0x0,0x47 /* B */ }, + { 0x7c,0x82,0x82,0x44,0x0,0x0,0x0,0x0,0x47 /* C */ }, + { 0xfe,0x82,0x82,0x7c,0x0,0x0,0x0,0x0,0x47 /* D */ }, + { 0xfe,0x92,0x92,0x82,0x0,0x0,0x0,0x0,0x47 /* E */ }, + { 0xfe,0x12,0x12,0x2,0x0,0x0,0x0,0x0,0x47 /* F */ }, + { 0x7c,0x82,0x92,0xf2,0x0,0x0,0x0,0x0,0x47 /* G */ }, + { 0xfe,0x10,0x10,0xfe,0x0,0x0,0x0,0x0,0x47 /* H */ }, + { 0x82,0xfe,0x82,0x0,0x0,0x0,0x0,0x0,0x37 /* I */ }, + { 0x42,0x82,0x82,0x7e,0x0,0x0,0x0,0x0,0x47 /* J */ }, + { 0xfe,0x10,0x28,0xc6,0x0,0x0,0x0,0x0,0x47 /* K */ }, + { 0xfe,0x80,0x80,0x80,0x0,0x0,0x0,0x0,0x47 /* L */ }, + { 0xfe,0x4,0x8,0x10,0x8,0x4,0xfe,0x0,0x77 /* M */ }, + { 0xfe,0x2,0x2,0xfc,0x0,0x0,0x0,0x0,0x47 /* N */ }, + { 0x7c,0x82,0x82,0x7c,0x0,0x0,0x0,0x0,0x47 /* O */ }, + { 0xfe,0x12,0x12,0xc,0x0,0x0,0x0,0x0,0x47 /* P */ }, + { 0x7c,0x82,0xa2,0x7c,0x40,0x80,0x0,0x0,0x67 /* Q */ }, + { 0xfe,0x12,0x12,0xec,0x0,0x0,0x0,0x0,0x47 /* R */ }, + { 0x8c,0x92,0x92,0x62,0x0,0x0,0x0,0x0,0x47 /* S */ }, + { 0x2,0x2,0xfe,0x2,0x2,0x0,0x0,0x0,0x57 /* T */ }, + { 0x7e,0x80,0x80,0x7e,0x0,0x0,0x0,0x0,0x47 /* U */ }, + { 0x3e,0x40,0x80,0x40,0x3e,0x0,0x0,0x0,0x57 /* V */ }, + { 0xfe,0x40,0x20,0x10,0x20,0x40,0xfe,0x0,0x77 /* W */ }, + { 0xc6,0x28,0x10,0x28,0xc6,0x0,0x0,0x0,0x57 /* X */ }, + { 0xe,0x10,0xe0,0x10,0xe,0x0,0x0,0x0,0x57 /* Y */ }, + { 0xe2,0x92,0x92,0x8e,0x0,0x0,0x0,0x0,0x47 /* Z */ }, /* 5a */ + + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 5b */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 5c */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 5d */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 5e */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 5f */ + { 0x00,0x00,0x00,0x00,0x0,0x0,0x0,0x00,0x0}, /* 60 */ + + { 0x40,0xa8,0xa8,0xa8,0xf0,0x0,0x0,0x0,0x55 /* a */ }, /* 61 */ + { 0xfe,0x90,0x90,0x90,0x60,0x0,0x0,0x0,0x57 /* b */ }, + { 0x70,0x88,0x88,0x88,0x0,0x0,0x0,0x0,0x45 /* c */ }, + { 0x60,0x90,0x90,0x90,0x7e,0x0,0x0,0x0,0x57 /* d */ }, + { 0x70,0xa8,0xa8,0xa8,0x10,0x0,0x0,0x0,0x55 /* e */ }, + { 0x10,0xfc,0x12,0x2,0x0,0x0,0x0,0x0,0x47 /* f */ }, + { 0x10,0xa8,0xa8,0xa8,0x78,0x0,0x0,0x0,0x55 /* g */ }, + { 0xfe,0x10,0x10,0xe0,0x0,0x0,0x0,0x0,0x47 /* h */ }, + { 0x88,0xfa,0x80,0x0,0x0,0x0,0x0,0x0,0x37 /* i */ }, + { 0x40,0x80,0x88,0x7a,0x0,0x0,0x0,0x0,0x47 /* j */ }, + { 0xfe,0x20,0x50,0x88,0x0,0x0,0x0,0x0,0x47 /* k */ }, + { 0x82,0xfe,0x80,0x0,0x0,0x0,0x0,0x0,0x37 /* l */ }, + { 0xf8,0x8,0x70,0x8,0xf8,0x0,0x0,0x0,0x55 /* m */ }, + { 0xf8,0x8,0x8,0xf0,0x0,0x0,0x0,0x0,0x45 /* n */ }, + { 0x70,0x88,0x88,0x70,0x0,0x0,0x0,0x0,0x45 /* o */ }, + { 0xf8,0x28,0x28,0x10,0x0,0x0,0x0,0x0,0x45 /* p */ }, + { 0x10,0x28,0x28,0xf8,0x0,0x0,0x0,0x0,0x45 /* q */ }, + { 0xf8,0x10,0x8,0x8,0x0,0x0,0x0,0x0,0x45 /* r */ }, + { 0x90,0xa8,0xa8,0x48,0x0,0x0,0x0,0x0,0x45 /* s */ }, + { 0x8,0xfe,0x8,0x0,0x0,0x0,0x0,0x0,0x37 /* t */ }, + { 0x78,0x80,0x80,0x78,0x0,0x0,0x0,0x0,0x45 /* u */ }, + { 0x38,0x40,0x80,0x40,0x38,0x0,0x0,0x0,0x55 /* v */ }, + { 0xf8,0x80,0x60,0x80,0xf8,0x0,0x0,0x0,0x55 /* w */ }, + { 0xd8,0x20,0xd8,0x0,0x0,0x0,0x0,0x0,0x35 /* x */ }, + { 0x18,0xa0,0xa0,0x78,0x0,0x0,0x0,0x0,0x45 /* y */ }, + { 0xc8,0xa8,0x98,0x0,0x0,0x0,0x0,0x0,0x35 /* z */ } /* 7a */ +}; + +#endif + #endif /* HAVE_LCD_BITMAP || SIMULATOR */ 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 */ |