[metrics] Implement synthetic slant for caret slope

Part of https://github.com/harfbuzz/harfbuzz/pull/3338
This commit is contained in:
Behdad Esfahbod 2022-01-02 10:46:38 -07:00
parent fc329f665f
commit fa008a021f
1 changed files with 9 additions and 1 deletions

View File

@ -167,10 +167,18 @@ hb_ot_metrics_get_position (hb_font_t *font,
unsigned rise = face->table.hhea->caretSlopeRise;
unsigned upem = face->get_upem ();
unsigned mult = rise < upem ? upem / rise : 1;
if (metrics_tag == HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE)
return mult * GET_METRIC_Y (hhea, caretSlopeRise);
else
return mult * GET_METRIC_X (hhea, caretSlopeRun);
{
unsigned run = mult * GET_METRIC_X (hhea, caretSlopeRun);
if (font->slant)
run += _hb_roundf (mult * GET_METRIC_Y (hhea, caretSlopeRise) * font->slant);
return run;
}
}
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: return GET_METRIC_X (hhea, caretOffset);