From cd91e9425554a30055333a52fc11a46682549bdf Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 14 Jun 2011 12:34:42 +0000 Subject: [PATCH] Evas bidi: Fix line reordering. We passed the wrong offset of the embedding level, moved to just using the offset part of the API. Also, Fribidi expects v_to_l to point to the start of a (start + len) sized buffer, fixed that as well. SVN revision: 60304 --- .../engines/common/language/evas_bidi_utils.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/legacy/evas/src/lib/engines/common/language/evas_bidi_utils.c b/legacy/evas/src/lib/engines/common/language/evas_bidi_utils.c index a6f0274c1a..5cb20ad6dc 100644 --- a/legacy/evas/src/lib/engines/common/language/evas_bidi_utils.c +++ b/legacy/evas/src/lib/engines/common/language/evas_bidi_utils.c @@ -418,18 +418,15 @@ evas_bidi_props_reorder_line(Eina_Unicode *eina_ustr, size_t start, size_t len, } } - /* Shaping must be done *BEFORE* breaking to lines so there's no choice but - doing it in textblock. */ { - /* FIXME: Hack around fribidi altering embedding_levels */ EvasBiDiLevel *emb_lvl; - emb_lvl = malloc(len * sizeof(EvasBiDiLevel)); - memcpy(emb_lvl, props->embedding_levels, len * sizeof(EvasBiDiLevel)); - if (!fribidi_reorder_line (FRIBIDI_FLAGS_DEFAULT, - props->char_types + start, - len, 0, props->direction, - emb_lvl, - ustr, v_to_l)) + emb_lvl = malloc((start + len) * sizeof(EvasBiDiLevel)); + memcpy(emb_lvl, props->embedding_levels, + (start + len) * sizeof(EvasBiDiLevel)); + /* We pass v_to_l - start, because fribidi assumes start is the offset + * from the start of v_to_l as well, not just the props. */ + if (!fribidi_reorder_line (FRIBIDI_FLAGS_DEFAULT, props->char_types, + len, start, props->direction, emb_lvl, ustr, v_to_l - start)) { free(emb_lvl); goto error;