From 71b4c999a511bf018acaf48a45e070470c0daf12 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 28 Oct 2013 00:20:59 +0100 Subject: [PATCH] Revert "Zero marks by GDEF for Tibetan" This reverts commit d5bd0590ae2fbc7b0dee86385a565aef00ffb835. The reasoning behind that logic was flawed and made under a misunderstanding of the original problem, and caused regressions as reported by Jonathan Kew in thread titled "tibetan marks" in Oct 2013. Apparently I have had fixed the original problem with this commit: 7e08f1258da229dfaf7e1c4b5c41e5bb83906cb0 So, revert the faulty commit and everything seems to be in good shape. --- src/hb-ot-layout-gsubgpos-private.hh | 4 ++-- src/hb-ot-shape-complex-arabic.cc | 10 +++------- src/hb-ot-shape-complex-default.cc | 17 +---------------- src/hb-ot-shape-complex-indic.cc | 8 +------- src/hb-ot-shape-complex-myanmar.cc | 15 +++++---------- src/hb-ot-shape-complex-private.hh | 8 ++------ src/hb-ot-shape-complex-sea.cc | 14 ++++---------- src/hb-ot-shape-complex-thai.cc | 9 +-------- src/hb-ot-shape.cc | 4 ++-- 9 files changed, 21 insertions(+), 68 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 7fa324700..16c96fafb 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -616,8 +616,8 @@ struct hb_apply_context_t } inline void _set_glyph_props (hb_codepoint_t glyph_index, - unsigned int class_guess = 0, - bool ligature = false) const + unsigned int class_guess = 0, + bool ligature = false) const { unsigned int add_in = _hb_glyph_info_get_glyph_props (&buffer->cur()) & HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 212b71481..4f6c86e8e 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -177,6 +177,8 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * * This also makes Arial Bold in Windows7 work. See: * https://bugzilla.mozilla.org/show_bug.cgi?id=644184 + * + * TODO: Add test cases for these two. */ map->add_gsub_pause (nuke_joiners); @@ -355,12 +357,6 @@ retry: arabic_fallback_plan_shape (fallback_plan, font, buffer); } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_arabic (const hb_segment_properties_t *props HB_UNUSED) -{ - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE; -} - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = { @@ -374,6 +370,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = NULL, /* decompose */ NULL, /* compose */ setup_masks_arabic, - zero_width_marks_preference_arabic, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ }; diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc index 946825d7d..d6afa0e1c 100644 --- a/src/hb-ot-shape-complex-default.cc +++ b/src/hb-ot-shape-complex-default.cc @@ -203,21 +203,6 @@ compose_default (const hb_ot_shape_normalize_context_t *c, return found; } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_default (const hb_segment_properties_t *props) -{ - switch ((hb_tag_t) props->script) - { - /* Unicode-2.0 additions */ - case HB_SCRIPT_TIBETAN: - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE; - - default: - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE; - } -} - - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = { "default", @@ -230,6 +215,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = NULL, /* decompose */ compose_default, NULL, /* setup_masks */ - zero_width_marks_preference_default, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE, true, /* fallback_position */ }; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index dace8f77c..9edefe305 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1797,12 +1797,6 @@ compose_indic (const hb_ot_shape_normalize_context_t *c, return c->unicode->compose (a, b, ab); } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_indic (const hb_segment_properties_t *props HB_UNUSED) -{ - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE; -} - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = { @@ -1816,6 +1810,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = decompose_indic, compose_indic, setup_masks_indic, - zero_width_marks_preference_indic, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 6cd7a2cb7..a32405a82 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -263,12 +263,6 @@ set_myanmar_properties (hb_glyph_info_t &info) -static hb_ot_shape_normalization_mode_t -normalization_preference_myanmar (const hb_segment_properties_t *props HB_UNUSED) -{ - return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT; -} - static void setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_buffer_t *buffer, @@ -525,10 +519,11 @@ final_reordering (const hb_ot_shape_plan_t *plan, HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position); } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_myanmar (const hb_segment_properties_t *props HB_UNUSED) + +static hb_ot_shape_normalization_mode_t +normalization_preference_myanmar (const hb_segment_properties_t *props HB_UNUSED) { - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY; + return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT; } @@ -544,6 +539,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = NULL, /* decompose */ NULL, /* compose */ setup_masks_myanmar, - zero_width_marks_preference_myanmar, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ }; diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index 3109516aa..ac0072ba5 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -39,7 +39,7 @@ #define complex_var_u8_1() var2.u8[3] -enum hb_ot_shape_zero_width_marks_t { +enum hb_ot_shape_zero_width_marks_type_t { HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, // HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE, @@ -140,11 +140,7 @@ struct hb_ot_complex_shaper_t hb_buffer_t *buffer, hb_font_t *font); - /* zero_width_marks_preference() - * Called during shape(). - */ - hb_ot_shape_zero_width_marks_t - (*zero_width_marks_preference) (const hb_segment_properties_t *props); + hb_ot_shape_zero_width_marks_type_t zero_width_marks; bool fallback_position; }; diff --git a/src/hb-ot-shape-complex-sea.cc b/src/hb-ot-shape-complex-sea.cc index 69d6678c6..da687ed64 100644 --- a/src/hb-ot-shape-complex-sea.cc +++ b/src/hb-ot-shape-complex-sea.cc @@ -162,12 +162,6 @@ set_sea_properties (hb_glyph_info_t &info) } -static hb_ot_shape_normalization_mode_t -normalization_preference_sea (const hb_segment_properties_t *props HB_UNUSED) -{ - return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT; -} - static void setup_masks_sea (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_buffer_t *buffer, @@ -366,10 +360,10 @@ final_reordering (const hb_ot_shape_plan_t *plan, } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_sea (const hb_segment_properties_t *props HB_UNUSED) +static hb_ot_shape_normalization_mode_t +normalization_preference_sea (const hb_segment_properties_t *props HB_UNUSED) { - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE; + return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT; } @@ -385,6 +379,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_sea = NULL, /* decompose */ NULL, /* compose */ setup_masks_sea, - zero_width_marks_preference_sea, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc index 955fc4477..45945339d 100644 --- a/src/hb-ot-shape-complex-thai.cc +++ b/src/hb-ot-shape-complex-thai.cc @@ -361,13 +361,6 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan, do_thai_pua_shaping (plan, buffer, font); } -static hb_ot_shape_zero_width_marks_t -zero_width_marks_preference_thai (const hb_segment_properties_t *props HB_UNUSED) -{ - return HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE; -} - - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = { "thai", @@ -380,6 +373,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = NULL, /* decompose */ NULL, /* compose */ NULL, /* setup_masks */ - zero_width_marks_preference_thai, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE, false,/* fallback_position */ }; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index d0737e220..63c36f936 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -452,7 +452,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) bool ret = false; unsigned int count = c->buffer->len; - switch (c->plan->shaper->zero_width_marks_preference (&c->plan->props)) + switch (c->plan->shaper->zero_width_marks) { case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY: zero_mark_widths_by_gdef (c->buffer); @@ -497,7 +497,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) ret = true; } - switch (c->plan->shaper->zero_width_marks_preference (&c->plan->props)) + switch (c->plan->shaper->zero_width_marks) { case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE: zero_mark_widths_by_unicode (c->buffer);