From 96eca87f89588126d3fa5c7f3884ae2f302a91e1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:24:40 +0200 Subject: [PATCH] Move things --- src/hb-ot-shape.cc | 22 ++++++++++------------ src/hb-ot-shape.hh | 3 +++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 7f4e442..4b7c2ef 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -62,6 +62,11 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask); plan.kerning_requested = !!plan.kern_mask; plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); + + bool disable_otl = plan.shaper->disable_otl && plan.shaper->disable_otl (&plan); + //plan.fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (face); + plan.fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (face); + plan.fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (face); } @@ -257,8 +262,6 @@ struct hb_ot_shape_context_t unsigned int num_user_features; /* Transient stuff */ - bool fallback_positioning; - bool fallback_glyph_classes; hb_direction_t target_direction; }; @@ -634,7 +637,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c) hb_ot_shape_setup_masks (c); /* This is unfortunate to go here, but necessary... */ - if (c->fallback_positioning) + if (c->plan->fallback_positioning) _hb_ot_shape_fallback_position_recategorize_marks (c->plan, c->font, buffer); hb_ot_map_glyphs_fast (buffer); @@ -748,7 +751,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) * If fallback positinoing happens or GPOS is present, we don't * care. */ - bool adjust_offsets_when_zeroing = c->fallback_positioning && + bool adjust_offsets_when_zeroing = c->plan->fallback_positioning && !c->plan->shaper->fallback_position && HB_DIRECTION_IS_FORWARD (c->buffer->props.direction); @@ -775,7 +778,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) break; } - if (likely (!c->fallback_positioning)) + if (likely (!c->plan->fallback_positioning)) c->plan->position (c->font, c->buffer); switch (c->plan->shaper->zero_width_marks) @@ -812,7 +815,7 @@ hb_ot_position (hb_ot_shape_context_t *c) hb_ot_position_complex (c); - if (c->fallback_positioning && c->plan->shaper->fallback_position) + if (c->plan->fallback_positioning && c->plan->shaper->fallback_position) _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)) @@ -820,7 +823,7 @@ hb_ot_position (hb_ot_shape_context_t *c) /* Visual fallback goes here. */ - if (c->fallback_positioning) + if (c->plan->fallback_positioning) _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); _hb_buffer_deallocate_gsubgpos_vars (c->buffer); @@ -872,11 +875,6 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) (unsigned) HB_BUFFER_MAX_OPS_MIN); } - bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); - //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); - c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face); - c->fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (c->face); - /* Save the original direction, we use it later. */ c->target_direction = c->buffer->props.direction; diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index 52e6b11..88c72dc 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -42,9 +42,12 @@ struct hb_ot_shape_plan_t const void *data; hb_mask_t rtlm_mask, frac_mask, numr_mask, dnom_mask; hb_mask_t kern_mask; + bool has_frac : 1; bool kerning_requested : 1; bool has_gpos_mark : 1; + bool fallback_positioning : 1; + bool fallback_glyph_classes : 1; inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const { -- 2.7.4