[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
pull/2893/head
Behdad Esfahbod 4 years ago
parent e19de65eae
commit 3622120fab
  1. 5
      src/hb-ot-layout-common.hh

@ -1969,8 +1969,11 @@ struct ClassDefFormat2
/* TODO Speed up, using hb_set_next() and bsearch()? */ /* TODO Speed up, using hb_set_next() and bsearch()? */
unsigned int count = rangeRecord.len; unsigned int count = rangeRecord.len;
for (unsigned int i = 0; i < count; i++) 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 true;
}
return false; return false;
} }
bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const

Loading…
Cancel
Save