From 1a0f4aa6dfee69236b422f7c8825eff940f45c19 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 22 Dec 2016 13:33:54 -0600 Subject: [PATCH] Revert "Synthesize GDEF glyph class for any glyph that does not have one in GDEF" This reverts commit 69f9fbc4200442a35484d3c790ae8f4979be5d60. See https://github.com/behdad/harfbuzz/issues/347#issuecomment-268873401 Fixes https://github.com/behdad/harfbuzz/issues/347 --- src/hb-ot-layout-gsub-table.hh | 22 ++-------------------- src/hb-ot-shape.cc | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index a81cd79c2..66fcb3f3a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1321,28 +1321,10 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) const GDEF &gdef = *hb_ot_layout_from_face (font->face)->gdef; unsigned int count = buffer->len; - hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) { - unsigned int props = gdef.get_glyph_props (info[i].codepoint); - if (!props) - { - /* Never mark default-ignorables as marks. - * They won't get in the way of lookups anyway, - * but having them as mark will cause them to be skipped - * over if the lookup-flag says so, but at least for the - * Mongolian variation selectors, looks like Uniscribe - * marks them as non-mark. Some Mongolian fonts without - * GDEF rely on this. Another notable character that - * this applies to is COMBINING GRAPHEME JOINER. */ - props = (_hb_glyph_info_get_general_category (&info[i]) != - HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK || - _hb_glyph_info_is_default_ignorable (&info[i])) ? - HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : - HB_OT_LAYOUT_GLYPH_PROPS_MARK; - } - _hb_glyph_info_set_glyph_props (&info[i], props); - _hb_glyph_info_clear_lig_props (&info[i]); + _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); + _hb_glyph_info_clear_lig_props (&buffer->info[i]); buffer->info[i].syllable() = 0; } } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 987279878..cf916cc82 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -529,6 +529,32 @@ hb_ot_map_glyphs_fast (hb_buffer_t *buffer) buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS; } +static inline void +hb_synthesize_glyph_classes (hb_ot_shape_context_t *c) +{ + unsigned int count = c->buffer->len; + hb_glyph_info_t *info = c->buffer->info; + for (unsigned int i = 0; i < count; i++) + { + hb_ot_layout_glyph_props_flags_t klass; + + /* Never mark default-ignorables as marks. + * They won't get in the way of lookups anyway, + * but having them as mark will cause them to be skipped + * over if the lookup-flag says so, but at least for the + * Mongolian variation selectors, looks like Uniscribe + * marks them as non-mark. Some Mongolian fonts without + * GDEF rely on this. Another notable character that + * this applies to is COMBINING GRAPHEME JOINER. */ + klass = (_hb_glyph_info_get_general_category (&info[i]) != + HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK || + _hb_glyph_info_is_default_ignorable (&info[i])) ? + HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : + HB_OT_LAYOUT_GLYPH_PROPS_MARK; + _hb_glyph_info_set_glyph_props (&info[i], klass); + } +} + static inline void hb_ot_substitute_default (hb_ot_shape_context_t *c) { @@ -560,6 +586,9 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) hb_ot_layout_substitute_start (c->font, buffer); + if (!hb_ot_layout_has_glyph_classes (c->face)) + hb_synthesize_glyph_classes (c); + c->plan->substitute (c->font, buffer); return;