Optimize non-slant extents code

This commit is contained in:
Behdad Esfahbod 2023-01-09 13:43:56 -07:00
parent 73dab7f784
commit d2aa2397ba
2 changed files with 10 additions and 4 deletions

View File

@ -188,8 +188,11 @@ struct hb_font_t
float y2 = em_fscale_y (extents->y_bearing + extents->height);
/* Apply slant. */
x1 += hb_min (y1 * slant_xy, y2 * slant_xy);
x2 += hb_max (y1 * slant_xy, y2 * slant_xy);
if (slant_xy)
{
x1 += hb_min (y1 * slant_xy, y2 * slant_xy);
x2 += hb_max (y1 * slant_xy, y2 * slant_xy);
}
extents->x_bearing = floorf (x1);
extents->y_bearing = floorf (y1);

View File

@ -630,8 +630,11 @@ hb_ft_get_glyph_extents (hb_font_t *font,
float y2 = y1 + y_mult * -ft_face->glyph->metrics.height;
/* Apply slant. */
x1 += hb_min (y1 * slant_xy, y2 * slant_xy);
x2 += hb_max (y1 * slant_xy, y2 * slant_xy);
if (slant_xy)
{
x1 += hb_min (y1 * slant_xy, y2 * slant_xy);
x2 += hb_max (y1 * slant_xy, y2 * slant_xy);
}
extents->x_bearing = floorf (x1);
extents->y_bearing = floorf (y1);