Imported Upstream version 8.2.2
[platform/upstream/harfbuzz.git] / src / OT / Layout / GPOS / AnchorFormat1.hh
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
17   bool sanitize (hb_sanitize_context_t *c) const
18   {
19     TRACE_SANITIZE (this);
20     return_trace (c->check_struct (this));
21   }
22
23   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
31   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