From 3622120fab4e7d324a1b5e8465e7a6cfeb246e8d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 10 Mar 2021 12:21:43 -0700 Subject: [PATCH] [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 --- src/hb-ot-layout-common.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 0a7e27b00..0ba7e3c06 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -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