1 #ifndef OT_LAYOUT_GPOS_PAIRVALUERECORD_HH
2 #define OT_LAYOUT_GPOS_PAIRVALUERECORD_HH
4 #include "ValueFormat.hh"
11 template <typename Types>
12 struct PairValueRecord
14 template <typename Types2>
15 friend struct PairSet;
18 typename Types::HBGlyphID
19 secondGlyph; /* GlyphID of second glyph in the
20 * pair--first glyph is listed in the
22 ValueRecord values; /* Positioning data for the first glyph
23 * followed by for second glyph */
25 DEFINE_SIZE_ARRAY (Types::HBGlyphID::static_size, values);
27 int cmp (hb_codepoint_t k) const
28 { return secondGlyph.cmp (k); }
33 const ValueFormat *valueFormats;
34 const ValueFormat *newFormats;
35 unsigned len1; /* valueFormats[0].get_len() */
36 const hb_map_t *glyph_map;
37 const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map;
40 bool subset (hb_subset_context_t *c,
41 context_t *closure) const
43 TRACE_SERIALIZE (this);
44 auto *s = c->serializer;
45 auto *out = s->start_embed (*this);
46 if (unlikely (!s->extend_min (out))) return_trace (false);
48 out->secondGlyph = (*closure->glyph_map)[secondGlyph];
50 closure->valueFormats[0].copy_values (s,
51 closure->newFormats[0],
52 closure->base, &values[0],
53 closure->layout_variation_idx_delta_map);
54 closure->valueFormats[1].copy_values (s,
55 closure->newFormats[1],
57 &values[closure->len1],
58 closure->layout_variation_idx_delta_map);
63 void collect_variation_indices (hb_collect_variation_indices_context_t *c,
64 const ValueFormat *valueFormats,
65 const void *base) const
67 unsigned record1_len = valueFormats[0].get_len ();
68 unsigned record2_len = valueFormats[1].get_len ();
69 const hb_array_t<const Value> values_array = values.as_array (record1_len + record2_len);
71 if (valueFormats[0].has_device ())
72 valueFormats[0].collect_variation_indices (c, base, values_array.sub_array (0, record1_len));
74 if (valueFormats[1].has_device ())
75 valueFormats[1].collect_variation_indices (c, base, values_array.sub_array (record1_len, record2_len));
78 bool intersects (const hb_set_t& glyphset) const
80 return glyphset.has(secondGlyph);
83 const Value* get_values_1 () const
88 const Value* get_values_2 (ValueFormat format1) const
90 return &values[format1.get_len ()];
99 #endif // OT_LAYOUT_GPOS_PAIRVALUERECORD_HH