From f7cfe99815c07f82d5ad253af1e811db734bf92b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 8 Dec 2018 13:40:44 +0330 Subject: [PATCH] [os2] Move typometrics detection logic to the table (#1465) --- src/hb-ot-hmtx-table.hh | 14 +++++--------- src/hb-ot-os2-table.hh | 7 ++++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index f22ed1d..cd5e798 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -192,16 +192,12 @@ struct hmtxvmtx default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face); bool got_font_extents = false; - if (T::os2Tag != HB_TAG_NONE) + if (T::os2Tag != HB_TAG_NONE && face->table.OS2->is_typo_metrics ()) { -#define USE_TYPO_METRICS (1u<<7) - if (0 != (face->table.OS2->fsSelection & USE_TYPO_METRICS)) - { - ascender = abs (face->table.OS2->sTypoAscender); - descender = -abs (face->table.OS2->sTypoDescender); - line_gap = face->table.OS2->sTypoLineGap; - got_font_extents = (ascender | descender) != 0; - } + ascender = abs (face->table.OS2->sTypoAscender); + descender = -abs (face->table.OS2->sTypoDescender); + line_gap = face->table.OS2->sTypoLineGap; + got_font_extents = (ascender | descender) != 0; } hb_blob_t *_hea_blob = hb_sanitize_context_t().reference_table (face); diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index e06ed57..67890f7 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -112,10 +112,11 @@ struct OS2 OBLIQUE = 1u<<9 }; - inline bool is_italic (void) const { return fsSelection & ITALIC; } - inline bool is_oblique (void) const { return fsSelection & OBLIQUE; } + inline bool is_italic (void) const { return fsSelection & ITALIC; } + inline bool is_oblique (void) const { return fsSelection & OBLIQUE; } + inline bool is_typo_metrics (void) const { return fsSelection & USE_TYPO_METRICS; } - enum us_width_class_t { + enum width_class_t { FWIDTH_ULTRA_CONDENSED = 1, /* 50% */ FWIDTH_EXTRA_CONDENSED = 2, /* 62.5% */ FWIDTH_CONDENSED = 3, /* 75% */ -- 2.7.4