[layout] Speed up ClassDefFormat2 intersects
This commit is contained in:
parent
85e7263b38
commit
5596a73087
|
@ -1900,14 +1900,17 @@ struct ClassDefFormat2_4
|
||||||
|
|
||||||
bool intersects (const hb_set_t *glyphs) const
|
bool intersects (const hb_set_t *glyphs) const
|
||||||
{
|
{
|
||||||
/* TODO Speed up, using hb_set_next() and bsearch()? */
|
if (rangeRecord.len > glyphs->get_population () * hb_bit_storage ((unsigned) rangeRecord.len) / 2)
|
||||||
for (auto &range : rangeRecord)
|
|
||||||
{
|
{
|
||||||
if (range.intersects (*glyphs) && range.value)
|
for (hb_codepoint_t g = HB_SET_VALUE_INVALID; glyphs->next (&g);)
|
||||||
|
if (get_class (g))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return hb_any (+ hb_iter (rangeRecord)
|
||||||
|
| hb_map ([glyphs] (const RangeRecord<Types> &range) { return range.intersects (*glyphs) && range.value; }));
|
||||||
|
}
|
||||||
bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const
|
bool intersects_class (const hb_set_t *glyphs, uint16_t klass) const
|
||||||
{
|
{
|
||||||
if (klass == 0)
|
if (klass == 0)
|
||||||
|
|
Loading…
Reference in New Issue