diff options
Diffstat (limited to 'apps/plugins/text_viewer/tv_display.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_display.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c index 59b4bdf437..c59765ebbe 100644 --- a/apps/plugins/text_viewer/tv_display.c +++ b/apps/plugins/text_viewer/tv_display.c | |||
@@ -349,7 +349,7 @@ static bool tv_set_font(const unsigned char *font) | |||
349 | } | 349 | } |
350 | #endif | 350 | #endif |
351 | 351 | ||
352 | static void tv_change_preferences(const struct tv_preferences *oldp) | 352 | static int tv_change_preferences(const struct tv_preferences *oldp) |
353 | { | 353 | { |
354 | #ifdef HAVE_LCD_BITMAP | 354 | #ifdef HAVE_LCD_BITMAP |
355 | static bool font_changing = false; | 355 | static bool font_changing = false; |
@@ -363,10 +363,18 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
363 | { | 363 | { |
364 | if (!tv_set_font(preferences->font_name)) | 364 | if (!tv_set_font(preferences->font_name)) |
365 | { | 365 | { |
366 | /* | ||
367 | * tv_set_font(rb->global_settings->font_file) doesn't fail usually. | ||
368 | * if it fails, a fatal problem occurs in Rockbox. | ||
369 | */ | ||
370 | if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file)) | ||
371 | return TV_CALLBACK_ERROR; | ||
372 | |||
366 | font_changing = true; | 373 | font_changing = true; |
367 | tv_copy_preferences(&new_prefs); | 374 | tv_copy_preferences(&new_prefs); |
368 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); | 375 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); |
369 | tv_set_preferences(&new_prefs); | 376 | |
377 | return (tv_set_preferences(&new_prefs))? TV_CALLBACK_STOP : TV_CALLBACK_ERROR; | ||
370 | } | 378 | } |
371 | col_width = 2 * rb->font_get_width(preferences->font, ' '); | 379 | col_width = 2 * rb->font_get_width(preferences->font, ' '); |
372 | font_changing = false; | 380 | font_changing = false; |
@@ -375,6 +383,7 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
375 | (void)oldp; | 383 | (void)oldp; |
376 | #endif | 384 | #endif |
377 | tv_change_viewport(); | 385 | tv_change_viewport(); |
386 | return TV_CALLBACK_OK; | ||
378 | } | 387 | } |
379 | 388 | ||
380 | bool tv_init_display(unsigned char **buf, size_t *size) | 389 | bool tv_init_display(unsigned char **buf, size_t *size) |