[glyf] Use contour_bounds_t::empty to simplify get_extents logic

This commit is contained in:
Ebrahim Byagowi 2019-10-29 21:37:07 +03:30
parent d59ae5836d
commit aa3831e295
1 changed files with 6 additions and 14 deletions

View File

@ -822,26 +822,18 @@ struct glyf
void get_extents (hb_font_t *font, hb_glyph_extents_t *extents)
{
if (min_x > max_x)
if (unlikely (empty ()))
{
extents->width = 0;
extents->x_bearing = 0;
}
else
{
extents->x_bearing = font->em_scalef_x (min_x);
extents->width = font->em_scalef_x (max_x - min_x);
}
if (min_y > max_y)
{
extents->height = 0;
extents->y_bearing = 0;
return;
}
else
{
extents->y_bearing = font->em_scalef_y (max_y);
extents->height = font->em_scalef_y (min_y - max_y);
}
extents->x_bearing = font->em_scalef_x (min_x);
extents->width = font->em_scalef_x (max_x - min_x);
extents->y_bearing = font->em_scalef_y (max_y);
extents->height = font->em_scalef_y (min_y - max_y);
}
protected: