提交 bdc2fc82 编写于 作者: B Behdad Esfahbod

[Arabic] Respect Arabic joining from neighboring context

Now we respect Arabic joining across runs.
上级 05207a79
...@@ -229,10 +229,23 @@ static void ...@@ -229,10 +229,23 @@ static void
arabic_joining (hb_buffer_t *buffer) arabic_joining (hb_buffer_t *buffer)
{ {
unsigned int count = buffer->len; 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); 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++) 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])); 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) ...@@ -244,7 +257,7 @@ arabic_joining (hb_buffer_t *buffer)
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type]; 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[prev].arabic_shaping_action() = entry->prev_action;
buffer->info[i].arabic_shaping_action() = entry->curr_action; buffer->info[i].arabic_shaping_action() = entry->curr_action;
...@@ -253,6 +266,20 @@ arabic_joining (hb_buffer_t *buffer) ...@@ -253,6 +266,20 @@ arabic_joining (hb_buffer_t *buffer)
state = entry->next_state; 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); HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册