xref: /aosp_15_r20/external/harfbuzz_ng/src/OT/Layout/GPOS/AnchorFormat1.hh (revision 2d1272b857b1f7575e6e246373e1cb218663db8a)
1 #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT1_HH
2 #define OT_LAYOUT_GPOS_ANCHORFORMAT1_HH
3 
4 namespace OT {
5 namespace Layout {
6 namespace GPOS_impl {
7 
8 struct AnchorFormat1
9 {
10   protected:
11   HBUINT16      format;                 /* Format identifier--format = 1 */
12   FWORD         xCoordinate;            /* Horizontal value--in design units */
13   FWORD         yCoordinate;            /* Vertical value--in design units */
14   public:
15   DEFINE_SIZE_STATIC (6);
16 
sanitizeOT::Layout::GPOS_impl::AnchorFormat117   bool sanitize (hb_sanitize_context_t *c) const
18   {
19     TRACE_SANITIZE (this);
20     return_trace (c->check_struct (this));
21   }
22 
get_anchorOT::Layout::GPOS_impl::AnchorFormat123   void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
24                    float *x, float *y) const
25   {
26     hb_font_t *font = c->font;
27     *x = font->em_fscale_x (xCoordinate);
28     *y = font->em_fscale_y (yCoordinate);
29   }
30 
copyOT::Layout::GPOS_impl::AnchorFormat131   AnchorFormat1* copy (hb_serialize_context_t *c) const
32   {
33     TRACE_SERIALIZE (this);
34     AnchorFormat1* out = c->embed<AnchorFormat1> (this);
35     if (!out) return_trace (out);
36     out->format = 1;
37     return_trace (out);
38   }
39 };
40 
41 
42 }
43 }
44 }
45 
46 #endif  // OT_LAYOUT_GPOS_ANCHORFORMAT1_HH
47