[buffer] Fix hb_buffer_append() pre/post-context logic
Part of https://github.com/harfbuzz/harfbuzz/pull/3150
This commit is contained in:
parent
33bfe9edd6
commit
4b5a81f13c
|
@ -1758,13 +1758,20 @@ hb_buffer_append (hb_buffer_t *buffer,
|
|||
|
||||
if (source->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE)
|
||||
{
|
||||
/* See similar logic in add_utf. */
|
||||
|
||||
/* pre-context */
|
||||
if (!orig_len && start + source->context_len[0] > 0)
|
||||
{
|
||||
buffer->clear_context (0);
|
||||
while (start > 0 && buffer->context_len[0] < buffer->CONTEXT_LENGTH)
|
||||
buffer->context[0][buffer->context_len[0]++] = source->info[--start].codepoint;
|
||||
for (auto i = 0u; i < source->context_len[0] && buffer->context_len[0] < buffer->CONTEXT_LENGTH; i++)
|
||||
buffer->context[0][buffer->context_len[0]++] = source->context[0][i];
|
||||
}
|
||||
|
||||
/* post-context */
|
||||
buffer->clear_context (1);
|
||||
while (end < source->len && buffer->context_len[1] < buffer->CONTEXT_LENGTH)
|
||||
buffer->context[1][buffer->context_len[1]++] = source->info[end++].codepoint;
|
||||
for (auto i = 0u; i < source->context_len[1] && buffer->context_len[1] < buffer->CONTEXT_LENGTH; i++)
|
||||
|
|
Loading…
Reference in New Issue