This source file includes following definitions.
- findsoftfont
- getdefaultfont
1
2
3
4
5
6
7
8
9
10
11
12
13 #include <linux/types.h>
14 #include <linux/string.h>
15 #include <asm/font.h>
16
17
18
19
20
21
22
23 extern char fontname_8x8[];
24 extern int fontwidth_8x8, fontheight_8x8;
25 extern u_char fontdata_8x8[];
26
27
28 extern char fontname_8x16[];
29 extern int fontwidth_8x16, fontheight_8x16;
30 extern u_char fontdata_8x16[];
31
32
33
34
35
36
37 struct softfontdesc {
38 char *name;
39 int *width;
40 int *height;
41 u_char *data;
42 };
43
44 static struct softfontdesc softfonts[] = {
45 { fontname_8x8, &fontwidth_8x8, &fontheight_8x8, fontdata_8x8 },
46 { fontname_8x16, &fontwidth_8x16, &fontheight_8x16, fontdata_8x16 }
47 };
48
49 static u_long numsoftfonts = sizeof(softfonts)/sizeof(*softfonts);
50
51
52
53
54
55
56 int findsoftfont(char *name, int *width, int *height, u_char *data[])
57 {
58 int i;
59
60 for (i = 0; i < numsoftfonts; i++)
61 if (!strcmp(softfonts[i].name, name)) {
62 if (width)
63 *width = *softfonts[i].width;
64 if (height)
65 *height = *softfonts[i].height;
66 if (data)
67 *data = softfonts[i].data;
68 return(1);
69 }
70 return(0);
71 }
72
73
74
75
76
77
78 void getdefaultfont(int xres, int yres, char *name[], int *width, int *height,
79 u_char *data[])
80 {
81 if (yres < 400) {
82 if (name)
83 *name = fontname_8x8;
84 if (width)
85 *width = fontwidth_8x8;
86 if (height)
87 *height = fontheight_8x8;
88 if (data)
89 *data = fontdata_8x8;
90 } else {
91 if (name)
92 *name = fontname_8x16;
93 if (width)
94 *width = fontwidth_8x16;
95 if (height)
96 *height = fontheight_8x16;
97 if (data)
98 *data = fontdata_8x16;
99 }
100 }