aboutsummaryrefslogtreecommitdiff
path: root/include/video_font_data.h
diff options
context:
space:
mode:
authorDzmitry Sankouski <dsankouski@gmail.com>2023-03-07 13:21:14 +0300
committerAnatolij Gustschin <agust@denx.de>2023-03-07 15:57:19 +0100
commit39c1fa2c212b8acf15dfbccd7b10c6de93ba88df (patch)
tree799bc6e1d231a7eb93de3ddb6524aa6c9018890b /include/video_font_data.h
parent0e177d5a95c020c6d7a0d4294de5c7f34f5bf664 (diff)
downloadu-boot-39c1fa2c212b8acf15dfbccd7b10c6de93ba88df.zip
u-boot-39c1fa2c212b8acf15dfbccd7b10c6de93ba88df.tar.gz
u-boot-39c1fa2c212b8acf15dfbccd7b10c6de93ba88df.tar.bz2
video console: implement multiple fonts configuration
This needed for unit testing different fonts. Configured fonts are placed in an array of fonts. First font is selected by default upon console probe. Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> [agust: fixed build error when bmp logo disabled] Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'include/video_font_data.h')
-rw-r--r--include/video_font_data.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/video_font_data.h b/include/video_font_data.h
new file mode 100644
index 0000000..37c3e003
--- /dev/null
+++ b/include/video_font_data.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2023 Dzmitry Sankouski <dsankouski@gmail.com>
+ */
+
+#ifndef _VIDEO_FONT_DATA_
+#define _VIDEO_FONT_DATA_
+#define VIDEO_FONT_BYTE_WIDTH(width) ((width / 8) + (width % 8 > 0))
+#define VIDEO_FONT_CHAR_PIXEL_BYTES(width, height) (height * VIDEO_FONT_BYTE_WIDTH(width))
+#define VIDEO_FONT_SIZE(chars, width, height) (chars * VIDEO_FONT_CHAR_PIXEL_BYTES(width, height))
+
+struct video_fontdata {
+ const char *name;
+ int width;
+ int height;
+ int byte_width;
+ int char_pixel_bytes;
+ unsigned char *video_fontdata;
+};
+
+#define FONT_ENTRY(_font_width, _font_height, _width_x_height) \
+{ \
+ .name = #_width_x_height, \
+ .width = _font_width, \
+ .height = _font_height, \
+ .byte_width = VIDEO_FONT_BYTE_WIDTH(_font_width), \
+ .char_pixel_bytes = VIDEO_FONT_CHAR_PIXEL_BYTES(_font_width, _font_height), \
+ .video_fontdata = video_fontdata_##_width_x_height, \
+}
+
+#endif /* _VIDEO_FONT_DATA_ */