[embolden] Adjust font_h_extents

This commit is contained in:
Behdad Esfahbod 2023-02-07 13:52:53 -07:00
parent b350122fb3
commit be1c14ee0a
2 changed files with 11 additions and 4 deletions

View File

@ -794,7 +794,7 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
metrics->line_gap = ft_face->size->metrics.height - (metrics->ascender - metrics->descender);
}
metrics->ascender = (hb_position_t) (y_mult * metrics->ascender);
metrics->ascender = (hb_position_t) (y_mult * (metrics->ascender + font->y_strength));
metrics->descender = (hb_position_t) (y_mult * metrics->descender);
metrics->line_gap = (hb_position_t) (y_mult * metrics->line_gap);

View File

@ -466,9 +466,16 @@ hb_ot_get_font_h_extents (hb_font_t *font,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
{
return _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, &metrics->ascender) &&
bool ret = _hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER, &metrics->ascender) &&
_hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER, &metrics->descender) &&
_hb_ot_metrics_get_position_common (font, HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP, &metrics->line_gap);
/* Embolden */
int y_shift = font->y_strength;
if (font->y_scale < 0) y_shift = -y_shift;
metrics->ascender += y_shift;
return ret;
}
#ifndef HB_NO_VERTICAL