From e307051ccb682664787fcf4e14560fb0d2cb5680 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 5 May 2011 11:05:37 +0000 Subject: [PATCH] Evas text_utils: Added evas_common_text_props_can_split SVN revision: 59202 --- .../evas/src/lib/engines/common/evas_text_utils.c | 25 ++++++++++++++++++++++ .../evas/src/lib/engines/common/evas_text_utils.h | 2 ++ 2 files changed, 27 insertions(+) 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, -- 2.7.4