VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Takashi Iwai <tiwai@suse.de> 2019-06-18 22:34:25 +0200 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2019-06-20 10:11:24 +0200 commit: dfd19a5004eff03755967086aa04254c3d91b8ec parent: 73a649d2b98e25f4960b8081080c78695fea8bc7
Commit Summary:
fonts: Prefer a bigger font for high resolution screens
Diffstat:
1 file changed, 6 insertions, 1 deletion
diff --git a/lib/fonts/fonts.c b/lib/fonts/fonts.c
index a8e31e9d6fc5..e7258d8c252b 100644
--- a/lib/fonts/fonts.c
+++ b/lib/fonts/fonts.c
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(find_font);
 const struct font_desc *get_default_font(int xres, int yres, u32 font_w,
 					 u32 font_h)
 {
-	int i, c, cc;
+	int i, c, cc, res;
 	const struct font_desc *f, *g;
 
 	g = NULL;
@@ -127,6 +127,11 @@ const struct font_desc *get_default_font(int xres, int yres, u32 font_w,
 		if ((yres < 400) == (f->height <= 8))
 			c += 1000;
 
+		/* prefer a bigger font for high resolution */
+		res = (xres / f->width) * (yres / f->height) / 1000;
+		if (res > 20)
+			c += 20 - res;
+
 		if ((font_w & (1 << (f->width - 1))) &&
 		    (font_h & (1 << (f->height - 1))))
 			c += 1000;