diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
commit | 230e5ab6a084ed50470f101934782dbf54b0d06b (patch) | |
tree | 5dd821c8d33f450470588e7a543f74bf74306e9e /drivers/video/fonts.c | |
parent | c9b1c8a64c6444d189856f1e26bdcb8b4cd0113a (diff) |
Merge with Linux 2.1.67.
Diffstat (limited to 'drivers/video/fonts.c')
-rw-r--r-- | drivers/video/fonts.c | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/drivers/video/fonts.c b/drivers/video/fonts.c new file mode 100644 index 000000000..f67890cfc --- /dev/null +++ b/drivers/video/fonts.c @@ -0,0 +1,113 @@ +/* + * linux/drivers/video/fonts.c -- `Soft' font definitions + * + * Created 1995 by Geert Uytterhoeven + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + + +#include <linux/types.h> +#include <linux/string.h> +#ifdef __mc68000__ +#include <asm/setup.h> +#endif +#include "font.h" + + + /* + * External Font Definitions + */ + +/* VGA8x8 */ +extern char fontname_8x8[]; +extern int fontwidth_8x8, fontheight_8x8; +extern u_char fontdata_8x8[]; + +/* VGA8x16 */ +extern char fontname_8x16[]; +extern int fontwidth_8x16, fontheight_8x16; +extern u_char fontdata_8x16[]; + +/* PEARL8x8 */ +extern char fontname_pearl8x8[]; +extern int fontwidth_pearl8x8, fontheight_pearl8x8; +extern u_char fontdata_pearl8x8[]; + + + /* + * Font Descriptor Array + */ + +struct softfontdesc { + char *name; + int *width; + int *height; + u_char *data; +}; + +#define VGA8x8_IDX 0 +#define VGA8x16_IDX 1 +#define PEARL8x8_IDX 2 + +static struct softfontdesc softfonts[] = { + { fontname_8x8, &fontwidth_8x8, &fontheight_8x8, fontdata_8x8 }, + { fontname_8x16, &fontwidth_8x16, &fontheight_8x16, fontdata_8x16 }, + { fontname_pearl8x8, &fontwidth_pearl8x8, &fontheight_pearl8x8, + fontdata_pearl8x8 }, +}; + +static unsigned int numsoftfonts = sizeof(softfonts)/sizeof(*softfonts); + + + /* + * Find a font with a specific name + */ + +int findsoftfont(char *name, int *width, int *height, u_char *data[]) +{ + unsigned int i; + + for (i = 0; i < numsoftfonts; i++) + if (!strcmp(softfonts[i].name, name)) { + if (width) + *width = *softfonts[i].width; + if (height) + *height = *softfonts[i].height; + if (data) + *data = softfonts[i].data; + return(1); + } + return(0); +} + + + /* + * Get the default font for a specific screen size + */ + +void getdefaultfont(int xres, int yres, char *name[], int *width, int *height, + u_char *data[]) +{ + int i; + + if (yres < 400) { + i = VGA8x8_IDX; +#ifdef CONFIG_AMIGA + if (MACH_IS_AMIGA) + i = PEARL8x8_IDX; +#endif + } else + i = VGA8x16_IDX; + + if (name) + *name = softfonts[i].name; + if (width) + *width = *softfonts[i].width; + if (height) + *height = *softfonts[i].height; + if (data) + *data = softfonts[i].data; +} |