From 269de14dda7a86a20917fa9ea6a5864929c41364 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 4 Apr 2013 23:06:54 -0400 Subject: [PATCH] Don't compose Hangul jamo See thread "an issue regarding discrepancy between Korean and Unicode standards" on the mailing list for the rationale. In short: Uniscribe doesn't, so fonts are designed to work without it. --- src/hb-ot-shape-complex-default.cc | 6 ------ src/hb-ot-shape-normalize-private.hh | 1 - src/hb-ot-shape-normalize.cc | 11 +++++------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc index fad57f65e..ca092b5e9 100644 --- a/src/hb-ot-shape-complex-default.cc +++ b/src/hb-ot-shape-complex-default.cc @@ -74,12 +74,6 @@ collect_features_default (hb_ot_shape_planner_t *plan) static hb_ot_shape_normalization_mode_t 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; } diff --git a/src/hb-ot-shape-normalize-private.hh b/src/hb-ot-shape-normalize-private.hh index 8112f03ae..085d48511 100644 --- a/src/hb-ot-shape-normalize-private.hh +++ b/src/hb-ot-shape-normalize-private.hh @@ -41,7 +41,6 @@ enum hb_ot_shape_normalization_mode_t { HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED, HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS, /* never composes base-to-base */ HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, /* always fully decomposes and then recompose back */ - HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL, /* including base-to-base composition */ HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS }; diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 2d2b2dd0d..7f83d9d25 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -351,12 +351,11 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, while (buffer->idx < count) { hb_codepoint_t composed, glyph; - if (/* If mode is NOT COMPOSED_FULL (ie. it's COMPOSED_DIACRITICS), we don't try to - * compose a non-mark character with it's preceding starter. This is just an - * optimization to avoid trying to compose every two neighboring glyphs in most - * scripts. */ - (mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL || - HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur()))) && + if (/* We don't try to compose a non-mark character with it's preceding starter. + * This is both an optimization to avoid trying to compose every two neighboring + * glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul + * fonts are not designed to mix-and-match pre-composed syllables and Jamo. */ + HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())) && /* If there's anything between the starter and this char, they should have CCC * smaller than this character's. */ (starter == buffer->out_len - 1 ||