2003-07-07 00:55:18 -07:00
|
|
|
#include "edje_private.h"
|
2011-02-03 00:55:40 -08:00
|
|
|
#define _ELLIP_STR "\xE2\x80\xA6"
|
2004-10-30 08:51:55 -07:00
|
|
|
|
2016-03-21 16:31:26 -07:00
|
|
|
#include "../evas/canvas/evas_text.eo.h"
|
|
|
|
|
2007-03-30 16:39:41 -07:00
|
|
|
/* returns with and height for this part.
|
|
|
|
*
|
|
|
|
* depending on the value of the use_alternate_font_metrics flag, it will
|
|
|
|
* either use evas_object_geometry_get() or the _advance_get() functions.
|
|
|
|
*
|
|
|
|
* The latter is useful if you want to make sure that width and height
|
|
|
|
* are the same value for the same number of characters in the text.
|
|
|
|
* This usually only makes sense for monospaced fonts.
|
|
|
|
*
|
|
|
|
* In future changes to this file, you probably should use this wrapper
|
|
|
|
* function everywhere instead of calling evas_object_geometry_get()
|
|
|
|
* directly.
|
|
|
|
*/
|
2015-05-13 09:08:04 -07:00
|
|
|
|
2007-03-30 16:39:41 -07:00
|
|
|
static inline void
|
|
|
|
part_get_geometry(Edje_Real_Part *rp, Evas_Coord *w, Evas_Coord *h)
|
|
|
|
{
|
|
|
|
if (!rp->part->use_alternate_font_metrics)
|
2017-09-15 02:37:25 -07:00
|
|
|
{
|
|
|
|
Eina_Size2D sz = efl_gfx_size_get(rp->object);
|
|
|
|
if (w) *w = sz.w;
|
|
|
|
if (h) *h = sz.h;
|
|
|
|
}
|
2007-03-30 16:39:41 -07:00
|
|
|
else
|
|
|
|
{
|
2013-07-01 21:27:51 -07:00
|
|
|
if (w) *w = evas_object_text_horiz_advance_get(rp->object);
|
|
|
|
if (h) *h = evas_object_text_vert_advance_get(rp->object);
|
2007-03-30 16:39:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-13 09:08:04 -07:00
|
|
|
const char *
|
|
|
|
_set_translated_string(Edje *ed, Edje_Real_Part *ep)
|
|
|
|
{
|
|
|
|
const char *domain = NULL;
|
|
|
|
const char *text = NULL;
|
|
|
|
Edje_Part_Description_Text *chosen_desc;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
chosen_desc = (Edje_Part_Description_Text *)ep->chosen_description;
|
2015-05-13 09:08:04 -07:00
|
|
|
domain = chosen_desc->text.domain;
|
|
|
|
text = edje_string_get(&chosen_desc->text.text);
|
|
|
|
|
|
|
|
if (domain && text)
|
|
|
|
{
|
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
char p[PATH_MAX];
|
|
|
|
char *curpath;
|
|
|
|
char *curlocale;
|
|
|
|
|
|
|
|
snprintf(p, sizeof(p), "%s-%s", ed->file->fid, domain);
|
|
|
|
|
|
|
|
curlocale = setlocale(LC_ALL, "");
|
2015-06-01 08:38:04 -07:00
|
|
|
if (ed->language)
|
|
|
|
setlocale(LC_ALL, ed->language);
|
2015-05-13 09:08:04 -07:00
|
|
|
|
2015-06-01 08:38:04 -07:00
|
|
|
curpath = bindtextdomain(p, _edje_cache_path);
|
2015-05-13 09:08:04 -07:00
|
|
|
text = dgettext(p, text);
|
|
|
|
|
|
|
|
bindtextdomain(p, curpath);
|
|
|
|
setlocale(LC_ALL, curlocale);
|
2016-06-07 10:29:29 -07:00
|
|
|
#else
|
|
|
|
(void) ed;
|
2015-05-13 09:08:04 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
2003-07-07 00:55:18 -07:00
|
|
|
void
|
|
|
|
_edje_text_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep)
|
|
|
|
{
|
2003-11-03 22:15:19 -08:00
|
|
|
Edje_Part *pt = ep->part;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *desc;
|
|
|
|
unsigned int i;
|
2003-07-07 00:55:18 -07:00
|
|
|
|
|
|
|
if (ep->part->type != EDJE_PART_TYPE_TEXT) return;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* if text class exists for this part, add the edje to the tc member list */
|
2015-06-08 11:43:00 -07:00
|
|
|
desc = (Edje_Part_Description_Text *)pt->default_desc;
|
2010-07-29 05:02:36 -07:00
|
|
|
if ((pt->default_desc) && (desc->text.text_class))
|
2016-11-01 10:59:09 -07:00
|
|
|
efl_observable_observer_add(_edje_text_class_member, desc->text.text_class, ed->obj);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2006-03-27 23:45:54 -08:00
|
|
|
/* If any other classes exist add them */
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < pt->other.desc_count; ++i)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
desc = (Edje_Part_Description_Text *)pt->other.desc[i];
|
2013-07-01 21:27:51 -07:00
|
|
|
if ((desc) && (desc->text.text_class))
|
2016-11-01 10:59:09 -07:00
|
|
|
efl_observable_observer_add(_edje_text_class_member, desc->text.text_class, ed->obj);
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-11-24 23:22:19 -08:00
|
|
|
_edje_text_part_on_del(Edje *ed, Edje_Part *pt)
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *desc;
|
|
|
|
unsigned int i;
|
|
|
|
|
2011-04-08 22:48:47 -07:00
|
|
|
if (!pt) return;
|
2015-02-24 09:26:18 -08:00
|
|
|
if (pt->type != EDJE_PART_TYPE_TEXT)
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
desc = (Edje_Part_Description_Text *)pt->default_desc;
|
2010-07-29 05:02:36 -07:00
|
|
|
if ((pt->default_desc) && (desc->text.text_class))
|
2016-11-01 10:59:09 -07:00
|
|
|
efl_observable_observer_del(_edje_text_class_member, desc->text.text_class, ed->obj);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < pt->other.desc_count; ++i)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
desc = (Edje_Part_Description_Text *)pt->other.desc[i];
|
2013-07-01 21:27:51 -07:00
|
|
|
if (desc->text.text_class)
|
2016-11-01 10:59:09 -07:00
|
|
|
efl_observable_observer_del(_edje_text_class_member, desc->text.text_class, ed->obj);
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2003-11-24 23:22:19 -08:00
|
|
|
}
|
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
static const char *
|
2004-10-30 08:51:55 -07:00
|
|
|
_edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
|
|
|
|
Edje_Calc_Params *params,
|
2014-08-14 08:45:14 -07:00
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
2006-03-18 20:22:35 -08:00
|
|
|
const char *text, const char *font, int size,
|
2012-12-12 06:07:28 -08:00
|
|
|
Evas_Coord sw, Evas_Coord sh, int *free_text)
|
2004-10-30 08:51:55 -07:00
|
|
|
{
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T sc;
|
2004-10-30 08:51:55 -07:00
|
|
|
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
2016-12-20 16:01:01 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2004-10-30 09:54:58 -07:00
|
|
|
*free_text = 0;
|
2008-10-01 21:01:54 -07:00
|
|
|
if (sw <= 1) return "";
|
2004-10-30 09:54:58 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_text(params);
|
|
|
|
if ((params->type.text->ellipsis < 0) || (chosen_desc->text.min_x))
|
2013-06-03 08:02:16 -07:00
|
|
|
return text;
|
|
|
|
|
2009-12-09 07:44:54 -08:00
|
|
|
if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
2004-10-30 08:51:55 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_obj_text_ellipsis_set(ep->object, params->type.text->ellipsis);
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_text_set(ep->object, text);
|
2017-09-15 02:37:25 -07:00
|
|
|
efl_gfx_size_set(ep->object, EINA_SIZE2D(sw, sh));
|
2004-10-30 09:54:58 -07:00
|
|
|
|
2012-12-12 06:07:28 -08:00
|
|
|
return text;
|
2004-10-30 08:51:55 -07:00
|
|
|
}
|
|
|
|
|
2013-05-22 02:04:34 -07:00
|
|
|
const char *
|
2008-02-29 13:43:55 -08:00
|
|
|
_edje_text_font_get(const char *base, const char *new, char **free_later)
|
|
|
|
{
|
|
|
|
const char *base_style, *new_style, *aux;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t font_len, style_len;
|
2008-02-29 13:43:55 -08:00
|
|
|
|
|
|
|
if (base && (!new))
|
|
|
|
return base;
|
2009-10-07 03:55:48 -07:00
|
|
|
else if (!base)
|
2008-02-29 13:43:55 -08:00
|
|
|
return new;
|
|
|
|
base_style = strstr(base, ":style=");
|
|
|
|
if (!base_style)
|
|
|
|
return new;
|
|
|
|
|
|
|
|
new_style = strstr(new, ":style=");
|
|
|
|
if (new_style)
|
|
|
|
return new;
|
|
|
|
|
|
|
|
font_len = strlen(new);
|
|
|
|
aux = strchr(base_style, ',');
|
2011-01-15 19:31:05 -08:00
|
|
|
style_len = (aux) ? (size_t)(aux - base_style) : strlen(base_style);
|
2008-02-29 13:43:55 -08:00
|
|
|
|
|
|
|
*free_later = malloc(font_len + style_len + 1);
|
|
|
|
memcpy(*free_later, new, font_len);
|
|
|
|
memcpy(*free_later + font_len, base_style, style_len);
|
|
|
|
(*free_later)[font_len + style_len] = '\0';
|
|
|
|
|
|
|
|
return *free_later;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_text_class_font_get(Edje *ed, Edje_Part_Description_Text *chosen_desc, int *size, char **free_later)
|
2008-02-29 13:43:55 -08:00
|
|
|
{
|
|
|
|
Edje_Text_Class *tc;
|
|
|
|
const char *text_class_name, *font;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
font = edje_string_get(&chosen_desc->text.font);
|
2008-02-29 13:43:55 -08:00
|
|
|
*size = chosen_desc->text.size;
|
|
|
|
|
|
|
|
text_class_name = chosen_desc->text.text_class;
|
|
|
|
if ((!text_class_name) || (!text_class_name[0]))
|
|
|
|
return font;
|
|
|
|
|
|
|
|
tc = _edje_text_class_find(ed, text_class_name);
|
|
|
|
if (!tc)
|
|
|
|
return font;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
font = _edje_text_font_get(edje_string_get(&chosen_desc->text.font), tc->font, free_later);
|
2008-02-29 13:43:55 -08:00
|
|
|
*size = _edje_text_size_calc(*size, tc);
|
|
|
|
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
2003-07-07 00:55:18 -07:00
|
|
|
void
|
|
|
|
_edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
2013-07-01 21:27:51 -07:00
|
|
|
Edje_Calc_Params *params,
|
2013-08-05 01:41:09 -07:00
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
2015-06-17 00:26:30 -07:00
|
|
|
Eina_Bool calc_only)
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
const char *text = NULL;
|
|
|
|
const char *font;
|
|
|
|
char *font2 = NULL;
|
|
|
|
char *sfont = NULL;
|
|
|
|
int size;
|
|
|
|
Evas_Coord tw, th;
|
|
|
|
Evas_Coord sw, sh;
|
|
|
|
int inlined_font = 0, free_text = 0;
|
|
|
|
Eina_Bool same_text = EINA_FALSE;
|
|
|
|
FLOAT_T sc;
|
2013-07-01 21:27:51 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!ep->typedata.text)) return;
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
2016-12-20 16:01:01 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
2015-05-13 09:08:04 -07:00
|
|
|
|
|
|
|
if (chosen_desc->text.domain)
|
|
|
|
{
|
|
|
|
if (!chosen_desc->text.text.translated)
|
|
|
|
chosen_desc->text.text.translated = _set_translated_string(ed, ep);
|
|
|
|
if (chosen_desc->text.text.translated)
|
|
|
|
text = chosen_desc->text.text.translated;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!text)
|
|
|
|
text = edje_string_get(&chosen_desc->text.text);
|
2008-02-29 13:43:55 -08:00
|
|
|
font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
|
|
|
if (ep->typedata.text->font) font = ep->typedata.text->font;
|
|
|
|
if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
|
2015-06-16 05:05:06 -07:00
|
|
|
|
2016-06-16 05:50:38 -07:00
|
|
|
if (chosen_desc->text.id_text_source >= 0)
|
2007-10-14 16:54:27 -07:00
|
|
|
{
|
2014-04-22 10:19:09 -07:00
|
|
|
Edje_Part_Description_Text *et;
|
|
|
|
Edje_Real_Part *rp2;
|
2016-06-16 05:50:38 -07:00
|
|
|
ep->typedata.text->text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
|
2014-04-22 10:19:09 -07:00
|
|
|
|
|
|
|
et = _edje_real_part_text_text_source_description_get(ep, &rp2);
|
|
|
|
text = edje_string_get(&(et->text.text));
|
|
|
|
if (rp2->typedata.text->text) text = rp2->typedata.text->text;
|
2007-10-14 16:54:27 -07:00
|
|
|
}
|
2016-06-16 05:50:38 -07:00
|
|
|
|
|
|
|
if (chosen_desc->text.id_source >= 0)
|
2007-10-14 16:54:27 -07:00
|
|
|
{
|
2014-04-22 10:19:09 -07:00
|
|
|
Edje_Part_Description_Text *et;
|
|
|
|
Edje_Real_Part *rp2;
|
|
|
|
|
2016-06-16 05:50:38 -07:00
|
|
|
ep->typedata.text->source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
|
|
|
|
|
2014-04-22 10:19:09 -07:00
|
|
|
et = _edje_real_part_text_source_description_get(ep, &rp2);
|
|
|
|
font = edje_string_get(&(et->text.font));
|
|
|
|
size = et->text.size;
|
|
|
|
if (rp2->typedata.text->font) font = rp2->typedata.text->font;
|
|
|
|
if (rp2->typedata.text->size > 0) size = rp2->typedata.text->size;
|
2007-10-14 16:54:27 -07:00
|
|
|
}
|
2008-03-24 01:22:01 -07:00
|
|
|
|
2005-11-24 00:10:22 -08:00
|
|
|
if (!text) text = "";
|
|
|
|
if (!font) font = "";
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2004-08-30 01:07:00 -07:00
|
|
|
/* check if the font is embedded in the .eet */
|
2010-06-28 06:56:30 -07:00
|
|
|
if (ed->file->fonts)
|
2004-08-30 01:07:00 -07:00
|
|
|
{
|
2013-07-01 21:27:51 -07:00
|
|
|
Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->fonts, font);
|
2007-04-04 06:25:55 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
if (fnt)
|
|
|
|
{
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len = strlen(font) + sizeof("edje/fonts/") + 1;
|
2010-10-11 00:24:46 -07:00
|
|
|
font2 = alloca(len);
|
2010-10-11 00:31:12 -07:00
|
|
|
sprintf(font2, "edje/fonts/%s", font);
|
2010-10-11 00:24:46 -07:00
|
|
|
font = font2;
|
2013-07-01 21:27:51 -07:00
|
|
|
inlined_font = 1;
|
2011-08-18 03:59:34 -07:00
|
|
|
font2 = NULL;
|
2013-07-01 21:27:51 -07:00
|
|
|
}
|
2004-08-30 01:07:00 -07:00
|
|
|
}
|
2005-03-20 08:49:10 -08:00
|
|
|
|
|
|
|
if ((_edje_fontset_append) && (font))
|
|
|
|
{
|
2013-07-01 21:27:51 -07:00
|
|
|
font2 = malloc(strlen(font) + 1 + strlen(_edje_fontset_append) + 1);
|
|
|
|
if (font2)
|
|
|
|
{
|
|
|
|
strcpy(font2, font);
|
|
|
|
strcat(font2, ",");
|
|
|
|
strcat(font2, _edje_fontset_append);
|
|
|
|
font = font2;
|
|
|
|
}
|
2005-03-20 08:49:10 -08:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2014-05-12 19:24:43 -07:00
|
|
|
sw = TO_INT(params->eval.w);
|
|
|
|
sh = TO_INT(params->eval.h);
|
2009-02-05 10:15:34 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_text(params);
|
|
|
|
if (params->type.text->size)
|
|
|
|
size = params->type.text->size;
|
2011-08-30 08:21:44 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((text == ep->typedata.text->cache.in_str)
|
|
|
|
|| (text && ep->typedata.text->cache.in_str && !strcmp(ep->typedata.text->cache.in_str, text)))
|
2011-08-30 08:21:44 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
text = ep->typedata.text->cache.in_str;
|
2011-08-30 08:21:44 -07:00
|
|
|
same_text = EINA_TRUE;
|
|
|
|
}
|
2009-02-05 10:15:34 -08:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->typedata.text->cache.in_size == size) &&
|
|
|
|
(ep->typedata.text->cache.in_w == sw) &&
|
|
|
|
(ep->typedata.text->cache.in_h == sh) &&
|
|
|
|
(ep->typedata.text->cache.in_str) &&
|
2011-08-30 08:21:44 -07:00
|
|
|
same_text &&
|
2016-12-20 16:01:01 -08:00
|
|
|
(EQ(ep->typedata.text->cache.align_x, params->type.text->align.x)) &&
|
|
|
|
(EQ(ep->typedata.text->cache.align_y, params->type.text->align.y)) &&
|
|
|
|
(EQ(ep->typedata.text->cache.ellipsis, params->type.text->ellipsis)) &&
|
2012-09-11 06:14:51 -07:00
|
|
|
(ep->typedata.text->cache.fit_x == chosen_desc->text.fit_x) &&
|
2014-03-17 03:10:22 -07:00
|
|
|
(ep->typedata.text->cache.fit_y == chosen_desc->text.fit_y) &&
|
|
|
|
(ep->typedata.text->cache.in_font == font))
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2013-07-01 21:27:51 -07:00
|
|
|
text = ep->typedata.text->cache.out_str;
|
|
|
|
size = ep->typedata.text->cache.out_size;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
goto arrange_text;
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
2011-08-30 08:21:44 -07:00
|
|
|
if (!same_text)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
eina_stringshare_replace(&ep->typedata.text->cache.in_str, text);
|
2011-08-30 08:21:44 -07:00
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.text->cache.in_size = size;
|
|
|
|
if (chosen_desc->text.fit_x && (ep->typedata.text->cache.in_str && eina_stringshare_strlen(ep->typedata.text->cache.in_str) > 0))
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2018-02-12 13:02:06 -08:00
|
|
|
if (inlined_font) efl_text_font_source_set(ep->object, ed->path);
|
|
|
|
else efl_text_font_source_set(ep->object, NULL);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_text_set(ep->object, text);
|
2016-06-22 23:10:07 -07:00
|
|
|
/* the fit shoult not depend on font size, because it give the differet
|
|
|
|
* size calculation. As base font size for calculate fit size I take
|
|
|
|
* 10 (ten), because this value used for calculate fit by Y below */
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, 10);
|
2016-06-22 23:10:07 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2016-06-22 23:10:07 -07:00
|
|
|
size = (10 * sw) / tw;
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
2016-06-22 23:10:07 -07:00
|
|
|
while ((tw > sw) && (size > 1))
|
2011-02-27 10:09:00 -08:00
|
|
|
{
|
2016-06-22 23:10:07 -07:00
|
|
|
size--;
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2011-02-27 10:09:00 -08:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
2013-07-01 21:27:51 -07:00
|
|
|
}
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
if (chosen_desc->text.fit_y && (ep->typedata.text->cache.in_str && eina_stringshare_strlen(ep->typedata.text->cache.in_str) > 0))
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2013-07-01 21:27:51 -07:00
|
|
|
/* if we fit in the x axis, too, size already has a somewhat
|
|
|
|
* meaningful value, so don't overwrite it with the starting
|
|
|
|
* value in that case
|
|
|
|
*/
|
|
|
|
if (!chosen_desc->text.fit_x) size = sh;
|
2005-03-20 14:16:24 -08:00
|
|
|
|
2018-02-12 13:02:06 -08:00
|
|
|
if (inlined_font) efl_text_font_source_set(ep->object, ed->path);
|
|
|
|
else efl_text_font_source_set(ep->object, NULL);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_text_set(ep->object, text);
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
|
|
|
|
|
|
|
/* only grow the font size if we didn't already reach the max size
|
|
|
|
* for the x axis
|
|
|
|
*/
|
|
|
|
if (!chosen_desc->text.fit_x && th < sh)
|
|
|
|
{
|
|
|
|
int dif;
|
|
|
|
|
|
|
|
dif = (th - sh) / 4;
|
|
|
|
if (dif < 1) dif = 1;
|
|
|
|
while ((th < sh) && (sw > 0))
|
|
|
|
{
|
|
|
|
size += dif;
|
|
|
|
if (size <= 0) break;
|
|
|
|
|
2018-02-12 13:02:06 -08:00
|
|
|
if (inlined_font) efl_text_font_source_set(ep->object, ed->path);
|
|
|
|
else efl_text_font_source_set(ep->object, NULL);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
|
|
|
if ((size > 0) && (th == 0)) break;
|
|
|
|
}
|
|
|
|
size -= dif;
|
|
|
|
}
|
|
|
|
else if (th > sh)
|
|
|
|
{
|
|
|
|
int current;
|
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, 10);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
|
|
|
|
|
|
|
if (th == sh)
|
|
|
|
current = 10;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int bottom, top;
|
|
|
|
|
|
|
|
if (th < sh) bottom = 10;
|
2015-06-08 11:43:00 -07:00
|
|
|
else if (th > sh)
|
|
|
|
bottom = 1;
|
|
|
|
else bottom = 0; /* XXX shut up GCC, th == sh is handled before! */
|
2013-07-01 21:27:51 -07:00
|
|
|
|
|
|
|
top = size;
|
|
|
|
/* search one that fits (binary search) */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
current = (top + bottom) / 2;
|
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, current);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (th < sh) bottom = current + 1;
|
|
|
|
else if (th > sh)
|
|
|
|
top = current - 1;
|
2013-07-01 21:27:51 -07:00
|
|
|
} while ((bottom < top) && (th != sh));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* search the larger one that fits (linear search) */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
current++;
|
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, current);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2013-07-01 21:27:51 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
|
|
|
} while (th <= sh);
|
|
|
|
size = current - 1;
|
|
|
|
}
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
2004-10-30 08:51:55 -07:00
|
|
|
|
2011-02-27 10:09:03 -08:00
|
|
|
/* Make sure the size is in range */
|
|
|
|
if (size < 1)
|
2013-07-01 21:27:51 -07:00
|
|
|
size = 1;
|
2011-02-27 10:09:03 -08:00
|
|
|
else if ((size > chosen_desc->text.size_range_max) &&
|
|
|
|
(chosen_desc->text.size_range_max > 0))
|
2013-07-01 21:27:51 -07:00
|
|
|
size = chosen_desc->text.size_range_max;
|
2011-02-27 10:09:03 -08:00
|
|
|
else if (size < chosen_desc->text.size_range_min)
|
2013-07-01 21:27:51 -07:00
|
|
|
size = chosen_desc->text.size_range_min;
|
2011-02-27 10:09:03 -08:00
|
|
|
|
|
|
|
/* Handle ellipsis */
|
2011-08-20 16:47:46 -07:00
|
|
|
if (!chosen_desc->text.min_x)
|
2003-07-07 00:55:18 -07:00
|
|
|
{
|
2018-02-12 13:02:06 -08:00
|
|
|
if (inlined_font) efl_text_font_source_set(ep->object, ed->path);
|
|
|
|
else efl_text_font_source_set(ep->object, NULL);
|
2004-10-30 08:51:55 -07:00
|
|
|
|
2015-06-09 00:04:26 -07:00
|
|
|
text = _edje_text_fit_x(ed, ep, params, chosen_desc,
|
|
|
|
text, font, size,
|
|
|
|
sw, sh, &free_text);
|
|
|
|
}
|
2016-07-11 18:20:03 -07:00
|
|
|
else if ((ed->file->version >= 3) && (ed->file->minor >= 6))
|
|
|
|
{
|
|
|
|
evas_object_text_ellipsis_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.text->ellipsis);
|
2016-07-11 18:20:03 -07:00
|
|
|
}
|
2015-06-09 00:04:26 -07:00
|
|
|
|
|
|
|
eina_stringshare_replace(&ep->typedata.text->cache.out_str, text);
|
|
|
|
ep->typedata.text->cache.in_w = sw;
|
|
|
|
ep->typedata.text->cache.in_h = sh;
|
|
|
|
ep->typedata.text->cache.in_font = font;
|
|
|
|
ep->typedata.text->cache.out_size = size;
|
2016-08-14 06:30:32 -07:00
|
|
|
ep->typedata.text->cache.align_x = params->type.text->align.x;
|
|
|
|
ep->typedata.text->cache.align_y = params->type.text->align.y;
|
|
|
|
ep->typedata.text->cache.ellipsis = params->type.text->ellipsis;
|
2015-06-09 00:04:26 -07:00
|
|
|
ep->typedata.text->cache.fit_x = chosen_desc->text.fit_x;
|
|
|
|
ep->typedata.text->cache.fit_y = chosen_desc->text.fit_y;
|
2013-07-01 21:27:51 -07:00
|
|
|
arrange_text:
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2018-02-12 13:02:06 -08:00
|
|
|
if (inlined_font) efl_text_font_source_set(ep->object, ed->path);
|
|
|
|
else efl_text_font_source_set(ep->object, NULL);
|
2014-07-07 04:43:42 -07:00
|
|
|
|
2017-11-30 18:51:56 -08:00
|
|
|
if (ep->part->scale) efl_gfx_scale_set(ep->object, TO_DOUBLE(sc));
|
2014-02-05 02:40:24 -08:00
|
|
|
|
2018-02-12 13:02:06 -08:00
|
|
|
efl_text_font_set(ep->object, font, size);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_text_set(ep->object, text);
|
2015-06-09 00:04:26 -07:00
|
|
|
part_get_geometry(ep, &tw, &th);
|
2013-07-01 08:04:27 -07:00
|
|
|
|
2015-06-09 00:04:26 -07:00
|
|
|
/* Handle alignment */
|
|
|
|
{
|
|
|
|
FLOAT_T align_x;
|
2016-08-14 06:30:32 -07:00
|
|
|
if (params->type.text->align.x < FROM_INT(0))
|
2015-06-09 00:04:26 -07:00
|
|
|
{
|
|
|
|
if (evas_object_text_direction_get(ep->object) ==
|
|
|
|
EVAS_BIDI_DIRECTION_RTL)
|
|
|
|
{
|
|
|
|
align_x = FROM_INT(1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
align_x = FROM_INT(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
align_x = params->type.text->align.x;
|
2015-06-09 00:04:26 -07:00
|
|
|
}
|
|
|
|
ep->typedata.text->offset.x = TO_INT(SCALE(align_x, (sw - tw)));
|
2016-08-14 06:30:32 -07:00
|
|
|
ep->typedata.text->offset.y = TO_INT(SCALE(params->type.text->align.y, (sh - th)));
|
2015-06-09 00:04:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!calc_only)
|
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
Eina_Position2D pos;
|
|
|
|
pos.x = ed->x + TO_INT(params->eval.x) + ep->typedata.text->offset.x;
|
|
|
|
pos.y = ed->y + TO_INT(params->eval.y) + ep->typedata.text->offset.y;
|
|
|
|
efl_gfx_position_set(ep->object, pos);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_visible_set(ep->object, params->visible);
|
2015-06-09 00:04:26 -07:00
|
|
|
}
|
2013-07-01 21:27:51 -07:00
|
|
|
|
2015-06-09 00:04:26 -07:00
|
|
|
{
|
|
|
|
Evas_Text_Style_Type style;
|
|
|
|
Edje_Text_Effect effect;
|
|
|
|
|
|
|
|
style = EVAS_TEXT_STYLE_PLAIN;
|
|
|
|
|
|
|
|
evas_object_color_set(ep->object,
|
|
|
|
(params->color.r * params->color.a) / 255,
|
|
|
|
(params->color.g * params->color.a) / 255,
|
|
|
|
(params->color.b * params->color.a) / 255,
|
|
|
|
params->color.a);
|
|
|
|
effect = ep->part->effect;
|
|
|
|
switch (effect & EDJE_TEXT_EFFECT_MASK_BASIC)
|
|
|
|
{
|
|
|
|
case EDJE_TEXT_EFFECT_NONE:
|
|
|
|
case EDJE_TEXT_EFFECT_PLAIN:
|
|
|
|
style = EVAS_TEXT_STYLE_PLAIN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_OUTLINE:
|
|
|
|
style = EVAS_TEXT_STYLE_OUTLINE;
|
|
|
|
evas_object_text_outline_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color2.r * params->type.text->color2.a) / 255,
|
|
|
|
(params->type.text->color2.g * params->type.text->color2.a) / 255,
|
|
|
|
(params->type.text->color2.b * params->type.text->color2.a) / 255,
|
|
|
|
params->type.text->color2.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SOFT_OUTLINE:
|
|
|
|
style = EVAS_TEXT_STYLE_SOFT_OUTLINE;
|
|
|
|
evas_object_text_outline_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color2.r * params->type.text->color2.a) / 255,
|
|
|
|
(params->type.text->color2.g * params->type.text->color2.a) / 255,
|
|
|
|
(params->type.text->color2.b * params->type.text->color2.a) / 255,
|
|
|
|
params->type.text->color2.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_SHADOW;
|
|
|
|
evas_object_text_shadow_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color3.r * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.g * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.b * params->type.text->color3.a) / 255,
|
|
|
|
params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SOFT_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_SOFT_SHADOW;
|
|
|
|
evas_object_text_shadow_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color3.r * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.g * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.b * params->type.text->color3.a) / 255,
|
|
|
|
params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_OUTLINE_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_OUTLINE_SHADOW;
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_obj_text_outline_color_set(ep->object, (params->type.text->color2.r * params->type.text->color2.a) / 255, (params->type.text->color2.g * params->type.text->color2.a) / 255, (params->type.text->color2.b * params->type.text->color2.a) / 255, params->type.text->color2.a);
|
|
|
|
evas_obj_text_shadow_color_set(ep->object, (params->type.text->color3.r * params->type.text->color3.a) / 255, (params->type.text->color3.g * params->type.text->color3.a) / 255, (params->type.text->color3.b * params->type.text->color3.a) / 255, params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW;
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_obj_text_outline_color_set(ep->object, (params->type.text->color2.r * params->type.text->color2.a) / 255, (params->type.text->color2.g * params->type.text->color2.a) / 255, (params->type.text->color2.b * params->type.text->color2.a) / 255, params->type.text->color2.a);
|
|
|
|
evas_obj_text_shadow_color_set(ep->object, (params->type.text->color3.r * params->type.text->color3.a) / 255, (params->type.text->color3.g * params->type.text->color3.a) / 255, (params->type.text->color3.b * params->type.text->color3.a) / 255, params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_FAR_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_FAR_SHADOW;
|
|
|
|
evas_object_text_shadow_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color3.r * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.g * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.b * params->type.text->color3.a) / 255,
|
|
|
|
params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW:
|
|
|
|
style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW;
|
|
|
|
evas_object_text_shadow_color_set(ep->object,
|
2016-08-14 06:30:32 -07:00
|
|
|
(params->type.text->color3.r * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.g * params->type.text->color3.a) / 255,
|
|
|
|
(params->type.text->color3.b * params->type.text->color3.a) / 255,
|
|
|
|
params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_GLOW:
|
|
|
|
style = EVAS_TEXT_STYLE_GLOW;
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_obj_text_glow_color_set(ep->object, (params->type.text->color2.r * params->type.text->color2.a) / 255, (params->type.text->color2.g * params->type.text->color2.a) / 255, (params->type.text->color2.b * params->type.text->color2.a) / 255, params->type.text->color2.a);
|
|
|
|
evas_obj_text_glow2_color_set(ep->object, (params->type.text->color3.r * params->type.text->color3.a) / 255, (params->type.text->color3.g * params->type.text->color3.a) / 255, (params->type.text->color3.b * params->type.text->color3.a) / 255, params->type.text->color3.a);
|
2015-06-09 00:04:26 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
style = EVAS_TEXT_STYLE_PLAIN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION)
|
|
|
|
{
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT:
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET
|
|
|
|
(style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
evas_object_text_style_set(ep->object, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (free_text) free((char *)text);
|
|
|
|
if (font2) free(font2);
|
|
|
|
if (sfont) free(sfont);
|
|
|
|
}
|
2007-05-03 16:15:09 -07:00
|
|
|
|
2015-06-09 00:04:26 -07:00
|
|
|
Evas_Font_Size
|
|
|
|
_edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class * tc)
|
|
|
|
{
|
|
|
|
int val;
|
2007-05-03 16:15:09 -07:00
|
|
|
|
2015-06-09 00:04:26 -07:00
|
|
|
if (tc->size == 0)
|
|
|
|
{
|
|
|
|
val = size;
|
|
|
|
}
|
|
|
|
else if (tc->size > 0.0)
|
|
|
|
{
|
|
|
|
val = tc->size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = (size * -tc->size) / 100;
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|