aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-03-14 22:38:24 +0000
committerMichael Brown <mcb30@ipxe.org>2022-03-15 17:27:18 +0000
commitba93c9134ce9d9edcba117b690fbbdd35b3e066b (patch)
tree91e226e7af8ffda69ac68e16a7be03778128e4d0 /src/arch
parent2ff3385e0078edda43e13ebfc9978fbcc5db311a (diff)
downloadipxe-ba93c9134ce9d9edcba117b690fbbdd35b3e066b.zip
ipxe-ba93c9134ce9d9edcba117b690fbbdd35b3e066b.tar.gz
ipxe-ba93c9134ce9d9edcba117b690fbbdd35b3e066b.tar.bz2
[fbcon] Support Unicode character output
Accumulate UTF-8 characters in fbcon_putchar(), and require the frame buffer console's .glyph() method to accept Unicode character values. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/interface/pcbios/vesafb.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/arch/x86/interface/pcbios/vesafb.c b/src/arch/x86/interface/pcbios/vesafb.c
index 50e4858..86edbda 100644
--- a/src/arch/x86/interface/pcbios/vesafb.c
+++ b/src/arch/x86/interface/pcbios/vesafb.c
@@ -78,6 +78,15 @@ struct console_driver bios_console __attribute__ (( weak ));
/** Font corresponding to selected character width and height */
#define VESAFB_FONT VBE_FONT_8x16
+/** Number of ASCII glyphs within the font */
+#define VESAFB_ASCII 128
+
+/** Glyph to render for non-ASCII characters
+ *
+ * We choose to use one of the box-drawing glyphs.
+ */
+#define VESAFB_UNKNOWN 0xfe
+
/* Forward declaration */
struct console_driver vesafb_console __console_driver;
@@ -130,12 +139,24 @@ static int vesafb_rc ( unsigned int status ) {
/**
* Get character glyph
*
- * @v character Character
+ * @v character Unicode character
* @v glyph Character glyph to fill in
*/
static void vesafb_glyph ( unsigned int character, uint8_t *glyph ) {
- size_t offset = ( character * VESAFB_CHAR_HEIGHT );
+ unsigned int index;
+ size_t offset;
+
+ /* Identify glyph */
+ if ( character < VESAFB_ASCII ) {
+ /* ASCII character: use corresponding glyph */
+ index = character;
+ } else {
+ /* Non-ASCII character: use "unknown" glyph */
+ index = VESAFB_UNKNOWN;
+ }
+ /* Copy glyph from BIOS font table */
+ offset = ( index * VESAFB_CHAR_HEIGHT );
copy_from_real ( glyph, vesafb.glyphs.segment,
( vesafb.glyphs.offset + offset ), VESAFB_CHAR_HEIGHT);
}