[Arabic] Respect Arabic joining from neighboring context
Now we respect Arabic joining across runs.
This commit is contained in:
parent
05207a79e0
commit
bdc2fc8294
|
@ -229,10 +229,23 @@ static void
|
|||
arabic_joining (hb_buffer_t *buffer)
|
||||
{
|
||||
unsigned int count = buffer->len;
|
||||
unsigned int prev = 0, state = 0;
|
||||
unsigned int prev = (unsigned int) -1, state = 0;
|
||||
|
||||
HB_BUFFER_ALLOCATE_VAR (buffer, arabic_shaping_action);
|
||||
|
||||
/* Check pre-context */
|
||||
for (unsigned int i = 0; i < buffer->context_len[0]; i++)
|
||||
{
|
||||
unsigned int this_type = get_joining_type (buffer->context[0][i], buffer->unicode->general_category (buffer->context[0][i]));
|
||||
|
||||
if (unlikely (this_type == JOINING_TYPE_T))
|
||||
continue;
|
||||
|
||||
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
|
||||
state = entry->next_state;
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
unsigned int this_type = get_joining_type (buffer->info[i].codepoint, _hb_glyph_info_get_general_category (&buffer->info[i]));
|
||||
|
@ -244,7 +257,7 @@ arabic_joining (hb_buffer_t *buffer)
|
|||
|
||||
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
|
||||
|
||||
if (entry->prev_action != NONE)
|
||||
if (entry->prev_action != NONE && prev != (unsigned int) -1)
|
||||
buffer->info[prev].arabic_shaping_action() = entry->prev_action;
|
||||
|
||||
buffer->info[i].arabic_shaping_action() = entry->curr_action;
|
||||
|
@ -253,6 +266,20 @@ arabic_joining (hb_buffer_t *buffer)
|
|||
state = entry->next_state;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < buffer->context_len[1]; i++)
|
||||
{
|
||||
unsigned int this_type = get_joining_type (buffer->context[1][i], buffer->unicode->general_category (buffer->context[0][i]));
|
||||
|
||||
if (unlikely (this_type == JOINING_TYPE_T))
|
||||
continue;
|
||||
|
||||
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
|
||||
if (entry->prev_action != NONE && prev != (unsigned int) -1)
|
||||
buffer->info[prev].arabic_shaping_action() = entry->prev_action;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue