From 2e5b49d11d1dbfd44d8c640cb9ce5de7d26ca873 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 19 Jul 2019 11:41:07 +0430 Subject: [PATCH] Add HB_NO_METRICS and fix HB_TINY build (#1839) --- src/hb-config.hh | 1 + src/hb-ot-face-table-list.hh | 2 -- src/hb-ot-metrics-internal.cc | 8 +++++++- src/hb-ot-metrics.cc | 6 ++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/hb-config.hh b/src/hb-config.hh index adf2b3348..bd440050e 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -66,6 +66,7 @@ #define HB_NO_LAYOUT_COLLECT_GLYPHS #define HB_NO_LAYOUT_UNUSED #define HB_NO_MATH +#define HB_NO_METRICS #define HB_NO_MMAP #define HB_NO_NAME #define HB_NO_OPEN diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh index 09e000d04..7af024612 100644 --- a/src/hb-ot-face-table-list.hh +++ b/src/hb-ot-face-table-list.hh @@ -53,9 +53,7 @@ HB_OT_ACCELERATOR (OT, cmap) HB_OT_TABLE (OT, hhea) HB_OT_ACCELERATOR (OT, hmtx) HB_OT_TABLE (OT, OS2) -#ifndef HB_NO_OT_FONT_GLYPH_NAMES HB_OT_ACCELERATOR (OT, post) -#endif #ifndef HB_NO_NAME HB_OT_ACCELERATOR (OT, name) #endif diff --git a/src/hb-ot-metrics-internal.cc b/src/hb-ot-metrics-internal.cc index 9af5b8c38..ccf4e3706 100644 --- a/src/hb-ot-metrics-internal.cc +++ b/src/hb-ot-metrics-internal.cc @@ -51,9 +51,14 @@ hb_ot_metrics_get_position_internal (hb_face_t *face, { switch (metrics_tag) { +#ifndef HB_NO_VAR +#define GET_VAR hb_ot_metrics_get_variation (face, metrics_tag) +#else +#define GET_VAR 0 +#endif #define GET_METRIC(TABLE, ATTR) \ (face->table.TABLE->has_data () && \ - (position && (*position = face->table.TABLE->ATTR + face->table.MVAR->get_var (metrics_tag, nullptr, 0)), true)) + (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); @@ -89,6 +94,7 @@ hb_ot_metrics_get_position_internal (hb_face_t *face, case HB_OT_METRICS_UNDERLINE_SIZE: return GET_METRIC (post->table, underlineThickness); case HB_OT_METRICS_UNDERLINE_OFFSET: return GET_METRIC (post->table, underlinePosition); #undef GET_METRIC +#undef GET_VAR default: return false; } } diff --git a/src/hb-ot-metrics.cc b/src/hb-ot-metrics.cc index d6672c685..8a9859751 100644 --- a/src/hb-ot-metrics.cc +++ b/src/hb-ot-metrics.cc @@ -24,6 +24,8 @@ #include "hb.hh" +#ifndef HB_NO_METRICS + #include "hb-ot-metrics.hh" #include "hb-ot-var-mvar-table.hh" #include "hb-ot-face.hh" @@ -89,6 +91,7 @@ hb_ot_metrics_get_position (hb_font_t *font, } } +#ifndef HB_NO_VAR /** * hb_ot_metrics_get_variation: * @face: @@ -133,3 +136,6 @@ hb_ot_metrics_get_y_variation (hb_font_t *font, hb_ot_metrics_t metrics_tag) { return font->em_scalef_y (hb_ot_metrics_get_variation (font->face, metrics_tag)); } +#endif + +#endif