diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-09-20 08:07:51 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-09-20 08:07:51 +0000 |
commit | bed3d3f7e06c6582f9677ab6222cd89c84a9c8c7 (patch) | |
tree | 59ef1faa129f0813071d5e81b2e55b5d04886202 /apps | |
parent | eb5cc653dba373f2d2ce48f8efbc0b19a424971e (diff) | |
download | rockbox-bed3d3f7e06c6582f9677ab6222cd89c84a9c8c7.tar.gz rockbox-bed3d3f7e06c6582f9677ab6222cd89c84a9c8c7.zip |
New full ISO-8859-1 system font.
Added font loading from dir browser.
Changed default font location to /.rockbox/default.fnt.
Code-policed font code.
Removed old font tools.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2347 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/main.c | 8 | ||||
-rw-r--r-- | apps/menu.c | 9 | ||||
-rw-r--r-- | apps/recorder/icons.c | 10 | ||||
-rw-r--r-- | apps/recorder/icons.h | 1 | ||||
-rw-r--r-- | apps/tree.c | 36 |
5 files changed, 48 insertions, 16 deletions
diff --git a/apps/main.c b/apps/main.c index 4b8c9e1e7e..b13e5448b9 100644 --- a/apps/main.c +++ b/apps/main.c @@ -68,6 +68,7 @@ void init(void) show_logo(); settings_reset(); settings_load(); + font_load(ROCKBOX_DIR "/default.fon"); sleep(HZ/2); } @@ -89,10 +90,7 @@ void init(void) lcd_init(); - // FIXME should call font_init before this, - // because may use loadable font in show_logo(). - // I didn't call font_init here, since - // disk system isn't up yet. + font_init(); show_logo(); #ifdef DEBUG @@ -148,6 +146,7 @@ void init(void) } settings_load(); + font_load(ROCKBOX_DIR "/default.fon"); mpeg_init( global_settings.volume, global_settings.bass, @@ -160,7 +159,6 @@ void init(void) status_init(); usb_start_monitoring(); power_init(); - font_init(); } int main(void) diff --git a/apps/menu.c b/apps/menu.c index a42929ccf5..5f1b9b64ea 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -93,14 +93,19 @@ void put_cursorxy(int x, int y, bool on) { #ifdef HAVE_LCD_BITMAP int fh, fw; + int xpos, ypos; lcd_getfontsize(FONT_UI, &fw, &fh); + xpos = x*6; + ypos = y*fh + lcd_getymargin(); + if ( fh > 8 ) + ypos += (fh - 8) / 2; #endif /* place the cursor */ if(on) { #ifdef HAVE_LCD_BITMAP lcd_bitmap ( bitmap_icons_6x8[Cursor], - x*6, y*fh + lcd_getymargin(), 4, 8, true); + xpos, ypos, 4, 8, true); #elif defined(SIMULATOR) /* player simulator */ unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; @@ -112,7 +117,7 @@ void put_cursorxy(int x, int y, bool on) else { #if defined(HAVE_LCD_BITMAP) /* I use xy here since it needs to disregard the margins */ - lcd_clearrect (x*6, y*fh + lcd_getymargin(), 4, 8); + lcd_clearrect (xpos, ypos, 4, 8); #elif defined(SIMULATOR) /* player simulator in action */ lcd_clearrect (x*6, 12+y*16, 4, 8); diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index fbfaf6cd8c..0e628d8255 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -69,6 +69,8 @@ unsigned char bitmap_icons_6x8[LastIcon][6] = { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x00 }, /* Mod or ajz file */ { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, + /* Font file */ + { 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e }, }; unsigned char bitmap_icons_7x8[][7] = @@ -234,10 +236,10 @@ void statusbar_icon_volume(int percent) /* display volume lever numerical? */ if (TIME_BEFORE(current_tick,switch_tick)) { snprintf(buffer, sizeof(buffer), "%2d", percent); - lcd_getstringsize(buffer, FONT_UI, &width, &height); + lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); if (height <= STATUSBAR_HEIGHT) lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - - width/2, STATUSBAR_Y_POS, buffer, 0); + width/2, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); } else { /* display volume bar */ volume = volume * 14 / 100; @@ -309,8 +311,8 @@ void statusbar_time(int hour, int minute) strncpy(buffer, "--:--", sizeof buffer); } - lcd_getstringsize(buffer, FONT_UI, &width, &height); + lcd_getstringsize(buffer, FONT_SYSFIXED, &width, &height); if (height <= STATUSBAR_HEIGHT) - lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, 0); + lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer, FONT_SYSFIXED); } #endif diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 3102093898..1cf75151da 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -28,6 +28,7 @@ enum icons_6x8 { Box_Filled, Box_Empty, Slider_Horizontal, File, Folder, Directory, Playlist, Repeat, Selected, Cursor, Wps, Mod_Ajz, + Font, LastIcon }; diff --git a/apps/tree.c b/apps/tree.c index 40d686490a..9689ac5ae9 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -137,7 +137,8 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; #define TREE_ATTR_M3U 0x80 /* playlist */ #define TREE_ATTR_WPS 0x100 /* wps config file */ #define TREE_ATTR_MOD 0x200 /* firmware file */ -#define TREE_ATTR_EQ 0x300 /* EQ config file */ +#define TREE_ATTR_EQ 0x400 /* EQ config file */ +#define TREE_ATTR_FONT 0x800 /* font file */ #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ static int build_playlist(int start_index) @@ -182,14 +183,12 @@ static int compare(const void* p1, const void* p2) static int showdir(char *path, int start) { int icon_type = 0; -#ifdef HAVE_LCD_BITMAP - int line_height = LINE_HEIGTH; -#endif int i; int tree_max_on_screen; bool dir_buffer_full; #ifdef HAVE_LCD_BITMAP + int line_height = LINE_HEIGTH; int fw, fh; lcd_getfontsize(FONT_UI, &fw, &fh); tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; @@ -255,6 +254,8 @@ static int showdir(char *path, int start) else if (!strcasecmp(&entry->d_name[len-4], ".wps")) dptr->attr |= TREE_ATTR_WPS; #ifdef HAVE_RECORDER_KEYPAD + else if (!strcasecmp(&entry->d_name[len-4], ".fnt")) + dptr->attr |= TREE_ATTR_FONT; else if (!strcasecmp(&entry->d_name[len-4], ".ajz")) #else else if (!strcasecmp(&entry->d_name[len-4], ".mod")) @@ -372,15 +373,24 @@ static int showdir(char *path, int start) icon_type = Mod_Ajz; break; +#ifdef HAVE_LCD_BITMAP + case TREE_ATTR_FONT: + icon_type = Font; + break; +#endif default: icon_type = 0; } if (icon_type) { #ifdef HAVE_LCD_BITMAP + int offset=0; + if ( line_height > 8 ) + offset = (line_height - 8) / 2; lcd_bitmap(bitmap_icons_6x8[icon_type], CURSOR_X * 6 + CURSOR_WIDTH, - MARGIN_Y+(i-start)*line_height, 6, 8, true); + MARGIN_Y+(i-start)*line_height + offset, + 6, 8, true); #else lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); lcd_putc(LINE_X-1, i-start, i-start); @@ -712,6 +722,22 @@ bool dirbrowse(char *root) restore = true; break; +#ifdef HAVE_LCD_BITMAP + case TREE_ATTR_FONT: + snprintf(buf, sizeof buf, "%s/%s", + currdir, file->name); + font_load(buf); + lcd_getfontsize(FONT_UI, &fw, &fh); + tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; + /* make sure cursor is on screen */ + while ( dircursor > tree_max_on_screen ) { + dircursor--; + dirstart++; + } + restore = true; + break; +#endif + #ifndef SIMULATOR /* firmware file */ case TREE_ATTR_MOD: |