summaryrefslogtreecommitdiff
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-04-07 11:23:14 +0200
committerHelge Deller <deller@gmx.de>2026-04-07 17:38:07 +0200
commit97df8960240afc47c2349d008b0993e7727bbda5 (patch)
tree27d0e8bf365339335652e27ac8e6756ef6defaca /drivers/tty/vt
parentc713b96427ce5c4a74b8babe14137451ac3ffe54 (diff)
lib/fonts: Provide helpers for calculating glyph pitch and size
Implement pitch and size calculation for a single font glyph in the new helpers font_glyph_pitch() and font_glyph_size(). Replace the instances where the calculations are open-coded. Note that in the case of fbcon console rotation, the parameters for a glyph's width and height might be reversed. This is intentional. v2: - fix typos in commit message Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3c90856488cd..5c9fec4f99a0 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -71,7 +71,6 @@
* by Adam Tla/lka <atlka@pg.gda.pl>, Aug 2006
*/
-#include <linux/math.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched/signal.h>
@@ -244,7 +243,7 @@ enum {
*/
unsigned int vc_font_pitch(const struct vc_font *font)
{
- return DIV_ROUND_UP(font->width, 8);
+ return font_glyph_pitch(font->width);
}
EXPORT_SYMBOL_GPL(vc_font_pitch);
@@ -261,7 +260,7 @@ EXPORT_SYMBOL_GPL(vc_font_pitch);
*/
unsigned int vc_font_size(const struct vc_font *font)
{
- return font->height * vc_font_pitch(font) * font->charcount;
+ return font_glyph_size(font->width, font->height) * font->charcount;
}
EXPORT_SYMBOL_GPL(vc_font_size);