Evas text_utils: Added evas_common_text_props_can_split
authorTom Hacohen <tom@stosb.com>
Thu, 5 May 2011 11:05:37 +0000 (11:05 +0000)
committerTom Hacohen <tom@stosb.com>
Thu, 5 May 2011 11:05:37 +0000 (11:05 +0000)
SVN revision: 59202

legacy/evas/src/lib/engines/common/evas_text_utils.c
legacy/evas/src/lib/engines/common/evas_text_utils.h

index f30899f..4e29e44 100644 (file)
@@ -66,6 +66,31 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
      }
 }
 
+EAPI Eina_Bool
+evas_common_text_props_can_split(Evas_Text_Props *props, int _cutoff)
+{
+#ifdef OT_SUPPORT
+   Evas_Font_OT_Info *itr;
+   size_t i;
+   itr = props->info->ot + props->start;
+   _cutoff += props->text_offset;
+   /* FIXME: can I binary search? I don't think this is always sorted */
+   for (i = 0 ; i < props->len ; i++, itr++)
+     {
+        if (itr->source_cluster == (size_t) _cutoff)
+          {
+             return EINA_TRUE;
+          }
+     }
+
+   /* We didn't find the cutoff position. */
+   ERR("Couldn't find the cutoff position. Is it inside a cluster?");
+   return EINA_FALSE;
+#else
+   return EINA_TRUE;
+#endif
+}
+
 /* Won't work in the middle of ligatures, assumes cutoff < len.
  * Also won't work in the middle of indic words, should handle that in a
  * smart way. */
index 46902a6..689ab29 100644 (file)
@@ -72,6 +72,8 @@ evas_common_text_props_content_ref(Evas_Text_Props *props);
 void
 evas_common_text_props_content_unref(Evas_Text_Props *props);
 
+EAPI Eina_Bool
+evas_common_text_props_can_split(Evas_Text_Props *props, int _cutoff);
 
 EAPI void
 evas_common_text_props_split(Evas_Text_Props *base, Evas_Text_Props *ext,