aboutsummaryrefslogtreecommitdiff
path: root/include/video_console.h
diff options
context:
space:
mode:
authorJanne Grunau2024-03-16 22:50:19 +0100
committerHeinrich Schuchardt2024-03-21 06:56:13 +0100
commit5ea38f95c474563de7e0a1fe2fb0e652121b25d5 (patch)
tree865e115f0b2244c5d8f31feadbec16f00d556c0a /include/video_console.h
parent7046bfe79e0ac34636fe8ada5f356a947f07740a (diff)
video: console: Parse UTF-8 character sequences
efi_console / UEFI applications (grub2, sd-boot, ...) pass UTF-8 character sequences to vidconsole which results in wrong glyphs for code points outside of ASCII. The truetype console expects Unicode code points and bitmap font based consoles expect code page 437 code points. To support both convert UTF-8 to UTF-32 and pass Unicode code points in vidconsole_ops.putc_xy(). These can be used directly in console_truetype and after conversion to code page 437 in console_{normal,rotate}. This fixes rendering of international, symbol and box drawing characters used by UEFI applications. Signed-off-by: Janne Grunau <j@jannau.net>
Diffstat (limited to 'include/video_console.h')
-rw-r--r--include/video_console.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/video_console.h b/include/video_console.h
index bde67fa9a5a..8b5928dc5eb 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -43,6 +43,7 @@ enum {
* @col_saved: Saved X position, in fractional units (VID_TO_POS(x))
* @row_saved: Saved Y position in pixels (0=top)
* @escape_buf: Buffer to accumulate escape sequence
+ * @utf8_buf: Buffer to accumulate UTF-8 byte sequence
*/
struct vidconsole_priv {
struct stdio_dev sdev;
@@ -66,6 +67,7 @@ struct vidconsole_priv {
int row_saved;
int col_saved;
char escape_buf[32];
+ char utf8_buf[5];
};
/**
@@ -124,12 +126,12 @@ struct vidconsole_ops {
* @x_frac: Fractional pixel X position (0=left-most pixel) which
* is the X position multipled by VID_FRAC_DIV.
* @y: Pixel Y position (0=top-most pixel)
- * @ch: Character to write
+ * @cp: UTF-32 code point to write
* @return number of fractional pixels that the cursor should move,
* if all is OK, -EAGAIN if we ran out of space on this line, other -ve
* on error
*/
- int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, char ch);
+ int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, int cp);
/**
* move_rows() - Move text rows from one place to another
@@ -403,12 +405,12 @@ void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
* @x_frac: Fractional pixel X position (0=left-most pixel) which
* is the X position multipled by VID_FRAC_DIV.
* @y: Pixel Y position (0=top-most pixel)
- * @ch: Character to write
+ * @cp: UTF-32 code point to write
* Return: number of fractional pixels that the cursor should move,
* if all is OK, -EAGAIN if we ran out of space on this line, other -ve
* on error
*/
-int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, char ch);
+int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, int cp);
/**
* vidconsole_move_rows() - Move text rows from one place to another