[layout] Move skippy_iter setup from constructor into init()
This commit is contained in:
parent
b051be542a
commit
514564f544
|
@ -684,7 +684,8 @@ struct PairPosFormat1
|
||||||
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
||||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
||||||
|
|
||||||
|
@ -754,7 +755,8 @@ struct PairPosFormat2
|
||||||
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
||||||
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
if (likely (index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
||||||
|
|
||||||
|
@ -904,7 +906,8 @@ struct CursivePosFormat1
|
||||||
const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)];
|
const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)];
|
||||||
if (!this_record.exitAnchor) return TRACE_RETURN (false);
|
if (!this_record.exitAnchor) return TRACE_RETURN (false);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
if (!skippy_iter.next ()) return TRACE_RETURN (false);
|
||||||
|
|
||||||
|
@ -1048,7 +1051,8 @@ struct MarkBasePosFormat1
|
||||||
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
|
||||||
/* now we search backwards for a non-mark glyph */
|
/* now we search backwards for a non-mark glyph */
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||||
do {
|
do {
|
||||||
|
@ -1153,7 +1157,8 @@ struct MarkLigPosFormat1
|
||||||
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
|
||||||
/* now we search backwards for a non-mark glyph */
|
/* now we search backwards for a non-mark glyph */
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||||
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
||||||
|
@ -1270,7 +1275,8 @@ struct MarkMarkPosFormat1
|
||||||
if (likely (mark1_index == NOT_COVERED)) return TRACE_RETURN (false);
|
if (likely (mark1_index == NOT_COVERED)) return TRACE_RETURN (false);
|
||||||
|
|
||||||
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
/* now we search backwards for a suitable mark glyph until a non-mark glyph */
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, 1);
|
skippy_iter.reset (buffer->idx, 1);
|
||||||
skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags);
|
skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags);
|
||||||
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
if (!skippy_iter.prev ()) return TRACE_RETURN (false);
|
||||||
|
|
|
@ -337,23 +337,22 @@ struct hb_apply_context_t
|
||||||
|
|
||||||
struct skipping_iterator_t
|
struct skipping_iterator_t
|
||||||
{
|
{
|
||||||
inline skipping_iterator_t (hb_apply_context_t *c_,
|
inline void init (hb_apply_context_t *c_, bool context_match = false)
|
||||||
bool context_match = false) :
|
|
||||||
idx (0),
|
|
||||||
c (c_),
|
|
||||||
match_glyph_data (NULL),
|
|
||||||
num_items (0),
|
|
||||||
end (0)
|
|
||||||
{
|
{
|
||||||
|
c = c_;
|
||||||
|
match_glyph_data = NULL,
|
||||||
|
matcher.set_match_func (NULL, NULL);
|
||||||
matcher.set_lookup_props (c->lookup_props);
|
matcher.set_lookup_props (c->lookup_props);
|
||||||
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
|
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
|
||||||
matcher.set_ignore_zwnj (context_match || c->table_index == 1);
|
matcher.set_ignore_zwnj (context_match || c->table_index == 1);
|
||||||
/* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */
|
/* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */
|
||||||
matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj);
|
matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj);
|
||||||
if (!context_match)
|
matcher.set_mask (context_match ? -1 : c->lookup_mask);
|
||||||
matcher.set_mask (c->lookup_mask);
|
}
|
||||||
|
inline void set_lookup_props (unsigned int lookup_props)
|
||||||
|
{
|
||||||
|
matcher.set_lookup_props (lookup_props);
|
||||||
}
|
}
|
||||||
inline void set_lookup_props (unsigned int lookup_props) { matcher.set_lookup_props (lookup_props); }
|
|
||||||
inline void set_match_func (matcher_t::match_func_t match_func,
|
inline void set_match_func (matcher_t::match_func_t match_func,
|
||||||
const void *match_data,
|
const void *match_data,
|
||||||
const USHORT glyph_data[])
|
const USHORT glyph_data[])
|
||||||
|
@ -705,7 +704,8 @@ static inline bool match_input (hb_apply_context_t *c,
|
||||||
|
|
||||||
hb_buffer_t *buffer = c->buffer;
|
hb_buffer_t *buffer = c->buffer;
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c);
|
||||||
skippy_iter.reset (buffer->idx, count - 1);
|
skippy_iter.reset (buffer->idx, count - 1);
|
||||||
skippy_iter.set_match_func (match_func, match_data, input);
|
skippy_iter.set_match_func (match_func, match_data, input);
|
||||||
|
|
||||||
|
@ -874,7 +874,8 @@ static inline bool match_backtrack (hb_apply_context_t *c,
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (NULL);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c, true);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c, true);
|
||||||
skippy_iter.reset (c->buffer->backtrack_len (), count);
|
skippy_iter.reset (c->buffer->backtrack_len (), count);
|
||||||
skippy_iter.set_match_func (match_func, match_data, backtrack);
|
skippy_iter.set_match_func (match_func, match_data, backtrack);
|
||||||
|
|
||||||
|
@ -894,7 +895,8 @@ static inline bool match_lookahead (hb_apply_context_t *c,
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (NULL);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t skippy_iter (c, true);
|
hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (c, true);
|
||||||
skippy_iter.reset (c->buffer->idx + offset - 1, count);
|
skippy_iter.reset (c->buffer->idx + offset - 1, count);
|
||||||
skippy_iter.set_match_func (match_func, match_data, lookahead);
|
skippy_iter.set_match_func (match_func, match_data, lookahead);
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,8 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
|
||||||
OT::hb_apply_context_t c (1, font, buffer);
|
OT::hb_apply_context_t c (1, font, buffer);
|
||||||
c.set_lookup_mask (plan->kern_mask);
|
c.set_lookup_mask (plan->kern_mask);
|
||||||
c.set_lookup_props (OT::LookupFlag::IgnoreMarks);
|
c.set_lookup_props (OT::LookupFlag::IgnoreMarks);
|
||||||
OT::hb_apply_context_t::skipping_iterator_t skippy_iter (&c);
|
OT::hb_apply_context_t::skipping_iterator_t skippy_iter;
|
||||||
|
skippy_iter.init (&c);
|
||||||
|
|
||||||
unsigned int count = buffer->len;
|
unsigned int count = buffer->len;
|
||||||
hb_glyph_info_t *info = buffer->info;
|
hb_glyph_info_t *info = buffer->info;
|
||||||
|
|
Loading…
Reference in New Issue