summaryrefslogtreecommitdiffstats
path: root/apps/settings.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-24 13:19:34 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-24 13:19:34 +0000
commitaa0f4a4bbe370032d8166628f456709be1330118 (patch)
tree597c91fb16493881d7a281ef3c28e274a899022b /apps/settings.c
parentf323300b82aa945dd4cadb20d8d7e23a6602ef49 (diff)
downloadrockbox-aa0f4a4bbe370032d8166628f456709be1330118.tar.gz
rockbox-aa0f4a4bbe370032d8166628f456709be1330118.tar.bz2
rockbox-aa0f4a4bbe370032d8166628f456709be1330118.zip
FS#12273 - use buflib for font storage. thanks to the testers :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30589 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 258facee38..14217ed1ae 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -876,30 +876,38 @@ void settings_apply(bool read_disk)
/* fonts need to be loaded before the WPS */
if (global_settings.font_file[0]
&& global_settings.font_file[0] != '-') {
+ const char* loaded_font = font_filename(global_status.font_id[SCREEN_MAIN]);
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.font_file);
- CHART2(">font_load ", global_settings.font_file);
- rc = font_load(NULL, buf);
- CHART2("<font_load ", global_settings.font_file);
- if (rc < 0)
- font_reset(NULL);
+ if (!loaded_font || strcmp(loaded_font, buf))
+ {
+ CHART2(">font_load ", global_settings.font_file);
+ if (global_status.font_id[SCREEN_MAIN] >= 0)
+ font_unload(global_status.font_id[SCREEN_MAIN]);
+ rc = font_load(buf);
+ CHART2("<font_load ", global_settings.font_file);
+ global_status.font_id[SCREEN_MAIN] = rc;
+ lcd_setfont(rc);
+ }
}
- else
- font_reset(NULL);
#ifdef HAVE_REMOTE_LCD
if ( global_settings.remote_font_file[0]
&& global_settings.remote_font_file[0] != '-') {
+ const char* loaded_font = font_filename(global_status.font_id[SCREEN_REMOTE]);
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.remote_font_file);
- CHART2(">font_load_remoteui ", global_settings.remote_font_file);
- rc = font_load_remoteui(buf);
- CHART2("<font_load_remoteui ", global_settings.remote_font_file);
- if (rc < 0)
- font_load_remoteui(NULL);
+ if (!loaded_font || strcmp(loaded_font, buf))
+ {
+ CHART2(">font_load_remoteui ", global_settings.remote_font_file);
+ if (global_status.font_id[SCREEN_REMOTE] >= 0)
+ font_unload(global_status.font_id[SCREEN_REMOTE]);
+ rc = font_load(buf);
+ CHART2("<font_load_remoteui ", global_settings.remote_font_file);
+ global_status.font_id[SCREEN_REMOTE] = rc;
+ lcd_remote_setfont(rc);
+ }
}
- else
- font_load_remoteui(NULL);
#endif
if ( global_settings.kbd_file[0]
&& global_settings.kbd_file[0] != '-') {
@@ -1070,6 +1078,16 @@ void settings_reset(void)
#if defined (HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
enc_global_settings_reset();
#endif
+#ifdef HAVE_LCD_BITMAP
+ FOR_NB_SCREENS(i)
+ {
+ if (global_status.font_id[i] > FONT_SYSFIXED)
+ {
+ font_unload(global_status.font_id[i]);
+ global_status.font_id[i] = FONT_SYSFIXED;
+ }
+ }
+#endif
}
/** Changing setting values **/