Evas text: Added _text_props_cluster_next.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 17 Jul 2011 10:47:54 +0000 (10:47 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 17 Jul 2011 10:47:54 +0000 (10:47 +0000)
Started using it in tb.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@61435 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c
src/lib/engines/common/evas_text_utils.c
src/lib/engines/common/evas_text_utils.h

index 65e0b00..64a5815 100644 (file)
@@ -3153,6 +3153,7 @@ _layout_get_charwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
       const Evas_Object_Textblock_Text_Item *ti, size_t line_start,
       const char *breaks)
 {
+   int wrap;
    size_t uwrap;
    size_t len = eina_ustrbuf_length_get(ti->parent.text_node->unicode);
    /* Currently not being used, because it doesn't contain relevant
@@ -3160,7 +3161,6 @@ _layout_get_charwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
    (void) breaks;
 
      {
-        int wrap;
         wrap = _layout_text_cutoff_get(c, fmt, ti);
         if (wrap < 0)
            return -1;
@@ -3169,7 +3169,10 @@ _layout_get_charwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
 
 
    if (uwrap == line_start)
-      MOVE_NEXT_UNTIL(len, uwrap);
+     {
+        uwrap = ti->parent.text_pos +
+           (size_t) evas_common_text_props_cluster_next(&ti->text_props, wrap);
+     }
    if ((uwrap <= line_start) || (uwrap > len))
       return -1;
 
index 74c3c99..57210c5 100644 (file)
@@ -65,9 +65,36 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
      }
 }
 
+EAPI int
+evas_common_text_props_cluster_next(const Evas_Text_Props *props, int pos)
+{
+   int prop_pos = evas_common_text_props_index_find(props, pos);
+   if ((props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) && (prop_pos > 0))
+     {
+#ifdef OT_SUPPORT
+        return props->info->ot[props->start + prop_pos - 1].source_cluster -
+           props->text_offset;
+#else
+        return props->start + prop_pos - 1 - props->text_offset;
+#endif
+     }
+   else if ((props->bidi.dir != EVAS_BIDI_DIRECTION_RTL) &&
+         (prop_pos < (int) (props->len - 1)))
+     {
+#ifdef OT_SUPPORT
+        return props->info->ot[props->start + prop_pos + 1].source_cluster -
+           props->text_offset;
+#else
+        return props->start + prop_pos + 1 - props->text_offset;
+#endif
+     }
+
+   return pos;
+}
+
 /* Returns the index of the logical char in the props. */
 EAPI int
-evas_common_text_props_index_find(Evas_Text_Props *props, int _cutoff)
+evas_common_text_props_index_find(const Evas_Text_Props *props, int _cutoff)
 {
 #ifdef OT_SUPPORT
    Evas_Font_OT_Info *ot_info;
index fdfa4f7..6d42d99 100644 (file)
@@ -72,7 +72,10 @@ void
 evas_common_text_props_content_unref(Evas_Text_Props *props);
 
 EAPI int
-evas_common_text_props_index_find(Evas_Text_Props *props, int _cutoff);
+evas_common_text_props_cluster_next(const Evas_Text_Props *props, int pos);
+
+EAPI int
+evas_common_text_props_index_find(const Evas_Text_Props *props, int _cutoff);
 
 EAPI void
 evas_common_text_props_split(Evas_Text_Props *base, Evas_Text_Props *ext,