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.
This commit is contained in:
Behdad Esfahbod 2012-07-30 14:53:41 -04:00
parent 7afb14407e
commit 7e34601ded
5 changed files with 18 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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
}

View File

@ -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);