Add a reverse () call to hb_array_t.
diff --git a/src/hb-array.hh b/src/hb-array.hh
index cbd6485..c9c6dee 100644
--- a/src/hb-array.hh
+++ b/src/hb-array.hh
@@ -171,6 +171,21 @@
unsigned int get_size () const { return length * this->get_item_size (); }
+ void reverse ()
+ {
+ int rhs = length - 1;
+ int lhs = 0;
+ while (rhs > lhs)
+ {
+ Type value_rhs = arrayZ[rhs];
+ Type value_lhs = arrayZ[lhs];
+ arrayZ[rhs] = value_lhs;
+ arrayZ[lhs] = value_rhs;
+ rhs--;
+ lhs++;
+ }
+ }
+
hb_array_t sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
{
if (!start_offset && !seg_count)
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 4f862d9..7969aad 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -850,6 +850,20 @@
return GLYPH_VARIANT_NOT_FOUND;
}
+ VariationSelectorRecord(const VariationSelectorRecord& other)
+ {
+ *this = other;
+ }
+
+ void operator= (const VariationSelectorRecord& other)
+ {
+ varSelector = other.varSelector;
+ HBUINT32 offset = other.defaultUVS;
+ defaultUVS = offset;
+ offset = other.nonDefaultUVS;
+ nonDefaultUVS = offset;
+ }
+
void collect_unicodes (hb_set_t *out, const void *base) const
{
(base+defaultUVS).collect_unicodes (out);
@@ -992,17 +1006,7 @@
void _reverse_variation_records ()
{
- int rhs = record.len - 1;
- int lhs = 0;
- while (rhs > lhs)
- {
- int value_rhs = record[rhs].varSelector;
- int value_lhs = record[lhs].varSelector;
- record[rhs].varSelector = value_lhs;
- record[lhs].varSelector = value_rhs;
- rhs--;
- lhs++;
- }
+ record.as_array ().reverse ();
}
void _add_links_to_variation_records (hb_serialize_context_t *c,