From: Tom Hacohen Date: Thu, 5 May 2011 11:05:37 +0000 (+0000) Subject: Evas text_utils: Added evas_common_text_props_can_split X-Git-Tag: submit/devel/efl/20131022.203902~9666 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e307051ccb682664787fcf4e14560fb0d2cb5680;p=platform%2Fupstream%2Fefl.git Evas text_utils: Added evas_common_text_props_can_split SVN revision: 59202 --- diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.c b/legacy/evas/src/lib/engines/common/evas_text_utils.c index f30899f..4e29e44 100644 --- a/legacy/evas/src/lib/engines/common/evas_text_utils.c +++ b/legacy/evas/src/lib/engines/common/evas_text_utils.c @@ -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. */ diff --git a/legacy/evas/src/lib/engines/common/evas_text_utils.h b/legacy/evas/src/lib/engines/common/evas_text_utils.h index 46902a6..689ab29 100644 --- a/legacy/evas/src/lib/engines/common/evas_text_utils.h +++ b/legacy/evas/src/lib/engines/common/evas_text_utils.h @@ -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,