Skip bidi if no RTL characters are present

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-07-02 20:37:08 +02:00
parent e8d0a8f85c
commit a06cec31e7

View file

@ -859,6 +859,7 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
unsigned run_start, run_end;
struct grub_unicode_glyph *visual;
unsigned cur_level;
int bidi_needed = 0;
auto void push_stack (unsigned new_override, unsigned new_level);
void push_stack (unsigned new_override, unsigned new_level)
@ -967,9 +968,11 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
switch (type)
{
case GRUB_BIDI_TYPE_RLE:
bidi_needed = 1;
push_stack (cur_override, (cur_level | 1) + 1);
break;
case GRUB_BIDI_TYPE_RLO:
bidi_needed = 1;
push_stack (OVERRIDE_R, (cur_level | 1) + 1);
break;
case GRUB_BIDI_TYPE_LRE:
@ -983,6 +986,9 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
break;
case GRUB_BIDI_TYPE_BN:
break;
case GRUB_BIDI_TYPE_R:
case GRUB_BIDI_TYPE_AL:
bidi_needed = 1;
default:
{
if (join_state == JOIN_FORCE)
@ -1017,6 +1023,8 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
}
}
if (bidi_needed)
{
for (run_start = 0; run_start < visual_len; run_start = run_end)
{
unsigned prev_level, next_level, cur_run_level;
@ -1178,6 +1186,12 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
continue;
}
}
}
else
{
for (i = 0; i < visual_len; i++)
levels[i] = 0;
}
grub_free (resolved_types);
{