[metrics] Simplify x-height fallback

This commit is contained in:
Behdad Esfahbod 2022-03-15 10:45:50 -06:00
parent 6bf8f0a38f
commit 21f5ef56f5
1 changed files with 2 additions and 2 deletions

View File

@ -316,9 +316,9 @@ hb_ot_metrics_get_position_with_fallback (hb_font_t *font,
break; break;
case HB_OT_METRICS_TAG_X_HEIGHT: case HB_OT_METRICS_TAG_X_HEIGHT:
if (hb_font_get_nominal_glyph (font, 'o', &glyph) && if (hb_font_get_nominal_glyph (font, 'x', &glyph) &&
hb_font_get_glyph_extents (font, glyph, &extents)) hb_font_get_glyph_extents (font, glyph, &extents))
*position = extents.height + 2 * extents.y_bearing; *position = extents.y_bearing;
else else
*position = font->y_scale / 2; *position = font->y_scale / 2;
break; break;