}
}
- /* 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;