[cff] Fix extent rounding

I broke it in b0abbfd868.
This commit is contained in:
Behdad Esfahbod 2022-12-22 08:34:01 -07:00
parent 897c102703
commit 392463bff5
2 changed files with 8 additions and 8 deletions

View File

@ -422,8 +422,8 @@ bool OT::cff1::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph
}
else
{
extents->x_bearing = bounds.min.x.to_int ();
extents->width = bounds.max.x.to_int () - extents->x_bearing;
extents->x_bearing = roundf (bounds.min.x.to_real ());
extents->width = roundf (bounds.max.x.to_real () - extents->x_bearing);
}
if (bounds.min.y >= bounds.max.y)
{
@ -432,8 +432,8 @@ bool OT::cff1::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph
}
else
{
extents->y_bearing = bounds.max.y.to_int ();
extents->height = bounds.min.y.to_int () - extents->y_bearing;
extents->y_bearing = roundf (bounds.max.y.to_real ());
extents->height = roundf (bounds.min.y.to_real () - extents->y_bearing);
}
font->scale_glyph_extents (extents);

View File

@ -124,8 +124,8 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font,
}
else
{
extents->x_bearing = param.min_x.to_int ();
extents->width = param.max_x.to_int () - extents->x_bearing;
extents->x_bearing = roundf (param.min_x.to_real ());
extents->width = roundf (param.max_x.to_real () - extents->x_bearing);
}
if (param.min_y >= param.max_y)
{
@ -134,8 +134,8 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font,
}
else
{
extents->y_bearing = param.max_y.to_int ();
extents->height = param.min_y.to_int () - extents->y_bearing;
extents->y_bearing = roundf (param.max_y.to_real ());
extents->height = roundf (param.min_y.to_real () - extents->y_bearing);
}
font->scale_glyph_extents (extents);