1 #ifndef OT_LAYOUT_GPOS_ANCHOR_HH
2 #define OT_LAYOUT_GPOS_ANCHOR_HH
4 #include "AnchorFormat1.hh"
5 #include "AnchorFormat2.hh"
6 #include "AnchorFormat3.hh"
16 HBUINT16 format; /* Format identifier */
17 AnchorFormat1 format1;
18 AnchorFormat2 format2;
19 AnchorFormat3 format3;
22 DEFINE_SIZE_UNION (2, format);
24 bool sanitize (hb_sanitize_context_t *c) const
26 TRACE_SANITIZE (this);
27 if (!u.format.sanitize (c)) return_trace (false);
29 case 1: return_trace (u.format1.sanitize (c));
30 case 2: return_trace (u.format2.sanitize (c));
31 case 3: return_trace (u.format3.sanitize (c));
32 default:return_trace (true);
36 void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
37 float *x, float *y) const
41 case 1: u.format1.get_anchor (c, glyph_id, x, y); return;
42 case 2: u.format2.get_anchor (c, glyph_id, x, y); return;
43 case 3: u.format3.get_anchor (c, glyph_id, x, y); return;
48 bool subset (hb_subset_context_t *c) const
52 case 1: return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
54 if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
56 // AnchorFormat 2 just containins extra hinting information, so
57 // if hints are being dropped convert to format 1.
58 return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
60 return_trace (bool (reinterpret_cast<Anchor *> (u.format2.copy (c->serializer))));
61 case 3: return_trace (u.format3.subset (c));
62 default:return_trace (false);
66 void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
72 u.format3.collect_variation_indices (c);
83 #endif // OT_LAYOUT_GPOS_ANCHOR_HH