Fix EFI and IEEE1275
This commit is contained in:
parent
023e3a5ca7
commit
9a3355cfde
2 changed files with 30 additions and 61 deletions
|
@ -85,29 +85,35 @@ map_char (grub_uint32_t c)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_putchar (grub_uint32_t c)
|
||||
grub_console_putchar (const struct grub_unicode_glyph *c)
|
||||
{
|
||||
grub_efi_char16_t str[2];
|
||||
grub_efi_char16_t str[2 + c->ncomb];
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
unsigned i, j;
|
||||
|
||||
o = grub_efi_system_table->con_out;
|
||||
|
||||
/* For now, do not try to use a surrogate pair. */
|
||||
if (c > 0xffff)
|
||||
c = '?';
|
||||
|
||||
str[0] = (grub_efi_char16_t) map_char (c & 0xffff);
|
||||
str[1] = 0;
|
||||
if (c->base > 0xffff)
|
||||
str[0] = '?';
|
||||
else
|
||||
str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff);
|
||||
j = 1;
|
||||
for (i = 0; i < c->ncomb; i++)
|
||||
if (c->base < 0xffff)
|
||||
str[j++] = c->combining[i].code;
|
||||
str[j] = 0;
|
||||
|
||||
/* Should this test be cached? */
|
||||
if (c > 0x7f && efi_call_2 (o->test_string, o, str) != GRUB_EFI_SUCCESS)
|
||||
if ((c->base > 0x7f || c->ncomb)
|
||||
&& efi_call_2 (o->test_string, o, str) != GRUB_EFI_SUCCESS)
|
||||
return;
|
||||
|
||||
efi_call_2 (o->output_string, o, str);
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_console_getcharwidth (grub_uint32_t c __attribute__ ((unused)))
|
||||
grub_console_getcharwidth (const struct grub_unicode_glyph *c __attribute__ ((unused)))
|
||||
{
|
||||
/* For now, every printable character has the width 1. */
|
||||
return 1;
|
||||
|
@ -351,7 +357,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_UCS4_VISUAL
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -76,60 +76,18 @@ grub_ofconsole_writeesc (const char *str)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_putchar (grub_uint32_t c)
|
||||
grub_ofconsole_putchar (const struct grub_unicode_glyph *c)
|
||||
{
|
||||
char chr;
|
||||
|
||||
if (c > 0x7F)
|
||||
{
|
||||
/* Better than nothing. */
|
||||
switch (c)
|
||||
{
|
||||
case GRUB_TERM_DISP_LEFT:
|
||||
c = '<';
|
||||
break;
|
||||
chr = c->base;
|
||||
|
||||
case GRUB_TERM_DISP_UP:
|
||||
c = '^';
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DISP_RIGHT:
|
||||
c = '>';
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DISP_DOWN:
|
||||
c = 'v';
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DISP_HLINE:
|
||||
c = '-';
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DISP_VLINE:
|
||||
c = '|';
|
||||
break;
|
||||
|
||||
case GRUB_TERM_DISP_UL:
|
||||
case GRUB_TERM_DISP_UR:
|
||||
case GRUB_TERM_DISP_LL:
|
||||
case GRUB_TERM_DISP_LR:
|
||||
c = '+';
|
||||
break;
|
||||
|
||||
default:
|
||||
c = '?';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
chr = c;
|
||||
|
||||
if (c == '\n')
|
||||
if (chr == '\n')
|
||||
{
|
||||
grub_curr_y++;
|
||||
grub_curr_x = 0;
|
||||
}
|
||||
else if (c == '\r')
|
||||
else if (chr == '\r')
|
||||
{
|
||||
grub_curr_x = 0;
|
||||
}
|
||||
|
@ -138,16 +96,19 @@ grub_ofconsole_putchar (grub_uint32_t c)
|
|||
grub_curr_x++;
|
||||
if (grub_curr_x >= grub_ofconsole_width)
|
||||
{
|
||||
grub_ofconsole_putchar ('\n');
|
||||
grub_ofconsole_putchar ('\r');
|
||||
grub_curr_x++;
|
||||
chr = '\n';
|
||||
grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||
chr = '\r';
|
||||
grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||
grub_curr_y++;
|
||||
grub_curr_x = 1;
|
||||
}
|
||||
}
|
||||
grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_ofconsole_getcharwidth (grub_uint32_t c __attribute__((unused)))
|
||||
grub_ofconsole_getcharwidth (const struct grub_unicode_glyph *c __attribute__((unused)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -497,7 +458,8 @@ static struct grub_term_output grub_ofconsole_term_output =
|
|||
.setcolor = grub_ofconsole_setcolor,
|
||||
.getcolor = grub_ofconsole_getcolor,
|
||||
.setcursor = grub_ofconsole_setcursor,
|
||||
.refresh = grub_ofconsole_refresh
|
||||
.refresh = grub_ofconsole_refresh,
|
||||
.flags = GRUB_TERM_CODE_TYPE_ASCII
|
||||
};
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue