2 * `Soft' font definitions
4 * Created 1995 by Geert Uytterhoeven
5 * Rewritten 1998 by Martin Mares <mj@ucw.cz>
7 * 2001 - Documented with DocBook
8 * - Brad Douglas <brad@neruo.com>
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
15 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/string.h>
18 #if defined(__mc68000__)
19 #include <asm/setup.h>
21 #include <linux/font.h>
23 static const struct font_desc
*fonts
[] = {
24 #ifdef CONFIG_FONT_8x8
27 #ifdef CONFIG_FONT_8x16
30 #ifdef CONFIG_FONT_6x11
33 #ifdef CONFIG_FONT_7x14
36 #ifdef CONFIG_FONT_SUN8x16
39 #ifdef CONFIG_FONT_SUN12x22
42 #ifdef CONFIG_FONT_10x18
45 #ifdef CONFIG_FONT_ACORN_8x8
48 #ifdef CONFIG_FONT_PEARL_8x8
51 #ifdef CONFIG_FONT_MINI_4x6
54 #ifdef CONFIG_FONT_6x10
57 #ifdef CONFIG_FONT_TER16x32
62 #define num_fonts ARRAY_SIZE(fonts)
65 #error No fonts configured.
70 * find_font - find a font
71 * @name: string name of a font
73 * Find a specified font with string name @name.
75 * Returns %NULL if no font found, or a pointer to the
79 const struct font_desc
*find_font(const char *name
)
83 BUILD_BUG_ON(!num_fonts
);
84 for (i
= 0; i
< num_fonts
; i
++)
85 if (!strcmp(fonts
[i
]->name
, name
))
89 EXPORT_SYMBOL(find_font
);
93 * get_default_font - get default font
94 * @xres: screen size of X
95 * @yres: screen size of Y
96 * @font_w: bit array of supported widths (1 - 32)
97 * @font_h: bit array of supported heights (1 - 32)
99 * Get the default font for a specified screen size.
100 * Dimensions are in pixels.
102 * Returns %NULL if no font is found, or a pointer to the
106 const struct font_desc
*get_default_font(int xres
, int yres
, u32 font_w
,
110 const struct font_desc
*f
, *g
;
114 for (i
= 0; i
< num_fonts
; i
++) {
117 #if defined(__mc68000__)
118 #ifdef CONFIG_FONT_PEARL_8x8
119 if (MACH_IS_AMIGA
&& f
->idx
== PEARL8x8_IDX
)
122 #ifdef CONFIG_FONT_6x11
123 if (MACH_IS_MAC
&& xres
< 640 && f
->idx
== VGA6x11_IDX
)
127 if ((yres
< 400) == (f
->height
<= 8))
130 /* prefer a bigger font for high resolution */
131 res
= (xres
/ f
->width
) * (yres
/ f
->height
) / 1000;
135 if ((font_w
& (1 << (f
->width
- 1))) &&
136 (font_h
& (1 << (f
->height
- 1))))
146 EXPORT_SYMBOL(get_default_font
);
148 MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
149 MODULE_DESCRIPTION("Console Fonts");
150 MODULE_LICENSE("GPL");