[buffer] Add optional merge_clusters arg to reverse_groups()

This commit is contained in:
Behdad Esfahbod 2021-12-10 13:02:43 -07:00
parent e949e51218
commit 21c4fc1011
1 changed files with 6 additions and 1 deletions

View File

@ -210,7 +210,8 @@ struct hb_buffer_t
void reverse () { reverse_range (0, len); }
template <typename FuncType>
void reverse_groups (const FuncType& group)
void reverse_groups (const FuncType& group,
bool merge_clusters = false)
{
if (unlikely (!len))
return;
@ -223,10 +224,14 @@ struct hb_buffer_t
{
if (!group (info[i - 1], info[i]))
{
if (merge_clusters)
this->merge_clusters (start, i);
reverse_range (start, i);
start = i;
}
}
if (merge_clusters)
this->merge_clusters (start, i);
reverse_range (start, i);
}