From 76ee238d483d39b1374d9804e4c8bad5a8f8c106 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 26 Nov 2025 01:18:18 -0500 Subject: [PATCH] FS#13704 - Rockpaint fonts memory troubles -- Disable font rendering in font selection Displaying the fonts as you select them is nice but IMO pretty wasteful I think a few static bitmaps would probably suffice I however don't feel like addressing this so lets just disable it, for now? Change-Id: I882cc0c4129e99d8b2f4ac135301dc3906340bb7 --- apps/plugins/rockpaint.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index a0fe37b6f4..8f85721500 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -1134,6 +1134,7 @@ static bool browse( char *dst, int dst_size, const char *start ) * In other words, cache_first-1 must be cached before cache_first-2 is cached. * - there is enough space to store all preview currently displayed. */ +#if 0 /* Broken crashy caching implementation that renders the font in the list FS#13704 */ static bool browse_fonts( char *dst, int dst_size ) { #define LINE_SPACE 2 @@ -1312,7 +1313,7 @@ static bool browse_fonts( char *dst, int dst_size ) li = tree->filesindir-1; if( reset_font ) { - // fixme rb->font_load(NULL, bbuf_s ); + // fixme rb->font_load(bbuf_s ); reset_font = false; } if( lvi-fvi+1 < tree->filesindir ) @@ -1386,6 +1387,35 @@ static bool browse_fonts( char *dst, int dst_size ) #undef PREVIEW_SIZE #undef PREVIEW_NEXT } +#else /* simple uncached non-rendered fallback */ +static bool browse_fonts( char *dst, int dst_size ) +{ + /* taken from text_viewer */ + char font[MAX_PATH], name[MAX_FILENAME+10]; + rb->snprintf(name, sizeof(name), "%s.fnt", rb->global_settings->font_file); + + struct browse_context browse = { + .dirfilter = SHOW_FONT, + .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, + .title = rb->str(LANG_CUSTOM_FONT), + .icon = Icon_Menu_setting, + .root = FONT_DIR, + .selected = name, + .buf = font, + .bufsize = sizeof(font), + //.callback_show_item = &callback_show_font, + }; + + rb->rockbox_browse(&browse); + + if (browse.flags & BROWSE_SELECTED) + { + rb->snprintf( dst, dst_size, "%s", font ); + return true; + } + return false; +} +#endif /*********************************************************************** * HSVRGB Color chooser