[GPOS] Sanitize Cursive positioning anchors lazily

Speeds up Duployan-Regular.otf load time by 30%.
Doesn't seem to slow down shaping in a measurable way.
colr-paint-template
Behdad Esfahbod 1 year ago
parent fcb9e5915f
commit b382e616cc
  1. 10
      src/OT/Layout/GPOS/CursivePosFormat1.hh

@ -91,7 +91,13 @@ struct CursivePosFormat1
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this));
if (unlikely (!coverage.sanitize (c, this)))
return_trace (false);
if (c->lazy_some_gpos)
return_trace (entryExitRecord.sanitize_shallow (c));
else
return_trace (entryExitRecord.sanitize (c, this));
}
bool intersects (const hb_set_t *glyphs) const
@ -120,6 +126,7 @@ struct CursivePosFormat1
const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)];
if (!this_record.entryAnchor) return_trace (false);
if (unlikely (!this_record.sanitize (&c->sanitizer, this))) return_trace (false);
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset_fast (buffer->idx, 1);
@ -136,6 +143,7 @@ struct CursivePosFormat1
buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1);
return_trace (false);
}
if (unlikely (!prev_record.sanitize (&c->sanitizer, this))) return_trace (false);
unsigned int i = skippy_iter.idx;
unsigned int j = buffer->idx;

Loading…
Cancel
Save