summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-03-09 15:14:53 +0100
committerHelge Deller <deller@gmx.de>2026-03-09 15:47:21 +0100
commit514d0de7cf403144d3e6c5b9fabb1ce4c15974ca (patch)
tree3b1acf7be87281f58a94782a969a6b4113f110c1 /include
parent1e3c49aa03fbfeea595ca0c9a4ebaf1e9cc078af (diff)
lib/fonts: Create font_data_t from struct console_font with font_data_import()
Add font_data_import() and update consoles to use it. The implementation of font_data_import() is based on code from fbcon, which supports overflow checks and crc32 checksums. Fbcon uses the crc32 checksum. Newport_con now implements the same overflow checks as fbcon. As before, this console does not support checksums, which are optional. Newport_con can now also handle input font data with a vertical pitch other than 32 bytes. (The vertical pitch is the offset between two glyphs in the font data.) As an internal change, remove the const qualifier from the data field if struct font_data. This allows font_data_import() to write the data without type casting. For all users of the font data via font_data_t, the stored data is still read only. v3: - fix typos Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/font.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/font.h b/include/linux/font.h
index 58bf3c64cabb..3eb4818402c5 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -13,6 +13,8 @@
#include <linux/types.h>
+struct console_font;
+
/*
* font_data_t and helpers
*/
@@ -54,6 +56,8 @@ static inline const unsigned char *font_data_buf(font_data_t *fd)
return (const unsigned char *)fd;
}
+font_data_t *font_data_import(const struct console_font *font, unsigned int vpitch,
+ u32 (*calc_csum)(u32, const void *, size_t));
void font_data_get(font_data_t *fd);
bool font_data_put(font_data_t *fd);
unsigned int font_data_size(font_data_t *fd);
@@ -124,7 +128,7 @@ extern const struct font_desc *get_default_font(int xres, int yres,
struct font_data {
unsigned int extra[FONT_EXTRA_WORDS];
- const unsigned char data[];
+ unsigned char data[];
} __packed;
#endif /* _VIDEO_FONT_H */