fix empty glyf's advance width
This commit is contained in:
parent
9d3a252030
commit
c7edd14dc9
|
@ -418,7 +418,13 @@ struct glyf
|
||||||
unsigned int num_points = 0;
|
unsigned int num_points = 0;
|
||||||
unsigned int start_offset, end_offset;
|
unsigned int start_offset, end_offset;
|
||||||
if (unlikely (!get_offsets (glyph, &start_offset, &end_offset))) return false;
|
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;
|
CompositeGlyphHeader::Iterator composite;
|
||||||
if (get_composite (glyph, &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);
|
float side_bearing = glyf_accel.get_side_bearing_var (glyph, font->coords, font->num_coords, vertical);
|
||||||
glyf_accel.fini ();
|
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)
|
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);
|
float advance = glyf_accel.get_advance_var (glyph, font->coords, font->num_coords, vertical);
|
||||||
glyf_accel.fini ();
|
glyf_accel.fini ();
|
||||||
|
|
||||||
return (unsigned int)advance;
|
return (unsigned int)roundf (advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue