mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 16:01:07 +01:00
fix empty glyf's advance width
This commit is contained in:
1 parent
9d3a252030
commit
c7edd14dc9
2 files changed
+9
-3
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user