[subset] Make ClassDef format2 .intersects() return false if range value 0

We treat Class0 as "doesn't intersect".  That's the only meaningful
interpretation. If one allos Class0 to mean "intersects", then the
intersects() result should be true iff glyphset is non-empty.

Related to https://github.com/harfbuzz/harfbuzz/issues/2703
This commit is contained in:
Behdad Esfahbod 2021-03-10 12:21:43 -07:00
parent e19de65eae
commit 3622120fab
1 changed files with 4 additions and 1 deletions

View File

@ -1969,8 +1969,11 @@ struct ClassDefFormat2
/* TODO Speed up, using hb_set_next() and bsearch()? */
unsigned int count = rangeRecord.len;
for (unsigned int i = 0; i < count; i++)
if (rangeRecord[i].intersects (glyphs))
{
const auto& range = rangeRecord[i];
if (range.intersects (glyphs) && range.value)
return true;
}
return false;
}
bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const