bidi works in terminal in grub-emu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-15 21:14:11 +01:00
parent dfed5c6bb4
commit 0a239a8211
23 changed files with 1101 additions and 799 deletions

View file

@ -65,7 +65,8 @@ static struct grub_term_output grub_console_term_output =
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_console_setcursor
.setcursor = grub_console_setcursor,
.flags = GRUB_TERM_CODE_TYPE_VGA
};
void

View file

@ -214,45 +214,7 @@ grub_virtual_screen_get_glyph (grub_uint32_t code,
unsigned *width)
{
if (code > 0x7f)
{
/* Map some unicode characters to the VGA font, if possible. */
switch (code)
{
case 0x2190: /* left arrow */
code = 0x1b;
break;
case 0x2191: /* up arrow */
code = 0x18;
break;
case 0x2192: /* right arrow */
code = 0x1a;
break;
case 0x2193: /* down arrow */
code = 0x19;
break;
case 0x2501: /* horizontal line */
code = 0xc4;
break;
case 0x2503: /* vertical line */
code = 0xb3;
break;
case 0x250F: /* upper-left corner */
code = 0xda;
break;
case 0x2513: /* upper-right corner */
code = 0xbf;
break;
case 0x2517: /* lower-left corner */
code = 0xc0;
break;
case 0x251B: /* lower-right corner */
code = 0xd9;
break;
default:
return grub_font_get_glyph_any (code, bitmap, width);
}
}
return grub_font_get_glyph_any (code, bitmap, width);
/* TODO This is wrong for the new font module. Should it be fixed? */
if (bitmap)
@ -592,7 +554,7 @@ static struct grub_term_output grub_vesafb_term =
.cls = grub_vesafb_cls,
.setcolorstate = grub_virtual_screen_setcolorstate,
.setcursor = grub_vesafb_setcursor,
.flags = 0,
.flags = GRUB_TERM_CODE_TYPE_VGA
};
GRUB_MOD_INIT(vesafb)

View file

@ -287,23 +287,23 @@ scroll_up (void)
}
static void
grub_vga_putchar (grub_uint32_t c)
grub_vga_putchar (const struct grub_unicode_glyph *c)
{
#if DEBUG_VGA
static int show = 1;
#endif
if (c == '\a')
if (c->base == '\a')
/* FIXME */
return;
if (c == '\b' || c == '\n' || c == '\r')
if (c->base == '\b' || c->base == '\n' || c->base == '\r')
{
/* Erase current cursor, if any. */
if (cursor_state)
write_char ();
switch (c)
switch (c->base)
{
case '\b':
if (xpos > 0)
@ -331,13 +331,19 @@ grub_vga_putchar (grub_uint32_t c)
struct colored_char *p;
unsigned char_width = 1;
glyph = grub_font_get_glyph(font, c);
glyph = grub_font_get_glyph(font, c->base);
if (xpos + char_width > TEXT_WIDTH)
grub_vga_putchar ('\n');
{
xpos = 0;
if (ypos >= TEXT_HEIGHT - 1)
scroll_up ();
else
ypos++;
}
p = text_buf + xpos + ypos * TEXT_WIDTH;
p->code = c;
p->code = c->base;
p->fg_color = fg_color;
p->bg_color = bg_color;
p->width = char_width - 1;
@ -387,12 +393,12 @@ grub_vga_putchar (grub_uint32_t c)
}
static grub_ssize_t
grub_vga_getcharwidth (grub_uint32_t c)
grub_vga_getcharwidth (const struct grub_unicode_glyph *c)
{
#if 0
struct grub_font_glyph glyph;
glyph = grub_font_get_glyph (c);
glyph = grub_font_get_glyph (c->base);
return glyph.char_width;
#else
@ -499,7 +505,7 @@ static struct grub_term_output grub_vga_term =
.cls = grub_vga_cls,
.setcolorstate = grub_vga_setcolorstate,
.setcursor = grub_vga_setcursor,
.flags = 0,
.flags = GRUB_TERM_CODE_TYPE_UCS4_VISUAL,
};
GRUB_MOD_INIT(vga)

View file

@ -164,6 +164,7 @@ static struct grub_term_output grub_vga_text_term =
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_vga_text_setcursor,
.flags = GRUB_TERM_CODE_TYPE_VGA
};
GRUB_MOD_INIT(vga_text)