diff --git a/src/hb-config.hh b/src/hb-config.hh index 381146c5586f96fffa79464c18acd6a9ded7f4d9..2ff92ced3e9adb3f788343dcf2fa9a510fd363e2 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -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 diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index e11dc15ce6e6ddc90b9163aa365459a1bcfcd631..4bc91c2efc1038fa4ea16c5cb394322accef1c80 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -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; diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index 09164427e379313be041721493b97a896de407d5..452da635d1df9ba65aac020aa2f45d137ea20e0f 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -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;