Fix rtl handling for color glyphs

When the run contains a mix of color and non-color
glyphs, composite_color_glyphs returns the non-color
glyphs unhandled in the same array. In the rtl case,
the glyphs are processed from the end and the unhandled
glyphs are accumulated at the end as well, and we
need to move them to the beginning of the array before
we return. Add the missing memmove call to do that.

Fixes: #533
This commit is contained in:
Matthias Clasen 2022-02-11 05:44:39 -05:00
parent fb3734fac0
commit 603cdf939f

View file

@ -2771,8 +2771,10 @@ composite_color_glyphs (cairo_surface_t *surface,
byte_pos += clusters[i].num_bytes;
}
if (cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD)
if (cluster_flags & CAIRO_TEXT_CLUSTER_FLAG_BACKWARD) {
memmove (utf8, utf8 + *utf8_len - remaining_bytes, remaining_bytes);
memmove (glyphs, glyphs + (*num_glyphs - remaining_glyphs), sizeof (cairo_glyph_t) * remaining_glyphs);
}
*utf8_len = remaining_bytes;
*num_glyphs = remaining_glyphs;