From 45e3044ed47fcaab15579da516df8922b3b48954 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Sun, 1 Aug 2010 13:52:04 +0200 Subject: Add wide character support to the Hurd console * hurd/console.h (CONS_WCHAR_MASK, CONS_WCHAR_CONTINUED): New macros. * console/console.c: Include (main): Call setlocale. * console/display.c (display_output_one): Call wcwidth() to know the width of the character to be displayed. Iterate over this with to insert characters with the additional CONS_WCHAR_CONTINUED flag. Update screen_shift_right and display_record_filechange calls accordingly. * console-client/vga-dynafont.c (WCHAR_BOLD, WCHAR_ITALIC, WCHAR_MASK): Change macro values. (dynafont_new): Use glyph->bbox.{width,height} instead of df->font->bbox.{width,height}. (dynafont_change_font): Likewise. (dynafont_lookup_internal): Likewise. Mask out CONS_WCHAR_CONTINUED before calling bdf_find_glyph, but test it for the second position of a double-width glyph. (dynafont_activate): Enable 9-bit width only when font width is not dividable by 8. --- hurd/console.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'hurd/console.h') diff --git a/hurd/console.h b/hurd/console.h index 065ed7d2..16bc068d 100644 --- a/hurd/console.h +++ b/hurd/console.h @@ -50,7 +50,13 @@ typedef struct uint32_t italic : 1; uint32_t bold : 1; } conchar_attr_t; - + +/* We support double-width characters by using an extra bit to identify the + continuation in the character matrix. The constants below document our + usage of wchar_t. */ +#define CONS_WCHAR_MASK ((wchar_t) 0x401fffff) +#define CONS_WCHAR_CONTINUED ((wchar_t) 0x40000000) + typedef struct { wchar_t chr; -- cgit v1.2.3