Evas text: Added _text_props_cluster_next.

Started using it in tb.

SVN revision: 61435
This commit is contained in:
Tom Hacohen 2011-07-17 10:47:54 +00:00
parent 4f9010d33d
commit c47d4bebd8
3 changed files with 37 additions and 4 deletions

View 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;

View 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;

View 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,