1 #ifndef OT_LAYOUT_GPOS_ANCHORFORMAT2_HH
2 #define OT_LAYOUT_GPOS_ANCHORFORMAT2_HH
12 HBUINT16 format; /* Format identifier--format = 2 */
13 FWORD xCoordinate; /* Horizontal value--in design units */
14 FWORD yCoordinate; /* Vertical value--in design units */
15 HBUINT16 anchorPoint; /* Index to glyph contour point */
17 DEFINE_SIZE_STATIC (8);
19 bool sanitize (hb_sanitize_context_t *c) const
21 TRACE_SANITIZE (this);
22 return_trace (c->check_struct (this));
25 void get_anchor (hb_ot_apply_context_t *c, hb_codepoint_t glyph_id,
26 float *x, float *y) const
28 hb_font_t *font = c->font;
31 *x = font->em_fscale_x (xCoordinate);
32 *y = font->em_fscale_y (yCoordinate);
36 unsigned int x_ppem = font->x_ppem;
37 unsigned int y_ppem = font->y_ppem;
38 hb_position_t cx = 0, cy = 0;
41 ret = (x_ppem || y_ppem) &&
42 font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
43 *x = ret && x_ppem ? cx : font->em_fscale_x (xCoordinate);
44 *y = ret && y_ppem ? cy : font->em_fscale_y (yCoordinate);
47 AnchorFormat2* copy (hb_serialize_context_t *c) const
49 TRACE_SERIALIZE (this);
50 return_trace (c->embed<AnchorFormat2> (this));
58 #endif // OT_LAYOUT_GPOS_ANCHORFORMAT2_HH