fix empty glyf's advance width

pull/1939/head
Michiharu Ariza 6 years ago
parent 511518c759
commit 10f264da75
  1. 8
      src/hb-ot-glyf-table.hh
  2. 4
      src/hb-ot-hmtx-table.cc

@ -418,7 +418,13 @@ struct glyf
unsigned int num_points = 0;
unsigned int start_offset, end_offset;
if (unlikely (!get_offsets (glyph, &start_offset, &end_offset))) return false;
if (unlikely (end_offset - start_offset < GlyphHeader::static_size)) return false;
if (unlikely (end_offset - start_offset < GlyphHeader::static_size))
{
/* empty glyph */
points_.resize (PHANTOM_COUNT);
for (unsigned int i = 0; i < points_.length; i++) points_[i].init ();
return true;
}
CompositeGlyphHeader::Iterator composite;
if (get_composite (glyph, &composite))

@ -37,7 +37,7 @@ int hmtxvmtx_accelerator_base_t::get_side_bearing_var_tt (hb_font_t *font, hb_co
float side_bearing = glyf_accel.get_side_bearing_var (glyph, font->coords, font->num_coords, vertical);
glyf_accel.fini ();
return (int)side_bearing;
return (int)roundf (side_bearing);
}
unsigned int hmtxvmtx_accelerator_base_t::get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool vertical)
@ -48,7 +48,7 @@ unsigned int hmtxvmtx_accelerator_base_t::get_advance_var_tt (hb_font_t *font, h
float advance = glyf_accel.get_advance_var (glyph, font->coords, font->num_coords, vertical);
glyf_accel.fini ();
return (unsigned int)advance;
return (unsigned int)roundf (advance);
}
}

Loading…
Cancel
Save