tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GlyphHeader.hh (1519B)


      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 {
     14  bool has_data () const { return numberOfContours; }
     15 
     16  template <typename accelerator_t>
     17  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 = lsb;
     25    extents->y_bearing = hb_max (yMin, yMax);
     26    extents->width     = hb_max (xMin, xMax) - hb_min (xMin, xMax);
     27    extents->height    = hb_min (yMin, yMax) - hb_max (yMin, yMax);
     28 
     29    font->scale_glyph_extents (extents);
     30 
     31    return true;
     32  }
     33 
     34  HBINT16	numberOfContours;
     35 	    /* If the number of contours is
     36 	     * greater than or equal to zero,
     37 	     * this is a simple glyph; if negative,
     38 	     * this is a composite glyph. */
     39  FWORD	xMin;	/* Minimum x for coordinate data. */
     40  FWORD	yMin;	/* Minimum y for coordinate data. */
     41  FWORD	xMax;	/* Maximum x for coordinate data. */
     42  FWORD	yMax;	/* Maximum y for coordinate data. */
     43  public:
     44  DEFINE_SIZE_STATIC (10);
     45 };
     46 
     47 
     48 } /* namespace glyf_impl */
     49 } /* namespace OT */
     50 
     51 
     52 #endif /* OT_GLYF_GLYPHHEADER_HH */