xref: /illumos-gate/usr/src/uts/common/sys/font.h (revision 5661bb76)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  * Copyright 2019 Toomas Soome <tsoome@me.com>
26  */
27 
28 #ifndef _SYS_FONT_H
29 #define	_SYS_FONT_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Number of chars encoded in font data. Bundled fonts are generated
37  * from bdf files and this constant depends on the data in the bdf file.
38  * If more entries are added to the bdf files, then this number must be
39  * increased.
40  */
41 #define	ENCODED_CHARS	256
42 
43 struct font {
44 	short	width;
45 	short	height;
46 	uint8_t	*char_ptr[ENCODED_CHARS];
47 	void	*image_data;
48 };
49 
50 typedef	struct  bitmap_data {
51 	short		width;
52 	short		height;
53 	unsigned char	*image;
54 	unsigned char	**encoding;
55 } bitmap_data_t;
56 
57 struct fontlist {
58 	bitmap_data_t	*data;
59 	bitmap_data_t   *(*fontload)(char *);
60 };
61 
62 extern struct fontlist fonts[];
63 
64 #define	DEFAULT_FONT_DATA	font_data_12x22
65 #define	BORDER_PIXELS		10	/* space from screen border */
66 /*
67  * Built in fonts.
68  */
69 extern bitmap_data_t font_data_12x22;
70 extern bitmap_data_t font_data_8x16;
71 extern bitmap_data_t font_data_7x14;
72 extern bitmap_data_t font_data_6x10;
73 
74 void set_font(struct font *, short *, short *, short, short);
75 void font_bit_to_pix4(struct font *, uint8_t *, uint32_t, uint8_t, uint8_t);
76 void font_bit_to_pix8(struct font *, uint8_t *, uint32_t, uint8_t, uint8_t);
77 void font_bit_to_pix16(struct font *, uint16_t *, uint32_t, uint16_t, uint16_t);
78 void font_bit_to_pix24(struct font *, uint8_t *, uint32_t, uint32_t, uint32_t);
79 void font_bit_to_pix32(struct font *, uint32_t *, uint32_t, uint32_t, uint32_t);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif /* !_SYS_FONT_H */
86