diff --git a/src/hb-config.hh b/src/hb-config.hh index 2eab7d8b65755176befdb00daa41a513b31921d5..f6dc4fbb16955aa9ce130deb2a0adefb5550329e 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -82,6 +82,10 @@ #define HB_NO_SUBSET_CFF #endif +#ifdef HB_NO_GETENV +#define HB_NO_UNISCRIBE_BUG_COMPATIBLE +#endif + #ifdef HB_NO_LEGACY #define HB_NO_OT_LAYOUT_BLACKLIST #define HB_NO_OT_SHAPE_FALLBACK diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 7befbf6303298131f916272d729f0469b1c4f8d4..45351b885a8a21ca2da32992dc09531609a22b65 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -274,7 +274,9 @@ struct indic_shape_plan_t const indic_config_t *config; bool is_old_spec; +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE bool uniscribe_bug_compatible; +#endif mutable hb_atomic_int_t virama_glyph; would_substitute_feature_t rphf; @@ -300,7 +302,9 @@ data_create_indic (const hb_ot_shape_plan_t *plan) } indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chosen_script[0] & 0x000000FFu) != '2'); +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE indic_plan->uniscribe_bug_compatible = hb_options ().uniscribe_bug_compatible; +#endif indic_plan->virama_glyph.set_relaxed (-1); /* Use zero-context would_substitute() matching for new-spec of the main @@ -918,11 +922,11 @@ initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer, unsigned int start, unsigned int end) { - const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; - /* We treat placeholder/dotted-circle as if they are consonants, so we * should just chain. Only if not in compatibility mode that is... */ +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE + const HB_UNUSED indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data; if (indic_plan->uniscribe_bug_compatible) { /* For dotted-circle, this is what Uniscribe does: @@ -931,6 +935,7 @@ initial_reordering_standalone_cluster (const hb_ot_shape_plan_t *plan, if (buffer->info[end - 1].indic_category() == OT_DOTTEDCIRCLE) return; } +#endif initial_reordering_consonant_syllable (plan, face, buffer, start, end); } @@ -1370,14 +1375,18 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, * Uniscribe doesn't do this. * TEST: U+0930,U+094D,U+0915,U+094B,U+094D */ +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE if (!indic_plan->uniscribe_bug_compatible && - unlikely (is_halant (info[new_reph_pos]))) { + unlikely (is_halant (info[new_reph_pos]))) + { for (unsigned int i = base + 1; i < new_reph_pos; i++) if (info[i].indic_category() == OT_M) { /* Ok, got it. */ new_reph_pos--; } } +#endif + goto reph_move; } @@ -1476,6 +1485,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, /* * Finish off the clusters and go home! */ +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE if (indic_plan->uniscribe_bug_compatible) { switch ((hb_tag_t) plan->props.script) @@ -1493,6 +1503,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, break; } } +#endif } @@ -1590,11 +1601,11 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c, * https://docs.microsoft.com/en-us/typography/script-development/sinhala#shaping */ - const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan->data; +#ifndef HB_NO_UNISCRIBE_BUG_COMPATIBLE + const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) c->plan->data; hb_codepoint_t glyph; - - if (hb_options ().uniscribe_bug_compatible || + if (indic_plan->uniscribe_bug_compatible || (c->font->get_nominal_glyph (ab, &glyph) && indic_plan->pstf.would_substitute (&glyph, 1, c->font->face))) { @@ -1603,6 +1614,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c, *b = ab; return true; } +#endif } return (bool) c->unicode->decompose (ab, a, b);