diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 91898b35b..ae6a0bda8 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -646,6 +646,33 @@ struct TupleVariationData tuple_vars = std::move (new_vars); } } + + /* merge tuple variations with overlapping tents */ + void merge_tuple_variations () + { + hb_vector_t new_vars; + hb_hashmap_t, unsigned> m; + unsigned i = 0; + for (const tuple_delta_t& var : tuple_vars) + { + /* if all axes are pinned, drop the tuple variation */ + if (var.axis_tuples.is_empty ()) continue; + + unsigned *idx; + if (m.has (var.axis_tuples, &idx)) + { + new_vars[*idx] += var; + } + else + { + new_vars.push (var); + m.set (var.axis_tuples, i); + i++; + } + } + tuple_vars.fini (); + tuple_vars = std::move (new_vars); + } }; struct tuple_iterator_t diff --git a/src/hb-subset-instancer-solver.hh b/src/hb-subset-instancer-solver.hh index 911b37f4a..b1f859493 100644 --- a/src/hb-subset-instancer-solver.hh +++ b/src/hb-subset-instancer-solver.hh @@ -42,12 +42,30 @@ struct Triple { maximum == o.maximum; } + bool operator != (const Triple o) const + { return !(*this == o); } + bool is_point () const { return minimum == middle && middle == maximum; } bool contains (float point) const { return minimum <= point && point <= maximum; } + /* from hb_array_t hash ()*/ + uint32_t hash () const + { + uint32_t current = /*cbf29ce4*/0x84222325; + current = current ^ hb_hash (minimum); + current = current * 16777619; + + current = current ^ hb_hash (middle); + current = current * 16777619; + + current = current ^ hb_hash (maximum); + current = current * 16777619; + return current; + } + float minimum; float middle; float maximum;