zenilib: zenilib/jni/external/freetype2/src/bdf/bdf.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
33 #include <ft2build.h>
34 #include FT_INTERNAL_OBJECTS_H
35 #include FT_INTERNAL_STREAM_H
36
37
38 FT_BEGIN_HEADER
39
40
41 /* Imported from bdfP.h */
42
43 #define _bdf_glyph_modified( map, e ) \
44 ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) )
45 #define _bdf_set_glyph_modified( map, e ) \
46 ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) )
47 #define _bdf_clear_glyph_modified( map, e ) \
48 ( (map)[(e) >> 5] &= ~( 1 << ( (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 {
79 int correct_metrics;
80 int keep_unencoded;
81 int keep_comments;
82 int font_spacing;
83
84 } bdf_options_t;
85
86
87 /* Callback function type for unknown configuration options. */
88 typedef int
89 (*bdf_options_callback_t)( bdf_options_t* opts,
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 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
122 } bdf_property_t;
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
143 } bdf_bbx_t;
144
145
146 typedef struct bdf_glyph_t_
147 {
148 char* name; /* Glyph name. */
149 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
157 } bdf_glyph_t;
158
159
160 typedef struct _hashnode_
161 {
162 const char* key;
163 size_t data;
164
165 } _hashnode, *hashnode;
166
167
168 typedef struct hashtable_
169 {
170 int limit;
171 int size;
172 int used;
173 hashnode* table;
174
175 } hashtable;
176
177
178 typedef struct bdf_glyphlist_t_
179 {
180 unsigned short pad; /* Pad to 4-byte boundary. */
181 unsigned short bpp; /* Bits per pixel. */
182 long start; /* Beginning encoding value of glyphs. */
183 long end; /* Ending encoding value of glyphs. */
184 bdf_glyph_t* glyphs; /* Glyphs themselves. */
185 unsigned long glyphs_size; /* Glyph structures allocated. */
186 unsigned long glyphs_used; /* Glyph structures used. */
187 bdf_bbx_t bbx; /* Overall bounding box of glyphs. */
188
189 } bdf_glyphlist_t;
190
191
192 typedef struct bdf_font_t_
193 {
194 char* name; /* Name of the font. */
195 bdf_bbx_t bbx; /* Font bounding box. */
196
197 long point_size; /* Point size of the font. */
198 unsigned long resolution_x; /* Font horizontal resolution. */
199 unsigned long resolution_y; /* Font vertical resolution. */
200
201 int spacing; /* Font spacing value. */
202
203 unsigned short monowidth; /* Logical width for monowidth font. */
204
205 long default_char; /* Encoding of the default glyph. */
206
207 long font_ascent; /* Font ascent. */
208 long font_descent; /* Font descent. */
209
210 unsigned long glyphs_size; /* Glyph structures allocated. */
211 unsigned long glyphs_used; /* Glyph structures used. */
212 bdf_glyph_t* glyphs; /* Glyphs themselves. */
213
214 unsigned long unencoded_size; /* Unencoded glyph struct. allocated. */
215 unsigned long unencoded_used; /* Unencoded glyph struct. used. */
216 bdf_glyph_t* unencoded; /* Unencoded glyphs themselves. */
217
218 unsigned long props_size; /* Font properties allocated. */
219 unsigned long props_used; /* Font properties used. */
220 bdf_property_t* props; /* Font properties themselves. */
221
222 char* comments; /* Font comments. */
223 unsigned long comments_len; /* Length of comment string. */
224
225 bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */
226
227 void* internal; /* Internal data for the font. */
228
229 /* The size of the next two arrays must be in sync with the */
230 /* size of the `have' array in the `bdf_parse_t' structure. */
231 unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */
232 unsigned long umod[34816]; /* Bitmap indicating modified */
233 /* unencoded glyphs. */
234 unsigned short modified; /* Boolean indicating font modified. */
235 unsigned short bpp; /* Bits per pixel. */
236
237 FT_Memory memory;
238
239 bdf_property_t* user_props;
240 unsigned long nuser_props;
241 hashtable proptbl;
242
243 } bdf_font_t;
244
245
246 /*************************************************************************/
247 /* */
248 /* Types for load/save callbacks. */
249 /* */
250 /*************************************************************************/
251
252
253 /* Error codes. */
254 #define BDF_MISSING_START -1
255 #define BDF_MISSING_FONTNAME -2
256 #define BDF_MISSING_SIZE -3
257 #define BDF_MISSING_CHARS -4
258 #define BDF_MISSING_STARTCHAR -5
259 #define BDF_MISSING_ENCODING -6
260 #define BDF_MISSING_BBX -7
261
262 #define BDF_OUT_OF_MEMORY -20
263
264 #define BDF_INVALID_LINE -100
265
266
267 /*************************************************************************/
268 /* */
269 /* BDF font API. */
270 /* */
271 /*************************************************************************/
272
273 FT_LOCAL( FT_Error )
274 bdf_load_font( FT_Stream stream,
275 FT_Memory memory,
276 bdf_options_t* opts,
277 bdf_font_t* *font );
278
279 FT_LOCAL( void )
280 bdf_free_font( bdf_font_t* font );
281
282 FT_LOCAL( bdf_property_t * )
283 bdf_get_property( char* name,
284 bdf_font_t* font );
285
286 FT_LOCAL( bdf_property_t * )
287 bdf_get_font_property( bdf_font_t* font,
288 const char* name );
289
290
291 FT_END_HEADER
292
293
294 #endif /* __BDF_H__ */
295
296
297 /* END */
bdf_font_t
struct bdf_font_t_ bdf_font_t
bdf_font_t_::spacing
int spacing
Definition: bdf.h:201
FT_Error
int FT_Error
Definition: fttypes.h:296
bdf_font_t_::unencoded_size
unsigned long unencoded_size
Definition: bdf.h:214
bdf_font_t_::point_size
long point_size
Definition: bdf.h:197
bdf_font_t_::comments
char * comments
Definition: bdf.h:222
bdf_font_t_::user_props
bdf_property_t * user_props
Definition: bdf.h:239
bdf_property_t
struct bdf_property_t_ bdf_property_t
bdf_property_t_::value
union bdf_property_t_::@25 value
_hashnode
struct _hashnode_ _hashnode
FT_END_HEADER
#define FT_END_HEADER
Definition: ftheader.h:54
bdf_bbx_t_
Definition: bdf.h:132
bdf_glyphlist_t_::glyphs_size
unsigned long glyphs_size
Definition: bdf.h:185
bdf_glyph_t_::encoding
long encoding
Definition: bdf.h:149
bdf_glyphlist_t_::glyphs_used
unsigned long glyphs_used
Definition: bdf.h:186
stream
GLuint GLuint stream
Definition: glew.h:6573
bdf_property_t_::name
char * name
Definition: bdf.h:111
bdf_font_t_
Definition: bdf.h:192
bdf_property_t_::format
int format
Definition: bdf.h:112
bdf_bbx_t
struct bdf_bbx_t_ bdf_bbx_t
bdf_font_t_::font_ascent
long font_ascent
Definition: bdf.h:207
bdf_font_t_::unencoded
bdf_glyph_t * unencoded
Definition: bdf.h:216
bdf_font_t_::monowidth
unsigned short monowidth
Definition: bdf.h:203
hashtable_::size
int size
Definition: bdf.h:171
bdf_free_font
bdf_free_font(bdf_font_t *font)
Definition: bdflib.c:2517
bdf_font_t_::modified
unsigned short modified
Definition: bdf.h:234
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
bdf_font_t_::resolution_y
unsigned long resolution_y
Definition: bdf.h:199
bdf_get_font_property
bdf_get_font_property(bdf_font_t *font, const char *name)
Definition: bdflib.c:2598
bdf_font_t_::resolution_x
unsigned long resolution_x
Definition: bdf.h:198
bdf_glyph_t_::bbx
bdf_bbx_t bbx
Definition: bdf.h:152
bdf_font_t_::props
bdf_property_t * props
Definition: bdf.h:220
bdf_font_t_::props_size
unsigned long props_size
Definition: bdf.h:218
bdf_glyphlist_t_::bpp
unsigned short bpp
Definition: bdf.h:181
bdf_glyphlist_t_::start
long start
Definition: bdf.h:182
bdf_property_t_
Definition: bdf.h:109
FT_BEGIN_HEADER
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
params
GLenum GLvoid ** params
Definition: gl2ext.h:806
bdf_property_t_::builtin
int builtin
Definition: bdf.h:113
hashnode
struct _hashnode_ * hashnode
FT_LOCAL
#define FT_LOCAL(x)
Definition: ftconfig.h:466
bdf_options_callback_t
int(* bdf_options_callback_t)(bdf_options_t *opts, char **params, unsigned long nparams, void *client_data)
Definition: bdf.h:89
bdf_options_t_::correct_metrics
int correct_metrics
Definition: bdf.h:79
bdf_bbx_t_::descent
short descent
Definition: bdf.h:141
_hashnode_::data
size_t data
Definition: bdf.h:163
bdf_font_t_::name
char * name
Definition: bdf.h:194
bdf_glyph_t_::dwidth
unsigned short dwidth
Definition: bdf.h:151
bdf_glyph_t_
Definition: bdf.h:146
bdf_property_t_::ul
unsigned long ul
Definition: bdf.h:118
bdf_font_t_::bpp
unsigned short bpp
Definition: bdf.h:235
bdf_glyphlist_t_::bbx
bdf_bbx_t bbx
Definition: bdf.h:187
bdf_font_t_::default_char
long default_char
Definition: bdf.h:205
bdf_font_t_::glyphs_size
unsigned long glyphs_size
Definition: bdf.h:210
bdf_glyphlist_t_
Definition: bdf.h:178
int
int
Definition: SDL_systhread.c:37
bdf_bbx_t_::x_offset
short x_offset
Definition: bdf.h:137
bdf_font_t_::font_descent
long font_descent
Definition: bdf.h:208
bdf_property_t_::l
long l
Definition: bdf.h:117
bdf_glyph_t_::bpr
unsigned long bpr
Definition: bdf.h:154
bdf_options_t_::keep_unencoded
int keep_unencoded
Definition: bdf.h:80
bdf_property_t_::atom
char * atom
Definition: bdf.h:116
bdf_font_t_::nuser_props
unsigned long nuser_props
Definition: bdf.h:240
bdf_font_t_::unencoded_used
unsigned long unencoded_used
Definition: bdf.h:215
bdf_font_t_::comments_len
unsigned long comments_len
Definition: bdf.h:223
FT_Memory
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
_hashnode_
Definition: bdf.h:160
bdf_font_t_::overflow
bdf_glyphlist_t overflow
Definition: bdf.h:225
bdf_glyphlist_t_::pad
unsigned short pad
Definition: bdf.h:180
bdf_load_font
bdf_load_font(FT_Stream stream, FT_Memory memory, bdf_options_t *opts, bdf_font_t **font)
Definition: bdflib.c:2359
const
#define const
Definition: zconf.h:91
ft2build.h
bdf_bbx_t_::y_offset
short y_offset
Definition: bdf.h:138
bdf_font_t_::nmod
unsigned long nmod[34816]
Definition: bdf.h:231
bdf_glyph_t_::name
char * name
Definition: bdf.h:148
_hashnode_::key
const char * key
Definition: bdf.h:162
bdf_options_t_
Definition: bdf.h:77
bdf_font_t_::memory
FT_Memory memory
Definition: bdf.h:237
bdf_glyphlist_t
struct bdf_glyphlist_t_ bdf_glyphlist_t
bdf_bbx_t_::height
unsigned short height
Definition: bdf.h:135
bdf_glyphlist_t_::glyphs
bdf_glyph_t * glyphs
Definition: bdf.h:184
bdf_bbx_t_::ascent
short ascent
Definition: bdf.h:140
hashtable_::used
int used
Definition: bdf.h:172
hashtable
struct hashtable_ hashtable
hashtable_::limit
int limit
Definition: bdf.h:170
bdf_glyph_t_::swidth
unsigned short swidth
Definition: bdf.h:150
bdf_glyph_t_::bytes
unsigned short bytes
Definition: bdf.h:155
bdf_font_t_::glyphs
bdf_glyph_t * glyphs
Definition: bdf.h:212
hashtable_
Definition: bdf.h:168
bdf_bbx_t_::width
unsigned short width
Definition: bdf.h:134
bdf_font_t_::proptbl
hashtable proptbl
Definition: bdf.h:241
bdf_font_t_::glyphs_used
unsigned long glyphs_used
Definition: bdf.h:211
bdf_options_t_::font_spacing
int font_spacing
Definition: bdf.h:82
bdf_get_property
bdf_get_property(char *name, bdf_font_t *font)
Definition: bdflib.c:1076
bdf_glyph_t
struct bdf_glyph_t_ bdf_glyph_t
hashtable_::table
hashnode * table
Definition: bdf.h:173
bdf_options_t
struct bdf_options_t_ bdf_options_t
FT_StreamRec_
Definition: ftsystem.h:321
bdf_font_t_::umod
unsigned long umod[34816]
Definition: bdf.h:232
bdf_glyph_t_::bitmap
unsigned char * bitmap
Definition: bdf.h:153
bdf_glyphlist_t_::end
long end
Definition: bdf.h:183
bdf_font_t_::bbx
bdf_bbx_t bbx
Definition: bdf.h:195
bdf_options_t_::keep_comments
int keep_comments
Definition: bdf.h:81
bdf_font_t_::props_used
unsigned long props_used
Definition: bdf.h:219