[hmtx/glyf] Rename side-bearing functions for clarity

pull/3707/head
Behdad Esfahbod 2 years ago
parent 23435d5285
commit f46ddeba48
  1. 4
      src/OT/glyf/Glyph.hh
  2. 2
      src/OT/glyf/GlyphHeader.hh
  3. 6
      src/OT/glyf/glyf.hh
  4. 6
      src/hb-ot-font.cc
  5. 12
      src/hb-ot-hmtx-table.hh

@ -106,10 +106,10 @@ struct Glyph
hb_array_t<contour_point_t> phantoms = points.sub_array (points.length - PHANTOM_COUNT, PHANTOM_COUNT);
{
int h_delta = (int) header->xMin -
glyf_accelerator.hmtx->get_side_bearing (gid);
glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid);
int v_orig = (int) header->yMax +
#ifndef HB_NO_VERTICAL
glyf_accelerator.vmtx->get_side_bearing (gid)
glyf_accelerator.vmtx->get_leading_bearing_without_var_unscaled (gid)
#else
0
#endif

@ -19,7 +19,7 @@ struct GlyphHeader
{
/* 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); */
extents->x_bearing = font->em_scale_x (glyf_accelerator.hmtx->get_side_bearing (gid));
extents->x_bearing = font->em_scale_x (glyf_accelerator.hmtx->get_leading_bearing_without_var_unscaled (gid));
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));

@ -281,7 +281,7 @@ struct glyf_accelerator_t
return hb_clamp (roundf (result), 0.f, (float) UINT_MAX / 2);
}
int get_side_bearing_var (hb_font_t *font, hb_codepoint_t gid, bool is_vertical) const
int get_leading_bearing_with_var_unscaled (hb_font_t *font, hb_codepoint_t gid, bool is_vertical) const
{
if (unlikely (gid >= num_glyphs)) return 0;
@ -291,9 +291,9 @@ struct glyf_accelerator_t
if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms, false))))
return
#ifndef HB_NO_VERTICAL
is_vertical ? vmtx->get_side_bearing (gid) :
is_vertical ? vmtx->get_leading_bearing_without_var_unscaled (gid) :
#endif
hmtx->get_side_bearing (gid);
hmtx->get_leading_bearing_without_var_unscaled (gid);
return is_vertical
? roundf (phantoms[glyf_impl::PHANTOM_TOP].y) - extents.y_bearing

@ -314,7 +314,7 @@ hb_ot_get_glyph_v_origin (hb_font_t *font,
if (ot_face->vmtx->has_data ())
{
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx;
hb_position_t tsb = vmtx.get_side_bearing (font, glyph);
hb_position_t tsb = vmtx.get_leading_bearing_with_var_unscaled (font, glyph);
*y = extents.y_bearing + font->em_scale_y (tsb);
return true;
}
@ -515,9 +515,9 @@ hb_ot_font_set_funcs (hb_font_t *font)
#ifndef HB_NO_VAR
int
_glyf_get_side_bearing_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
_glyf_get_leading_bearing_with_var_unscaled (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{
return font->face->table.glyf->get_side_bearing_var (font, glyph, is_vertical);
return font->face->table.glyf->get_leading_bearing_with_var_unscaled (font, glyph, is_vertical);
}
unsigned

@ -44,7 +44,7 @@
HB_INTERNAL int
_glyf_get_side_bearing_var (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
_glyf_get_leading_bearing_with_var_unscaled (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
HB_INTERNAL unsigned
_glyf_get_advance_with_var_unscaled (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
@ -150,7 +150,7 @@ struct hmtxvmtx
hb_codepoint_t old_gid;
if (!c->plan->old_gid_for_new_gid (_, &old_gid))
return hb_pair (0u, 0);
return hb_pair (_mtx.get_advance_without_var_unscaled (old_gid), _mtx.get_side_bearing (old_gid));
return hb_pair (_mtx.get_advance_without_var_unscaled (old_gid), _mtx.get_leading_bearing_without_var_unscaled (old_gid));
})
;
@ -221,7 +221,7 @@ struct hmtxvmtx
bool has_data () const { return (bool) num_bearings; }
int get_side_bearing (hb_codepoint_t glyph) const
int get_leading_bearing_without_var_unscaled (hb_codepoint_t glyph) const
{
if (glyph < num_long_metrics)
return table->longMetricZ[glyph].sb;
@ -233,9 +233,9 @@ struct hmtxvmtx
return bearings[glyph - num_long_metrics];
}
int get_side_bearing (hb_font_t *font, hb_codepoint_t glyph) const
int get_leading_bearing_with_var_unscaled (hb_font_t *font, hb_codepoint_t glyph) const
{
int side_bearing = get_side_bearing (glyph);
int side_bearing = get_leading_bearing_without_var_unscaled (glyph);
#ifndef HB_NO_VAR
if (unlikely (glyph >= num_bearings) || !font->num_coords)
@ -245,7 +245,7 @@ struct hmtxvmtx
if (var_table->get_lsb_delta_unscaled (glyph, font->coords, font->num_coords, &lsb))
return side_bearing + roundf (lsb);
return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
return _glyf_get_leading_bearing_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
#else
return side_bearing;
#endif

Loading…
Cancel
Save