diff options
-rw-r--r-- | apps/gui/skin_engine/skin_fonts.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 33 | ||||
-rw-r--r-- | firmware/export/font.h | 5 |
3 files changed, 20 insertions, 19 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 13e2df5889..1ebfee2c04 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; @@ -2082,6 +2074,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) { @@ -2091,20 +2084,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]; + struct skin_font *font = &skinfonts[font_id-FONT_FIRSTUSERFONT]; if (!font) { - DEBUGF("Could not find font %d\n", skin_font_id); + DEBUGF("Could not find font %d\n", font_id); success = false; continue; } @@ -2121,7 +2115,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; } @@ -2154,6 +2148,12 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, old_aa.width = wps_data->albumart->width; } #endif + int i; + for (i=0;i<MAXUSERFONTS;i++) + { + skinfonts[i].id = -1; + skinfonts[i].name = NULL; + } skin_data_reset(wps_data); curr_screen = screen; @@ -2175,6 +2175,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, curr_vp->lines = NULL; viewport_set_defaults(&curr_vp->vp, screen); + curr_vp->vp.font = FONT_UI; curr_line = NULL; if (!skin_start_new_line(curr_vp, 0)) diff --git a/firmware/export/font.h b/firmware/export/font.h index 307db6967d..406901d072 100644 --- a/firmware/export/font.h +++ b/firmware/export/font.h @@ -54,9 +54,10 @@ enum { SYSTEMFONTCOUNT, /* Number of fonts reserved for the system and ui */ FONT_FIRSTUSERFONT = 2 }; +#define MAXUSERFONTS 8 -/* SYSFONT, FONT_UI, FONT_UI_REMOTE + 8 fonts in skins */ -#define MAXFONTS 11 +/* SYSFONT, FONT_UI, FONT_UI_REMOTE + MAXUSERFONTS fonts in skins */ +#define MAXFONTS (SYSTEMFONTCOUNT + MAXUSERFONTS) /* * .fnt loadable font file format definition |