diff --git a/src/lib/efl/interfaces/efl_text_format.eo b/src/lib/efl/interfaces/efl_text_format.eo index 0ec06a91d4..5e14893f06 100644 --- a/src/lib/efl/interfaces/efl_text_format.eo +++ b/src/lib/efl/interfaces/efl_text_format.eo @@ -14,7 +14,8 @@ enum Efl.Text.Format.Horizontal_Alignment_Type { locale, [[Respects locale's langauge settings]] left, [[Text is placed at the left end of the line]] right, [[Text is placed at the right end of the line]] - center [[Text is places at the center of the line]] + center, [[Text is places at the center of the line]] + end [[Text is places at opposite side of LTR/RTL (bidirectional) settings]] } enum Efl.Text.Format.Vertical_Alignment_Type { diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 44006d2860..ea0a4ffb69 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -425,7 +425,8 @@ typedef enum _Evas_Textblock_Align_Auto { EVAS_TEXTBLOCK_ALIGN_AUTO_NONE, EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL, - EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE + EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE, + EVAS_TEXTBLOCK_ALIGN_AUTO_END } Evas_Textblock_Align_Auto; struct _Evas_Object_Textblock_Item @@ -1957,6 +1958,8 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch * @li "middle" - Alias for "center" * @li "left" - Puts the text at the left of the line * @li "right" - Puts the text at the right of the line + * @li "start" - Respects LTR/RTL settings. It is same with "auto" + * @li "end" - Puts the text at the opposite side of LTR/RTL settings * @li - A number between 0.0 and 1.0 where 0.0 represents * "left" and 1.0 represents "right" * @li % - A percentage between 0% and 100% where 0% @@ -1965,11 +1968,16 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch * align= * @endcode */ - if (len == 4 && !strcmp(param, "auto")) + if ((len == 4 && !strcmp(param, "auto")) || + (len == 5 && !strcmp(param, "start"))) { fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL; } - if (len == 6 && !strcmp(param, "locale")) + else if (len == 3 && !strcmp(param, "end")) + { + fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_END; + } + else if (len == 6 && !strcmp(param, "locale")) { fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE; } @@ -3537,6 +3545,20 @@ _layout_line_align_get(Ctxt *c) return 0.0; } } + else if ((c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_END) && c->ln) + { + if (c->ln->items && c->ln->items->text_node && + (c->ln->par->direction == EVAS_BIDI_DIRECTION_RTL)) + { + /* Align left*/ + return 0.0; + } + else + { + /* Align right */ + return 1.0; + } + } else if (c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE) { if (evas_common_language_direction_get() == EVAS_BIDI_DIRECTION_RTL) @@ -15614,6 +15636,10 @@ _efl_canvas_text_efl_text_format_halign_set(Eo *obj, Efl_Canvas_Text_Data *o, Ef { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL); } + else if (type == EFL_TEXT_HORIZONTAL_ALIGNMENT_END) + { + _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_END); + } else if (type == EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE) { _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE); @@ -15645,6 +15671,10 @@ _efl_canvas_text_efl_text_format_halign_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text { ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_AUTO; } + else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_END) + { + ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_END; + } else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE) { ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE;