From c67c0086ef66e05228f9cc1f4c169f690e130511 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 1 Mar 2023 13:32:44 -0700 Subject: [PATCH] [GPOS] Fix indexing in MarkLigPos This was broken in 8708b9e081. Fixes https://github.com/harfbuzz/harfbuzz/issues/4142 --- src/OT/Layout/GPOS/MarkLigPosFormat1.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/OT/Layout/GPOS/MarkLigPosFormat1.hh b/src/OT/Layout/GPOS/MarkLigPosFormat1.hh index 7e7b438aa..92e83a0e9 100644 --- a/src/OT/Layout/GPOS/MarkLigPosFormat1.hh +++ b/src/OT/Layout/GPOS/MarkLigPosFormat1.hh @@ -126,15 +126,15 @@ struct MarkLigPosFormat1_2 return_trace (false); } - j = (unsigned) c->last_base; + unsigned idx = (unsigned) c->last_base; /* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */ - //if (!_hb_glyph_info_is_ligature (&buffer->info[j])) { return_trace (false); } + //if (!_hb_glyph_info_is_ligature (&buffer->info[idx])) { return_trace (false); } - unsigned int lig_index = (this+ligatureCoverage).get_coverage (buffer->info[j].codepoint); + unsigned int lig_index = (this+ligatureCoverage).get_coverage (buffer->info[idx].codepoint); if (lig_index == NOT_COVERED) { - buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1); + buffer->unsafe_to_concat_from_outbuffer (idx, buffer->idx + 1); return_trace (false); } @@ -145,7 +145,7 @@ struct MarkLigPosFormat1_2 unsigned int comp_count = lig_attach.rows; if (unlikely (!comp_count)) { - buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1); + buffer->unsafe_to_concat_from_outbuffer (idx, buffer->idx + 1); return_trace (false); } @@ -154,7 +154,7 @@ struct MarkLigPosFormat1_2 * can directly use the component index. If not, we attach the mark * glyph to the last component of the ligature. */ unsigned int comp_index; - unsigned int lig_id = _hb_glyph_info_get_lig_id (&buffer->info[j]); + unsigned int lig_id = _hb_glyph_info_get_lig_id (&buffer->info[idx]); unsigned int mark_id = _hb_glyph_info_get_lig_id (&buffer->cur()); unsigned int mark_comp = _hb_glyph_info_get_lig_comp (&buffer->cur()); if (lig_id && lig_id == mark_id && mark_comp > 0) @@ -162,7 +162,7 @@ struct MarkLigPosFormat1_2 else comp_index = comp_count - 1; - return_trace ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j)); + return_trace ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, idx)); } bool subset (hb_subset_context_t *c) const