* mark python sqlite DEP opt and update .cache
[t2sde.git] / package / kernel / linux / hotfix-fbcon-fonts.patch
blob835aa0eec2b13e085845263b3e252ae5077f23f0
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/linux/hotfix-fbcon-fonts.patch
3 # Copyright (C) 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 diff --git a/lib/fonts/fonts.c b/lib/fonts/fonts.c
15 index 47e34950b665..efc3efabae79 100644
16 --- a/lib/fonts/fonts.c
17 +++ b/lib/fonts/fonts.c
18 @@ -108,6 +108,10 @@ EXPORT_SYMBOL(find_font);
19 * chosen font.
23 +#define TARGET_XRES 100
24 +#define TARGET_YRES 25
26 const struct font_desc *get_default_font(int xres, int yres,
27 unsigned long *font_w,
28 unsigned long *font_h)
29 @@ -116,9 +120,10 @@ const struct font_desc *get_default_font(int xres, int yres,
30 const struct font_desc *f, *g;
32 g = NULL;
33 - cc = -10000;
34 + cc = INT_MAX;
35 for (i = 0; i < num_fonts; i++) {
36 f = fonts[i];
37 +#if 0
38 c = f->pref;
39 #if defined(__mc68000__)
40 #ifdef CONFIG_FONT_PEARL_8x8
41 @@ -137,12 +142,15 @@ const struct font_desc *get_default_font(int xres, int yres,
42 res = (xres / f->width) * (yres / f->height) / 1000;
43 if (res > 20)
44 c += 20 - res;
45 +#endif
46 + /* closest to ideal target res - TODO: maybe add yres */
47 + c = abs(TARGET_XRES - xres / f->width);
49 if ((!font_w || test_bit(f->width - 1, font_w)) &&
50 (!font_h || test_bit(f->height - 1, font_h)))
51 - c += 1000;
52 + c /= 2;
54 - if (c > cc) {
55 + if (c < cc) {
56 cc = c;
57 g = f;