diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/viewer.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 2077273e66..519c8a23dc 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -1693,18 +1693,11 @@ static bool change_font(unsigned char *font) | |||
1693 | rb->snprintf(buf, MAX_PATH, "%s/%s.fnt", FONT_DIR, font); | 1693 | rb->snprintf(buf, MAX_PATH, "%s/%s.fnt", FONT_DIR, font); |
1694 | if (rb->font_load(NULL, buf) < 0) { | 1694 | if (rb->font_load(NULL, buf) < 0) { |
1695 | rb->splash(HZ/2, "Font load failed."); | 1695 | rb->splash(HZ/2, "Font load failed."); |
1696 | |||
1697 | return false; | 1696 | return false; |
1698 | } | 1697 | } |
1699 | 1698 | ||
1700 | return true; | 1699 | return true; |
1701 | } | 1700 | } |
1702 | |||
1703 | static void revert_font(void) | ||
1704 | { | ||
1705 | if (rb->strcmp(prefs.font, rb->global_settings->font_file)) | ||
1706 | change_font(rb->global_settings->font_file); | ||
1707 | } | ||
1708 | #endif | 1701 | #endif |
1709 | 1702 | ||
1710 | static bool viewer_init(void) | 1703 | static bool viewer_init(void) |
@@ -2190,10 +2183,12 @@ read_end: | |||
2190 | start_position = file_pos + screen_top_ptr - buffer; | 2183 | start_position = file_pos + screen_top_ptr - buffer; |
2191 | 2184 | ||
2192 | #ifdef HAVE_LCD_BITMAP | 2185 | #ifdef HAVE_LCD_BITMAP |
2186 | /* load prefs font if it is different than the global settings font */ | ||
2193 | if (rb->strcmp(prefs.font, rb->global_settings->font_file)) { | 2187 | if (rb->strcmp(prefs.font, rb->global_settings->font_file)) { |
2194 | if (!change_font(prefs.font)) { | 2188 | if (!change_font(prefs.font)) { |
2195 | revert_font(); | 2189 | /* fallback by re-loading the global settings font */ |
2196 | return false; | 2190 | if (!change_font(rb->global_settings->font_file)) |
2191 | return false; | ||
2197 | } | 2192 | } |
2198 | } | 2193 | } |
2199 | 2194 | ||
@@ -2715,9 +2710,10 @@ static bool font_setting(void) | |||
2715 | 2710 | ||
2716 | if (new_font != old_font) | 2711 | if (new_font != old_font) |
2717 | { | 2712 | { |
2718 | if (!change_font(prefs.font)) | 2713 | /* load selected font */ |
2719 | { | 2714 | if (!change_font((unsigned char *)names[new_font].string)) { |
2720 | revert_font(); | 2715 | /* revert by re-loading the preferences font */ |
2716 | change_font(prefs.font); | ||
2721 | return false; | 2717 | return false; |
2722 | } | 2718 | } |
2723 | rb->memset(prefs.font, 0, MAX_PATH); | 2719 | rb->memset(prefs.font, 0, MAX_PATH); |