ReactOS 0.4.16-dev-2357-g35d0dfe
bdf.h
Go to the documentation of this file.
1/*
2 * Copyright 2000 Computing Research Labs, New Mexico State University
3 * Copyright 2001-2004, 2011 Francesco Zappa Nardelli
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
20 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24
25#ifndef BDF_H_
26#define BDF_H_
27
28
29/*
30 * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
31 */
32
36
37
39
40
41/* Imported from bdfP.h */
42
43#define _bdf_glyph_modified( map, e ) \
44 ( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) )
45#define _bdf_set_glyph_modified( map, e ) \
46 ( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) )
47#define _bdf_clear_glyph_modified( map, e ) \
48 ( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) )
49
50/* end of bdfP.h */
51
52
53 /**************************************************************************
54 *
55 * BDF font options macros and types.
56 *
57 */
58
59
60#define BDF_CORRECT_METRICS 0x01 /* Correct invalid metrics when loading. */
61#define BDF_KEEP_COMMENTS 0x02 /* Preserve the font comments. */
62#define BDF_KEEP_UNENCODED 0x04 /* Keep the unencoded glyphs. */
63#define BDF_PROPORTIONAL 0x08 /* Font has proportional spacing. */
64#define BDF_MONOWIDTH 0x10 /* Font has mono width. */
65#define BDF_CHARCELL 0x20 /* Font has charcell spacing. */
66
67#define BDF_ALL_SPACING ( BDF_PROPORTIONAL | \
68 BDF_MONOWIDTH | \
69 BDF_CHARCELL )
70
71#define BDF_DEFAULT_LOAD_OPTIONS ( BDF_CORRECT_METRICS | \
72 BDF_KEEP_COMMENTS | \
73 BDF_KEEP_UNENCODED | \
74 BDF_PROPORTIONAL )
75
76
77 typedef struct bdf_options_t_
78 {
83
85
86
87 /* Callback function type for unknown configuration options. */
88 typedef int
90 char** params,
91 unsigned long nparams,
92 void* client_data );
93
94
95 /**************************************************************************
96 *
97 * BDF font property macros and types.
98 *
99 */
100
101
102#define BDF_ATOM 1
103#define BDF_INTEGER 2
104#define BDF_CARDINAL 3
105
106
107 /* This structure represents a particular property of a font. */
108 /* There are a set of defaults and each font has their own. */
109 typedef struct bdf_property_t_
110 {
111 const char* name; /* Name of the property. */
112 int format; /* Format of the property. */
113 int builtin; /* A builtin property. */
114 union
115 {
116 char* atom;
117 long l;
118 unsigned long ul;
119
120 } value; /* Value of the property. */
121
123
124
125 /**************************************************************************
126 *
127 * BDF font metric and glyph types.
128 *
129 */
130
131
132 typedef struct bdf_bbx_t_
133 {
134 unsigned short width;
135 unsigned short height;
136
137 short x_offset;
138 short y_offset;
139
140 short ascent;
141 short descent;
142
144
145
146 typedef struct bdf_glyph_t_
147 {
148 char* name; /* Glyph name. */
149 unsigned long encoding; /* Glyph encoding. */
150 unsigned short swidth; /* Scalable width. */
151 unsigned short dwidth; /* Device width. */
152 bdf_bbx_t bbx; /* Glyph bounding box. */
153 unsigned char* bitmap; /* Glyph bitmap. */
154 unsigned long bpr; /* Number of bytes used per row. */
155 unsigned short bytes; /* Number of bytes used for the bitmap. */
156
158
159
160 typedef struct bdf_font_t_
161 {
162 char* name; /* Name of the font. */
163 bdf_bbx_t bbx; /* Font bounding box. */
164
165 unsigned long point_size; /* Point size of the font. */
166 unsigned long resolution_x; /* Font horizontal resolution. */
167 unsigned long resolution_y; /* Font vertical resolution. */
168
169 int spacing; /* Font spacing value. */
170
171 unsigned short monowidth; /* Logical width for monowidth font. */
172
173 unsigned long default_char; /* Encoding of the default glyph. */
174
175 long font_ascent; /* Font ascent. */
176 long font_descent; /* Font descent. */
177
178 unsigned long glyphs_size; /* Glyph structures allocated. */
179 unsigned long glyphs_used; /* Glyph structures used. */
180 bdf_glyph_t* glyphs; /* Glyphs themselves. */
181
182 unsigned long unencoded_size; /* Unencoded glyph struct. allocated. */
183 unsigned long unencoded_used; /* Unencoded glyph struct. used. */
184 bdf_glyph_t* unencoded; /* Unencoded glyphs themselves. */
185
186 unsigned long props_size; /* Font properties allocated. */
187 unsigned long props_used; /* Font properties used. */
188 bdf_property_t* props; /* Font properties themselves. */
189
190 char* comments; /* Font comments. */
191 unsigned long comments_len; /* Length of comment string. */
192
193 void* internal; /* Internal data for the font. */
194
195 unsigned short bpp; /* Bits per pixel. */
196
198
200 unsigned long nuser_props;
202
204
205
206 /**************************************************************************
207 *
208 * Types for load/save callbacks.
209 *
210 */
211
212
213 /* Error codes. */
214#define BDF_MISSING_START -1
215#define BDF_MISSING_FONTNAME -2
216#define BDF_MISSING_SIZE -3
217#define BDF_MISSING_CHARS -4
218#define BDF_MISSING_STARTCHAR -5
219#define BDF_MISSING_ENCODING -6
220#define BDF_MISSING_BBX -7
221
222#define BDF_OUT_OF_MEMORY -20
223
224#define BDF_INVALID_LINE -100
225
226
227 /**************************************************************************
228 *
229 * BDF font API.
230 *
231 */
232
236 bdf_options_t* opts,
237 bdf_font_t* *font );
238
239 FT_LOCAL( void )
241
243 bdf_get_property( char* name,
244 bdf_font_t* font );
245
248 const char* name );
249
250
252
253
254#endif /* BDF_H_ */
255
256
257/* END */
bdf_get_property(char *name, bdf_font_t *font)
Definition: bdflib.c:881
struct bdf_options_t_ bdf_options_t
struct bdf_glyph_t_ bdf_glyph_t
bdf_get_font_property(bdf_font_t *font, const char *name)
Definition: bdflib.c:2401
struct bdf_font_t_ bdf_font_t
int(* bdf_options_callback_t)(bdf_options_t *opts, char **params, unsigned long nparams, void *client_data)
Definition: bdf.h:89
struct bdf_bbx_t_ bdf_bbx_t
bdf_free_font(bdf_font_t *font)
Definition: bdflib.c:2330
bdf_load_font(FT_Stream stream, FT_Memory memory, bdf_options_t *opts, bdf_font_t **font)
Definition: bdflib.c:2176
struct bdf_property_t_ bdf_property_t
#define FT_LOCAL(x)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define FT_END_HEADER
Definition: ftheader.h:57
#define FT_BEGIN_HEADER
Definition: ftheader.h:37
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
int FT_Error
Definition: fttypes.h:299
GLenum const GLfloat * params
Definition: glext.h:5645
static char memory[1024 *256]
Definition: process.c:122
Definition: mk_font.cpp:20
short x_offset
Definition: bdf.h:137
unsigned short width
Definition: bdf.h:134
short y_offset
Definition: bdf.h:138
short ascent
Definition: bdf.h:140
unsigned short height
Definition: bdf.h:135
short descent
Definition: bdf.h:141
unsigned long default_char
Definition: bdf.h:173
unsigned long unencoded_size
Definition: bdf.h:182
void * internal
Definition: bdf.h:193
unsigned short monowidth
Definition: bdf.h:171
unsigned long nuser_props
Definition: bdf.h:200
unsigned long glyphs_size
Definition: bdf.h:178
char * name
Definition: bdf.h:162
FT_HashRec proptbl
Definition: bdf.h:201
int spacing
Definition: bdf.h:169
char * comments
Definition: bdf.h:190
unsigned long point_size
Definition: bdf.h:165
unsigned short bpp
Definition: bdf.h:195
unsigned long props_used
Definition: bdf.h:187
FT_Memory memory
Definition: bdf.h:197
bdf_property_t * props
Definition: bdf.h:188
unsigned long comments_len
Definition: bdf.h:191
long font_descent
Definition: bdf.h:176
bdf_glyph_t * unencoded
Definition: bdf.h:184
unsigned long unencoded_used
Definition: bdf.h:183
bdf_glyph_t * glyphs
Definition: bdf.h:180
unsigned long glyphs_used
Definition: bdf.h:179
bdf_bbx_t bbx
Definition: bdf.h:163
unsigned long props_size
Definition: bdf.h:186
long font_ascent
Definition: bdf.h:175
unsigned long resolution_y
Definition: bdf.h:167
unsigned long resolution_x
Definition: bdf.h:166
bdf_property_t * user_props
Definition: bdf.h:199
unsigned char * bitmap
Definition: bdf.h:153
unsigned short dwidth
Definition: bdf.h:151
unsigned short swidth
Definition: bdf.h:150
bdf_bbx_t bbx
Definition: bdf.h:152
unsigned short bytes
Definition: bdf.h:155
unsigned long encoding
Definition: bdf.h:149
unsigned long bpr
Definition: bdf.h:154
char * name
Definition: bdf.h:148
int keep_comments
Definition: bdf.h:81
int font_spacing
Definition: bdf.h:82
int correct_metrics
Definition: bdf.h:79
int keep_unencoded
Definition: bdf.h:80
int format
Definition: bdf.h:112
unsigned long ul
Definition: bdf.h:118
const char * name
Definition: bdf.h:111
char * atom
Definition: bdf.h:116
int builtin
Definition: bdf.h:113
union bdf_property_t_::@4567 value
long l
Definition: bdf.h:117
Definition: name.c:39
Definition: parse.h:23