linux/lib/fonts
Thomas Zimmermann d237f719b2 lib/fonts: Fix bit position when rotating by 180 degrees
Fix the horizontal bit position when rotating a glyph by 180°. The
original code in rotate_ud() rounded the value in width up to a
multiple of 8, aka the bit pitch, and calculated the rotated pixel
from that value. The new code stores the glyph's pitch in bit_pitch,
but fails to update the rotated pixel's output accordingly. Simply
replacing the variable does this.

The bug can be reproduced by setting a font with an unaligned width,
such as sun12x22, like this:

 setfont sun12x22
 echo 2 > /sys/class/graphics/fbcon/rotate

Without the fix, the font looks distorted.

Fixes: a30e9e6b01 ("lib/fonts: Refactor glyph-rotation helpers")
Closes: https://lore.gitlab.freedesktop.org/drm-ai-reviews/review-patch7-20260407092555.58816-8-tzimmermann@suse.de/
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-04-28 14:18:51 +02:00
..
font_6x8.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_6x10.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_6x11.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_7x14.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_8x8.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_8x16.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_10x18.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_acorn_8x8.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_mini_4x6.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_pearl_8x8.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_rotate.c lib/fonts: Fix bit position when rotating by 180 degrees 2026-04-28 14:18:51 +02:00
font_sun8x16.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_sun12x22.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_ter10x18.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font_ter16x32.c lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
font.h lib/fonts: Remove internal symbols and macros from public header file 2026-03-09 15:47:21 +01:00
fonts.c lib/fonts: Provide helpers for calculating glyph pitch and size 2026-04-07 17:38:07 +02:00
Kconfig lib/fonts: Add Terminus 10x18 console font 2025-12-02 19:57:01 +01:00
Makefile lib/fonts: Implement glyph rotation 2026-04-07 17:38:07 +02:00