evas, edje: Apply align according to paragraph_direction
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 12 Jan 2018 02:48:24 +0000 (11:48 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Fri, 12 Jan 2018 02:49:28 +0000 (11:49 +0900)
It is a patch to keep backward compat with Tizen 2.4.
This feature should be replaced by align=locale feature.
Please, check the following upstream patch.
https://phab.enlightenment.org/D4664

@tizen_feature

Change-Id: I847ee5bae6d35afe29321fdeeb186f60b746fd18

src/lib/edje/edje_text.c
src/lib/evas/canvas/evas_object_textblock.c

index 562bd56..72bffcc 100644 (file)
@@ -505,6 +505,7 @@ arrange_text:
       FLOAT_T align_x;
       if (params->type.text->align.x < FROM_INT(0))
         {
+           /* TIZEN_ONLY(20170216): Apply align according to paragraph_direction
            if (evas_object_text_direction_get(ep->object) ==
                EVAS_BIDI_DIRECTION_RTL)
              {
@@ -514,6 +515,29 @@ arrange_text:
              {
                 align_x = FROM_INT(0);
              }
+            */
+           if (evas_object_paragraph_direction_get(ep->object) == EVAS_BIDI_DIRECTION_LTR)
+             {
+                align_x = FROM_INT(0);
+             }
+           else if ((evas_object_paragraph_direction_get(ep->object) == EVAS_BIDI_DIRECTION_RTL) ||
+                    (evas_object_paragraph_direction_get(ep->object) == EVAS_BIDI_DIRECTION_ANY_RTL))
+             {
+                align_x = FROM_INT(1);
+             }
+           else
+             {
+                if (evas_object_text_direction_get(ep->object) ==
+                    EVAS_BIDI_DIRECTION_RTL)
+                  {
+                     align_x = FROM_INT(1);
+                  }
+                else
+                  {
+                     align_x = FROM_INT(0);
+                  }
+             }
+           /* END */
         }
       else
         {
index 94bcaf2..29a67e5 100644 (file)
@@ -3608,6 +3608,14 @@ _layout_line_align_get(Ctxt *c)
 #ifdef BIDI_SUPPORT
    if ((c->align_auto == EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL) && c->ln)
      {
+        /* TIZEN_ONLY(20170216): Apply align according to paragraph_direction */
+        if (c->o->paragraph_direction == EVAS_BIDI_DIRECTION_LTR)
+          return 0.0;
+        else if ((c->o->paragraph_direction == EVAS_BIDI_DIRECTION_RTL) ||
+                 (c->o->paragraph_direction == EVAS_BIDI_DIRECTION_ANY_RTL))
+          return 1.0;
+        /* END */
+
         if (c->ln->items && c->ln->items->text_node &&
               (c->ln->par->direction == EVAS_BIDI_DIRECTION_RTL))
           {