From c23ce62829d98c2dc78f1fd8a8810cefd0f10402 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 15 Jan 2014 13:37:40 +0100 Subject: fonts: Do not unload completely on USB. The font engine can now perform cache lookups even if the font file is closed, if the font was disabled with the new font_disable_all() function. It is highly probable that the lookup succeeds but in the cache-miss case a blank, full-width glyph will be returned. Change-Id: I3c97e747d2a0ba30c7b495c6118c9f029d265b56 --- firmware/export/font.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'firmware/export') diff --git a/firmware/export/font.h b/firmware/export/font.h index ed003f2..d19e0b8 100644 --- a/firmware/export/font.h +++ b/firmware/export/font.h @@ -125,6 +125,13 @@ void font_unload(int font_id); void font_unload_all(void); void font_lock(int font_id, bool lock); +/* Closes the file descriptor if the font file (if cached) but keeps + * the cache intact, so font_get_{bits,width} still work. */ +void font_disable_all(void); +/* Re-opens the file descriptor of the font file. Should be called as + * counter-part of font_disable_all(); */ +void font_enable_all(void); + struct font* font_get(int font); int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber); -- cgit v1.1