[OT] Merge clusters when reordering marks for normalization
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=541608 and cluster test.
This commit is contained in:
parent
b6d7d161a8
commit
e995d33c10
|
@ -201,6 +201,8 @@ struct hb_buffer_t {
|
||||||
HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size);
|
HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size);
|
||||||
|
|
||||||
inline void clear_context (unsigned int side) { context_len[side] = 0; }
|
inline void clear_context (unsigned int side) { context_len[side] = 0; }
|
||||||
|
|
||||||
|
HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1678,3 +1678,24 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer)
|
||||||
}
|
}
|
||||||
normalize_glyphs_cluster (buffer, start, end, backward);
|
normalize_glyphs_cluster (buffer, start, end, backward);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hb_buffer_t::sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *))
|
||||||
|
{
|
||||||
|
assert (!have_positions);
|
||||||
|
for (unsigned int i = start + 1; i < end; i++)
|
||||||
|
{
|
||||||
|
unsigned int j = i;
|
||||||
|
while (j > start && compar (&info[j - 1], &info[i]) > 0)
|
||||||
|
j--;
|
||||||
|
if (i == j)
|
||||||
|
continue;
|
||||||
|
/* Move item i to occupy place for item j, shift what's in between. */
|
||||||
|
merge_clusters (j, i + 1);
|
||||||
|
{
|
||||||
|
hb_glyph_info_t t = info[i];
|
||||||
|
memmove (&info[j + 1], &info[j], (i - j) * sizeof (hb_glyph_info_t));
|
||||||
|
info[j] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_stable_sort (buffer->info + i, end - i, compare_combining_class);
|
buffer->sort (i, end, compare_combining_class);
|
||||||
|
|
||||||
i = end;
|
i = end;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue