From d7fd78dc3d95747639cbbd42c28cf77c22c26543 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 9 May 2010 13:20:35 +0200 Subject: [PATCH] macroify EFI characters mapping --- include/grub/unicode.h | 10 ++++++ term/efi/console.c | 71 +++++++++++++++++++----------------------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/include/grub/unicode.h b/include/grub/unicode.h index 9d1fe7ca0..64769258a 100644 --- a/include/grub/unicode.h +++ b/include/grub/unicode.h @@ -188,12 +188,22 @@ enum GRUB_UNICODE_UPARROW = 0x2191, GRUB_UNICODE_RIGHTARROW = 0x2192, GRUB_UNICODE_DOWNARROW = 0x2193, + GRUB_UNICODE_LIGHT_HLINE = 0x2500, GRUB_UNICODE_HLINE = 0x2501, + GRUB_UNICODE_LIGHT_VLINE = 0x2502, GRUB_UNICODE_VLINE = 0x2503, + GRUB_UNICODE_LIGHT_CORNER_UL = 0x250c, GRUB_UNICODE_CORNER_UL = 0x250f, + GRUB_UNICODE_LIGHT_CORNER_UR = 0x2510, GRUB_UNICODE_CORNER_UR = 0x2513, + GRUB_UNICODE_LIGHT_CORNER_LL = 0x2514, GRUB_UNICODE_CORNER_LL = 0x2517, + GRUB_UNICODE_LIGHT_CORNER_LR = 0x2518, GRUB_UNICODE_CORNER_LR = 0x251b, + GRUB_UNICODE_BLACK_UP_TRIANGLE = 0x25b2, + GRUB_UNICODE_BLACK_RIGHT_TRIANGLE = 0x25ba, + GRUB_UNICODE_BLACK_DOWN_TRIANGLE = 0x25bc, + GRUB_UNICODE_BLACK_LEFT_TRIANGLE = 0x25c4, GRUB_UNICODE_VARIATION_SELECTOR_1 = 0xfe00, GRUB_UNICODE_VARIATION_SELECTOR_16 = 0xfe0f, GRUB_UNICODE_VARIATION_SELECTOR_17 = 0xe0100, diff --git a/term/efi/console.c b/term/efi/console.c index d54c1c4be..d3240590b 100644 --- a/term/efi/console.c +++ b/term/efi/console.c @@ -33,46 +33,39 @@ static int read_key = -1; static grub_uint32_t map_char (grub_uint32_t c) { - if (c > 0x7f) + /* Map some unicode characters to the EFI character. */ + switch (c) { - /* Map some unicode characters to the EFI character. */ - switch (c) - { - case 0x2190: /* left arrow */ - c = 0x25c4; - break; - case 0x2191: /* up arrow */ - c = 0x25b2; - break; - case 0x2192: /* right arrow */ - c = 0x25ba; - break; - case 0x2193: /* down arrow */ - c = 0x25bc; - break; - case 0x2501: /* horizontal line */ - c = 0x2500; - break; - case 0x2503: /* vertical line */ - c = 0x2502; - break; - case 0x250F: /* upper-left corner */ - c = 0x250c; - break; - case 0x2513: /* upper-right corner */ - c = 0x2510; - break; - case 0x2517: /* lower-left corner */ - c = 0x2514; - break; - case 0x251B: /* lower-right corner */ - c = 0x2518; - break; - - default: - c = '?'; - break; - } + case GRUB_UNICODE_LEFTARROW: + c = GRUB_UNICODE_BLACK_LEFT_TRIANGLE; + break; + case GRUB_UNICODE_UPARROW: + c = GRUB_UNICODE_BLACK_UP_TRIANGLE; + break; + case GRUB_UNICODE_RIGHTARROW: + c = GRUB_UNICODE_BLACK_RIGHT_TRIANGLE; + break; + case GRUB_UNICODE_DOWNARROW: + c = GRUB_UNICODE_BLACK_DOWN_TRIANGLE; + break; + case GRUB_UNICODE_HLINE: + c = GRUB_UNICODE_LIGHT_HLINE; + break; + case GRUB_UNICODE_VLINE: + c = GRUB_UNICODE_LIGHT_VLINE; + break; + case GRUB_UNICODE_CORNER_UL: + c = GRUB_UNICODE_LIGHT_CORNER_UL; + break; + case GRUB_UNICODE_CORNER_UR: + c = GRUB_UNICODE_LIGHT_CORNER_UR; + break; + case GRUB_UNICODE_CORNER_LL: + c = GRUB_UNICODE_LIGHT_CORNER_LL; + break; + case GRUB_UNICODE_CORNER_LR: + c = GRUB_UNICODE_LIGHT_CORNER_LR; + break; } return c;