[embolden] Fix glyph_extents in hb-ft

This commit is contained in:
Behdad Esfahbod 2023-02-07 13:49:16 -07:00
parent 61a1a88940
commit b350122fb3
1 changed files with 16 additions and 0 deletions

View File

@ -657,6 +657,22 @@ hb_ft_get_glyph_extents (hb_font_t *font,
extents->width = ceilf (x2) - extents->x_bearing; extents->width = ceilf (x2) - extents->x_bearing;
extents->height = ceilf (y2) - extents->y_bearing; extents->height = ceilf (y2) - extents->y_bearing;
if (font->x_strength || font->y_strength)
{
/* Y */
int y_shift = font->y_strength;
if (font->y_scale < 0) y_shift = -y_shift;
extents->y_bearing += y_shift;
extents->height -= y_shift;
/* X */
int x_shift = font->x_strength;
if (font->x_scale < 0) x_shift = -x_shift;
if (font->embolden_in_place)
extents->x_bearing -= x_shift / 2;
extents->width += x_shift;
}
return true; return true;
} }