textblock: correct text position for RTL text with margins
Summary: If a RTL textblock has right margin, text is wrongly placed (right margin is moved to left). This patch fixes this issue. Test cases are also added to test text position with margins. @fix Reviewers: tasn, herdsman Subscribers: woohyun, cedric Differential Revision: https://phab.enlightenment.org/D1691
This commit is contained in:
parent
795f9d6ce3
commit
e9a40835f2
|
@ -3397,8 +3397,8 @@ loop_advance:
|
|||
/* c->o->style_pad.r is already included in the line width, so it's
|
||||
* not used in this calculation. . */
|
||||
c->ln->x = c->marginl + c->o->style_pad.l +
|
||||
((c->w - c->ln->w -
|
||||
c->o->style_pad.l - c->marginl) * _layout_line_align_get(c));
|
||||
((c->w - c->ln->w - c->o->style_pad.l -
|
||||
c->marginl - c->marginr) * _layout_line_align_get(c));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1954,6 +1954,39 @@ START_TEST(evas_textblock_various)
|
|||
evas_textblock_cursor_pos_set(cur, 0);
|
||||
evas_textblock_cursor_char_delete(cur);
|
||||
|
||||
/* Check margins' position */
|
||||
{
|
||||
Evas_Coord nw, nh, lx, lw;
|
||||
|
||||
evas_object_textblock_text_markup_set(tb, "This is a test");
|
||||
evas_object_textblock_size_native_get(tb, &nw, &nh);
|
||||
evas_object_resize(tb, nw, nh);
|
||||
evas_object_textblock_line_number_geometry_get(tb, 0, &lx, NULL, &lw, NULL);
|
||||
ck_assert_int_eq(lx, 0);
|
||||
ck_assert_int_eq(lx + lw, nw);
|
||||
|
||||
evas_object_textblock_text_markup_set(tb, "<left_margin=10 right_margin=5>This is a test</>");
|
||||
evas_object_textblock_size_native_get(tb, &nw, &nh);
|
||||
evas_object_resize(tb, nw, nh);
|
||||
evas_object_textblock_line_number_geometry_get(tb, 0, &lx, NULL, &lw, NULL);
|
||||
ck_assert_int_eq(lx, 10);
|
||||
ck_assert_int_eq(lx + lw + 5, nw);
|
||||
|
||||
evas_object_textblock_text_markup_set(tb, "עוד פסקה");
|
||||
evas_object_textblock_size_native_get(tb, &nw, &nh);
|
||||
evas_object_resize(tb, nw, nh);
|
||||
evas_object_textblock_line_number_geometry_get(tb, 0, &lx, NULL, &lw, NULL);
|
||||
ck_assert_int_eq(lx, 0);
|
||||
ck_assert_int_eq(lx + lw, nw);
|
||||
|
||||
evas_object_textblock_text_markup_set(tb, "<left_margin=10 right_margin=5>עוד פסקה</>");
|
||||
evas_object_textblock_size_native_get(tb, &nw, &nh);
|
||||
evas_object_resize(tb, nw, nh);
|
||||
evas_object_textblock_line_number_geometry_get(tb, 0, &lx, NULL, &lw, NULL);
|
||||
ck_assert_int_eq(lx, 10);
|
||||
ck_assert_int_eq(lx + lw + 5, nw);
|
||||
}
|
||||
|
||||
/* Super big one line item. */
|
||||
{
|
||||
#define CNT 10000
|
||||
|
|
Loading…
Reference in New Issue