edje/styles: keep an escaped string of font_set. As eina_ecaped_string() creates a new string just make it once and use when needed.

Reviewers: Hermet, ali.alzyod

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9615
This commit is contained in:
subhransu mohanty 2019-08-19 19:21:47 +09:00 committed by Hermet Park
parent f10a3c9ee3
commit 1d930427a3
3 changed files with 11 additions and 9 deletions

View File

@ -2457,6 +2457,7 @@ EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
extern Eina_Inlist *_edje_edjes;
extern char *_edje_fontset_append;
extern char *_edje_fontset_append_escaped;
extern FLOAT_T _edje_scale;
extern int _edje_util_freeze_val;
extern int _edje_util_freeze_calc_count;

View File

@ -168,7 +168,7 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force)
Eina_Strbuf *txt = NULL;
Edje_Style_Tag *tag;
Edje_Text_Class *tc;
char *fontset = NULL, *fontsource = NULL;
char *fontset = _edje_fontset_append_escaped, *fontsource = NULL;
if (!ed->file) return;
@ -253,7 +253,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force)
eina_strbuf_append(txt, "'");
}
if (fontset) free(fontset);
if (fontsource) free(fontsource);
/* Configure the style */
@ -448,11 +447,12 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
Eina_Strbuf *txt = NULL;
Eina_List *l, *ll;
Edje_Style *stl;
char *fontset = _edje_fontset_append_escaped;
EINA_LIST_FOREACH(edf->styles, l, stl)
{
Edje_Style_Tag *tag;
char *fontset = NULL, *fontsource = NULL, *ts;
char *fontsource = NULL, *ts;
if (stl->style) break;
@ -464,8 +464,6 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
stl->style = evas_textblock_style_new();
evas_textblock_style_set(stl->style, NULL);
if (_edje_fontset_append)
fontset = eina_str_escape(_edje_fontset_append);
if (edf->fonts)
fontsource = eina_str_escape(edf->path);
@ -495,8 +493,7 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
{
if (fontset)
{
eina_strbuf_append(txt, " ");
eina_strbuf_append(txt, "font_fallbacks=");
eina_strbuf_append(txt, " font_fallbacks=");
eina_strbuf_append(txt, fontset);
}
if (fontsource)
@ -510,7 +507,6 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
if (tag->text_class) stl->readonly = EINA_FALSE;
}
if (fontset) free(fontset);
if (fontsource) free(fontsource);
/* Configure the style */

View File

@ -27,6 +27,7 @@ Efl_Observable *_edje_size_class_member = NULL;
static Eina_Rbtree *_edje_box_layout_registry = NULL;
char *_edje_fontset_append = NULL;
char *_edje_fontset_append_escaped = NULL;
FLOAT_T _edje_scale = ZERO;
Eina_Bool _edje_password_show_last = EINA_FALSE;
double _edje_password_show_last_timeout = 0;
@ -357,8 +358,12 @@ EAPI void
edje_fontset_append_set(const char *fonts)
{
if (_edje_fontset_append)
free(_edje_fontset_append);
{
free(_edje_fontset_append);
free(_edje_fontset_append_escaped);
}
_edje_fontset_append = fonts ? strdup(fonts) : NULL;
_edje_fontset_append_escaped = fonts ? eina_str_escape(fonts) : NULL;
}
EAPI const char *