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.
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.
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]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #include <sys/queue.h>
37 VFNT_MAP_NORMAL
= 0, /* Normal font. */
38 VFNT_MAP_NORMAL_RH
, /* Normal font right hand. */
39 VFNT_MAP_BOLD
, /* Bold font. */
40 VFNT_MAP_BOLD_RH
, /* Bold font right hand. */
41 VFNT_MAPS
/* Number of maps. */
45 * If the custom console font was loaded, pass it for kernel as an module.
46 * We do not just load the font file, as the font file needs to be processed,
47 * and the early boot has very little resources. So we just set up the
48 * needed structures and make an copy of the byte arrays.
50 * Note we can not copy the structures one to one due to the pointer size,
51 * so we record the data by using fixed size structure.
57 uint32_t fi_bitmap_size
;
58 uint32_t fi_map_count
[VFNT_MAPS
];
62 uint32_t font_src
; /* Source glyph. */
63 uint16_t font_dst
; /* Target glyph. */
64 uint16_t font_len
; /* The number of glyphs in sequence. */
67 /* Any unknown glyph is mapped as first (offset 0) glyph in bitmap. */
69 struct font_map
*vf_map
[VFNT_MAPS
]; /* Mapping tables. */
70 uint8_t *vf_bytes
; /* Font bitmap data. */
71 uint32_t vf_width
; /* Glyph width. */
72 uint32_t vf_height
; /* Glyph height. */
73 uint32_t vf_map_count
[VFNT_MAPS
]; /* Entries in map */
76 typedef struct bitmap_data
{
79 uint32_t compressed_size
;
80 uint32_t uncompressed_size
;
81 uint8_t *compressed_data
;
93 FONT_FLAGS font_flags
;
94 bitmap_data_t
*font_data
;
95 bitmap_data_t
*(*font_load
)(char *);
96 STAILQ_ENTRY(fontlist
) font_next
;
99 #define FONT_HEADER_MAGIC "VFNT0002"
105 uint32_t fh_glyph_count
;
106 uint32_t fh_map_count
[4];
107 } __attribute__((__packed__
));
109 typedef STAILQ_HEAD(font_list
, fontlist
) font_list_t
;
110 extern font_list_t fonts
;
113 * Built in fonts. We are using Gallant as default on sparc to keep
114 * smooth transition from prom and 8x16 on x86, for vga text mode.
117 #define DEFAULT_FONT_DATA font_data_12x22
118 extern bitmap_data_t font_data_12x22
;
120 #define DEFAULT_FONT_DATA font_data_8x16
121 extern bitmap_data_t font_data_8x16
;
123 #define BORDER_PIXELS 10 /* space from screen border */
125 bitmap_data_t
*set_font(short *, short *, short, short);
126 const uint8_t *font_lookup(const struct font
*, uint32_t);
127 void font_bit_to_pix4(struct font
*, uint8_t *, uint32_t, uint8_t, uint8_t);
128 void font_bit_to_pix8(struct font
*, uint8_t *, uint32_t, uint8_t, uint8_t);
129 void font_bit_to_pix16(struct font
*, uint16_t *, uint32_t, uint16_t, uint16_t);
130 void font_bit_to_pix24(struct font
*, uint8_t *, uint32_t, uint32_t, uint32_t);
131 void font_bit_to_pix32(struct font
*, uint32_t *, uint32_t, uint32_t, uint32_t);
137 #endif /* !_SYS_FONT_H */