From cfa72955a029cd79433694cac6b5630788609cd4 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Tue, 7 Apr 2026 11:23:19 +0200 Subject: lib/fonts: Implement font rotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the core of fbcon's font-rotation code to the font library as the new helper font_data_rotate(). The code can rotate in steps of 90°. For completeness, it also copies the glyph data for multiples of 360°. Bring back the memset optimization. A memset to 0 again clears the whole glyph output buffer. Then use the internal rotation helpers on the cleared output. Fbcon's original implementation worked like this, but lost it during refactoring. Replace fbcon's font-rotation code with the new implementations. All that's left to do for fbcon is to maintain its internal fbcon state. v2: - fix typos Signed-off-by: Thomas Zimmermann Signed-off-by: Helge Deller --- include/linux/font.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/font.h b/include/linux/font.h index 0a240dd70422..6845f02d739a 100644 --- a/include/linux/font.h +++ b/include/linux/font.h @@ -111,6 +111,9 @@ void font_glyph_rotate_180(const unsigned char *glyph, unsigned int width, unsig unsigned char *out); void font_glyph_rotate_270(const unsigned char *glyph, unsigned int width, unsigned int height, unsigned char *out); +unsigned char *font_data_rotate(font_data_t *fd, unsigned int width, unsigned int height, + unsigned int charcount, unsigned int steps, + unsigned char *buf, size_t *bufsize); /* * Font description -- cgit v1.2.3