Skip to contentSkip to conversation

lib/fonts: add font 6x8 for oled display

PATCH RESEND Superseded Sascha Hauer 2 participants 2 messages Aug 20, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 lib/fonts: add font 6x8 for oled display

From: Sven Schneider <[email protected]>

This font is derived from lib/fonts/font_6x10.c and is useful for small OLED displays.
---

Hi All,

I am not sure any new fonts are desired in the kernel. If yes, please consider for inclusion, otherwise some "go away, there are enough fonts in the kernel already" would be nice as well so I can stop trying getting it in :)

Sascha

 include/linux/font.h |    4 +-
 lib/fonts/Kconfig    |    7 +
 lib/fonts/Makefile   |    1 +
 lib/fonts/font_6x8.c | 2575 ++++++++++++++++++++++++++++++++++++++++++
 lib/fonts/fonts.c    |    3 +
 5 files changed, 2589 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 include/linux/font.h
 create mode 100644 lib/fonts/font_6x8.c
include/linux/font.h +3 -1
old mode 100644
new mode 100755
index 51b91c8b69d58..4a3f8741bb7e5
@@ -33,6 +33,7 @@ struct font_desc {
 #define	MINI4x6_IDX	9
 #define FONT6x10_IDX	10
 #define TER16x32_IDX	11
+#define FONT6x8_IDX	12
 
 extern const struct font_desc	font_vga_8x8,
 			font_vga_8x16,
@@ -45,7 +46,8 @@ extern const struct font_desc	font_vga_8x8,
 			font_acorn_8x8,
 			font_mini_4x6,
 			font_6x10,
-			font_ter_16x32;
+			font_ter_16x32,
+			font_6x8;
 
 /* Find a font with a specific name */
 
lib/fonts/Kconfig +7 -0
index 37baa79cdd71f..c035fde66aebe 100644
@@ -119,6 +119,12 @@ config FONT_TER16x32
 	  This is the high resolution, large version for use with HiDPI screens.
 	  If the standard font is unreadable for you, say Y, otherwise say N.
 
+config FONT_6x8
+	bool "OLED 6x8 font" if FONTS
+	depends on FRAMEBUFFER_CONSOLE
+	help
+	  This font is useful for small displays (OLED).
+
 config FONT_AUTOSELECT
 	def_bool y
 	depends on !FONT_8x8
@@ -132,6 +138,7 @@ config FONT_AUTOSELECT
 	depends on !FONT_SUN12x22
 	depends on !FONT_10x18
 	depends on !FONT_TER16x32
+	depends on !FONT_6x8
 	select FONT_8x16
 
 endif # FONT_SUPPORT
lib/fonts/Makefile +1 -0
index ed95070860deb..e16f68492174a 100644
@@ -15,6 +15,7 @@ font-objs-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o
 font-objs-$(CONFIG_FONT_MINI_4x6)  += font_mini_4x6.o
 font-objs-$(CONFIG_FONT_6x10)      += font_6x10.o
 font-objs-$(CONFIG_FONT_TER16x32)  += font_ter16x32.o
+font-objs-$(CONFIG_FONT_6x8)       += font_6x8.o
 
 font-objs += $(font-objs-y)
 
lib/fonts/font_6x8.c new file +2575 -0

2,575 lines not on this page · raw message

lib/fonts/fonts.c +3 -0
index e7258d8c252b2..760f2e6893bdb 100644
@@ -57,6 +57,9 @@ static const struct font_desc *fonts[] = {
 #ifdef CONFIG_FONT_TER16x32
 	&font_ter_16x32,
 #endif
+#ifdef CONFIG_FONT_6x8
+    &font_6x8,
+#endif
 };
 
 #define num_fonts ARRAY_SIZE(fonts)
Signature · 1 line
2.28.0
#1 lore raw
Quoted 6 lines · Sascha Hauer

From: Sven Schneider <[email protected]>

This font is derived from lib/fonts/font_6x10.c and is useful for small OLED displays.
---

No signed-off-by: line? :(

Always use scripts/checkpatch.pl on your patch to find stuff like this, and other errors that this patch has.

Quoted 8 lines

Hi All,

I am not sure any new fonts are desired in the kernel. If yes, please consider for inclusion, otherwise some "go away, there are enough fonts in the kernel already" would be nice as well so I can stop trying getting it in :)

Sascha

Quoted 7 lines
 include/linux/font.h |    4 +-
 lib/fonts/Kconfig    |    7 +
 lib/fonts/Makefile   |    1 +
 lib/fonts/font_6x8.c | 2575 ++++++++++++++++++++++++++++++++++++++++++
 lib/fonts/fonts.c    |    3 +
 5 files changed, 2589 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 include/linux/font.h

You changed a .h file to be executable???

lib/fonts/fonts.c static const struct font_desc *fonts[] = { · line 61

Quoted 10 lines
lib/fonts/fonts.c +2 -0
index e7258d8c252b2..760f2e6893bdb 100644
@@ -57,6 +57,9 @@ static const struct font_desc *fonts[] = {
 #ifdef CONFIG_FONT_TER16x32
 	&font_ter_16x32,
 #endif
+#ifdef CONFIG_FONT_6x8
+    &font_6x8,

Tabs please.

As for "do we take new fonts?", sure, why not?

thanks,

greg k-h