From 3beab8be56effabe6373c4588a4217cf126447ca Mon Sep 17 00:00:00 2001 From: tasn Date: Sun, 17 Jul 2011 10:47:54 +0000 Subject: [PATCH] Evas text: Added _text_props_cluster_next. 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 | 7 +++++-- src/lib/engines/common/evas_text_utils.c | 29 ++++++++++++++++++++++++++++- src/lib/engines/common/evas_text_utils.h | 5 ++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 65e0b00..64a5815 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -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; diff --git a/src/lib/engines/common/evas_text_utils.c b/src/lib/engines/common/evas_text_utils.c index 74c3c99..57210c5 100644 --- a/src/lib/engines/common/evas_text_utils.c +++ b/src/lib/engines/common/evas_text_utils.c @@ -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; diff --git a/src/lib/engines/common/evas_text_utils.h b/src/lib/engines/common/evas_text_utils.h index fdfa4f7..6d42d99 100644 --- a/src/lib/engines/common/evas_text_utils.h +++ b/src/lib/engines/common/evas_text_utils.h @@ -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, -- 2.7.4