Better rounding clip boxes

This commit is contained in:
Behdad Esfahbod 2023-01-09 11:37:39 -07:00
parent a085efa699
commit 6c1a4bed4a
2 changed files with 4 additions and 4 deletions

View File

@ -184,8 +184,8 @@ struct hb_font_t
{
extents->x_bearing = em_scale_x (extents->x_bearing);
extents->y_bearing = em_scale_y (extents->y_bearing);
extents->width = em_scale_x (extents->width);
extents->height = em_scale_y (extents->height);
extents->width = em_scale_x (extents->x_bearing + extents->width) - extents->x_bearing;
extents->height = em_scale_y (extents->y_bearing + extents->height) - extents->y_bearing;
/* Apply slant. */
extents->x_bearing += roundf (extents->y_bearing * slant_xy);

View File

@ -447,9 +447,9 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
if (FT_Get_Color_Glyph_ClipBox (ft_face, gid, &clip_box))
{
c.funcs->push_clip_rectangle (c.data,
clip_box.bottom_left.x - font->slant_xy * clip_box.bottom_left.y,
clip_box.bottom_left.x - roundf (font->slant_xy * clip_box.bottom_left.y),
clip_box.bottom_left.y,
clip_box.top_right.x - font->slant_xy * clip_box.top_right.y,
clip_box.top_right.x - roundf (font->slant_xy * clip_box.top_right.y),
clip_box.top_right.y);
}
else