forked from enlightenment/efl
Merge branch 'master' into devs/hermet/lottie
This commit is contained in:
commit
8e79dd7e67
|
@ -21,7 +21,7 @@ if [ "$DISTRO" != "" ] ; then
|
|||
-Ddebug-threads=true -Dglib=true -Dg-mainloop=true -Dxpresent=true -Dxgesture=false -Dxinput22=true \
|
||||
-Devas-loaders-disabler=json -Decore-imf-loaders-disabler= -Demotion-loaders-disabler=gstreamer,libvlc,xine \
|
||||
-Demotion-generic-loaders-disabler=vlc -Dharfbuzz=true -Dpixman=true -Dhyphen=true \
|
||||
-Dvnc-server=true -Dbindings=luajit -Delogind=false -Dinstall-eo-files=true"
|
||||
-Dvnc-server=true -Dbindings=luajit -Delogind=false -Dinstall-eo-files=true -Dphysics=true"
|
||||
|
||||
# Enabled png, jpeg evas loader for in tree edje file builds
|
||||
DISABLED_LINUX_COPTS=" -Daudio=false -Davahi=false -Dx11=false -Dphysics=false -Deeze=false \
|
||||
|
|
|
@ -67,7 +67,8 @@ test_efl_ui_text_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
|||
|
||||
en = _create_label(win, bx);
|
||||
efl_text_markup_set(en, "You can also <b>ENTER</b> markup!");
|
||||
efl_text_font_set(en, "Sans", 14);
|
||||
efl_text_font_family_set(en, "Sans");
|
||||
efl_text_font_size_set(en, 14);
|
||||
efl_text_wrap_set(en, EFL_TEXT_FORMAT_WRAP_WORD);
|
||||
efl_text_multiline_set(en, EINA_TRUE);
|
||||
|
||||
|
@ -76,7 +77,8 @@ test_efl_ui_text_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
|||
"You can use the text -> markup helper\nto make coding easier.");
|
||||
efl_text_markup_set(en, markup);
|
||||
free(markup);
|
||||
efl_text_font_set(en, "Sans", 14);
|
||||
efl_text_font_family_set(en, "Sans");
|
||||
efl_text_font_size_set(en, 14);
|
||||
efl_text_wrap_set(en, EFL_TEXT_FORMAT_WRAP_WORD);
|
||||
efl_text_multiline_set(en, EINA_TRUE);
|
||||
|
||||
|
@ -85,7 +87,8 @@ test_efl_ui_text_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
|||
"You can use markup -> text helpers<ps>to make coding easier.");
|
||||
efl_text_set(en, markup);
|
||||
free(markup);
|
||||
efl_text_font_set(en, "Sans", 14);
|
||||
efl_text_font_family_set(en, "Sans");
|
||||
efl_text_font_size_set(en, 14);
|
||||
efl_text_wrap_set(en, EFL_TEXT_FORMAT_WRAP_WORD);
|
||||
efl_text_multiline_set(en, EINA_TRUE);
|
||||
}
|
||||
|
@ -161,7 +164,8 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
|||
efl_text_interactive_editable_set(en, EINA_TRUE);
|
||||
efl_ui_text_scrollable_set(en, EINA_TRUE);
|
||||
|
||||
efl_text_font_set(en, "Sans", 12);
|
||||
efl_text_font_family_set(en, "Sans");
|
||||
efl_text_font_size_set(en, 12);
|
||||
efl_text_font_width_set(en, EFL_TEXT_FONT_WIDTH_ULTRACONDENSED);
|
||||
efl_text_normal_color_set(en, 255, 255, 255, 255);
|
||||
|
||||
|
|
|
@ -294,11 +294,9 @@ _font_size_change(void *data, const Efl_Event *ev)
|
|||
{
|
||||
Eo *win = data;
|
||||
Eo *text;
|
||||
const char *font;
|
||||
|
||||
text = efl_key_wref_get(win, "text");
|
||||
efl_text_font_get(text, &font, NULL);
|
||||
efl_text_font_set(text, font, elm_spinner_value_get(ev->object));
|
||||
efl_text_font_size_set(text, elm_spinner_value_get(ev->object));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -462,7 +460,8 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
|||
// Note: No TEXT object with EO APIs
|
||||
o = text = evas_object_text_add(evas_object_evas_get(win));
|
||||
efl_event_callback_add(o, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _text_resize, NULL);
|
||||
efl_text_font_set(o, "Sans:style=Bold", default_font_size);
|
||||
efl_text_font_family_set(o, "Sans:style=Bold");
|
||||
efl_text_font_size_set(o, default_font_size);
|
||||
efl_gfx_entity_scale_set(text, elm_config_scale_get());
|
||||
efl_text_set(o, "EFL");
|
||||
efl_gfx_entity_visible_set(o, 1);
|
||||
|
|
|
@ -817,7 +817,8 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
efl_text_set(efl_added, "Clicking the image will play/pause animation."),
|
||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
||||
efl_gfx_hint_weight_set(efl_added, 1, 0),
|
||||
efl_text_font_set(efl_added, "Sans", 10),
|
||||
efl_text_font_family_set(efl_added, "Sans"),
|
||||
efl_text_font_size_set(efl_added, 10),
|
||||
efl_text_normal_color_set(efl_added, 255, 255, 255, 255),
|
||||
efl_pack(bx, efl_added)
|
||||
);
|
||||
|
|
|
@ -156,7 +156,7 @@ _setter_add(Eo *vbox, Eo *btn, Options option)
|
|||
efl_add(EFL_UI_TEXT_CLASS, hbox,
|
||||
efl_text_set(efl_added, text),
|
||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
||||
efl_text_valign_set(efl_added, 0.5),
|
||||
efl_text_vertical_align_set(efl_added, 0.5),
|
||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(40, 0)),
|
||||
efl_gfx_hint_weight_set(efl_added, 0, EFL_GFX_HINT_EXPAND),
|
||||
efl_pack(hbox, efl_added));
|
||||
|
@ -210,14 +210,14 @@ _button_frame_add(Eo *box, Eo *btn)
|
|||
efl_add(EFL_UI_TEXT_CLASS, hbox,
|
||||
efl_text_set(efl_added, "to"),
|
||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
||||
efl_text_halign_set(efl_added, 0.5),
|
||||
efl_text_horizontal_align_set(efl_added, 0.5),
|
||||
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(60, 0)),
|
||||
efl_gfx_hint_weight_set(efl_added, 0, EFL_GFX_HINT_EXPAND),
|
||||
efl_pack(hbox, efl_added));
|
||||
|
||||
efl_add(EFL_UI_TEXT_CLASS, hbox,
|
||||
efl_text_set(efl_added, "relative"),
|
||||
efl_text_halign_set(efl_added, 0.5),
|
||||
efl_text_horizontal_align_set(efl_added, 0.5),
|
||||
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
||||
efl_pack(hbox, efl_added));
|
||||
|
||||
|
|
|
@ -135,7 +135,8 @@ efl_main(void *data EINA_UNUSED,
|
|||
efl_text_markup_set(efl_part(layout, "text"), "This is an example text. This is a layout text part.");
|
||||
efl_text_wrap_set(efl_part(layout, "text"), wraps[wrap_itr].wrap);
|
||||
efl_text_normal_color_set(efl_part(layout, "text"), 255, 255, 0, 255);
|
||||
efl_text_font_set(efl_part(layout, "text"), "Serif", 12);
|
||||
efl_text_font_family_set(efl_part(layout, "text"), "Serif");
|
||||
efl_text_font_size_set(efl_part(layout, "text"), 12);
|
||||
|
||||
efl_canvas_layout_part_text_expand_set(efl_part(layout, "text"),
|
||||
expands[expand_itr].expand);
|
||||
|
|
|
@ -154,7 +154,7 @@ elm_main(int argc EINA_UNUSED, char **argv)
|
|||
|
||||
txt = efl_add(EFL_UI_TEXT_CLASS, ibox);
|
||||
efl_gfx_hint_weight_set(txt, 0.95, EFL_GFX_HINT_EXPAND);
|
||||
efl_text_halign_set(txt, 0.2);
|
||||
efl_text_horizontal_align_set(txt, 0.2);
|
||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||
snprintf(buf, sizeof(buf), "placeholder style item [%d]", i);
|
||||
efl_text_set(txt, buf);
|
||||
|
@ -232,7 +232,7 @@ elm_main(int argc EINA_UNUSED, char **argv)
|
|||
/*select mode */
|
||||
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
||||
efl_gfx_hint_weight_set(txt, EFL_GFX_HINT_EXPAND, 0.01);
|
||||
efl_text_halign_set(txt, 0.02);
|
||||
efl_text_horizontal_align_set(txt, 0.02);
|
||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||
efl_text_set(txt, "Select Mode");
|
||||
efl_pack_end(wbox, txt);
|
||||
|
@ -260,7 +260,7 @@ elm_main(int argc EINA_UNUSED, char **argv)
|
|||
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
|
||||
efl_gfx_hint_weight_set(txt, EFL_GFX_HINT_EXPAND, 0.01);
|
||||
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
||||
efl_text_halign_set(txt, 0.02);
|
||||
efl_text_horizontal_align_set(txt, 0.02);
|
||||
efl_text_set(txt, "Item Scroll");
|
||||
efl_pack_end(wbox, txt);
|
||||
|
||||
|
|
|
@ -42,6 +42,32 @@ static Ecore_Win32_Key_Mask _ecore_win32_key_mask = 0;
|
|||
static Eina_Bool _ecore_win32_ctrl_fake = EINA_FALSE;
|
||||
static Eina_Bool _ecore_win32_clipboard_has_data = EINA_FALSE;
|
||||
|
||||
static char *
|
||||
_ecore_win32_utf16_to_utf8(const wchar_t *text)
|
||||
{
|
||||
char *res;
|
||||
int size;
|
||||
|
||||
/* text is used as an array, hence never NULL */
|
||||
|
||||
size = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL);
|
||||
if (size == 0)
|
||||
return NULL;
|
||||
|
||||
res = (char *)malloc(size * sizeof(char));
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
||||
size = WideCharToMultiByte(CP_UTF8, 0, text, -1, res, size, NULL, NULL);
|
||||
if (size == 0)
|
||||
{
|
||||
free(res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_ecore_win32_modifiers_get(void)
|
||||
{
|
||||
|
@ -1176,15 +1202,14 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
if (res == -1)
|
||||
{
|
||||
/* dead key, but managed like normal key */
|
||||
compose = _ecore_win32_utf16_to_utf8(buf);
|
||||
}
|
||||
else if (res == 0)
|
||||
{
|
||||
INF("No translatable character found, skipping");
|
||||
if (msg->window_param >= 0x30 && msg->window_param <= 0x39)
|
||||
{
|
||||
buf[0] = msg->window_param;
|
||||
}
|
||||
else return NULL;
|
||||
compose = _ecore_win32_utf16_to_utf8(buf);
|
||||
/* otherwise, compose is NULL */
|
||||
}
|
||||
else if (res >= 2)
|
||||
{
|
||||
|
@ -1196,12 +1221,12 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
res = ToUnicode(msg->window_param,
|
||||
MapVirtualKey(msg->window_param, MAPVK_VK_TO_CHAR),
|
||||
kbd_state, buf, 4, 0);
|
||||
if ((res != 1) && (res != -1))
|
||||
return NULL;
|
||||
if (!((res != 1) && (res != -1)))
|
||||
compose = _ecore_win32_utf16_to_utf8(buf);
|
||||
/* otherwise, compose is NULL */
|
||||
}
|
||||
|
||||
string[0] = (char)buf[0];
|
||||
compose = string;
|
||||
else /* res == 1 : 1 char written to buf */
|
||||
compose = _ecore_win32_utf16_to_utf8(buf);
|
||||
|
||||
/*** key field ***/
|
||||
|
||||
|
@ -1232,7 +1257,6 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
{
|
||||
buf[0] = msg->window_param;
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
else if (res >= 2)
|
||||
{
|
||||
|
@ -1303,7 +1327,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
{
|
||||
buf[0] = msg->window_param;
|
||||
}
|
||||
else return NULL;
|
||||
else buf[0] = 0;// return NULL;
|
||||
}
|
||||
else if (res >= 2)
|
||||
{
|
||||
|
@ -1353,7 +1377,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key) +
|
||||
strlen(keyname) + 1 +
|
||||
strlen(key) + 1 +
|
||||
(compose ? (strlen(compose) + 1) : 0));
|
||||
(compose ? strlen(compose) : 0) + 1);
|
||||
if (!e)
|
||||
return NULL;
|
||||
|
||||
|
@ -1366,7 +1390,12 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
|
|||
|
||||
memcpy((char *)e->keyname, keyname, strlen(keyname));
|
||||
memcpy((char *)e->key, key, strlen(key));
|
||||
if (compose) memcpy((char *)e->compose, compose, strlen(compose));
|
||||
if (compose)
|
||||
{
|
||||
memcpy((char *)e->compose, compose, strlen(compose));
|
||||
free(compose);
|
||||
}
|
||||
|
||||
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ _efl_canvas_layout_part_text_efl_text_format_ellipsis_get(const Eo *obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_set(Eo *obj,
|
||||
void *_pd EINA_UNUSED, const char *font, Efl_Font_Size size)
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_family_set(Eo *obj,
|
||||
void *_pd EINA_UNUSED, const char *font)
|
||||
{
|
||||
Edje_User_Defined *eud;
|
||||
|
||||
|
@ -161,17 +161,43 @@ _efl_canvas_layout_part_text_efl_text_font_font_set(Eo *obj,
|
|||
eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
|
||||
|
||||
eud->u.text_style.types |= EDJE_PART_TEXT_PROP_FONT;
|
||||
efl_text_font_set(pd->rp->object, font, size);
|
||||
efl_text_font_family_set(pd->rp->object, font);
|
||||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_family_get(const Eo *obj,
|
||||
void *_pd EINA_UNUSED)
|
||||
{
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return NULL;
|
||||
|
||||
return efl_text_font_family_get(pd->rp->object);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_get(const Eo *obj,
|
||||
void *_pd EINA_UNUSED, const char **font, Efl_Font_Size *size)
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_size_set(Eo *obj,
|
||||
void *_pd EINA_UNUSED, Efl_Font_Size size)
|
||||
{
|
||||
Edje_User_Defined *eud;
|
||||
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
|
||||
|
||||
efl_text_font_get(pd->rp->object, font, size);
|
||||
|
||||
eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
|
||||
|
||||
eud->u.text_style.types |= EDJE_PART_TEXT_PROP_FONT;
|
||||
efl_text_font_size_set(pd->rp->object, size);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Font_Size
|
||||
_efl_canvas_layout_part_text_efl_text_font_font_size_get(const Eo *obj,
|
||||
void *_pd EINA_UNUSED)
|
||||
{
|
||||
PROXY_DATA_GET(obj, pd);
|
||||
if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return 0;
|
||||
|
||||
return efl_text_font_size_get(pd->rp->object);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -372,8 +398,8 @@ _canvas_layout_user_text_collect(Edje *ed, Edje_User_Defined *eud)
|
|||
Edje_Part_Text_Prop *prop;
|
||||
|
||||
prop = _prop_new(props, EDJE_PART_TEXT_PROP_FONT);
|
||||
efl_text_font_get(rp->object, &prop->val.font.font,
|
||||
&prop->val.font.size);
|
||||
prop->val.font.font = efl_text_font_family_get(rp->object);
|
||||
prop->val.font.size = efl_text_font_size_get(rp->object);
|
||||
}
|
||||
|
||||
if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_SHADOW_DIRECTION)
|
||||
|
@ -484,9 +510,11 @@ _canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj,
|
|||
break;
|
||||
|
||||
case EDJE_PART_TEXT_PROP_FONT:
|
||||
efl_text_font_set(efl_part(obj,
|
||||
efl_text_font_family_set(efl_part(obj,
|
||||
eud->part),
|
||||
prop->val.font.font);
|
||||
efl_text_font_size_set(efl_part(obj,
|
||||
eud->part),
|
||||
prop->val.font.font,
|
||||
prop->val.font.size);
|
||||
break;
|
||||
|
||||
|
|
|
@ -141,7 +141,8 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
|
|||
if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
|
||||
evas_obj_text_ellipsis_set(ep->object, params->type.text->ellipsis);
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
efl_text_set(ep->object, text);
|
||||
efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(sw, sh));
|
||||
|
||||
|
@ -342,16 +343,19 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
/* 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 */
|
||||
efl_text_font_set(ep->object, font, 10);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, 10);
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
|
||||
size = (10 * sw) / tw;
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
while ((tw > sw) && (size > 1))
|
||||
{
|
||||
size--;
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +372,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
efl_text_set(ep->object, text);
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
|
||||
|
@ -390,7 +395,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
else efl_text_font_source_set(ep->object, NULL);
|
||||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
if ((size > 0) && (th == 0)) break;
|
||||
|
@ -402,7 +408,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
int current;
|
||||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
efl_text_font_set(ep->object, font, 10);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, 10);
|
||||
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
|
||||
|
@ -424,7 +431,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
current = (top + bottom) / 2;
|
||||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
efl_text_font_set(ep->object, font, current);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, current);
|
||||
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
|
||||
|
@ -440,7 +448,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
|||
current++;
|
||||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
efl_text_font_set(ep->object, font, current);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, current);
|
||||
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
} while (th <= sh);
|
||||
|
@ -490,7 +499,8 @@ arrange_text:
|
|||
|
||||
if (ep->part->scale) efl_gfx_entity_scale_set(ep->object, TO_DOUBLE(sc));
|
||||
|
||||
efl_text_font_set(ep->object, font, size);
|
||||
efl_text_font_family_set(ep->object, font);
|
||||
efl_text_font_size_set(ep->object, size);
|
||||
efl_text_set(ep->object, text);
|
||||
part_get_geometry(ep, &tw, &th);
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style
|
|||
Efl.Text_Markup.markup { get; set; }
|
||||
Efl.Text_Format.ellipsis { set; get; }
|
||||
Efl.Text_Format.wrap { set; get; }
|
||||
Efl.Text_Font.font { set; get; }
|
||||
Efl.Text_Font.font_family { set; get; }
|
||||
Efl.Text_Font.font_size { set; get; }
|
||||
Efl.Text_Style.normal_color { set; get; }
|
||||
Efl.Text_Style.backing_type { set; get; }
|
||||
Efl.Text_Style.backing_color { set; get;}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// src/lib/efl/interfaces/efl_text_font.eo
|
||||
import efl_gfx_types;
|
||||
enum @beta Efl.Text_Font_Weight {
|
||||
[[Type of font weight]]
|
||||
|
@ -52,21 +51,18 @@ interface @beta Efl.Text_Font {
|
|||
]]
|
||||
c_prefix: efl_text;
|
||||
methods {
|
||||
@property font {
|
||||
[[The font family, filename and size for a given text object.
|
||||
@property font_family {
|
||||
[[The font family, filename for a given text object.
|
||||
|
||||
This property controls the font name and size of a text object.
|
||||
This property controls the font name of a text object.
|
||||
The font string has to follow fontconfig's convention for
|
||||
naming fonts, as it's the underlying library used to query system
|
||||
fonts by Evas (see the fc-list command's output, on your system,
|
||||
to get an idea). Alternatively, youe can use the full path to a font
|
||||
fonts by EFL (see the $[fc-list] command's output, on your system,
|
||||
to get an idea). Alternatively, you can use the full path to a font
|
||||
file.
|
||||
|
||||
To skip changing font family pass null as font family.
|
||||
To skip changing font size pass 0 as font size.
|
||||
|
||||
When reading it, the font name string is still owned by
|
||||
Evas and should not be freed.
|
||||
EFL and should not be freed.
|
||||
See also @.font_source.
|
||||
]]
|
||||
set {
|
||||
|
@ -75,9 +71,21 @@ interface @beta Efl.Text_Font {
|
|||
}
|
||||
values {
|
||||
font: string; [[The font family name or filename.]]
|
||||
}
|
||||
}
|
||||
|
||||
@property font_size {
|
||||
[[The font size for a given text object.
|
||||
|
||||
This property controls the font size of a text object.
|
||||
]]
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
size: Efl.Font.Size; [[The font size, in points.]]
|
||||
}
|
||||
}
|
||||
|
||||
@property font_source {
|
||||
[[The font (source) file to be used on a given text object.
|
||||
|
||||
|
@ -85,7 +93,7 @@ interface @beta Efl.Text_Font {
|
|||
given text object, overriding system lookup, which will first
|
||||
occur in the given file's contents.
|
||||
|
||||
See also @.font.
|
||||
See also @.font_family.
|
||||
]]
|
||||
set {
|
||||
}
|
||||
|
|
|
@ -45,21 +45,21 @@ interface @beta Efl.Text_Format {
|
|||
}
|
||||
}
|
||||
|
||||
@property halign_auto_type {
|
||||
@property horizontal_align_auto_type {
|
||||
[[Horizontal alignment of text]]
|
||||
values {
|
||||
value: Efl.Text_Format_Horizontal_Alignment_Auto_Type; [[Alignment type]]
|
||||
}
|
||||
}
|
||||
|
||||
@property halign {
|
||||
@property horizontal_align {
|
||||
[[Horizontal alignment of text]]
|
||||
values {
|
||||
value: double; [[Horizontal alignment value]]
|
||||
}
|
||||
}
|
||||
|
||||
@property valign {
|
||||
@property vertical_align {
|
||||
[[Vertical alignment of text]]
|
||||
values {
|
||||
value: double; [[Vertical alignment value]]
|
||||
|
|
|
@ -2088,7 +2088,8 @@ _update_text_theme(Eo *obj, Efl_Ui_Text_Data *sd)
|
|||
font_name = edje_object_data_get(wd->resize_obj, "font.name");
|
||||
font_size = edje_object_data_get(wd->resize_obj, "font.size");
|
||||
font_size_n = font_size ? atoi(font_size) : 0;
|
||||
efl_text_font_set(sd->text_obj, font_name, font_size_n);
|
||||
efl_text_font_family_set(sd->text_obj, font_name);
|
||||
efl_text_font_size_set(sd->text_obj, font_size_n);
|
||||
|
||||
// color
|
||||
if (disabled)
|
||||
|
@ -2104,7 +2105,8 @@ _update_text_theme(Eo *obj, Efl_Ui_Text_Data *sd)
|
|||
font_name = edje_object_data_get(wd->resize_obj, "guide.font.name");
|
||||
font_size = edje_object_data_get(wd->resize_obj, "guide.font.size");
|
||||
font_size_n = font_size ? atoi(font_size) : 0;
|
||||
efl_text_font_set(sd->text_guide_obj, font_name, font_size_n);
|
||||
efl_text_font_family_set(sd->text_guide_obj, font_name);
|
||||
efl_text_font_size_set(sd->text_guide_obj, font_size_n);
|
||||
|
||||
colorcode = NULL;
|
||||
// color
|
||||
|
|
|
@ -5,40 +5,44 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
Efl.Text_Style, Efl.Text_Format,
|
||||
Efl.Text_Markup, Efl.Ui.I18n
|
||||
{
|
||||
[[Efl canvas text class]]
|
||||
[[This is the Canvas-level text class. This class only takes care of rendering text,
|
||||
if you need user interaction consider the classes in $Efl.Ui.]]
|
||||
methods {
|
||||
@property is_empty {
|
||||
[[Whether the object is empty (no text) or not
|
||||
[[Whether the object is empty (no text) or not.
|
||||
]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
is_empty: bool; [[$true if empty, $false otherwise]]
|
||||
is_empty: bool; [[$true if empty.]]
|
||||
}
|
||||
}
|
||||
cursor_add {
|
||||
[[Add cursor that will manipulate and iterate content of the text object
|
||||
It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create.]]
|
||||
[[Adds an existing cursor to the text object.
|
||||
If the cursor already belonged to another text object it will be reassigned to the new one.
|
||||
It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create.
|
||||
]]
|
||||
params {
|
||||
cursor: Efl.Text.Cursor; [[Text cursor.]]
|
||||
cursor: Efl.Text.Cursor; [[The text cursor to use.]]
|
||||
}
|
||||
}
|
||||
cursor_create {
|
||||
[[ Create new cursor and add it to text object
|
||||
[[Creates a new cursor and adds it to the text object.
|
||||
This cursor can be used to manipulate and iterate the content of the text object.
|
||||
]]
|
||||
return: Efl.Text.Cursor @move; [[Text cursor.]]
|
||||
return: Efl.Text.Cursor @move; [[The created text cursor.]]
|
||||
}
|
||||
visible_range_get {
|
||||
[[Returns the currently visible range.
|
||||
|
||||
The given $start and $end cursor act like out-variables here,
|
||||
as they are set to the positions of the start and the end of the
|
||||
The given $start and $end cursors are output variables:
|
||||
they are set to the positions of the start and the end of the
|
||||
visible range in the text, respectively.
|
||||
]]
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
return: bool; [[$true on success.]]
|
||||
params {
|
||||
@in start: Efl.Text.Cursor; [[Range start position]]
|
||||
@in end: Efl.Text.Cursor; [[Range end position]]
|
||||
@in start: Efl.Text.Cursor; [[Range start position.]]
|
||||
@in end: Efl.Text.Cursor; [[Range end position.]]
|
||||
}
|
||||
}
|
||||
@property style_insets {
|
||||
|
@ -48,92 +52,97 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
]]
|
||||
get {}
|
||||
values {
|
||||
l: int; [[Left padding]]
|
||||
r: int; [[Right padding]]
|
||||
t: int; [[Top padding]]
|
||||
b: int; [[Bottom padding]]
|
||||
l: int; [[Left padding.]]
|
||||
r: int; [[Right padding.]]
|
||||
t: int; [[Top padding.]]
|
||||
b: int; [[Bottom padding.]]
|
||||
}
|
||||
}
|
||||
@property bidi_delimiters {
|
||||
[[BiDi delimiters are used for in-paragraph separation of bidi
|
||||
[[BiDi delimiters are used for in-paragraph separation of bidirectional
|
||||
segments. This is useful, for example, in the recipient fields of
|
||||
e-mail clients where bidi oddities can occur when mixing RTL
|
||||
and LTR.
|
||||
e-mail clients where bidi oddities can occur when mixing RTL (right-to-left)
|
||||
and LTR (left-to-right) text.
|
||||
]]
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
delim: string; [[A null terminated string of delimiters, e.g ",|" or $null if empty]]
|
||||
delim: string; [[A null terminated string of delimiters, e.g ",|" or $null if empty.]]
|
||||
}
|
||||
}
|
||||
@property newline_as_paragraph_separator {
|
||||
[[When $true, newline character will behave as a paragraph separator.
|
||||
[[When $true, the newline character will behave as a paragraph separator.
|
||||
]]
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
mode: bool; [[$true for legacy mode, $false otherwise]]
|
||||
mode: bool; [[$true for legacy mode, $false otherwise.]]
|
||||
}
|
||||
}
|
||||
style_apply {
|
||||
[[apply the style for this object, sent style member will override old ones, other styles will not be affected.
|
||||
similar to setting style using functions (for example font_slant_set, wrap_set).]]
|
||||
[[Applies a style to the text object. Applied style attributes override old ones, leaving other attributes
|
||||
unaffected.
|
||||
This is similar to setting individual style attributes using properties like @Efl.Text_Font.font_slant or
|
||||
@Efl.Text_Format.wrap.]]
|
||||
params {
|
||||
@in style: string; [[A whitespace-separated list of $[property=value] pairs, for example, $[font=sans size=30].]]
|
||||
@in style: string; [[A whitespace-separated list of $[property=value] pairs, for example,
|
||||
$[font=sans size=30].]]
|
||||
}
|
||||
}
|
||||
@property all_styles {
|
||||
[[Get all styles belong to this object as string (default styles plus styles
|
||||
from style_apply or style functions (for example font_slant_set, wrap_set).]]
|
||||
[[A string representing the complete set of styles applied to this text object.
|
||||
This includes the default attributes plus any additional style applied with @.style_apply
|
||||
or individual style properties like @Efl.Text_Font.font_slant or @Efl.Text_Format.wrap.]]
|
||||
get {}
|
||||
values {
|
||||
style: string; [[All styles, should not be freed.]]
|
||||
style: string; [[A whitespace-separated list of $[property=value] pairs, for example,
|
||||
$[font=sans size=30]. Do not free.]]
|
||||
}
|
||||
}
|
||||
@property size_formatted {
|
||||
[[The formatted width and height.
|
||||
[[The formatted width and height of this text block.
|
||||
|
||||
This calculates the actual size after restricting the
|
||||
textblock to the current size of the object.
|
||||
text block to the current size of the object.
|
||||
|
||||
The main difference between this and @.size_native.get
|
||||
is that the "native" function does not wrapping into account
|
||||
it just calculates the real width of the object if it was
|
||||
placed on an infinite canvas, while this function gives the
|
||||
size after wrapping according to the size restrictions of the
|
||||
The main difference between this and @.size_native
|
||||
is that the "native" function does not take wrapping into account:
|
||||
it just calculates the real width of the object as if it was
|
||||
placed on an infinite canvas, while @.size_formatted gives the
|
||||
size after wrapping text according to the size restrictions of the
|
||||
object.
|
||||
|
||||
For example for a textblock containing the text:
|
||||
For example a text block containing the text:
|
||||
"You shall not pass!" with no margins or padding and assuming
|
||||
a monospace font and a size of 7x10 char widths (for simplicity)
|
||||
has a native size of 19x1 and a formatted size of 5x4.
|
||||
]]
|
||||
get {}
|
||||
values {
|
||||
size: Eina.Size2D; [[The size of the object]]
|
||||
size: Eina.Size2D; [[The formatted size of the object (after wrapping).]]
|
||||
}
|
||||
}
|
||||
@property size_native {
|
||||
[[The native width and height.
|
||||
[[The native width and height of this text block.
|
||||
|
||||
This calculates the actual size without taking account the
|
||||
current size of the object.
|
||||
|
||||
The main difference between this and @.size_formatted.get
|
||||
is that the "native" function does not take wrapping into
|
||||
account it just calculates the real width of the object if
|
||||
it was placed on an infinite canvas, while the "formatted"
|
||||
function gives the size after wrapping text according to
|
||||
the size restrictions of the object.
|
||||
The main difference between this and @.size_formatted
|
||||
is that the "native" function does not take wrapping into account:
|
||||
it just calculates the real width of the object as if it was
|
||||
placed on an infinite canvas, while @.size_formatted gives the
|
||||
size after wrapping text according to the size restrictions of the
|
||||
object.
|
||||
|
||||
For example for a textblock containing the text:
|
||||
For example a text block containing the text:
|
||||
"You shall not pass!" with no margins or padding and assuming
|
||||
a monospace font and a size of 7x10 char widths (for simplicity)
|
||||
has a native size of 19x1 and a formatted size of 5x4.
|
||||
]]
|
||||
get {}
|
||||
values {
|
||||
size: Eina.Size2D; [[The size of the object]]
|
||||
size: Eina.Size2D; [[The native size of the object (without wrapping).]]
|
||||
}
|
||||
}
|
||||
// Obstacles
|
||||
|
@ -145,17 +154,17 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
position of the obstacle.
|
||||
]]
|
||||
params {
|
||||
@in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
|
||||
@in eo_obs: Efl.Canvas.Object; [[Obstacle object.]]
|
||||
}
|
||||
return: bool; [[$true on success, $false otherwise.]]
|
||||
return: bool; [[$true on success.]]
|
||||
}
|
||||
obstacle_del {
|
||||
[[Removes $eo_obs from observation during text layout.
|
||||
]]
|
||||
params {
|
||||
@in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
|
||||
@in eo_obs: Efl.Canvas.Object; [[Obstacle object.]]
|
||||
}
|
||||
return: bool; [[$true on success, $false otherwise.]]
|
||||
return: bool; [[$true on success.]]
|
||||
}
|
||||
obstacles_update {
|
||||
[[Triggers for relayout due to obstacles' state change.
|
||||
|
@ -166,7 +175,7 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
layout.
|
||||
|
||||
For example: if you have just repositioned the obstacles to
|
||||
differrent coordinates relative to the textblock, you need to
|
||||
different coordinates relative to the text block, you need to
|
||||
call this so it will consider this new state and will relayout
|
||||
the text.
|
||||
]]
|
||||
|
@ -175,9 +184,9 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
[[Requests to layout the text off the mainloop.
|
||||
|
||||
Once layout is complete, the result is returned as @Eina.Rect,
|
||||
with w, h fields set.
|
||||
with the $w and $h fields set.
|
||||
]]
|
||||
return: future<Eina.Rect>; [[Future for layout result]]
|
||||
return: future<Eina.Rect>; [[Future for layout result.]]
|
||||
}
|
||||
}
|
||||
implements {
|
||||
|
@ -191,7 +200,8 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
Efl.Canvas.Filter.Internal.filter_dirty;
|
||||
Efl.Canvas.Filter.Internal.filter_input_render;
|
||||
Efl.Canvas.Filter.Internal.filter_state_prepare;
|
||||
Efl.Text_Font.font { get; set; }
|
||||
Efl.Text_Font.font_family { get; set; }
|
||||
Efl.Text_Font.font_size { get; set; }
|
||||
Efl.Text_Font.font_source { get; set; }
|
||||
Efl.Text_Font.font_fallbacks { get; set; }
|
||||
Efl.Text_Font.font_lang { get; set; }
|
||||
|
@ -221,9 +231,9 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
|
|||
Efl.Text_Format.ellipsis { get; set; }
|
||||
Efl.Text_Format.wrap { get; set; }
|
||||
Efl.Text_Format.multiline { get; set; }
|
||||
Efl.Text_Format.halign { get; set; }
|
||||
Efl.Text_Format.halign_auto_type { get; set; }
|
||||
Efl.Text_Format.valign { get; set; }
|
||||
Efl.Text_Format.horizontal_align { get; set; }
|
||||
Efl.Text_Format.horizontal_align_auto_type { get; set; }
|
||||
Efl.Text_Format.vertical_align { get; set; }
|
||||
Efl.Text_Format.linegap { get; set; }
|
||||
Efl.Text_Format.linerelgap { get; set; }
|
||||
Efl.Text_Format.tabstops { get; set; }
|
||||
|
|
|
@ -450,52 +450,64 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_text_efl_text_font_font_set(Eo *eo_obj, Evas_Text_Data *o, const char *font, Evas_Font_Size size)
|
||||
_evas_text_efl_text_font_font_family_set(Eo *eo_obj, Evas_Text_Data *o, const char *font)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Font_Description *fdesc;
|
||||
|
||||
if (!font && size <= 0) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(font);
|
||||
|
||||
evas_object_async_block(obj);
|
||||
if ((size == o->cur.size) &&
|
||||
(o->cur.font && font && !strcmp(font, o->cur.font))) return;
|
||||
if (eina_streq(font, o->cur.font)) return;
|
||||
|
||||
if (font)
|
||||
/* We can't assume the given font is same with current fdesc by comparing string.
|
||||
Since Evas starts to supporting "auto" for language,
|
||||
the given font string should be parsed once before comparing it. */
|
||||
fdesc = evas_font_desc_new();
|
||||
|
||||
/* Set default language according to locale. */
|
||||
eina_stringshare_replace(&(fdesc->lang), evas_font_lang_normalize("auto"));
|
||||
evas_font_name_parse(fdesc, font);
|
||||
|
||||
if (o->cur.fdesc && !evas_font_desc_cmp(fdesc, o->cur.fdesc))
|
||||
{
|
||||
/* We can't assume the given font is same with current fdesc by comparing string.
|
||||
Since Evas starts to supporting "auto" for language,
|
||||
the given font string should be parsed once before comparing it. */
|
||||
fdesc = evas_font_desc_new();
|
||||
|
||||
/* Set default language according to locale. */
|
||||
eina_stringshare_replace(&(fdesc->lang), evas_font_lang_normalize("auto"));
|
||||
evas_font_name_parse(fdesc, font);
|
||||
|
||||
if (o->cur.fdesc && !evas_font_desc_cmp(fdesc, o->cur.fdesc) &&
|
||||
(size == o->cur.size))
|
||||
{
|
||||
evas_font_desc_unref(fdesc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (o->cur.fdesc) evas_font_desc_unref(o->cur.fdesc);
|
||||
o->cur.fdesc = fdesc;
|
||||
eina_stringshare_replace(&o->cur.font, font);
|
||||
o->prev.font = NULL;
|
||||
evas_font_desc_unref(fdesc);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( size > 0 )
|
||||
o->cur.size = size;
|
||||
if (o->cur.fdesc) evas_font_desc_unref(o->cur.fdesc);
|
||||
o->cur.fdesc = fdesc;
|
||||
eina_stringshare_replace(&o->cur.font, font);
|
||||
o->prev.font = NULL;
|
||||
|
||||
_evas_text_font_reload(eo_obj, o);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_text_efl_text_font_font_get(const Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o, const char **font, Evas_Font_Size *size)
|
||||
EOLIAN static const char *
|
||||
_evas_text_efl_text_font_font_family_get(const Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o)
|
||||
{
|
||||
if (font) *font = o->cur.font;
|
||||
if (size) *size = o->cur.size;
|
||||
return o->cur.font;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_text_efl_text_font_font_size_set(Eo *eo_obj, Evas_Text_Data *o, Evas_Font_Size size)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
|
||||
EINA_SAFETY_ON_TRUE_RETURN(size <= 0);
|
||||
if (size == o->cur.size) return;
|
||||
|
||||
evas_object_async_block(obj);
|
||||
|
||||
o->cur.size = size;
|
||||
|
||||
_evas_text_font_reload(eo_obj, o);
|
||||
}
|
||||
|
||||
EOLIAN static Evas_Font_Size
|
||||
_evas_text_efl_text_font_font_size_get(const Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o)
|
||||
{
|
||||
return o->cur.size;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1043,7 +1055,8 @@ _evas_text_efl_object_dbg_info_get(Eo *eo_obj, Evas_Text_Data *o EINA_UNUSED, Ef
|
|||
|
||||
const char *text;
|
||||
int size;
|
||||
efl_text_font_get(eo_obj, &text, &size);
|
||||
text = efl_text_font_family_get(eo_obj);
|
||||
size = efl_text_font_size_get(eo_obj);
|
||||
EFL_DBG_INFO_APPEND(group, "Font", EINA_VALUE_TYPE_STRING, text);
|
||||
EFL_DBG_INFO_APPEND(group, "Text size", EINA_VALUE_TYPE_INT, size);
|
||||
|
||||
|
@ -2200,6 +2213,8 @@ _evas_text_efl_gfx_entity_scale_set(Evas_Object *eo_obj, Evas_Text_Data *o,
|
|||
font = eina_stringshare_add(o->cur.font);
|
||||
size = o->cur.size;
|
||||
if (o->cur.font) eina_stringshare_del(o->cur.font);
|
||||
if (o->cur.fdesc) evas_font_desc_unref(o->cur.fdesc);
|
||||
o->cur.fdesc = NULL;
|
||||
o->cur.font = NULL;
|
||||
o->prev.font = NULL;
|
||||
o->cur.size = 0;
|
||||
|
@ -2336,14 +2351,19 @@ evas_object_text_font_source_get(const Eo *obj)
|
|||
EAPI void
|
||||
evas_object_text_font_set(Eo *obj, const char *font, Evas_Font_Size size)
|
||||
{
|
||||
if (!font || size <= 0) return; /*Condition for legacy object*/
|
||||
efl_text_font_set((Eo *) obj, font, size);
|
||||
/*Condition for legacy object*/
|
||||
EINA_SAFETY_ON_NULL_RETURN(font);
|
||||
EINA_SAFETY_ON_TRUE_RETURN(size <= 0);
|
||||
|
||||
efl_text_font_family_set((Eo *) obj, font);
|
||||
efl_text_font_size_set((Eo *) obj, size);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_text_font_get(const Eo *obj, const char **font, Evas_Font_Size *size)
|
||||
{
|
||||
efl_text_font_get((Eo *) obj, font, size);
|
||||
if (font) *font = efl_text_font_family_get((Eo *) obj);
|
||||
if (size) *size = efl_text_font_size_get((Eo *) obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -1401,6 +1401,87 @@ static const char *gfx_filterstr = NULL;
|
|||
* @brief This page describes how to style text in an Evas Text Block.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal
|
||||
* Split str using commas as separators. All characters from the beginning of the string up until
|
||||
* the first comma (excluded) are copied into part1.
|
||||
* All characters after the last comma (excluded) up until the end of str are copied into part2.
|
||||
* Any character in between part1 and part2 is ignored (as right now it's only valid to have 1 comma and 2 strings).
|
||||
* For example, if str="str1,str2,str3,str4",
|
||||
* part1 will contain "str1" and part2 will contain "str4".
|
||||
* part1 and part2 must be already allocated and contain enough space for any possible outcome
|
||||
* of the parsing. The safest bet is that they should be as big as str.
|
||||
*/
|
||||
void
|
||||
_style_string_split(const char *str, char* part1, char* part2)
|
||||
{
|
||||
char *temp = part1;
|
||||
for (const char *p = str; *p; p++)
|
||||
{
|
||||
if (*p == ',')
|
||||
{
|
||||
*temp = 0;
|
||||
temp = part2;
|
||||
continue;
|
||||
}
|
||||
*temp = *p;
|
||||
temp++;
|
||||
}
|
||||
*temp = 0;
|
||||
}
|
||||
|
||||
#define FORMAT_SHADOW_SET(evas, efl) {fmt->style = evas; if (set_default) _FMT_INFO(effect) = efl;}
|
||||
|
||||
void
|
||||
_format_shadow_set(Evas_Object_Textblock_Format *fmt, char *str, Eina_Bool set_default, Efl_Canvas_Text_Data *o)
|
||||
{
|
||||
if (!strcmp(str, "shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW)
|
||||
else if (!strcmp(str, "outline"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_OUTLINE, EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE)
|
||||
else if (!strcmp(str, "soft_outline"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_SOFT_OUTLINE, EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE)
|
||||
else if (!strcmp(str, "outline_shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_OUTLINE_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW)
|
||||
else if (!strcmp(str, "outline_soft_shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW)
|
||||
else if (!strcmp(str, "glow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_GLOW, EFL_TEXT_STYLE_EFFECT_TYPE_GLOW)
|
||||
else if (!strcmp(str, "far_shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_FAR_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW)
|
||||
else if (!strcmp(str, "soft_shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_SOFT_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW)
|
||||
else if (!strcmp(str, "far_soft_shadow"))
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_FAR_SOFT_SHADOW, EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW)
|
||||
else /*off none plain */
|
||||
FORMAT_SHADOW_SET(EVAS_TEXT_STYLE_PLAIN, EFL_TEXT_STYLE_EFFECT_TYPE_NONE)
|
||||
}
|
||||
|
||||
#define FORMAT_SHADOW_DIRECTION_SET(direction) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_##direction); if (set_default) _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_##direction;}
|
||||
|
||||
void
|
||||
_format_shadow_direction_set(Evas_Object_Textblock_Format *fmt, char *str, Eina_Bool set_default, Efl_Canvas_Text_Data *o)
|
||||
{
|
||||
if (!strcmp(str, "bottom_right"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(BOTTOM_RIGHT)
|
||||
else if (!strcmp(str, "bottom"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(BOTTOM)
|
||||
else if (!strcmp(str, "bottom_left"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(BOTTOM_LEFT)
|
||||
else if (!strcmp(str, "left"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(LEFT)
|
||||
else if (!strcmp(str, "top_left"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(TOP_LEFT)
|
||||
else if (!strcmp(str, "top"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(TOP)
|
||||
else if (!strcmp(str, "top_right"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(TOP_RIGHT)
|
||||
else if (!strcmp(str, "right"))
|
||||
FORMAT_SHADOW_DIRECTION_SET(RIGHT)
|
||||
else
|
||||
FORMAT_SHADOW_DIRECTION_SET(BOTTOM_RIGHT)
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Init the format strings.
|
||||
|
@ -2387,62 +2468,20 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
|
|||
* style=<appearance>,<position>
|
||||
* @endcode
|
||||
*/
|
||||
const char *p;
|
||||
char *p1, *p2, *pp;
|
||||
char *part1, *part2;
|
||||
|
||||
p2 = alloca(len + 1);
|
||||
*p2 = 0;
|
||||
/* no comma */
|
||||
if (!strstr(param, ",")) p1 = (char*) param;
|
||||
else
|
||||
{
|
||||
p1 = alloca(len + 1);
|
||||
*p1 = 0;
|
||||
part1 = alloca(len + 1);
|
||||
*part1 = 0;
|
||||
|
||||
/* split string "str1,str2" into p1 and p2 (if we have more than
|
||||
* 1 str2 eg "str1,str2,str3,str4" then we don't care. p2 just
|
||||
* ends up being the last one as right now it's only valid to have
|
||||
* 1 comma and 2 strings */
|
||||
pp = p1;
|
||||
for (p = param; *p; p++)
|
||||
{
|
||||
if (*p == ',')
|
||||
{
|
||||
*pp = 0;
|
||||
pp = p2;
|
||||
continue;
|
||||
}
|
||||
*pp = *p;
|
||||
pp++;
|
||||
}
|
||||
*pp = 0;
|
||||
}
|
||||
if (!strcmp(p1, "off")) fmt->style = EVAS_TEXT_STYLE_PLAIN;
|
||||
else if (!strcmp(p1, "none")) fmt->style = EVAS_TEXT_STYLE_PLAIN;
|
||||
else if (!strcmp(p1, "plain")) fmt->style = EVAS_TEXT_STYLE_PLAIN;
|
||||
else if (!strcmp(p1, "shadow")) fmt->style = EVAS_TEXT_STYLE_SHADOW;
|
||||
else if (!strcmp(p1, "outline")) fmt->style = EVAS_TEXT_STYLE_OUTLINE;
|
||||
else if (!strcmp(p1, "soft_outline")) fmt->style = EVAS_TEXT_STYLE_SOFT_OUTLINE;
|
||||
else if (!strcmp(p1, "outline_shadow")) fmt->style = EVAS_TEXT_STYLE_OUTLINE_SHADOW;
|
||||
else if (!strcmp(p1, "outline_soft_shadow")) fmt->style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW;
|
||||
else if (!strcmp(p1, "glow")) fmt->style = EVAS_TEXT_STYLE_GLOW;
|
||||
else if (!strcmp(p1, "far_shadow")) fmt->style = EVAS_TEXT_STYLE_FAR_SHADOW;
|
||||
else if (!strcmp(p1, "soft_shadow")) fmt->style = EVAS_TEXT_STYLE_SOFT_SHADOW;
|
||||
else if (!strcmp(p1, "far_soft_shadow")) fmt->style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW;
|
||||
else fmt->style = EVAS_TEXT_STYLE_PLAIN;
|
||||
part2 = alloca(len + 1);
|
||||
*part2 = 0;
|
||||
|
||||
if (*p2)
|
||||
{
|
||||
if (!strcmp(p2, "bottom_right")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT);
|
||||
else if (!strcmp(p2, "bottom")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM);
|
||||
else if (!strcmp(p2, "bottom_left")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT);
|
||||
else if (!strcmp(p2, "left")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT);
|
||||
else if (!strcmp(p2, "top_left")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT);
|
||||
else if (!strcmp(p2, "top")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP);
|
||||
else if (!strcmp(p2, "top_right")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT);
|
||||
else if (!strcmp(p2, "right")) EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT);
|
||||
else EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT);
|
||||
}
|
||||
_style_string_split(param, part1, part2);
|
||||
|
||||
_format_shadow_set(fmt, part1, EINA_FALSE, NULL);
|
||||
|
||||
if (*part2)
|
||||
_format_shadow_direction_set(fmt, part2, EINA_FALSE, NULL);
|
||||
}
|
||||
else if (cmd == tabstopsstr)
|
||||
{
|
||||
|
@ -2860,62 +2899,19 @@ _default_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt,
|
|||
}
|
||||
else if (cmd == stylestr)
|
||||
{
|
||||
const char *p;
|
||||
char *p1, *p2, *pp;
|
||||
char *part1, *part2;
|
||||
|
||||
p2 = alloca(len + 1);
|
||||
*p2 = 0;
|
||||
/* no comma */
|
||||
if (!strstr(param, ",")) p1 = (char*) param;
|
||||
else
|
||||
{
|
||||
p1 = alloca(len + 1);
|
||||
*p1 = 0;
|
||||
part1 = alloca(len + 1);
|
||||
*part1 = 0;
|
||||
|
||||
part2 = alloca(len + 1);
|
||||
*part2 = 0;
|
||||
|
||||
/* split string "str1,str2" into p1 and p2 (if we have more than
|
||||
* 1 str2 eg "str1,str2,str3,str4" then we don't care. p2 just
|
||||
* ends up being the last one as right now it's only valid to have
|
||||
* 1 comma and 2 strings */
|
||||
pp = p1;
|
||||
for (p = param; *p; p++)
|
||||
{
|
||||
if (*p == ',')
|
||||
{
|
||||
*pp = 0;
|
||||
pp = p2;
|
||||
continue;
|
||||
}
|
||||
*pp = *p;
|
||||
pp++;
|
||||
}
|
||||
*pp = 0;
|
||||
}
|
||||
_style_string_split(param, part1, part2);
|
||||
_format_shadow_set(fmt, part1, EINA_TRUE, o);
|
||||
|
||||
if (!strcmp(p1, "off")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
|
||||
else if (!strcmp(p1, "none")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
|
||||
else if (!strcmp(p1, "plain")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
|
||||
else if (!strcmp(p1, "shadow")) {fmt->style = EVAS_TEXT_STYLE_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW;}
|
||||
else if (!strcmp(p1, "outline")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE;}
|
||||
else if (!strcmp(p1, "soft_outline")) {fmt->style = EVAS_TEXT_STYLE_SOFT_OUTLINE; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE;}
|
||||
else if (!strcmp(p1, "outline_shadow")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW;}
|
||||
else if (!strcmp(p1, "outline_soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW;}
|
||||
else if (!strcmp(p1, "glow")) {fmt->style = EVAS_TEXT_STYLE_GLOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_GLOW;}
|
||||
else if (!strcmp(p1, "far_shadow")) {fmt->style = EVAS_TEXT_STYLE_FAR_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW;}
|
||||
else if (!strcmp(p1, "soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW;}
|
||||
else if (!strcmp(p1, "far_soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW;}
|
||||
else {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
|
||||
if (*p2)
|
||||
{
|
||||
if (!strcmp(p2, "bottom_right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;}
|
||||
else if (!strcmp(p2, "bottom")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM;}
|
||||
else if (!strcmp(p2, "bottom_left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT;}
|
||||
else if (!strcmp(p2, "left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT;}
|
||||
else if (!strcmp(p2, "top_left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT;}
|
||||
else if (!strcmp(p2, "top")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP;}
|
||||
else if (!strcmp(p2, "top_right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT;}
|
||||
else if (!strcmp(p2, "right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT;}
|
||||
else {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;}
|
||||
}
|
||||
if (*part2)
|
||||
_format_shadow_direction_set(fmt, part2, EINA_TRUE, o);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -15975,20 +15971,16 @@ _canvas_text_format_changed(Eo *eo_obj, Efl_Canvas_Text_Data *o)
|
|||
/* Efl.Text.Font interface implementation */
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_font_font_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font EINA_UNUSED, int size EINA_UNUSED)
|
||||
_efl_canvas_text_efl_text_font_font_family_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font)
|
||||
{
|
||||
ASYNC_BLOCK;
|
||||
Eina_Bool changed = EINA_FALSE;
|
||||
|
||||
Eina_Stringshare *nfont;
|
||||
|
||||
if (size > 0 && o->default_format.info.size != size)
|
||||
{
|
||||
o->default_format.info.size = size;
|
||||
changed = EINA_TRUE;
|
||||
}
|
||||
EINA_SAFETY_ON_NULL_RETURN(font);
|
||||
|
||||
if (font && o->default_format.info.font != font)
|
||||
if (_FMT_INFO(font) != font && !eina_streq(_FMT_INFO(font), font))
|
||||
{
|
||||
nfont = eina_stringshare_add(font);
|
||||
if (nfont == _FMT_INFO(font))
|
||||
|
@ -16010,11 +16002,28 @@ _efl_canvas_text_efl_text_font_font_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Dat
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_font_font_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char **font EINA_UNUSED, int *size EINA_UNUSED)
|
||||
static const char *
|
||||
_efl_canvas_text_efl_text_font_font_family_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
|
||||
{
|
||||
if (font) *font = o->default_format.info.font;
|
||||
if (size) *size = o->default_format.info.size;
|
||||
return o->default_format.info.font;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_font_font_size_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o, int size)
|
||||
{
|
||||
ASYNC_BLOCK;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(size > 0);
|
||||
if (o->default_format.info.size != size)
|
||||
{
|
||||
o->default_format.info.size = size;
|
||||
_canvas_text_format_changed(obj, o);
|
||||
}
|
||||
}
|
||||
|
||||
static Efl_Font_Size
|
||||
_efl_canvas_text_efl_text_font_font_size_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
|
||||
{
|
||||
return o->default_format.info.size;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -16587,7 +16596,7 @@ _efl_canvas_text_efl_text_format_multiline_get(const Eo *obj EINA_UNUSED, Efl_Ca
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_format_halign_auto_type_set(Eo *obj, Efl_Canvas_Text_Data *o, Efl_Text_Format_Horizontal_Alignment_Auto_Type type)
|
||||
_efl_canvas_text_efl_text_format_horizontal_align_auto_type_set(Eo *obj, Efl_Canvas_Text_Data *o, Efl_Text_Format_Horizontal_Alignment_Auto_Type type)
|
||||
{
|
||||
ASYNC_BLOCK;
|
||||
if (type == EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_NONE)
|
||||
|
@ -16609,7 +16618,7 @@ _efl_canvas_text_efl_text_format_halign_auto_type_set(Eo *obj, Efl_Canvas_Text_D
|
|||
}
|
||||
|
||||
static Efl_Text_Format_Horizontal_Alignment_Auto_Type
|
||||
_efl_canvas_text_efl_text_format_halign_auto_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
|
||||
_efl_canvas_text_efl_text_format_horizontal_align_auto_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
|
||||
{
|
||||
Efl_Text_Format_Horizontal_Alignment_Auto_Type ret =
|
||||
EFL_TEXT_FORMAT_HORIZONTAL_ALIGNMENT_AUTO_TYPE_NONE;
|
||||
|
@ -16630,7 +16639,7 @@ _efl_canvas_text_efl_text_format_halign_auto_type_get(const Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_format_halign_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
||||
_efl_canvas_text_efl_text_format_horizontal_align_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
||||
double value)
|
||||
{
|
||||
ASYNC_BLOCK;
|
||||
|
@ -16640,13 +16649,13 @@ _efl_canvas_text_efl_text_format_halign_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
|||
}
|
||||
|
||||
static double
|
||||
_efl_canvas_text_efl_text_format_halign_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
|
||||
_efl_canvas_text_efl_text_format_horizontal_align_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
|
||||
{
|
||||
return _FMT(halign);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_format_valign_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
||||
_efl_canvas_text_efl_text_format_vertical_align_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
||||
double value)
|
||||
{
|
||||
ASYNC_BLOCK;
|
||||
|
@ -16658,7 +16667,7 @@ _efl_canvas_text_efl_text_format_valign_set(Eo *obj, Efl_Canvas_Text_Data *o,
|
|||
}
|
||||
|
||||
static double
|
||||
_efl_canvas_text_efl_text_format_valign_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
|
||||
_efl_canvas_text_efl_text_format_vertical_align_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
|
||||
{
|
||||
return o->valign;
|
||||
}
|
||||
|
|
|
@ -1192,16 +1192,14 @@ _evas_textgrid_font_reload(Eo *eo_obj, Evas_Textgrid_Data *o)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_textgrid_efl_text_font_font_set(Eo *eo_obj,
|
||||
_evas_textgrid_efl_text_font_font_family_set(Eo *eo_obj,
|
||||
Evas_Textgrid_Data *o,
|
||||
const char *font_name,
|
||||
Evas_Font_Size font_size)
|
||||
const char *font_name)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Font_Description *fdesc;
|
||||
|
||||
if ((!font_name) || (!*font_name) || (font_size <= 0))
|
||||
return;
|
||||
EINA_SAFETY_ON_TRUE_RETURN((!font_name) || (!*font_name));
|
||||
|
||||
evas_object_async_block(obj);
|
||||
fdesc = evas_font_desc_new();
|
||||
|
@ -1210,8 +1208,7 @@ _evas_textgrid_efl_text_font_font_set(Eo *eo_obj,
|
|||
evas_font_lang_normalize("auto"));
|
||||
evas_font_name_parse(fdesc, font_name);
|
||||
if (o->cur.font_description_normal &&
|
||||
!evas_font_desc_cmp(fdesc, o->cur.font_description_normal) &&
|
||||
(font_size == o->cur.font_size))
|
||||
!evas_font_desc_cmp(fdesc, o->cur.font_description_normal))
|
||||
{
|
||||
evas_font_desc_unref(fdesc);
|
||||
return;
|
||||
|
@ -1221,7 +1218,6 @@ _evas_textgrid_efl_text_font_font_set(Eo *eo_obj,
|
|||
evas_font_desc_unref(o->cur.font_description_normal);
|
||||
o->cur.font_description_normal = fdesc;
|
||||
|
||||
o->cur.font_size = font_size;
|
||||
eina_stringshare_replace(&o->cur.font_name, font_name);
|
||||
o->prev.font_name = NULL;
|
||||
|
||||
|
@ -1229,9 +1225,28 @@ _evas_textgrid_efl_text_font_font_set(Eo *eo_obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_textgrid_efl_text_font_font_get(const Eo *eo_obj EINA_UNUSED, Evas_Textgrid_Data *o, const char **font_name, Evas_Font_Size *font_size)
|
||||
_evas_textgrid_efl_text_font_font_family_get(const Eo *eo_obj EINA_UNUSED, Evas_Textgrid_Data *o, const char **font_name)
|
||||
{
|
||||
if (font_name) *font_name = o->cur.font_name;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_textgrid_efl_text_font_font_size_set(Eo *eo_obj,
|
||||
Evas_Textgrid_Data *o,
|
||||
Evas_Font_Size font_size)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN(font_size <= 0);
|
||||
|
||||
if (font_size == o->cur.font_size) return;
|
||||
|
||||
o->cur.font_size = font_size;
|
||||
|
||||
_evas_textgrid_font_reload(eo_obj, o);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_textgrid_efl_text_font_font_size_get(const Eo *eo_obj EINA_UNUSED, Evas_Textgrid_Data *o, Evas_Font_Size *font_size)
|
||||
{
|
||||
if (font_size) *font_size = o->cur.font_size;
|
||||
}
|
||||
|
||||
|
@ -1442,7 +1457,8 @@ _evas_textgrid_efl_object_dbg_info_get(Eo *eo_obj, Evas_Textgrid_Data *o EINA_UN
|
|||
|
||||
const char *text;
|
||||
int size;
|
||||
efl_text_font_get(eo_obj, &text, &size);
|
||||
text = efl_text_font_family_get(eo_obj);
|
||||
size = efl_text_font_size_get(eo_obj);
|
||||
EFL_DBG_INFO_APPEND(group, "Font", EINA_VALUE_TYPE_STRING, text);
|
||||
EFL_DBG_INFO_APPEND(group, "Text size", EINA_VALUE_TYPE_INT, size);
|
||||
|
||||
|
@ -1475,13 +1491,15 @@ evas_object_textgrid_font_source_get(const Eo *obj)
|
|||
EAPI void
|
||||
evas_object_textgrid_font_set(Eo *obj, const char *font_name, Evas_Font_Size font_size)
|
||||
{
|
||||
efl_text_font_set((Eo *) obj, font_name, font_size);
|
||||
efl_text_font_family_set((Eo *) obj, font_name);
|
||||
efl_text_font_size_set((Eo *) obj, font_size);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_textgrid_font_get(const Eo *obj, const char **font_name, Evas_Font_Size *font_size)
|
||||
{
|
||||
efl_text_font_get((Eo *) obj, font_name, font_size);
|
||||
if (font_name) *font_name = efl_text_font_family_get((Eo *) obj);
|
||||
if (font_size) *font_size = efl_text_font_size_get((Eo *) obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
|
@ -252,8 +252,10 @@ _evas_text_class_initializer(Efl_Class *klass)
|
|||
EFL_OBJECT_OP_FUNC(efl_gfx_entity_scale_set, _evas_text_efl_gfx_entity_scale_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_set, _evas_text_efl_text_text_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_get, _evas_text_efl_text_text_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_set, _evas_text_efl_text_font_font_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_get, _evas_text_efl_text_font_font_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_family_set, _evas_text_efl_text_font_font_family_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_family_get, _evas_text_efl_text_font_font_family_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_size_set, _evas_text_efl_text_font_font_size_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_size_get, _evas_text_efl_text_font_font_size_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_source_set, _evas_text_efl_text_font_font_source_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_source_get, _evas_text_efl_text_font_font_source_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_bitmap_scalable_set, _evas_text_efl_text_font_font_bitmap_scalable_set),
|
||||
|
|
|
@ -45,10 +45,16 @@ Efl_Object *_evas_textgrid_efl_object_constructor(Eo *obj, Evas_Textgrid_Data *p
|
|||
void _evas_textgrid_efl_object_destructor(Eo *obj, Evas_Textgrid_Data *pd);
|
||||
|
||||
|
||||
void _evas_textgrid_efl_text_font_font_set(Eo *obj, Evas_Textgrid_Data *pd, const char *font, Efl_Font_Size size);
|
||||
void _evas_textgrid_efl_text_font_font_family_set(Eo *obj, Evas_Textgrid_Data *pd, const char *font);
|
||||
|
||||
|
||||
void _evas_textgrid_efl_text_font_font_get(const Eo *obj, Evas_Textgrid_Data *pd, const char **font, Efl_Font_Size *size);
|
||||
void _evas_textgrid_efl_text_font_font_family_get(const Eo *obj, Evas_Textgrid_Data *pd, const char **font);
|
||||
|
||||
|
||||
void _evas_textgrid_efl_text_font_font_size_set(Eo *obj, Evas_Textgrid_Data *pd, Efl_Font_Size size);
|
||||
|
||||
|
||||
void _evas_textgrid_efl_text_font_font_size_get(const Eo *obj, Evas_Textgrid_Data *pd, Efl_Font_Size *size);
|
||||
|
||||
|
||||
void _evas_textgrid_efl_text_font_font_source_set(Eo *obj, Evas_Textgrid_Data *pd, const char *font_source);
|
||||
|
@ -90,8 +96,10 @@ _evas_textgrid_class_initializer(Efl_Class *klass)
|
|||
EFL_OBJECT_OP_FUNC(evas_obj_textgrid_palette_get, _evas_textgrid_palette_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_constructor, _evas_textgrid_efl_object_constructor),
|
||||
EFL_OBJECT_OP_FUNC(efl_destructor, _evas_textgrid_efl_object_destructor),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_set, _evas_textgrid_efl_text_font_font_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_get, _evas_textgrid_efl_text_font_font_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_family_set, _evas_textgrid_efl_text_font_font_family_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_family_get, _evas_textgrid_efl_text_font_font_family_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_size_set, _evas_textgrid_efl_text_font_font_size_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_size_get, _evas_textgrid_efl_text_font_font_size_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_source_set, _evas_textgrid_efl_text_font_font_source_set),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_source_get, _evas_textgrid_efl_text_font_font_source_get),
|
||||
EFL_OBJECT_OP_FUNC(efl_text_font_bitmap_scalable_set, _evas_textgrid_efl_text_font_font_bitmap_scalable_set),
|
||||
|
|
|
@ -119,7 +119,7 @@ EOAPI void evas_obj_textgrid_grid_size_get(const Eo *obj, int *w, int *h);
|
|||
* the textgrid object. @c width and @c height can be @c null. On error, they
|
||||
* are set to 0.
|
||||
*
|
||||
* See also @ref efl_text_font_set and
|
||||
* See also @ref efl_text_font_size_set, @ref efl_text_font_family_set and
|
||||
* @ref evas_obj_textgrid_supported_font_styles_set
|
||||
*
|
||||
* @param[in] obj The object.
|
||||
|
|
|
@ -112,7 +112,7 @@ EAPI void evas_object_textgrid_size_get(const Evas_Textgrid *obj, int *w, int *h
|
|||
* the textgrid object. @c width and @c height can be @c null. On error, they
|
||||
* are set to 0.
|
||||
*
|
||||
* See also @ref Efl.Text_Font.font.set and
|
||||
* See also @ref efl_text_font_size_set, @ref efl_text_font_family_set and
|
||||
* @ref evas_object_textgrid_supported_font_styles_set
|
||||
*
|
||||
* @param[in] obj The object.
|
||||
|
|
|
@ -161,7 +161,8 @@ START_TEST(edje_test_text_font)
|
|||
efl_file_key_set(layout, "test");
|
||||
ck_assert(!efl_file_load(layout));
|
||||
|
||||
efl_text_font_set(efl_part(layout, "text"), "Sans", 14);
|
||||
efl_text_font_family_set(efl_part(layout, "text"), "Sans");
|
||||
efl_text_font_size_set(efl_part(layout, "text"), 14);
|
||||
|
||||
}
|
||||
END_TEST
|
||||
|
@ -288,7 +289,8 @@ _basic_check(Eo *layout, Eina_Bool set)
|
|||
{
|
||||
efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD);
|
||||
efl_text_ellipsis_set(efl_part(layout, "text"), 1.0);
|
||||
efl_text_font_set(efl_part(layout, "text"), "Sans", 12);
|
||||
efl_text_font_family_set(efl_part(layout, "text"), "Sans");
|
||||
efl_text_font_size_set(efl_part(layout, "text"), 12);
|
||||
}
|
||||
|
||||
wrap = efl_text_wrap_get(efl_part(layout, "text"));
|
||||
|
@ -297,7 +299,8 @@ _basic_check(Eo *layout, Eina_Bool set)
|
|||
ellipsis = efl_text_ellipsis_get(efl_part(layout, "text"));
|
||||
ck_assert(EINA_DBL_EQ(ellipsis, 1.0));
|
||||
|
||||
efl_text_font_get(efl_part(layout, "text"), &font, &size);
|
||||
font = efl_text_font_family_get(efl_part(layout, "text"));
|
||||
size = efl_text_font_size_get(efl_part(layout, "text"));
|
||||
ck_assert_str_eq(font, "Sans");
|
||||
ck_assert_int_eq(size, 12);
|
||||
}
|
||||
|
|
|
@ -4528,20 +4528,27 @@ EFL_START_TEST(efl_text_font)
|
|||
|
||||
const char * font;
|
||||
int font_size;
|
||||
efl_text_font_set(txt, "Sans", 20);
|
||||
efl_text_font_set(txt, NULL, 0);
|
||||
efl_text_font_family_set(txt, "Sans");
|
||||
efl_text_font_size_set(txt, 20);
|
||||
efl_text_font_family_set(txt, NULL);
|
||||
efl_text_font_size_set(txt, 0);
|
||||
|
||||
efl_text_font_get(txt, &font, &font_size);
|
||||
font = efl_text_font_family_get(txt);
|
||||
font_size = efl_text_font_size_get(txt);
|
||||
fail_if(20 != font_size);
|
||||
fail_if(strcmp(font,"Sans"));
|
||||
|
||||
efl_text_font_set(txt, NULL, 30);
|
||||
efl_text_font_get(txt, &font, &font_size);
|
||||
efl_text_font_family_set(txt, NULL);
|
||||
efl_text_font_size_set(txt, 30);
|
||||
font = efl_text_font_family_get(txt);
|
||||
font_size = efl_text_font_size_get(txt);
|
||||
fail_if(30 != font_size);
|
||||
fail_if(strcmp(font,"Sans"));
|
||||
|
||||
efl_text_font_set(txt, "arial", 0);
|
||||
efl_text_font_get(txt, &font, &font_size);
|
||||
efl_text_font_family_set(txt, "arial");
|
||||
efl_text_font_size_set(txt, 0);
|
||||
font = efl_text_font_family_get(txt);
|
||||
font_size = efl_text_font_size_get(txt);
|
||||
fail_if(30 != font_size);
|
||||
fail_if(strcmp(font,"arial"));
|
||||
|
||||
|
@ -4588,6 +4595,21 @@ EFL_START_TEST(efl_canvas_text_style)
|
|||
efl_canvas_text_style_apply(txt, "backing=on");
|
||||
ck_assert_int_eq(efl_text_backing_type_get(txt), EFL_TEXT_STYLE_BACKING_TYPE_ENABLED);
|
||||
|
||||
efl_canvas_text_style_apply(txt, "style=far_soft_shadow");
|
||||
ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW);
|
||||
|
||||
efl_canvas_text_style_apply(txt, "style=glow,top_right");
|
||||
ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_GLOW);
|
||||
ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT);
|
||||
|
||||
efl_canvas_text_style_apply(txt, "style=far_shadow,top");
|
||||
ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW);
|
||||
ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP);
|
||||
|
||||
efl_canvas_text_style_apply(txt, "style=soft_outline,top,bottom");
|
||||
ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE);
|
||||
ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM);
|
||||
|
||||
efl_canvas_text_style_apply(txt, "color=#EF596C");
|
||||
efl_text_normal_color_get(txt, &r, &g, &b, &a);
|
||||
ck_assert_int_eq(r, 0xEF);
|
||||
|
|
Loading…
Reference in New Issue