• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef OT_GLYF_GLYPHHEADER_HH
2 #define OT_GLYF_GLYPHHEADER_HH
3 
4 
5 #include "../../hb-open-type.hh"
6 
7 
8 namespace OT {
9 namespace glyf_impl {
10 
11 
12 struct GlyphHeader
13 {
has_dataOT::glyf_impl::GlyphHeader14   bool has_data () const { return numberOfContours; }
15 
16   template <typename accelerator_t>
get_extents_without_var_scaledOT::glyf_impl::GlyphHeader17   bool get_extents_without_var_scaled (hb_font_t *font, const accelerator_t &glyf_accelerator,
18 				       hb_codepoint_t gid, hb_glyph_extents_t *extents) const
19   {
20     /* Undocumented rasterizer behavior: shift glyph to the left by (lsb - xMin), i.e., xMin = lsb */
21     /* extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); */
22     int lsb = hb_min (xMin, xMax);
23     (void) glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid, &lsb);
24     extents->x_bearing = font->em_scale_x (lsb);
25     extents->y_bearing = font->em_scale_y (hb_max (yMin, yMax));
26     extents->width     = font->em_scale_x (hb_max (xMin, xMax) - hb_min (xMin, xMax));
27     extents->height    = font->em_scale_y (hb_min (yMin, yMax) - hb_max (yMin, yMax));
28 
29     return true;
30   }
31 
32   HBINT16	numberOfContours;
33 		    /* If the number of contours is
34 		     * greater than or equal to zero,
35 		     * this is a simple glyph; if negative,
36 		     * this is a composite glyph. */
37   FWORD	xMin;	/* Minimum x for coordinate data. */
38   FWORD	yMin;	/* Minimum y for coordinate data. */
39   FWORD	xMax;	/* Maximum x for coordinate data. */
40   FWORD	yMax;	/* Maximum y for coordinate data. */
41   public:
42   DEFINE_SIZE_STATIC (10);
43 };
44 
45 
46 } /* namespace glyf_impl */
47 } /* namespace OT */
48 
49 
50 #endif /* OT_GLYF_GLYPHHEADER_HH */
51