From 484f6e8215038006a945da67d245f14db3eeeb2e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 11 May 2019 00:13:35 -0700 Subject: [PATCH] [config] Add HB_LEAN Part of https://github.com/harfbuzz/harfbuzz/issues/1652 --- src/hb-config.hh | 5 +++++ src/hb-ot-math.cc | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/hb-config.hh b/src/hb-config.hh index 6c7a4eb..b13215a 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -36,9 +36,14 @@ #ifdef HB_TINY +#define HB_LEAN #define HB_MINI +#endif + +#ifdef HB_LEAN #define HB_NO_BITMAP #define HB_NO_CFF +#define HB_NO_MATH #endif #ifdef HB_MINI diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index bd31bf5..b06824a 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -58,6 +58,10 @@ hb_bool_t hb_ot_math_has_data (hb_face_t *face) { +#ifdef HB_NO_MATH + return false; +#endif + return face->table.MATH->has_data (); } @@ -80,6 +84,10 @@ hb_position_t hb_ot_math_get_constant (hb_font_t *font, hb_ot_math_constant_t constant) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_constant(constant, font); } @@ -96,6 +104,10 @@ hb_position_t hb_ot_math_get_glyph_italics_correction (hb_font_t *font, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_italics_correction (glyph, font); } @@ -112,6 +124,10 @@ hb_position_t hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_top_accent_attachment (glyph, font); } @@ -128,6 +144,10 @@ hb_bool_t hb_ot_math_is_glyph_extended_shape (hb_face_t *face, hb_codepoint_t glyph) { +#ifdef HB_NO_MATH + return false; +#endif + return face->table.MATH->get_glyph_info().is_extended_shape (glyph); } @@ -154,6 +174,10 @@ hb_ot_math_get_glyph_kerning (hb_font_t *font, hb_ot_math_kern_t kern, hb_position_t correction_height) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_glyph_info().get_kerning (glyph, kern, correction_height, @@ -187,6 +211,12 @@ hb_ot_math_get_glyph_variants (hb_font_t *font, unsigned int *variants_count, /* IN/OUT */ hb_ot_math_glyph_variant_t *variants /* OUT */) { +#ifdef HB_NO_MATH + if (variants_count) + *variants_count = 0; + return 0; +#endif + return font->face->table.MATH->get_variants().get_glyph_variants (glyph, direction, font, start_offset, variants_count, @@ -211,6 +241,10 @@ hb_position_t hb_ot_math_get_min_connector_overlap (hb_font_t *font, hb_direction_t direction) { +#ifdef HB_NO_MATH + return 0; +#endif + return font->face->table.MATH->get_variants().get_min_connector_overlap (direction, font); } @@ -243,6 +277,12 @@ hb_ot_math_get_glyph_assembly (hb_font_t *font, hb_ot_math_glyph_part_t *parts, /* OUT */ hb_position_t *italics_correction /* OUT */) { +#ifdef HB_NO_MATH + if (parts_count) + *parts_count = 0; + return 0; +#endif + return font->face->table.MATH->get_variants().get_glyph_parts (glyph, direction, font, -- 2.7.4