Enlightenment CVS committal Author : raster Project : e17 Module : libs/edje
Dir : e17/libs/edje/src/lib Modified Files: edje_text.c Log Message: retain text styles fron theme if they are specificed =================================================================== RCS file: /cvs/e/e17/libs/edje/src/lib/edje_text.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -3 -r1.65 -r1.66 --- edje_text.c 8 Sep 2007 18:31:56 -0000 1.65 +++ edje_text.c 17 Sep 2007 05:07:35 -0000 1.66 @@ -280,6 +280,7 @@ const char *text; const char *font; char *font2 = NULL; + char *sfont = NULL; int size; Evas_Coord tw, th; Evas_Coord sw, sh; @@ -297,7 +298,41 @@ tc = _edje_text_class_find(ed, chosen_desc->text.text_class); if (tc) { - if (tc->font) font = tc->font; + /* if the existing font spec in edje has a :style=XXX in it then + * its hinting that it wants to remain in that style even when + * a textclass is applied. if the textclass does not explicitly + * state a style, then snarf the old style out of the font spec + * and apply it to the text class being applie + */ + if ((tc->font) && (chosen_desc->text.font)) + { + char *tok, *tok2, *e; + + tok = strstr(chosen_desc->text.font, ":style="); + tok2 = strstr(tc->font, ":style="); + if ((tok) && (!tok2)) + { + char *stl; + int tclen; + + e = strchr(tok, ','); + stl = alloca(e - tok + 1); + strncpy(stl, tok, e - tok); + stl[e - tok] = 0; + font = tc->font; + tclen = strlen(tc->font); + sfont = malloc(tclen + e - tok + 1); + strcpy(sfont, tc->font); + strcpy(sfont + tclen, stl); + font = sfont; + } + else + font = tc->font; + } + else + { + if (tc->font) font = tc->font; + } size = _edje_text_size_calc(size, tc); } } @@ -618,6 +653,8 @@ free((char *)text); if (font2) free(font2); + if (sfont) + free(sfont); } Evas_Font_Size ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs