From f7d49d9c2b9899f9caeeff766714631918129d2c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 2 Jan 2022 11:16:33 -0700 Subject: [PATCH] [metrics] Simplify --- src/hb-ot-metrics.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-metrics.cc b/src/hb-ot-metrics.cc index 7ebdd1f09..b7153151d 100644 --- a/src/hb-ot-metrics.cc +++ b/src/hb-ot-metrics.cc @@ -164,9 +164,14 @@ hb_ot_metrics_get_position (hb_font_t *font, 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 = (font->slant && rise && rise < upem) ? hb_min (upem / rise, 256u) : 1u; + unsigned mult = 1u; + + if (font->slant) + { + unsigned rise = face->table.hhea->caretSlopeRise; + unsigned upem = face->get_upem (); + mult = (rise && rise < upem) ? hb_min (upem / rise, 256u) : 1u; + } if (metrics_tag == HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE) return mult * GET_METRIC_Y (hhea, caretSlopeRise);