+ void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
+ {
+ unsigned count = rangeRecord.len;
+ if (klass == 0)
+ {
+ hb_codepoint_t g = HB_SET_VALUE_INVALID;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (!hb_set_next (glyphs, &g))
+ break;
+ while (g != HB_SET_VALUE_INVALID && g < rangeRecord[i].first)
+ {
+ intersect_glyphs->add (g);
+ hb_set_next (glyphs, &g);
+ }
+ g = rangeRecord[i].last;
+ }
+ while (g != HB_SET_VALUE_INVALID && hb_set_next (glyphs, &g))
+ intersect_glyphs->add (g);
+
+ return;
+ }
+
+ hb_codepoint_t g = HB_SET_VALUE_INVALID;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (rangeRecord[i].value != klass) continue;
+
+ if (g != HB_SET_VALUE_INVALID)
+ {
+ if (g >= rangeRecord[i].first &&
+ g <= rangeRecord[i].last)
+ intersect_glyphs->add (g);
+ if (g > rangeRecord[i].last)
+ continue;
+ }
+
+ g = rangeRecord[i].first - 1;
+ while (hb_set_next (glyphs, &g))
+ {
+ if (g >= rangeRecord[i].first && g <= rangeRecord[i].last)
+ intersect_glyphs->add (g);
+ else if (g > rangeRecord[i].last)
+ break;
+ }
+ }
+ }
+
+ void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
+ {
+ if (glyphs->is_empty ()) return;
+
+ unsigned count = rangeRecord.len;
+ hb_codepoint_t g = HB_SET_VALUE_INVALID;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (!hb_set_next (glyphs, &g))
+ break;
+ if (g < rangeRecord[i].first)
+ {
+ intersect_classes->add (0);
+ break;
+ }
+ g = rangeRecord[i].last;
+ }
+ if (g != HB_SET_VALUE_INVALID && hb_set_next (glyphs, &g))
+ intersect_classes->add (0);
+
+ for (const RangeRecord& record : rangeRecord.iter ())
+ if (record.intersects (glyphs))
+ intersect_classes->add (record.value);
+ }
+