view mupdf-source/thirdparty/harfbuzz/src/OT/glyf/GlyphHeader.hh @ 46:7ee69f120f19 default tip

>>>>> tag v1.26.5+1 for changeset b74429b0f5c4
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 11 Oct 2025 17:17:30 +0200
parents b50eed0cc0ef
children
line wrap: on
line source

#ifndef OT_GLYF_GLYPHHEADER_HH
#define OT_GLYF_GLYPHHEADER_HH


#include "../../hb-open-type.hh"


namespace OT {
namespace glyf_impl {


struct GlyphHeader
{
  bool has_data () const { return numberOfContours; }

  template <typename accelerator_t>
  bool get_extents_without_var_scaled (hb_font_t *font, const accelerator_t &glyf_accelerator,
				       hb_codepoint_t gid, hb_glyph_extents_t *extents) const
  {
    /* Undocumented rasterizer behavior: shift glyph to the left by (lsb - xMin), i.e., xMin = lsb */
    /* extents->x_bearing = hb_min (glyph_header.xMin, glyph_header.xMax); */
    int lsb = hb_min (xMin, xMax);
    (void) glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid, &lsb);
    extents->x_bearing = font->em_scale_x (lsb);
    extents->y_bearing = font->em_scale_y (hb_max (yMin, yMax));
    extents->width     = font->em_scale_x (hb_max (xMin, xMax) - hb_min (xMin, xMax));
    extents->height    = font->em_scale_y (hb_min (yMin, yMax) - hb_max (yMin, yMax));

    return true;
  }

  HBINT16	numberOfContours;
		    /* If the number of contours is
		     * greater than or equal to zero,
		     * this is a simple glyph; if negative,
		     * this is a composite glyph. */
  FWORD	xMin;	/* Minimum x for coordinate data. */
  FWORD	yMin;	/* Minimum y for coordinate data. */
  FWORD	xMax;	/* Maximum x for coordinate data. */
  FWORD	yMax;	/* Maximum y for coordinate data. */
  public:
  DEFINE_SIZE_STATIC (10);
};


} /* namespace glyf_impl */
} /* namespace OT */


#endif /* OT_GLYF_GLYPHHEADER_HH */