From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1C8gMA-0004cg-US for mharc-grub-devel@gnu.org; Sat, 18 Sep 2004 10:38:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C8gM9-0004cH-54 for grub-devel@gnu.org; Sat, 18 Sep 2004 10:38:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C8gM8-0004bn-3B for grub-devel@gnu.org; Sat, 18 Sep 2004 10:38:28 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C8gM7-0004bk-VG for grub-devel@gnu.org; Sat, 18 Sep 2004 10:38:28 -0400 Received: from [212.43.237.68] (helo=kotoba.storever.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C8gFs-0006TO-K6 for grub-devel@gnu.org; Sat, 18 Sep 2004 10:32:00 -0400 Received: from localhost (localhost [127.0.0.1]) by kotoba.storever.com (Postfix) with ESMTP id 1DFFDF54FE68 for ; Sat, 18 Sep 2004 16:31:58 +0200 (CEST) From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Sat, 18 Sep 2004 16:32:21 +0200 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200409181632.21893.okuji@enbug.org> Subject: terminal enhancement X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2004 14:38:29 -0000 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