forked from enlightenment/efl
Add negative font size handling in text_classes
* negative size is a multiplier for the origianl size i.e. : -100 = 1.0x; -120 = 1.2x SVN revision: 29835
This commit is contained in:
parent
405dcfc633
commit
61bda22a70
|
@ -641,7 +641,7 @@ _edje_part_recalc_single(Edje *ed,
|
|||
if (tc)
|
||||
{
|
||||
if (tc->font) font = tc->font;
|
||||
if (tc->size > 0) size = tc->size;
|
||||
size = _edje_text_size_calc(size, tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ _edje_part_recalc_single(Edje *ed,
|
|||
if (tc)
|
||||
{
|
||||
if (tc->font) font = tc->font;
|
||||
if (tc->size > 0) size = tc->size;
|
||||
size = _edje_text_size_calc(size, tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1138,7 +1138,7 @@ _edje_embryo_fn_set_text_class(Embryo_Program *ep, Embryo_Cell *params)
|
|||
GETSTR(class, params[1]);
|
||||
GETSTR(font, params[2]);
|
||||
if( !class || !font ) return 0;
|
||||
fsize = (Evas_Font_Size)EMBRYO_CELL_TO_FLOAT(params[3]);
|
||||
fsize = (Evas_Font_Size) EMBRYO_CELL_TO_FLOAT(params[3]);
|
||||
edje_object_text_class_set(ed->obj, class, font, fsize);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -776,9 +776,9 @@ struct _Edje_Color_Class
|
|||
|
||||
struct _Edje_Text_Class
|
||||
{
|
||||
const char *name;
|
||||
const char *font;
|
||||
double size;
|
||||
const char *name;
|
||||
const char *font;
|
||||
Evas_Font_Size size;
|
||||
};
|
||||
|
||||
struct _Edje_Var_Int
|
||||
|
@ -940,13 +940,14 @@ void _edje_program_run(Edje *ed, Edje_Program *pr, int force, const char *ssig,
|
|||
void _edje_emit(Edje *ed, const char *sig, const char *src);
|
||||
void _edje_emit_handle(Edje *ed, const char *sig, const char *src);
|
||||
|
||||
void _edje_text_init(void);
|
||||
void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
|
||||
void _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
|
||||
|
||||
void _edje_text_init(void);
|
||||
void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_part_on_add_clippers(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
|
||||
void _edje_text_real_part_on_del(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
|
||||
Evas_Font_Size _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc);
|
||||
|
||||
Edje_Real_Part *_edje_real_part_get(Edje *ed, const char *part);
|
||||
Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_member_add(Edje *ed, const char *color_class);
|
||||
|
|
|
@ -296,7 +296,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
if (tc)
|
||||
{
|
||||
if (tc->font) font = tc->font;
|
||||
if (tc->size > 0) size = tc->size;
|
||||
size = _edje_text_size_calc(size, tc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,3 +585,23 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
if (font2)
|
||||
free(font2);
|
||||
}
|
||||
|
||||
Evas_Font_Size
|
||||
_edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc)
|
||||
{
|
||||
int val;
|
||||
|
||||
if (tc->size == 0)
|
||||
{
|
||||
val = size;
|
||||
}
|
||||
else if (tc->size > 0.0)
|
||||
{
|
||||
val = tc->size;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = (size * -tc->size) / 100;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -281,12 +281,12 @@ _edje_textblock_style_all_update(Edje *ed)
|
|||
buf = _edje_strbuf_append(buf, "font_source=", &buflen, &bufalloc);
|
||||
buf = _edje_strbuf_append(buf, fontsource, &buflen, &bufalloc);
|
||||
}
|
||||
if (tag->font_size > 0)
|
||||
if (tag->font_size != 0)
|
||||
{
|
||||
char font_size[32];
|
||||
|
||||
if (found)
|
||||
snprintf(font_size, sizeof(font_size), "%f", tc->size);
|
||||
snprintf(font_size, sizeof(font_size), "%f", (double) _edje_text_size_calc(tag->font_size, tc));
|
||||
else
|
||||
snprintf(font_size, sizeof(font_size), "%f", tag->font_size);
|
||||
|
||||
|
|
|
@ -442,7 +442,6 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
|
|||
Edje_Text_Class *tc;
|
||||
|
||||
if (!text_class) return;
|
||||
if (size < 0) size = 0;
|
||||
if (!font) font = "";
|
||||
|
||||
tc = evas_hash_find(_edje_text_class_hash, text_class);
|
||||
|
@ -578,8 +577,6 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
|
|||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!text_class)) return;
|
||||
|
||||
if (size < 0.0) size = 0.0;
|
||||
|
||||
/* for each text_class in the edje */
|
||||
for (l = ed->text_classes; l; l = l->next)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue