summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/text_viewer/tv_menu.c4
-rw-r--r--apps/plugins/text_viewer/tv_window.c19
2 files changed, 11 insertions, 12 deletions
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index d9b5343490..eb92782385 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -254,6 +254,7 @@ static bool tv_font_setting(void)
254 int new_font = 0; 254 int new_font = 0;
255 int old_font; 255 int old_font;
256 bool res; 256 bool res;
257 unsigned char font_path[MAX_PATH];
257 258
258 struct tree_context *tree; 259 struct tree_context *tree;
259 struct tree_context backup; 260 struct tree_context backup;
@@ -266,7 +267,8 @@ static bool tv_font_setting(void)
266 rb->strlcat(backup.currdir, "/", MAX_PATH); 267 rb->strlcat(backup.currdir, "/", MAX_PATH);
267 rb->strlcat(backup.currdir, dc[tree->selected_item].name, MAX_PATH); 268 rb->strlcat(backup.currdir, dc[tree->selected_item].name, MAX_PATH);
268 tree->dirfilter = &dirfilter; 269 tree->dirfilter = &dirfilter;
269 rb->set_current_file(FONT_DIR"/"); 270 rb->snprintf(font_path, MAX_PATH, "%s/", FONT_DIR);
271 rb->set_current_file(font_path);
270 count = tree->filesindir; 272 count = tree->filesindir;
271 273
272 struct opt_items names[count]; 274 struct opt_items names[count];
diff --git a/apps/plugins/text_viewer/tv_window.c b/apps/plugins/text_viewer/tv_window.c
index 676aff40ab..36fbb9268c 100644
--- a/apps/plugins/text_viewer/tv_window.c
+++ b/apps/plugins/text_viewer/tv_window.c
@@ -278,11 +278,11 @@ bool tv_traverse_lines(void)
278static void tv_change_preferences(const struct tv_preferences *oldp) 278static void tv_change_preferences(const struct tv_preferences *oldp)
279{ 279{
280#ifdef HAVE_LCD_BITMAP 280#ifdef HAVE_LCD_BITMAP
281 static bool is_executing = false; 281 static bool font_changing = false;
282 const unsigned char *font_str; 282 const unsigned char *font_str;
283 283
284 is_executing = true; 284 font_str = (oldp && !font_changing)? oldp->font_name : rb->global_settings->font_file;
285 font_str = oldp? oldp->font_name: rb->global_settings->font_file; 285 font_changing = true;
286 286
287 /* change font */ 287 /* change font */
288 if (rb->strcmp(font_str, prefs->font_name)) 288 if (rb->strcmp(font_str, prefs->font_name))
@@ -291,25 +291,22 @@ static void tv_change_preferences(const struct tv_preferences *oldp)
291 { 291 {
292 struct tv_preferences new_prefs = *prefs; 292 struct tv_preferences new_prefs = *prefs;
293 293
294 if (!tv_set_font(font_str) && oldp != NULL)
295 {
296 font_str = rb->global_settings->font_file;
297 tv_set_font(font_str);
298 }
299
300 rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); 294 rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH);
301 tv_set_preferences(&new_prefs); 295 tv_set_preferences(&new_prefs);
302 } 296 }
303 } 297 }
298 else if (!oldp || font_changing)
299 tv_set_font(font_str);
304 300
305 /* calculates display lines */ 301 /* calculates display lines */
306 tv_check_header_and_footer(); 302 tv_check_header_and_footer();
307 display_lines = tv_calc_display_lines(); 303 display_lines = tv_calc_display_lines();
308 304
309 if (!is_executing) 305 /* if font_changing == false, the remaining processes need not be executed. */
306 if (!font_changing)
310 return; 307 return;
311 308
312 is_executing = false; 309 font_changing = false;
313#else 310#else
314 (void)oldp; 311 (void)oldp;
315 312