diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 9516ae6ec..ea592371f 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -685,7 +685,6 @@ struct PairPosFormat1 if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, buffer->idx, 1); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); if (!skippy_iter.next ()) return TRACE_RETURN (false); return TRACE_RETURN ((this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx)); @@ -755,7 +754,6 @@ struct PairPosFormat2 if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, buffer->idx, 1); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); if (!skippy_iter.next ()) return TRACE_RETURN (false); unsigned int len1 = valueFormat1.get_len (); @@ -905,7 +903,6 @@ struct CursivePosFormat1 if (!this_record.exitAnchor) return TRACE_RETURN (false); hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, buffer->idx, 1); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); if (!skippy_iter.next ()) return TRACE_RETURN (false); const EntryExitRecord &next_record = entryExitRecord[(this+coverage).get_coverage (buffer->info[skippy_iter.idx].codepoint)]; diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 332a7e730..6c1b5d98c 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -420,12 +420,11 @@ struct hb_apply_context_t match_glyph_data = glyph_data; } - inline bool has_no_chance (void) const { return unlikely (num_items && idx + num_items >= end); } inline void reject (void) { num_items++; match_glyph_data--; } inline bool next (void) { assert (num_items > 0); - while (!has_no_chance ()) + while (idx + num_items < end) { idx++; const hb_glyph_info_t &info = c->buffer->info[idx]; @@ -489,12 +488,11 @@ struct hb_apply_context_t match_glyph_data = glyph_data; } - inline bool has_no_chance (void) const { return unlikely (idx < num_items); } inline void reject (void) { num_items++; } inline bool prev (void) { assert (num_items > 0); - while (!has_no_chance ()) + while (idx >= num_items) { idx--; const hb_glyph_info_t &info = c->buffer->out_info[idx]; @@ -741,7 +739,6 @@ static inline bool match_input (hb_apply_context_t *c, hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, buffer->idx, count - 1); skippy_iter.set_match_func (match_func, match_data, input); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); /* * This is perhaps the trickiest part of OpenType... Remarks: @@ -910,7 +907,6 @@ static inline bool match_backtrack (hb_apply_context_t *c, hb_apply_context_t::skipping_backward_iterator_t skippy_iter (c, c->buffer->backtrack_len (), count, true); skippy_iter.set_match_func (match_func, match_data, backtrack); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); for (unsigned int i = 0; i < count; i++) if (!skippy_iter.prev ()) @@ -930,7 +926,6 @@ static inline bool match_lookahead (hb_apply_context_t *c, hb_apply_context_t::skipping_forward_iterator_t skippy_iter (c, c->buffer->idx + offset - 1, count, true); skippy_iter.set_match_func (match_func, match_data, lookahead); - if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); for (unsigned int i = 0; i < count; i++) if (!skippy_iter.next ())