From ec8dde8142fbf9e5bc0aee9318a7c4e73d61c758 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 19 Jul 2019 11:13:50 -0700 Subject: [PATCH] [metrics] Fall back to hhea if OS2 metrics are empty Reinstates previous logic, even if it might be unnecessary. --- src/hb-ot-metrics-internal.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hb-ot-metrics-internal.cc b/src/hb-ot-metrics-internal.cc index ccf4e3706..513053c1f 100644 --- a/src/hb-ot-metrics-internal.cc +++ b/src/hb-ot-metrics-internal.cc @@ -60,14 +60,14 @@ hb_ot_metrics_get_position_internal (hb_face_t *face, (face->table.TABLE->has_data () && \ (position && (*position = face->table.TABLE->ATTR + GET_VAR), true)) case HB_OT_METRICS_HORIZONTAL_ASCENDER: - return face->table.OS2->use_typo_metrics () ? - GET_METRIC (OS2, sTypoAscender) : GET_METRIC (hhea, ascender); + return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoAscender)) || + GET_METRIC (hhea, ascender); case HB_OT_METRICS_HORIZONTAL_DESCENDER: - return face->table.OS2->use_typo_metrics () ? - GET_METRIC (OS2, sTypoDescender) : GET_METRIC (hhea, descender); + return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoDescender)) || + GET_METRIC (hhea, descender); case HB_OT_METRICS_HORIZONTAL_LINE_GAP: - return face->table.OS2->use_typo_metrics () ? - GET_METRIC (OS2, sTypoLineGap) : GET_METRIC (hhea, lineGap); + return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoLineGap)) || + GET_METRIC (hhea, lineGap); case HB_OT_METRICS_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC (OS2, usWinAscent); case HB_OT_METRICS_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC (OS2, usWinDescent); case HB_OT_METRICS_VERTICAL_ASCENDER: return GET_METRIC (vhea, ascender);