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

@ -17,8 +17,10 @@
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _FONT_CACHE_H_
#define _FONT_CACHE_H_
#include <stdbool.h>
#include "lru.h"
/*******************************************************************************
@ -45,10 +47,16 @@ struct font_cache_entry
/* Create an auto sized font cache from buf */
void font_cache_create(
struct font_cache* fcache, void* buf, int buf_size, int bitmap_bytes_size);
/* Get font cache entry */
/* Get font cache entry for the given char_code
*
* cache_only: true if only a cache lookup should be performed and loading on miss should be avoided
*
* Note: With cache_only this can return NULL, which otherwise never happens */
struct font_cache_entry* font_cache_get(
struct font_cache* fcache,
unsigned short char_code,
bool cache_only,
void (*callback) (struct font_cache_entry* p, void *callback_data),
void *callback_data);