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.
This commit is contained in:
Behdad Esfahbod 2013-04-04 23:06:54 -04:00
parent 1f97060985
commit 269de14dda
3 changed files with 5 additions and 13 deletions

View File

@ -74,12 +74,6 @@ collect_features_default (hb_ot_shape_planner_t *plan)
static hb_ot_shape_normalization_mode_t static hb_ot_shape_normalization_mode_t
normalization_preference_default (const hb_segment_properties_t *props) 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; return HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
} }

View File

@ -41,7 +41,6 @@ enum hb_ot_shape_normalization_mode_t {
HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED, 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, /* 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_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 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS
}; };

View File

@ -351,12 +351,11 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
while (buffer->idx < count) while (buffer->idx < count)
{ {
hb_codepoint_t composed, glyph; hb_codepoint_t composed, glyph;
if (/* If mode is NOT COMPOSED_FULL (ie. it's COMPOSED_DIACRITICS), we don't try to if (/* We don't try to compose a non-mark character with it's preceding starter.
* compose a non-mark character with it's preceding starter. This is just an * This is both an optimization to avoid trying to compose every two neighboring
* optimization to avoid trying to compose every two neighboring glyphs in most * glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul
* scripts. */ * fonts are not designed to mix-and-match pre-composed syllables and Jamo. */
(mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_FULL || HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())) &&
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 /* If there's anything between the starter and this char, they should have CCC
* smaller than this character's. */ * smaller than this character's. */
(starter == buffer->out_len - 1 || (starter == buffer->out_len - 1 ||