[metrics] Scale up horizontal caret rise/run
Eg. if rise/run are 1/0, we now return upem/0. This is equivalent. Part of https://github.com/harfbuzz/harfbuzz/pull/3338
This commit is contained in:
parent
602bd39680
commit
fc329f665f
|
@ -160,9 +160,20 @@ hb_ot_metrics_get_position (hb_font_t *font,
|
|||
(position && (*position = font->em_scalef_y (face->table.TABLE->ATTR + GET_VAR)), true))
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC_Y (OS2, usWinAscent);
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC_Y (OS2, usWinDescent);
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE: return GET_METRIC_Y (hhea, caretSlopeRise);
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN: return GET_METRIC_X (hhea, caretSlopeRun);
|
||||
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE:
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN:
|
||||
{
|
||||
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);
|
||||
}
|
||||
case HB_OT_METRICS_TAG_HORIZONTAL_CARET_OFFSET: return GET_METRIC_X (hhea, caretOffset);
|
||||
|
||||
#ifndef HB_NO_VERTICAL
|
||||
case HB_OT_METRICS_TAG_VERTICAL_CARET_RISE: return GET_METRIC_X (vhea, caretSlopeRise);
|
||||
case HB_OT_METRICS_TAG_VERTICAL_CARET_RUN: return GET_METRIC_Y (vhea, caretSlopeRun);
|
||||
|
|
Loading…
Reference in New Issue