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
This commit is contained in:
Thomas Martitz 2014-01-15 13:37:40 +01:00
parent 84c7d6133b
commit c23ce62829
4 changed files with 123 additions and 13 deletions

View file

@ -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);