1057 inline const Coverage &get_coverage (void) const
1058 {
1059 return this+markCoverage;
1060 }
1061
1062 inline bool apply (hb_ot_apply_context_t *c) const
1063 {
1064 TRACE_APPLY (this);
1065 hb_buffer_t *buffer = c->buffer;
1066 unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
1067 if (likely (mark_index == NOT_COVERED)) return_trace (false);
1068
1069 /* Now we search backwards for a non-mark glyph */
1070 hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
1071 skippy_iter.reset (buffer->idx, 1);
1072 skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
1073 do {
1074 if (!skippy_iter.prev ()) return_trace (false);
1075 /* We only want to attach to the first of a MultipleSubst sequence.
1076 * https://github.com/harfbuzz/harfbuzz/issues/740
1077 * Reject others. */
1078 if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
1079 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
1080 (skippy_iter.idx == 0 ||
1081 _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) !=
1082 _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
1083 _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=
1084 _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx - 1]) + 1
1085 ))
1086 break;
1087 skippy_iter.reject ();
1088 } while (1);
1089
1090 /* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
1091 //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
1092
1093 unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
1094 if (base_index == NOT_COVERED) return_trace (false);
1095
1096 return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx));
1097 }
1098
1099 inline bool sanitize (hb_sanitize_context_t *c) const
1100 {
|
1057 inline const Coverage &get_coverage (void) const
1058 {
1059 return this+markCoverage;
1060 }
1061
1062 inline bool apply (hb_ot_apply_context_t *c) const
1063 {
1064 TRACE_APPLY (this);
1065 hb_buffer_t *buffer = c->buffer;
1066 unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
1067 if (likely (mark_index == NOT_COVERED)) return_trace (false);
1068
1069 /* Now we search backwards for a non-mark glyph */
1070 hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
1071 skippy_iter.reset (buffer->idx, 1);
1072 skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
1073 do {
1074 if (!skippy_iter.prev ()) return_trace (false);
1075 /* We only want to attach to the first of a MultipleSubst sequence.
1076 * https://github.com/harfbuzz/harfbuzz/issues/740
1077 * Reject others...
1078 * ...but stop if we find a mark in the MultipleSubst sequence:
1079 * https://github.com/harfbuzz/harfbuzz/issues/1020 */
1080 if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
1081 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
1082 (skippy_iter.idx == 0 ||
1083 _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx - 1]) ||
1084 _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) !=
1085 _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
1086 _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=
1087 _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx - 1]) + 1
1088 ))
1089 break;
1090 skippy_iter.reject ();
1091 } while (1);
1092
1093 /* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
1094 //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
1095
1096 unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
1097 if (base_index == NOT_COVERED) return_trace (false);
1098
1099 return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx));
1100 }
1101
1102 inline bool sanitize (hb_sanitize_context_t *c) const
1103 {
|