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
This commit is contained in:
Behdad Esfahbod 2018-06-30 15:59:25 +04:30
parent 8b9cbe3b24
commit d3c0980ac2
1 changed files with 4 additions and 1 deletions

View File

@ -1074,10 +1074,13 @@ struct MarkBasePosFormat1
if (!skippy_iter.prev ()) return_trace (false); if (!skippy_iter.prev ()) return_trace (false);
/* We only want to attach to the first of a MultipleSubst sequence. /* We only want to attach to the first of a MultipleSubst sequence.
* https://github.com/harfbuzz/harfbuzz/issues/740 * 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]) || if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) || 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
(skippy_iter.idx == 0 || (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]) !=
_hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) || _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
_hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) != _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=