[gsubgpos] Simplify OT::ClassDefFormat2::intersected_class_glyphs()
This commit is contained in:
parent
3261e05bdb
commit
137af3612b
|
@ -2057,8 +2057,9 @@ struct ClassDefFormat1
|
||||||
unsigned count = classValue.len;
|
unsigned count = classValue.len;
|
||||||
if (klass == 0)
|
if (klass == 0)
|
||||||
{
|
{
|
||||||
|
unsigned start_glyph = startGlyph;
|
||||||
for (unsigned g = HB_SET_VALUE_INVALID;
|
for (unsigned g = HB_SET_VALUE_INVALID;
|
||||||
hb_set_next (glyphs, &g) && g < startGlyph;)
|
hb_set_next (glyphs, &g) && g < start_glyph;)
|
||||||
intersect_glyphs->add (g);
|
intersect_glyphs->add (g);
|
||||||
|
|
||||||
for (unsigned g = startGlyph + count - 1;
|
for (unsigned g = startGlyph + count - 1;
|
||||||
|
@ -2070,7 +2071,19 @@ struct ClassDefFormat1
|
||||||
|
|
||||||
for (unsigned i = 0; i < count; i++)
|
for (unsigned i = 0; i < count; i++)
|
||||||
if (classValue[i] == klass && glyphs->has (startGlyph + i))
|
if (classValue[i] == klass && glyphs->has (startGlyph + i))
|
||||||
intersect_glyphs->add (startGlyph + i);
|
intersect_glyphs->add (startGlyph + i);
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* The following implementation is faster asymptotically, but slower
|
||||||
|
* in practice. */
|
||||||
|
unsigned start_glyph = startGlyph;
|
||||||
|
unsigned end_glyph = start_glyph + count;
|
||||||
|
for (unsigned g = startGlyph - 1;
|
||||||
|
hb_set_next (glyphs, &g) && g < end_glyph;)
|
||||||
|
if (classValue.arrayZ[g - start_glyph] == klass)
|
||||||
|
intersect_glyphs->add (g);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
|
void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
|
||||||
|
@ -2297,28 +2310,14 @@ struct ClassDefFormat2
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_codepoint_t g = HB_SET_VALUE_INVALID;
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (rangeRecord[i].value != klass) continue;
|
if (rangeRecord[i].value != klass) continue;
|
||||||
|
|
||||||
if (g != HB_SET_VALUE_INVALID)
|
unsigned end = rangeRecord[i].last + 1;
|
||||||
{
|
for (hb_codepoint_t g = rangeRecord[i].first - 1;
|
||||||
if (g >= rangeRecord[i].first &&
|
hb_set_next (glyphs, &g) && g < end;)
|
||||||
g <= rangeRecord[i].last)
|
intersect_glyphs->add (g);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue