From c8f529a07eca06acf2216935921377e7cad8436f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 19 Jun 2019 19:33:15 -0700 Subject: [PATCH] [config] Add HB_NO_HINTING, enabled by HB_TINY Disables HintingDevice tables and Anchors addressing contour points. Part of https://github.com/harfbuzz/harfbuzz/issues/1652 --- src/hb-config.hh | 3 ++- src/hb-ot-layout-common.hh | 6 ++++++ src/hb-ot-layout-gpos-table.hh | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hb-config.hh b/src/hb-config.hh index 8f78ede..5fac4f4 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -58,7 +58,7 @@ #define HB_NO_CFF #define HB_NO_COLOR #define HB_NO_GETENV -#define HB_NO_OT_FONT_GLYPH_NAMES +#define HB_NO_HINTING #define HB_NO_LANGUAGE_PRIVATE_SUBTAG #define HB_NO_LAYOUT_UNUSED #define HB_NO_MATH @@ -66,6 +66,7 @@ #define HB_NO_NAME #define HB_NO_OPEN #define HB_NO_SETLOCALE +#define HB_NO_OT_FONT_GLYPH_NAMES #define HB_NO_OT_SHAPE_FRACTIONS #define HB_NO_STAT #define HB_NO_SUBSET_LAYOUT diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index c332e28..a903bcd 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2166,8 +2166,10 @@ struct Device { switch (u.b.format) { +#ifndef HB_NO_HINTING case 1: case 2: case 3: return u.hinting.get_x_delta (font); +#endif #ifndef HB_NO_VAR case 0x8000: return u.variation.get_x_delta (font, store); @@ -2181,7 +2183,9 @@ struct Device switch (u.b.format) { case 1: case 2: case 3: +#ifndef HB_NO_HINTING return u.hinting.get_y_delta (font); +#endif #ifndef HB_NO_VAR case 0x8000: return u.variation.get_y_delta (font, store); @@ -2196,8 +2200,10 @@ struct Device TRACE_SANITIZE (this); if (!u.b.format.sanitize (c)) return_trace (false); switch (u.b.format) { +#ifndef HB_NO_HINTING case 1: case 2: case 3: return_trace (u.hinting.sanitize (c)); +#endif #ifndef HB_NO_VAR case 0x8000: return_trace (u.variation.sanitize (c)); diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 86c45be..d371c4b 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -267,6 +267,13 @@ struct AnchorFormat2 float *x, float *y) const { hb_font_t *font = c->font; + +#ifdef HB_NO_HINTING + *x = font->em_fscale_x (xCoordinate); + *y = font->em_fscale_y (yCoordinate); + return; +#endif + unsigned int x_ppem = font->x_ppem; unsigned int y_ppem = font->y_ppem; hb_position_t cx = 0, cy = 0; -- 2.7.4