diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 2354aeb21..b86649d77 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -222,9 +222,10 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, (void) buffer->next_glyph (); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_VARIATION_SELECTOR_FALLBACK; - _hb_glyph_info_set_general_category (&buffer->cur(), _HB_UNICODE_GENERAL_CATEGORY_VARIATION_SELECTOR); + if (buffer->not_found_variation_selector != HB_CODEPOINT_INVALID) + _hb_glyph_info_clear_default_ignorable (&buffer->cur()); set_glyph (buffer->cur(), font); (void) buffer->next_glyph (); diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 74d958d09..1aca39101 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -846,14 +846,16 @@ hb_ot_deal_with_variation_selectors (hb_buffer_t *buffer) unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; + hb_glyph_position_t *pos = buffer->pos; for (unsigned int i = 0; i < count; i++) { if (_hb_glyph_info_get_general_category (&info[i]) == _HB_UNICODE_GENERAL_CATEGORY_VARIATION_SELECTOR) { - _hb_glyph_info_clear_default_ignorable (&info[i]); info[i].codepoint = buffer->not_found_variation_selector; + pos[i].x_advance = pos[i].y_advance = pos[i].x_offset = pos[i].y_offset = 0; + _hb_glyph_info_set_general_category (&info[i], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK); } } } diff --git a/test/shape/data/in-house/tests/variation-selectors.tests b/test/shape/data/in-house/tests/variation-selectors.tests index 723e2cd5c..bcf656489 100644 --- a/test/shape/data/in-house/tests/variation-selectors.tests +++ b/test/shape/data/in-house/tests/variation-selectors.tests @@ -1,2 +1,2 @@ ../fonts/bbc24004e776f348a0f72287d24b0124867ee750.ttf;;U+0066,U+FE00,U+0069;[gid5=0+1134|gid1=0+0] -../fonts/bbc24004e776f348a0f72287d24b0124867ee750.ttf;--not-found-variation-selector-glyph=1000000;U+0066,U+FE00,U+0069;[gid5=0+1134|gid1000000=0+0] +../fonts/bbc24004e776f348a0f72287d24b0124867ee750.ttf;--not-found-variation-selector-glyph=1000000;U+0066,U+FE00,U+0069;[gid2=0+711|gid1000000=0+0|gid3=2+497]