[config] add HB_NO_OT_SHAPE_FRACTIONS, enabled in HB_LEAN
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 19 Jun 2019 23:57:48 +0000 (16:57 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 19 Jun 2019 23:57:48 +0000 (16:57 -0700)
Part of https://github.com/harfbuzz/harfbuzz/issues/1652

src/hb-config.hh
src/hb-ot-shape.cc
src/hb-ot-shape.hh

index 381146c..2ff92ce 100644 (file)
@@ -65,6 +65,7 @@
 #define HB_NO_NAME
 #define HB_NO_OPEN
 #define HB_NO_SETLOCALE
+#define HB_NO_OT_SHAPE_FRACTIONS
 #define HB_NO_SUBSET_LAYOUT
 #endif
 
index e11dc15..4bc91c2 100644 (file)
@@ -101,10 +101,13 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
   if (apply_morx)
     aat_map.compile (plan.aat_map);
 
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
   plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c'));
   plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r'));
   plan.dnom_mask = plan.map.get_1_mask (HB_TAG ('d','n','o','m'));
   plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask);
+#endif
+
   plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m'));
   hb_tag_t kern_tag = HB_DIRECTION_IS_HORIZONTAL (props.direction) ?
                      HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n');
@@ -309,10 +312,12 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t          *planner,
       break;
   }
 
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
   /* Automatic fractions. */
   map->add_feature (HB_TAG ('f','r','a','c'));
   map->add_feature (HB_TAG ('n','u','m','r'));
   map->add_feature (HB_TAG ('d','n','o','m'));
+#endif
 
   /* Random! */
   map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE);
@@ -590,6 +595,10 @@ hb_ot_mirror_chars (const hb_ot_shape_context_t *c)
 static inline void
 hb_ot_shape_setup_masks_fraction (const hb_ot_shape_context_t *c)
 {
+#ifdef HB_NO_OT_SHAPE_FRACTIONS
+  return;
+#endif
+
   if (!(c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
       !c->plan->has_frac)
     return;
index 0916442..452da63 100644 (file)
@@ -65,14 +65,24 @@ struct hb_ot_shape_plan_t
   hb_ot_map_t map;
   hb_aat_map_t aat_map;
   const void *data;
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
   hb_mask_t frac_mask, numr_mask, dnom_mask;
+#else
+  static constexpr hb_mask_t frac_mask = 0;
+  static constexpr hb_mask_t numr_mask = 0;
+  static constexpr hb_mask_t dnom_mask = 0;
+#endif
   hb_mask_t rtlm_mask;
   hb_mask_t kern_mask;
   hb_mask_t trak_mask;
 
   bool requested_kerning : 1;
   bool requested_tracking : 1;
+#ifndef HB_NO_OT_SHAPE_FRACTIONS
   bool has_frac : 1;
+#else
+  static constexpr bool has_frac = false;
+#endif
   bool has_gpos_mark : 1;
   bool zero_marks : 1;
   bool fallback_glyph_classes : 1;