forked from enlightenment/efl
Evas textblock: Fix BiDi text cut-off at the edges.
This patch fixes an issue causing text to be cut off in some cases. The problem was that we were calculating line width and alignment before we did any bidi calculations, which in turn caused us to use the wrong text items for those calculations. Many thanks to Daniel Hirt for investigating this deeply, finding all the nitty-gritty and generally pointing me to where the problem is. Daniel also provided the test case. His patch (D1291) was close, but not enough. Fixes T1496 @Fix
This commit is contained in:
parent
c8814e49ac
commit
841191d907
|
@ -3316,6 +3316,10 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
|
||||||
_layout_item_ascent_descent_adjust(c->obj, &c->ascent, &c->descent,
|
_layout_item_ascent_descent_adjust(c->obj, &c->ascent, &c->descent,
|
||||||
NULL, fmt);
|
NULL, fmt);
|
||||||
|
|
||||||
|
#ifdef BIDI_SUPPORT
|
||||||
|
_layout_line_reorder(c->ln);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Adjust all the item sizes according to the final line size,
|
/* Adjust all the item sizes according to the final line size,
|
||||||
* and update the x positions of all the items of the line. */
|
* and update the x positions of all the items of the line. */
|
||||||
EINA_INLIST_FOREACH(c->ln->items, it)
|
EINA_INLIST_FOREACH(c->ln->items, it)
|
||||||
|
@ -4442,6 +4446,7 @@ _layout_paragraph_reorder_lines(Evas_Object_Textblock_Paragraph *par)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Don't do much for the meanwhile. */
|
||||||
static inline void
|
static inline void
|
||||||
_layout_paragraph_render(Evas_Textblock_Data *o,
|
_layout_paragraph_render(Evas_Textblock_Data *o,
|
||||||
Evas_Object_Textblock_Paragraph *par)
|
Evas_Object_Textblock_Paragraph *par)
|
||||||
|
@ -4450,21 +4455,7 @@ _layout_paragraph_render(Evas_Textblock_Data *o,
|
||||||
return;
|
return;
|
||||||
par->rendered = EINA_TRUE;
|
par->rendered = EINA_TRUE;
|
||||||
|
|
||||||
#ifdef BIDI_SUPPORT
|
|
||||||
if (par->is_bidi)
|
|
||||||
{
|
|
||||||
_layout_update_bidi_props(o, par);
|
|
||||||
_layout_paragraph_reorder_lines(par);
|
|
||||||
/* Clear the bidi props because we don't need them anymore. */
|
|
||||||
if (par->bidi_props)
|
|
||||||
{
|
|
||||||
evas_bidi_paragraph_props_unref(par->bidi_props);
|
|
||||||
par->bidi_props = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void) o;
|
(void) o;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculates items width in current paragraph */
|
/* calculates items width in current paragraph */
|
||||||
|
@ -4678,6 +4669,14 @@ _layout_par(Ctxt *c)
|
||||||
|
|
||||||
c->y = c->par->y;
|
c->y = c->par->y;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BIDI_SUPPORT
|
||||||
|
if (c->par->is_bidi)
|
||||||
|
{
|
||||||
|
_layout_update_bidi_props(c->o, c->par);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
it = _ITEM(eina_list_data_get(c->par->logical_items));
|
it = _ITEM(eina_list_data_get(c->par->logical_items));
|
||||||
_layout_line_new(c, it->format);
|
_layout_line_new(c, it->format);
|
||||||
/* We walk on our own because we want to be able to add items from
|
/* We walk on our own because we want to be able to add items from
|
||||||
|
@ -4950,6 +4949,14 @@ end:
|
||||||
if (line_breaks)
|
if (line_breaks)
|
||||||
free(line_breaks);
|
free(line_breaks);
|
||||||
|
|
||||||
|
#ifdef BIDI_SUPPORT
|
||||||
|
if (c->par->bidi_props)
|
||||||
|
{
|
||||||
|
evas_bidi_paragraph_props_unref(c->par->bidi_props);
|
||||||
|
c->par->bidi_props = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2933,6 +2933,12 @@ START_TEST(evas_textblock_size)
|
||||||
(nw != oldnw + 8) || (nh != oldnh));
|
(nw != oldnw + 8) || (nh != oldnh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evas_object_resize(tb, 1000, 1000);
|
||||||
|
evas_object_textblock_text_markup_set(tb, "\u200fHello שלום");
|
||||||
|
evas_object_textblock_size_formatted_get(tb, &w, NULL);
|
||||||
|
evas_object_textblock_size_native_get(tb, &nw, NULL);
|
||||||
|
ck_assert_int_eq(nw, w);
|
||||||
|
|
||||||
/* FIXME: There is a lot more to be done. */
|
/* FIXME: There is a lot more to be done. */
|
||||||
END_TB_TEST();
|
END_TB_TEST();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue