grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

terminal enhancement


From: Yoshinori K. Okuji
Subject: terminal enhancement
Date: Sat, 18 Sep 2004 16:32:21 +0200
User-agent: KMail/1.6.1

To support Unicode in the menu interface, I think we need to add one 
more function into the terminal system. For now, the menu only thinks 
about ASCII characters. So the number of bytes in a string is identical 
to the number of columns to be used for displaying the string.

This is not true, generally speaking. In UTF-8, most Latin characters 
are 2-bytes but one column is used to show each character. Simply 
speaking, width(string) != length(string).

In POSIX, the function wcwidth is defined to get the width of a string 
of wide characters. We need a similar function in GRUB.

Basically, only terminal drivers know how many columns are used for a 
given string. If a terminal driver uses the font manager completely, we 
can get the information from the font manager, but not all terminals 
use the font manager (such as the PC console).

So I'd like to propose adding a new member 'getwidth' into struct 
grub_term. This function would be like this:

int
getwidth (grub_uint32_t code)
{
  /* CODE is encoded in UCS-4.  */

  /* Do something here.  */

  width = ...;
  return width;
}

Anyway, you need this kind of function to implement a terminal.

What do you think?

Okuji




reply via email to

[Prev in Thread] Current Thread [Next in Thread]