forked from enlightenment/efl
Evas text: Fixed bug with the text object direction detection.
This commit is contained in:
parent
8a818ad79d
commit
d6dababe78
|
@ -1,3 +1,8 @@
|
|||
2013-02-21 Tom Hacohen (TAsn)
|
||||
|
||||
* Evas text: Fixed bug with the text object direction detection.
|
||||
|
||||
size_range.
|
||||
2013-02-21 Carsten Haitzler (The Rasterman)
|
||||
|
||||
* Add ecore_x_dnd_self_begin() and ecore_x_dnd_self_drop() to
|
||||
|
|
1
NEWS
1
NEWS
|
@ -177,4 +177,5 @@ Fixes:
|
|||
* Evas: Fix Evas_Object_Text when LTR and RTL are used in the same paragraph.
|
||||
* Properly report file not found in Edje.
|
||||
* Fix ecore-x edid fetch to ftech 128, not 100 bytes.
|
||||
* Evas text: Fixed bug with the text object direction detection.
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ struct _Evas_Object_Text
|
|||
Evas_Object_Text_Item *ellipsis_end;
|
||||
} last_computed;
|
||||
|
||||
Evas_BiDi_Direction bidi_dir : 2;
|
||||
char changed : 1;
|
||||
};
|
||||
|
||||
|
@ -700,11 +701,20 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
|
|||
|
||||
if (o->items) _evas_object_text_items_clean(obj, o);
|
||||
|
||||
if (text && *text)
|
||||
o->bidi_dir = EVAS_BIDI_DIRECTION_LTR;
|
||||
else
|
||||
o->bidi_dir = EVAS_BIDI_DIRECTION_NEUTRAL;
|
||||
|
||||
#ifdef BIDI_SUPPORT
|
||||
if (o->bidi_delimiters)
|
||||
segment_idxs = evas_bidi_segment_idxs_get(text, o->bidi_delimiters);
|
||||
evas_bidi_paragraph_props_unref(o->bidi_par_props);
|
||||
o->bidi_par_props = evas_bidi_paragraph_props_get(text, len, segment_idxs);
|
||||
|
||||
if (o->bidi_par_props)
|
||||
o->bidi_dir = EVAS_BIDI_PAR_TYPE_TO_DIRECTION(o->bidi_par_props->direction);
|
||||
|
||||
evas_bidi_props_reorder_line(NULL, 0, len, o->bidi_par_props, &v_to_l);
|
||||
if (segment_idxs) free(segment_idxs);
|
||||
#endif
|
||||
|
@ -1098,7 +1108,7 @@ _text_direction_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
{
|
||||
Evas_BiDi_Direction *bidi_dir = va_arg(*list, Evas_BiDi_Direction *);
|
||||
const Evas_Object_Text *o = _pd;
|
||||
*bidi_dir = o->items ? o->items->text_props.bidi_dir : EVAS_BIDI_DIRECTION_NEUTRAL;
|
||||
*bidi_dir = o->bidi_dir;
|
||||
}
|
||||
|
||||
EAPI Evas_Coord
|
||||
|
|
|
@ -90,12 +90,36 @@ struct _Evas_BiDi_Props
|
|||
#define EVAS_BIDI_PARAGRAPH_WLTR FRIBIDI_PAR_WLTR
|
||||
#define EVAS_BIDI_PARAGRAPH_WRTL FRIBIDI_PAR_WRTL
|
||||
|
||||
#define EVAS_BIDI_PARAGRAPH_DIRECTION_IS_RTL(x) \
|
||||
(((x) && \
|
||||
((x->direction == EVAS_BIDI_PARAGRAPH_RTL) || \
|
||||
(x->direction == EVAS_BIDI_PARAGRAPH_WRTL))) ? \
|
||||
#define EVAS_BIDI_DIRECTION_IS_RTL(x) \
|
||||
((((x) == EVAS_BIDI_PARAGRAPH_RTL) || \
|
||||
((x) == EVAS_BIDI_PARAGRAPH_WRTL)) ? \
|
||||
EINA_TRUE : EINA_FALSE)
|
||||
|
||||
#define EVAS_BIDI_PARAGRAPH_DIRECTION_IS_RTL(x) \
|
||||
((x) && EVAS_BIDI_DIRECTION_IS_RTL((x)->direction))
|
||||
|
||||
#define EVAS_BIDI_PAR_TYPE_TO_DIRECTION(x) \
|
||||
_evas_bidi_par_type_to_direction(x)
|
||||
|
||||
static inline Evas_BiDi_Direction
|
||||
_evas_bidi_par_type_to_direction(EvasBiDiParType par_type)
|
||||
{
|
||||
switch (par_type)
|
||||
{
|
||||
case EVAS_BIDI_PARAGRAPH_LTR:
|
||||
case EVAS_BIDI_PARAGRAPH_WLTR:
|
||||
return EVAS_BIDI_DIRECTION_LTR;
|
||||
break;
|
||||
case EVAS_BIDI_PARAGRAPH_RTL:
|
||||
case EVAS_BIDI_PARAGRAPH_WRTL:
|
||||
return EVAS_BIDI_DIRECTION_RTL;
|
||||
break;
|
||||
case EVAS_BIDI_PARAGRAPH_NEUTRAL:
|
||||
default:
|
||||
return EVAS_BIDI_DIRECTION_NEUTRAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
# define evas_bidi_position_visual_to_logical(list, position) \
|
||||
(list) ? list[position] : position;
|
||||
|
|
|
@ -280,6 +280,14 @@ START_TEST(evas_text_set_get)
|
|||
evas_object_text_text_set(to, "");
|
||||
fail_if(evas_object_text_direction_get(to) != EVAS_BIDI_DIRECTION_NEUTRAL);
|
||||
|
||||
/* LTR paragraphs */
|
||||
evas_object_text_text_set(to, "Test נסיון");
|
||||
fail_if(evas_object_text_direction_get(to) != EVAS_BIDI_DIRECTION_LTR);
|
||||
|
||||
/* RTL paragraphs */
|
||||
evas_object_text_text_set(to, "נסיון test");
|
||||
fail_if(evas_object_text_direction_get(to) != EVAS_BIDI_DIRECTION_RTL);
|
||||
|
||||
END_TEXT_TEST();
|
||||
}
|
||||
END_TEST
|
||||
|
|
Loading…
Reference in New Issue