summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-24 14:52:16 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-24 14:52:16 +0000
commit83cfbf4e5102f1a72b4af2ae47a893168dc7cd02 (patch)
treef4a836b576902b2dd9cc2877268bfaf6f99bcb80 /apps
parent0c521cffd4b8875a7fa42912f2b86582d37494d5 (diff)
downloadrockbox-83cfbf4e5102f1a72b4af2ae47a893168dc7cd02.tar.gz
rockbox-83cfbf4e5102f1a72b4af2ae47a893168dc7cd02.zip
Allow fonts to use smaller buffers than the default size. use font_load_ex() to speficiy the buffer size. If the font is already loaded with a smaller buffer it will be reloaded to use the new size. Also fix an issue where handles would get lost if fonts fail to load in skins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30592 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_parser.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 8c87553be3..c8cca3d380 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -419,7 +419,7 @@ static int parse_font_load(struct skin_element *element,
if(element->params_count > 2)
glyphs = element->params[2].data.number;
else
- glyphs = GLYPHS_TO_CACHE;
+ glyphs = 0;
if (id < 2)
{
DEBUGF("font id must be >= 2\n");
@@ -1675,8 +1675,13 @@ static bool skin_load_fonts(struct wps_data *data)
{
char path[MAX_PATH];
snprintf(path, sizeof path, FONT_DIR "/%s", font->name);
- font->id = font_load(path/*,
- skinfonts[font_id-FONT_FIRSTUSERFONT].glyphs*/);
+ if (skinfonts[font_id-2].glyphs > 0)
+ {
+ font->id = font_load_ex(path,
+ font_glyphs_to_bufsize(path, skinfonts[font_id-2].glyphs));
+ }
+ else
+ font->id = font_load(path);
//printf("[%d] %s -> %d\n",font_id, font->name, font->id);
id_array[font_count++] = font->id;
}
@@ -1693,18 +1698,16 @@ static bool skin_load_fonts(struct wps_data *data)
/* finally, assign the font_id to the viewport */
vp->font = font->id;
}
- if (success)
+ data->font_ids = skin_buffer_alloc(font_count * sizeof(int));
+ if (!success || data->font_ids == NULL)
{
- data->font_ids = skin_buffer_alloc(font_count * sizeof(int));
- if (data->font_ids == NULL)
- {
- while (font_count > 0)
- font_unload(id_array[--font_count]);
- return false;
- }
- memcpy(data->font_ids, id_array, sizeof(int)*font_count);
- data->font_count = font_count;
+ while (font_count > 0)
+ font_unload(id_array[--font_count]);
+ data->font_ids = NULL;
+ return false;
}
+ memcpy(data->font_ids, id_array, sizeof(int)*font_count);
+ data->font_count = font_count;
return success;
}