From d3c0980ac234698627cb281e5526cc99139eed30 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 30 Jun 2018 15:59:25 +0430 Subject: [PATCH] Adjust MarkBasePos heuristic in presence of MultipleSubst From the issue: "In this font, the virama,ya first forms a ligature, then decomposes back to virama,ya. This causes those two to be marked parts of a MultipleSubst sequence. When attaching the matra, we look for the first of the MultipleSubst sequence because that's where we attach to (because of eg #740). In this case, the first glyph in the MultipleSubst sequence is a mark, so we skip it and attach to the base char before it." Font in question is Nirmala UI from Windows 10. Test sequence: U+0926,U+094D,U+092F,U+0941 Fixes https://github.com/harfbuzz/harfbuzz/issues/1020 --- src/hb-ot-layout-gpos-table.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index bc8a5fd6b..182c8d909 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1074,10 +1074,13 @@ struct MarkBasePosFormat1 if (!skippy_iter.prev ()) return_trace (false); /* We only want to attach to the first of a MultipleSubst sequence. * https://github.com/harfbuzz/harfbuzz/issues/740 - * Reject others. */ + * Reject others... + * ...but stop if we find a mark in the MultipleSubst sequence: + * https://github.com/harfbuzz/harfbuzz/issues/1020 */ if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) || 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) || (skippy_iter.idx == 0 || + _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx - 1]) || _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) != _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) || _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=