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
This commit is contained in:
Tom Hacohen 2011-06-14 12:34:42 +00:00
parent 36b21249d9
commit cd91e94255
1 changed files with 7 additions and 10 deletions

View File

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