From 7e34601dededd521bcef15111e39293df3d0d13d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 30 Jul 2012 14:53:41 -0400 Subject: [PATCH] Unbreak Hangul jamo composition When we removed the separate Hangul shaper, the specific normalization preference of Hangul was lost. Fix that. Also, the Thai shaper was copied from Hangul, so had the fully-composed normalization behavior, which was unnecessary. So, fix that too. --- src/hb-ot-shape-complex-arabic.cc | 2 +- src/hb-ot-shape-complex-indic.cc | 4 +--- src/hb-ot-shape-complex-misc.cc | 12 +++++++++--- src/hb-ot-shape-complex-private.hh | 9 ++++----- src/hb-ot-shape.cc | 4 +++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 75f5fe9c..1f63c125 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -206,7 +206,7 @@ _hb_ot_shape_complex_override_features_arabic (hb_ot_map_builder_t *map, } hb_ot_shape_normalization_mode_t -_hb_ot_shape_complex_normalization_preference_arabic (void) +_hb_ot_shape_complex_normalization_preference_arabic (const hb_segment_properties_t *props) { return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS; } diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index e4c151aa..c7025ffe 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -420,10 +420,8 @@ _hb_ot_shape_complex_override_features_indic (hb_ot_map_builder_t *map, hb_ot_shape_normalization_mode_t -_hb_ot_shape_complex_normalization_preference_indic (void) +_hb_ot_shape_complex_normalization_preference_indic (const hb_segment_properties_t *props) { - /* We want split matras decomposed by the common shaping logic. */ - /* XXX sort this out after adding per-shaper normalizers. */ return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS; } diff --git a/src/hb-ot-shape-complex-misc.cc b/src/hb-ot-shape-complex-misc.cc index 4578f0bf..4b9e6a67 100644 --- a/src/hb-ot-shape-complex-misc.cc +++ b/src/hb-ot-shape-complex-misc.cc @@ -79,8 +79,14 @@ _hb_ot_shape_complex_override_features_default (hb_ot_map_builder_t *map HB_UNUS } hb_ot_shape_normalization_mode_t -_hb_ot_shape_complex_normalization_preference_default (void) +_hb_ot_shape_complex_normalization_preference_default (const hb_segment_properties_t *props) { + switch ((hb_tag_t) props->script) + { + /* Unicode-1.1 additions */ + case HB_SCRIPT_HANGUL: + return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL; + } return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS; } @@ -108,9 +114,9 @@ _hb_ot_shape_complex_override_features_thai (hb_ot_map_builder_t *map HB_UNUSED, } hb_ot_shape_normalization_mode_t -_hb_ot_shape_complex_normalization_preference_thai (void) +_hb_ot_shape_complex_normalization_preference_thai (const hb_segment_properties_t *props HB_UNUSED) { - return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL; + return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS; } void diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index d444cd6b..689ca617 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -270,23 +270,22 @@ hb_ot_shape_complex_override_features (hb_ot_complex_shaper_t shaper, * normalization_preference() * * Called during shape_execute(). - * - * Shapers should return true if it prefers decomposed (NFD) input rather than precomposed (NFC). */ -typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_preference_func_t (void); +typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_preference_func_t (const hb_segment_properties_t *props HB_UNUSED); #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ HB_INTERNAL hb_ot_shape_complex_normalization_preference_func_t _hb_ot_shape_complex_normalization_preference_##name; HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS #undef HB_COMPLEX_SHAPER_IMPLEMENT static inline hb_ot_shape_normalization_mode_t -hb_ot_shape_complex_normalization_preference (hb_ot_complex_shaper_t shaper) +hb_ot_shape_complex_normalization_preference (hb_ot_complex_shaper_t shaper, + const hb_segment_properties_t *props) { switch (shaper) { default: #define HB_COMPLEX_SHAPER_IMPLEMENT(name) \ - case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_normalization_preference_##name (); + case hb_ot_complex_shaper_##name: return _hb_ot_shape_complex_normalization_preference_##name (props); HB_COMPLEX_SHAPERS_IMPLEMENT_SHAPERS #undef HB_COMPLEX_SHAPER_IMPLEMENT } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 7831f908..c727fa6e 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -492,7 +492,9 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) hb_ensure_native_direction (c->buffer); - _hb_ot_shape_normalize (c->font, c->buffer, hb_ot_shape_complex_normalization_preference (c->plan->shaper)); + _hb_ot_shape_normalize (c->font, c->buffer, + hb_ot_shape_complex_normalization_preference (c->plan->shaper, + &c->buffer->props)); hb_ot_shape_setup_masks (c); -- GitLab