Use hb_zip() some
This commit is contained in:
parent
200cdb721b
commit
f0dd0656b8
|
@ -145,26 +145,16 @@ struct SingleSubstFormat2
|
||||||
|
|
||||||
void closure (hb_closure_context_t *c) const
|
void closure (hb_closure_context_t *c) const
|
||||||
{
|
{
|
||||||
unsigned int count = substitute.len;
|
for (auto it = hb_zip (this+coverage, substitute); it; ++it)
|
||||||
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++)
|
if (c->glyphs->has (it->first))
|
||||||
{
|
c->out->add (it->second);
|
||||||
if (unlikely (iter.get_coverage () >= count))
|
|
||||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
|
||||||
if (c->glyphs->has (iter.get_glyph ()))
|
|
||||||
c->out->add (substitute[iter.get_coverage ()]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
void collect_glyphs (hb_collect_glyphs_context_t *c) const
|
||||||
{
|
{
|
||||||
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
|
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
|
||||||
unsigned int count = substitute.len;
|
for (auto it = hb_zip (this+coverage, substitute); it; ++it)
|
||||||
for (/*TODO(C++11)auto*/Coverage::iter_t iter = (this+coverage).iter (); iter; iter++)
|
c->output->add (it->second);
|
||||||
{
|
|
||||||
if (unlikely (iter.get_coverage () >= count))
|
|
||||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
|
||||||
c->output->add (substitute[iter.get_coverage ()]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Coverage &get_coverage () const { return this+coverage; }
|
const Coverage &get_coverage () const { return this+coverage; }
|
||||||
|
|
Loading…
Reference in New Issue