summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-10-26 11:40:44 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-10-26 11:40:44 +0900
commit9906cd211f805d971733f0815617256429f0304e (patch)
treedd351178ebb686ecd8396963a4234151281c4325 /src/lib/evas
parente474edc9f671419e433a0c52161149b89bee08c8 (diff)
evas textblocke: add align=end for putting a text at the opposite side of LTR/RTL
Summary: There is a requirement for putting text at right side for LTR and at left side for RTL. It satisfies that reqirement easily. It also add "start" keywork for "align" tag. "start" will be same with "auto". Intuitionally, developer will try "align=start" if they once saw "align=end" in elsewhere. On the other hand, it only add "END" as new enumeration value for efl interface. @feature Test Plan: N/A Reviewers: herdsman, cedric, jpeg, raster Reviewed By: raster Subscribers: woohyun Differential Revision: https://phab.enlightenment.org/D5342
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c36
1 files changed, 33 insertions, 3 deletions
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
425{ 425{
426 EVAS_TEXTBLOCK_ALIGN_AUTO_NONE, 426 EVAS_TEXTBLOCK_ALIGN_AUTO_NONE,
427 EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL, 427 EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL,
428 EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE 428 EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE,
429 EVAS_TEXTBLOCK_ALIGN_AUTO_END
429} Evas_Textblock_Align_Auto; 430} Evas_Textblock_Align_Auto;
430 431
431struct _Evas_Object_Textblock_Item 432struct _Evas_Object_Textblock_Item
@@ -1957,6 +1958,8 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
1957 * @li "middle" - Alias for "center" 1958 * @li "middle" - Alias for "center"
1958 * @li "left" - Puts the text at the left of the line 1959 * @li "left" - Puts the text at the left of the line
1959 * @li "right" - Puts the text at the right of the line 1960 * @li "right" - Puts the text at the right of the line
1961 * @li "start" - Respects LTR/RTL settings. It is same with "auto"
1962 * @li "end" - Puts the text at the opposite side of LTR/RTL settings
1960 * @li <number> - A number between 0.0 and 1.0 where 0.0 represents 1963 * @li <number> - A number between 0.0 and 1.0 where 0.0 represents
1961 * "left" and 1.0 represents "right" 1964 * "left" and 1.0 represents "right"
1962 * @li <number>% - A percentage between 0% and 100% where 0% 1965 * @li <number>% - 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
1965 * align=<value or preset> 1968 * align=<value or preset>
1966 * @endcode 1969 * @endcode
1967 */ 1970 */
1968 if (len == 4 && !strcmp(param, "auto")) 1971 if ((len == 4 && !strcmp(param, "auto")) ||
1972 (len == 5 && !strcmp(param, "start")))
1969 { 1973 {
1970 fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL; 1974 fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL;
1971 } 1975 }
1972 if (len == 6 && !strcmp(param, "locale")) 1976 else if (len == 3 && !strcmp(param, "end"))
1977 {
1978 fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_END;
1979 }
1980 else if (len == 6 && !strcmp(param, "locale"))
1973 { 1981 {
1974 fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE; 1982 fmt->halign_auto = EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE;
1975 } 1983 }
@@ -3537,6 +3545,20 @@ _layout_line_align_get(Ctxt *c)
3537 return 0.0; 3545 return 0.0;
3538 } 3546 }
3539 } 3547 }
3548 else if ((c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_END) && c->ln)
3549 {
3550 if (c->ln->items && c->ln->items->text_node &&
3551 (c->ln->par->direction == EVAS_BIDI_DIRECTION_RTL))
3552 {
3553 /* Align left*/
3554 return 0.0;
3555 }
3556 else
3557 {
3558 /* Align right */
3559 return 1.0;
3560 }
3561 }
3540 else if (c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE) 3562 else if (c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE)
3541 { 3563 {
3542 if (evas_common_language_direction_get() == EVAS_BIDI_DIRECTION_RTL) 3564 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
15614 { 15636 {
15615 _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL); 15637 _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL);
15616 } 15638 }
15639 else if (type == EFL_TEXT_HORIZONTAL_ALIGNMENT_END)
15640 {
15641 _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_END);
15642 }
15617 else if (type == EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE) 15643 else if (type == EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE)
15618 { 15644 {
15619 _FMT_SET(halign_auto, EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE); 15645 _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
15645 { 15671 {
15646 ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_AUTO; 15672 ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_AUTO;
15647 } 15673 }
15674 else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_END)
15675 {
15676 ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_END;
15677 }
15648 else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE) 15678 else if (_FMT(halign_auto) == EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE)
15649 { 15679 {
15650 ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE; 15680 ret = EFL_TEXT_HORIZONTAL_ALIGNMENT_LOCALE;