Another try to fix Mongolian free variation selectors

This reverts bf029281 and fixes it properly.  That commit
was not enough as it was only inheriting the shaping_action
for prev_action, but not curr_action.

Micro-test added.

https://code.google.com/p/chromium/issues/detail?id=393896
This commit is contained in:
Behdad Esfahbod 2014-07-17 14:16:38 -04:00
parent 5209c50506
commit 164c13d73f
5 changed files with 22 additions and 7 deletions

View File

@ -225,8 +225,6 @@ arabic_joining (hb_buffer_t *buffer)
unsigned int count = buffer->len;
unsigned int prev = (unsigned int) -1, state = 0;
HB_BUFFER_ALLOCATE_VAR (buffer, arabic_shaping_action);
/* Check pre-context */
if (!(buffer->flags & HB_BUFFER_FLAG_BOT))
for (unsigned int i = 0; i < buffer->context_len[0]; i++)
@ -253,8 +251,7 @@ arabic_joining (hb_buffer_t *buffer)
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
if (entry->prev_action != NONE && prev != (unsigned int) -1)
for (; prev < i; prev++)
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;
@ -275,9 +272,17 @@ arabic_joining (hb_buffer_t *buffer)
buffer->info[prev].arabic_shaping_action() = entry->prev_action;
break;
}
}
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
static void
mongolian_variation_selectors (hb_buffer_t *buffer)
{
/* Copy arabic_shaping_action() from base to Mongolian variation selectors. */
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 1; i < count; i++)
if (unlikely (hb_in_range (info[i].codepoint, 0x180Bu, 0x180Du)))
info[i].arabic_shaping_action() = info[i - 1].arabic_shaping_action();
}
static void
@ -285,12 +290,19 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font HB_UNUSED)
{
HB_BUFFER_ALLOCATE_VAR (buffer, arabic_shaping_action);
const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
arabic_joining (buffer);
if (plan->props.script == HB_SCRIPT_MONGOLIAN)
mongolian_variation_selectors (buffer);
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
buffer->info[i].mask |= arabic_plan->mask_array[buffer->info[i].arabic_shaping_action()];
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
}

View File

@ -122,8 +122,9 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
static inline hb_bool_t
is_variation_selector (hb_codepoint_t unicode)
{
/* U+180B..180D MONGOLIAN FREE VARIATION SELECTORs are handled in the
* Arabic shaper. No need to match them here. */
return unlikely (hb_in_ranges (unicode,
0x180Bu, 0x180Du, /* MONGOLIAN FREE VARIATION SELECTOR ONE..THREE */
0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
0xE0100u, 0xE01EFu)); /* VARIATION SELECTOR-17..256 */
}

View File

@ -3,4 +3,5 @@
4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf
d629e7fedc0b350222d7987345fe61613fa3929a.ttf
e207635780b42f898d58654b65098763e340f5c7.ttf
ef86fe710cfea877bbe0dbb6946a1f88d0661031.ttf
f499fbc23865022234775c43503bba2e63978fe1.ttf

View File

@ -1 +1,2 @@
fonts/sha1sum/37033cc5cf37bb223d7355153016b6ccece93b28.ttf:U+1826,U+180B,U+1826:[uni1826.E85E_ue.init1=0+599|uni1826.E856_ue.fina=2+750]
fonts/sha1sum/ef86fe710cfea877bbe0dbb6946a1f88d0661031.ttf:U+1820,U+180B:[uni1820.E821_a.isol1=0+1199]