2005-08-20 Yoshinori K. Okuji <okuji@enbug.org>

* kern/term.c (grub_putchar): Use grub_utf8_to_ucs4 for the
        conversion.
        (grub_getcharwidth): New function.

        * kern/misc.c (grub_utf8_to_ucs4): New function.

        * include/grub/term.h (struct grub_term): Added a new member
        "getcharwidth".
        (grub_getcharwidth): New prototype.

        * include/grub/misc.h (grub_utf8_to_ucs4): New prototype.

        * term/i386/pc/console.c (map_char): New function. Segregated from
        grub_console_putchar.
        (grub_console_putchar): Use map_char.
        (grub_console_getcharwidth): New function.
        (grub_console_term): Specified grub_console_getcharwidth as
        getcharwidth.

        * term/i386/pc/vga.c (grub_vga_getcharwidth): New function.
        (grub_vga_term): Specified grub_vga_getcharwidth as getcharwidth.

        * term/i386/pc/vesafb.c (grub_virtual_screen_setup): Return
        GRUB_ERRNO.
        (grub_vesafb_init): Do not use RC. Instead, use GRUB_ERRNO. Rely
        on grub_strtoul completely.
        (write_char): Declare local variables in the beginning of the
        function.
        (grub_vesafb_getcharwidth): New function.
        (grub_vesafb_term): Specified grub_vesafb_getcharwidth as
        getcharwidth.
This commit is contained in:
okuji 2005-08-20 05:26:51 +00:00
parent 1f0a95e481
commit ef0954341c
8 changed files with 205 additions and 117 deletions

View file

@ -472,6 +472,17 @@ grub_vga_putchar (grub_uint32_t c)
#endif
}
static grub_ssize_t
grub_vga_getcharwidth (grub_uint32_t c)
{
unsigned width;
if (! get_vga_glyph (c, 0, &width))
return 0;
return width;
}
static grub_uint16_t
grub_vga_getwh (void)
{
@ -570,6 +581,7 @@ static struct grub_term grub_vga_term =
.init = grub_vga_init,
.fini = grub_vga_fini,
.putchar = grub_vga_putchar,
.getcharwidth = grub_vga_getcharwidth,
.checkkey = grub_console_checkkey,
.getkey = grub_console_getkey,
.getwh = grub_vga_getwh,