forked from enlightenment/efl
edje/styles: avoid redundant style tag addition by providing extra checks.
Summary: we should only add font_size tag if the new size is different. we should only add font tag if there is a new font. Reviewers: ali.alzyod, Hermet, cedric, raster Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9613
This commit is contained in:
parent
1d930427a3
commit
a880a756cd
|
@ -208,44 +208,36 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force)
|
||||||
{
|
{
|
||||||
if (fontset)
|
if (fontset)
|
||||||
{
|
{
|
||||||
eina_strbuf_append(txt, " ");
|
eina_strbuf_append(txt, " font_fallbacks=");
|
||||||
eina_strbuf_append(txt, "font_fallbacks=");
|
|
||||||
eina_strbuf_append(txt, fontset);
|
eina_strbuf_append(txt, fontset);
|
||||||
}
|
}
|
||||||
if (fontsource)
|
if (fontsource)
|
||||||
{
|
{
|
||||||
eina_strbuf_append(txt, " ");
|
eina_strbuf_append(txt, " font_source=");
|
||||||
eina_strbuf_append(txt, "font_source=");
|
|
||||||
eina_strbuf_append(txt, fontsource);
|
eina_strbuf_append(txt, fontsource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EINA_DBL_EQ(tag->font_size, 0))
|
if (tc && tc->size && !EINA_DBL_EQ(tag->font_size, 0))
|
||||||
{
|
{
|
||||||
char font_size[32];
|
double new_size = _edje_text_size_calc(tag->font_size, tc);
|
||||||
|
if (!EINA_DBL_EQ(tag->font_size, new_size))
|
||||||
|
{
|
||||||
|
char buffer[32];
|
||||||
|
|
||||||
if (tc && tc->size)
|
snprintf(buffer, sizeof(buffer), "%.1f", new_size);
|
||||||
snprintf(font_size, sizeof(font_size), "%f",
|
eina_strbuf_append(txt, " font_size=");
|
||||||
(double)_edje_text_size_calc(tag->font_size, tc));
|
eina_strbuf_append(txt, buffer);
|
||||||
else
|
}
|
||||||
snprintf(font_size, sizeof(font_size), "%f",
|
|
||||||
tag->font_size);
|
|
||||||
|
|
||||||
eina_strbuf_append(txt, " ");
|
|
||||||
eina_strbuf_append(txt, "font_size=");
|
|
||||||
eina_strbuf_append(txt, font_size);
|
|
||||||
}
|
}
|
||||||
/* Add font name last to save evas from multiple loads */
|
/* Add font name last to save evas from multiple loads */
|
||||||
if (tag->font)
|
if (tc && tc->font && tag->font)
|
||||||
{
|
{
|
||||||
const char *f;
|
const char *f;
|
||||||
char *sfont = NULL;
|
char *sfont = NULL;
|
||||||
|
|
||||||
eina_strbuf_append(txt, " ");
|
eina_strbuf_append(txt, " font=");
|
||||||
eina_strbuf_append(txt, "font=");
|
|
||||||
|
|
||||||
if (tc) f = _edje_text_font_get(tag->font, tc->font, &sfont);
|
|
||||||
else f = tag->font;
|
|
||||||
|
|
||||||
|
f = _edje_text_font_get(tag->font, tc->font, &sfont);
|
||||||
eina_strbuf_append_escaped(txt, f);
|
eina_strbuf_append_escaped(txt, f);
|
||||||
|
|
||||||
if (sfont) free(sfont);
|
if (sfont) free(sfont);
|
||||||
|
|
Loading…
Reference in New Issue