Evas bidi: Fix line reordering.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 14 Jun 2011 12:34:42 +0000 (12:34 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 14 Jun 2011 12:34:42 +0000 (12:34 +0000)
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.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@60304 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/language/evas_bidi_utils.c

index a6f0274..5cb20ad 100644 (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;