From b710ea4fdeb1a620b396bd07665fc129fe5fc074 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 3 Oct 2018 21:17:59 +0200 Subject: [PATCH] Clean Fitzpatrick hack --- src/hb-ot-layout.hh | 2 +- src/hb-ot-shape.cc | 9 +++++++-- src/hb-unicode.hh | 20 -------------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 921fd8106..ac55459b6 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -214,7 +214,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) { hb_unicode_funcs_t *unicode = buffer->unicode; unsigned int u = info->codepoint; - unsigned int gen_cat = (unsigned int) unicode->modified_general_category (u); + unsigned int gen_cat = (unsigned int) unicode->general_category (u); unsigned int props = gen_cat; if (u >= 0x80) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 8c90e6898..748af9693 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -290,8 +290,13 @@ hb_set_unicode_props (hb_buffer_t *buffer) _hb_glyph_info_set_unicode_props (&info[i], buffer); /* Marks are already set as continuation by the above line. - * Handle ZWJ-continuation. */ - if (unlikely (_hb_glyph_info_is_zwj (&info[i]))) + * Handle Emoji_Modifier and ZWJ-continuation. */ + if (unlikely (_hb_glyph_info_get_general_category (&info[i]) == HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL && + hb_in_range (info[i].codepoint, 0x1F3FBu, 0x1F3FFu))) + { + _hb_glyph_info_set_continuation (&info[i]); + } + else if (unlikely (_hb_glyph_info_is_zwj (&info[i]))) { _hb_glyph_info_set_continuation (&info[i]); if (i + 1 < count && diff --git a/src/hb-unicode.hh b/src/hb-unicode.hh index 106fbf0aa..6d6a4fa0c 100644 --- a/src/hb-unicode.hh +++ b/src/hb-unicode.hh @@ -101,26 +101,6 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE return ret; } - - inline hb_unicode_general_category_t - modified_general_category (hb_codepoint_t u) - { - hb_unicode_general_category_t cat = general_category (u); - - if (unlikely (cat == HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)) - { - /* Recategorize emoji skin-tone modifiers as Unicode mark, so they - * behave correctly in non-native directionality. They originally - * are MODIFIER_SYMBOL. Fixes: - * https://github.com/harfbuzz/harfbuzz/issues/169 - */ - if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu))) - cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK; - } - - return cat; - } - inline unsigned int modified_combining_class (hb_codepoint_t u) {