diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-03-03 00:53:07 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-03-03 00:53:07 +0000 |
commit | f37b5078f69e8370a89e3adf53a6b9f98eb3a8cc (patch) | |
tree | 88d946d283f034411509e81436169002ff0d5d57 /apps/gui/skin_engine | |
parent | 9e611b1b009d6d5e02c10b5015cd4f2bc56f249e (diff) |
undo that last undo, make the font loader more forgiving to user errors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24994 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_fonts.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 39 |
2 files changed, 22 insertions, 18 deletions
diff --git a/apps/gui/skin_engine/skin_fonts.h b/apps/gui/skin_engine/skin_fonts.h index 0a847ee64c..095083818c 100644 --- a/apps/gui/skin_engine/skin_fonts.h +++ b/apps/gui/skin_engine/skin_fonts.h @@ -32,7 +32,6 @@ #ifndef _SKINFONTS_H_ #define _SKINFONTS_H_ -#define MAXUSERFONTS (MAXFONTS - SYSTEMFONTCOUNT) void skin_font_init(void); diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 76527f664a..d3d4911a16 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -935,14 +935,6 @@ static int parse_viewport(const char *wps_bufptr, else vp->flags &= ~VP_FLAG_ALIGN_RIGHT; /* ignore right-to-left languages */ - /* increment because font==2 and FONT_UI_REMOTE is ambiguous */ - if (vp->font > FONT_UI) - vp->font++; -#ifdef HAVE_REMOTE_LCD - if (vp->font == FONT_UI && curr_screen == SCREEN_REMOTE) - vp->font = FONT_UI_REMOTE; -#endif - struct skin_token_list *list = new_skin_token_list_item(NULL, skin_vp); if (!list) return WPS_ERROR_INVALID_PARAM; @@ -2088,6 +2080,7 @@ static bool skin_load_fonts(struct wps_data *data) /* don't spit out after the first failue to aid debugging */ bool success = true; struct skin_token_list *vp_list; + int font_id; /* walk though each viewport and assign its font */ for(vp_list = data->viewports; vp_list; vp_list = vp_list->next) { @@ -2097,20 +2090,21 @@ static bool skin_load_fonts(struct wps_data *data) struct viewport *vp = &skin_vp->vp; - if (vp->font < SYSTEMFONTCOUNT) + if (vp->font <= FONT_UI) { /* the usual case -> built-in fonts */ +#ifdef HAVE_REMOTE_LCD + if (vp->font == FONT_UI) + vp->font += curr_screen; +#endif continue; } - - /* decrement, because font has been incremented in viewport parsing - * due to the FONT_UI_REMOTE ambiguity */ - int skin_font_id = vp->font-1; + font_id = vp->font; /* now find the corresponding skin_font */ - struct skin_font *font = &skinfonts[skin_font_id-FONT_FIRSTUSERFONT]; - if (!font) + struct skin_font *font = &skinfonts[font_id-FONT_FIRSTUSERFONT]; + if (!font->name) { - DEBUGF("Could not find font %d\n", skin_font_id); + DEBUGF("font %d not specified\n", font_id); success = false; continue; } @@ -2127,7 +2121,7 @@ static bool skin_load_fonts(struct wps_data *data) if (font->id < 0) { DEBUGF("Unable to load font %d: '%s.fnt'\n", - skin_font_id, font->name); + font_id, font->name); success = false; continue; } @@ -2160,6 +2154,14 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, old_aa.width = wps_data->albumart->width; } #endif +#ifdef HAVE_LCD_BITMAP + int i; + for (i=0;i<MAXUSERFONTS;i++) + { + skinfonts[i].id = -1; + skinfonts[i].name = NULL; + } +#endif skin_data_reset(wps_data); curr_screen = screen; @@ -2181,6 +2183,9 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, curr_vp->lines = NULL; viewport_set_defaults(&curr_vp->vp, screen); +#ifdef HAVE_LCD_BITMAP + curr_vp->vp.font = FONT_UI; +#endif curr_line = NULL; if (!skin_start_new_line(curr_vp, 0)) |