Add a reverse () call to hb_array_t.
This commit is contained in:
parent
38c6598c1c
commit
50129b03a1
|
@ -171,6 +171,21 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
|||
|
||||
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)
|
||||
|
|
|
@ -850,6 +850,20 @@ struct VariationSelectorRecord
|
|||
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 @@ struct CmapSubtableFormat14
|
|||
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue