|
|
|
@ -1247,11 +1247,15 @@ struct SubstLookup : Lookup |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index); |
|
|
|
|
inline bool apply_string (hb_apply_context_t *c, const hb_set_digest_t *digest) const |
|
|
|
|
inline bool apply_string (hb_apply_context_t *c, |
|
|
|
|
unsigned int start, |
|
|
|
|
unsigned int end, |
|
|
|
|
const hb_set_digest_t *digest) const |
|
|
|
|
{ |
|
|
|
|
bool ret = false; |
|
|
|
|
end = MIN (end, c->buffer->len); |
|
|
|
|
|
|
|
|
|
if (unlikely (!c->buffer->len || !c->lookup_mask)) |
|
|
|
|
if (unlikely (start >= end || !c->lookup_mask)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
c->set_recurse_func (apply_recurse_func); |
|
|
|
@ -1261,9 +1265,10 @@ struct SubstLookup : Lookup |
|
|
|
|
{ |
|
|
|
|
/* in/out forward substitution */ |
|
|
|
|
c->buffer->clear_output (); |
|
|
|
|
c->buffer->idx = 0; |
|
|
|
|
|
|
|
|
|
while (c->buffer->idx < c->buffer->len) |
|
|
|
|
c->buffer->idx = start; |
|
|
|
|
|
|
|
|
|
while (c->buffer->idx < end) |
|
|
|
|
{ |
|
|
|
|
if (digest->may_have (c->buffer->cur().codepoint) && |
|
|
|
|
(c->buffer->cur().mask & c->lookup_mask) && |
|
|
|
@ -1272,14 +1277,15 @@ struct SubstLookup : Lookup |
|
|
|
|
else |
|
|
|
|
c->buffer->next_glyph (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ret) |
|
|
|
|
c->buffer->swap_buffers (); |
|
|
|
|
c->buffer->swap_buffers (); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
/* in-place backward substitution */ |
|
|
|
|
c->buffer->remove_output (); |
|
|
|
|
c->buffer->idx = c->buffer->len - 1; |
|
|
|
|
c->buffer->idx = end - 1; |
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
if (digest->may_have (c->buffer->cur().codepoint) && |
|
|
|
@ -1288,9 +1294,8 @@ struct SubstLookup : Lookup |
|
|
|
|
ret = true; |
|
|
|
|
else |
|
|
|
|
c->buffer->idx--; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
while ((int) c->buffer->idx >= 0); |
|
|
|
|
while ((int) c->buffer->idx >= (int) start); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|