xref: /illumos-gate/usr/src/uts/common/sys/font.h (revision 8533946bd264dca901fdf56bf3da1d81e728b423)
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  */
26 
27 #ifndef _SYS_FONT_H
28 #define	_SYS_FONT_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * Number of chars encoded in font data. Bundled fonts are generated
36  * from bdf files and this constant depends on the data in the bdf file.
37  * If more entries are added to the bdf files, then this number must be
38  * increased.
39  */
40 #define	ENCODED_CHARS	256
41 
42 struct font {
43 	short	width;
44 	short	height;
45 	uchar_t	*char_ptr[ENCODED_CHARS];
46 	void	*image_data;
47 };
48 
49 typedef	struct  bitmap_data {
50 	short		width;
51 	short		height;
52 	unsigned char	*image;
53 	unsigned char	**encoding;
54 } bitmap_data_t;
55 
56 struct fontlist {
57 	bitmap_data_t	*data;
58 	bitmap_data_t   *(*fontload)(char *);
59 };
60 
61 extern struct fontlist fonts[];
62 
63 #define	DEFAULT_FONT_DATA	font_data_12x22
64 #define	BORDER_PIXELS		10	/* space from screen border */
65 /*
66  * Built in fonts.
67  */
68 extern bitmap_data_t font_data_12x22;
69 extern bitmap_data_t font_data_8x16;
70 extern bitmap_data_t font_data_7x14;
71 extern bitmap_data_t font_data_6x10;
72 
73 void set_font(struct font *, short *, short *, short, short);
74 void font_bit_to_pix4(struct font *, uint8_t *, uchar_t, uint8_t, uint8_t);
75 void font_bit_to_pix8(struct font *, uint8_t *, uchar_t, uint8_t, uint8_t);
76 void font_bit_to_pix24(struct font *, uint32_t *, uchar_t, uint32_t, uint32_t);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* !_SYS_FONT_H */
83