diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-03-02 21:47:35 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-03-02 21:47:35 +0000 |
commit | 9e611b1b009d6d5e02c10b5015cd4f2bc56f249e (patch) | |
tree | 8e5006fb1f765d55738a8ed194234bb018c9bcfa | |
parent | 66ebc35c557e27401799e542a6fee8c824364bb2 (diff) |
revert r24989 ad r24990 which are cuasing segfaults... they were working fine for me though :( (stupid font stuff is cursed!)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24993 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_fonts.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 37 | ||||
-rw-r--r-- | firmware/export/font.h | 5 |
3 files changed, 19 insertions, 24 deletions
diff --git a/apps/gui/skin_engine/skin_fonts.h b/apps/gui/skin_engine/skin_fonts.h index 095083818c..0a847ee64c 100644 --- a/apps/gui/skin_engine/skin_fonts.h +++ b/apps/gui/skin_engine/skin_fonts.h @@ -32,6 +32,7 @@ #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 c4f8d1a8ca..76527f664a 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -935,6 +935,14 @@ 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; @@ -2080,7 +2088,6 @@ 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) { @@ -2090,21 +2097,20 @@ static bool skin_load_fonts(struct wps_data *data) struct viewport *vp = &skin_vp->vp; - if (vp->font <= FONT_UI) + if (vp->font < SYSTEMFONTCOUNT) { /* the usual case -> built-in fonts */ -#ifdef HAVE_REMOTE_LCD - if (vp->font == FONT_UI) - vp->font += curr_screen; -#endif continue; } - font_id = vp->font; + + /* decrement, because font has been incremented in viewport parsing + * due to the FONT_UI_REMOTE ambiguity */ + int skin_font_id = vp->font-1; /* now find the corresponding skin_font */ - struct skin_font *font = &skinfonts[font_id-FONT_FIRSTUSERFONT]; + struct skin_font *font = &skinfonts[skin_font_id-FONT_FIRSTUSERFONT]; if (!font) { - DEBUGF("Could not find font %d\n", font_id); + DEBUGF("Could not find font %d\n", skin_font_id); success = false; continue; } @@ -2121,7 +2127,7 @@ static bool skin_load_fonts(struct wps_data *data) if (font->id < 0) { DEBUGF("Unable to load font %d: '%s.fnt'\n", - font_id, font->name); + skin_font_id, font->name); success = false; continue; } @@ -2154,14 +2160,6 @@ 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; @@ -2183,9 +2181,6 @@ 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)) diff --git a/firmware/export/font.h b/firmware/export/font.h index 406901d072..307db6967d 100644 --- a/firmware/export/font.h +++ b/firmware/export/font.h @@ -54,10 +54,9 @@ enum { SYSTEMFONTCOUNT, /* Number of fonts reserved for the system and ui */ FONT_FIRSTUSERFONT = 2 }; -#define MAXUSERFONTS 8 -/* SYSFONT, FONT_UI, FONT_UI_REMOTE + MAXUSERFONTS fonts in skins */ -#define MAXFONTS (SYSTEMFONTCOUNT + MAXUSERFONTS) +/* SYSFONT, FONT_UI, FONT_UI_REMOTE + 8 fonts in skins */ +#define MAXFONTS 11 /* * .fnt loadable font file format definition |