Merge with Linux 2.4.0-test4-pre3.
[linux-2.6/linux-mips.git] / drivers / video / fonts.c
blob82aedaf0f8b6de7d1244fb7892598d30a48f84a4
1 /*
2 * linux/drivers/video/fonts.c -- `Soft' font definitions
4 * Created 1995 by Geert Uytterhoeven
5 * Rewritten 1998 by Martin Mares <mj@ucw.cz>
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
9 * for more details.
13 #include <linux/config.h>
14 #include <linux/types.h>
15 #include <linux/string.h>
16 #if defined(__mc68000__) || defined(CONFIG_APUS)
17 #include <asm/setup.h>
18 #endif
19 #include <video/font.h>
21 #define NO_FONTS
23 static struct fbcon_font_desc *fbcon_fonts[] = {
24 #ifdef CONFIG_FONT_8x8
25 #undef NO_FONTS
26 &font_vga_8x8,
27 #endif
28 #ifdef CONFIG_FONT_8x16
29 #undef NO_FONTS
30 &font_vga_8x16,
31 #endif
32 #ifdef CONFIG_FONT_6x11
33 #if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FB_SBUS)
34 #undef NO_FONTS
35 #endif
36 &font_vga_6x11,
37 #endif
38 #ifdef CONFIG_FONT_SUN8x16
39 #undef NO_FONTS
40 &font_sun_8x16,
41 #endif
42 #ifdef CONFIG_FONT_SUN12x22
43 #if defined(CONFIG_FB_SBUS) || defined(CONFIG_FBCON_CFB8) || defined(CONFIG_FBCON_CFB16) || defined(CONFIG_FBCON_CFB24) || defined(CONFIG_FBCON_CFB32)
44 #undef NO_FONTS
45 #endif
46 &font_sun_12x22,
47 #endif
48 #ifdef CONFIG_FONT_ACORN_8x8
49 #undef NO_FONTS
50 &font_acorn_8x8,
51 #endif
52 #ifdef CONFIG_FONT_PEARL_8x8
53 #undef NO_FONTS
54 &font_pearl_8x8,
55 #endif
58 #define num_fonts (sizeof(fbcon_fonts)/sizeof(*fbcon_fonts))
60 #ifdef NO_FONTS
61 #error No fonts configured.
62 #endif
65 * Find a font with a specific name
68 struct fbcon_font_desc *fbcon_find_font(char *name)
70 unsigned int i;
72 for (i = 0; i < num_fonts; i++)
73 if (!strcmp(fbcon_fonts[i]->name, name))
74 return fbcon_fonts[i];
75 return NULL;
80 * Get the default font for a specific screen size
83 struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres)
85 int i, c, cc;
86 struct fbcon_font_desc *f, *g;
88 g = NULL;
89 cc = -10000;
90 for(i=0; i<num_fonts; i++) {
91 f = fbcon_fonts[i];
92 c = f->pref;
93 #if defined(__mc68000__) || defined(CONFIG_APUS)
94 #ifdef CONFIG_FONT_PEARL_8x8
95 if (MACH_IS_AMIGA && f->idx == PEARL8x8_IDX)
96 c = 100;
97 #endif
98 #ifdef CONFIG_FONT_6x11
99 if (MACH_IS_MAC && xres < 640 && f->idx == VGA6x11_IDX)
100 c = 100;
101 #endif
102 #endif
103 if ((yres < 400) == (f->height <= 8))
104 c += 1000;
105 if (c > cc) {
106 cc = c;
107 g = f;
110 return g;