sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
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
29
#ifndef BDF_H_
30
#define BDF_H_
31
32
33
/*
34
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
35
*/
36
37
#include <
freetype/internal/ftobjs.h
>
38
#include <
freetype/internal/ftstream.h
>
39
#include <
freetype/internal/fthash.h
>
40
41
42
FT_BEGIN_HEADER
43
44
45
/* Imported from bdfP.h */
46
47
#define _bdf_glyph_modified( map, e ) \
48
( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) )
49
#define _bdf_set_glyph_modified( map, e ) \
50
( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) )
51
#define _bdf_clear_glyph_modified( map, e ) \
52
( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) )
53
54
/* end of bdfP.h */
55
56
57
/**************************************************************************
58
*
59
* BDF font options macros and types.
60
*
61
*/
62
63
64
#define BDF_CORRECT_METRICS 0x1000
/* Correct metrics when loading. */
65
#define BDF_KEEP_COMMENTS 0x2000
/* Preserve the font comments. */
66
#define BDF_KEEP_UNENCODED 0x4000
/* Keep the unencoded glyphs. */
67
68
#define BDF_PROPORTIONAL 0x08
/* Font has proportional spacing. */
69
#define BDF_MONOWIDTH 0x10
/* Font has mono width. */
70
#define BDF_CHARCELL 0x20
/* Font has charcell spacing. */
71
72
73
/**************************************************************************
74
*
75
* BDF font property macros and types.
76
*
77
*/
78
79
80
#define BDF_ATOM 1
81
#define BDF_INTEGER 2
82
#define BDF_CARDINAL 3
83
84
85
/* This structure represents a particular property of a font. */
86
/* There are a set of defaults and each font has their own. */
87
typedef
struct
bdf_property_t_
88
{
89
const
char
* name;
/* Name of the property. */
90
int
format;
/* Format of the property. */
91
int
builtin;
/* A builtin property. */
92
union
93
{
94
char
* atom;
95
long
l;
96
unsigned
long
ul;
97
98
} value;
/* Value of the property. */
99
100
} bdf_property_t;
101
102
103
/**************************************************************************
104
*
105
* BDF font metric and glyph types.
106
*
107
*/
108
109
110
typedef
struct
bdf_bbx_t_
111
{
112
unsigned
short
width;
113
unsigned
short
height;
114
115
short
x_offset;
116
short
y_offset;
117
118
short
ascent;
119
short
descent;
120
121
} bdf_bbx_t;
122
123
124
typedef
struct
bdf_glyph_t_
125
{
126
char
* name;
/* Glyph name. */
127
unsigned
long
encoding;
/* Glyph encoding. */
128
unsigned
short
swidth;
/* Scalable width. */
129
unsigned
short
dwidth;
/* Device width. */
130
bdf_bbx_t bbx;
/* Glyph bounding box. */
131
unsigned
char
* bitmap;
/* Glyph bitmap. */
132
unsigned
long
bpr;
/* Number of bytes used per row. */
133
unsigned
short
bytes;
/* Number of bytes used for the bitmap. */
134
135
} bdf_glyph_t;
136
137
138
typedef
struct
bdf_font_t_
139
{
140
char
* name;
/* Name of the font. */
141
bdf_bbx_t bbx;
/* Font bounding box. */
142
143
unsigned
long
point_size;
/* Point size of the font. */
144
unsigned
long
resolution_x;
/* Font horizontal resolution. */
145
unsigned
long
resolution_y;
/* Font vertical resolution. */
146
147
int
spacing;
/* Font spacing value. */
148
unsigned
long
default_char;
/* Encoding of the default glyph. */
149
150
long
font_ascent;
/* Font ascent. */
151
long
font_descent;
/* Font descent. */
152
153
unsigned
long
glyphs_size;
/* Glyph structures allocated. */
154
unsigned
long
glyphs_used;
/* Glyph structures used. */
155
bdf_glyph_t* glyphs;
/* Glyphs themselves. */
156
157
unsigned
long
unencoded_size;
/* Unencoded glyph struct. allocated. */
158
unsigned
long
unencoded_used;
/* Unencoded glyph struct. used. */
159
bdf_glyph_t* unencoded;
/* Unencoded glyphs themselves. */
160
161
unsigned
long
props_size;
/* Font properties allocated. */
162
unsigned
long
props_used;
/* Font properties used. */
163
bdf_property_t* props;
/* Font properties themselves. */
164
165
char
* comments;
/* Font comments. */
166
unsigned
long
comments_len;
/* Length of comment string. */
167
168
FT_Hash internal;
/* Internal data for the font. */
169
170
unsigned
short
bpp;
/* Bits per pixel. */
171
172
FT_Memory memory;
173
174
bdf_property_t* user_props;
175
unsigned
long
nuser_props;
176
FT_HashRec proptbl;
177
178
} bdf_font_t;
179
180
181
/**************************************************************************
182
*
183
* Types for load/save callbacks.
184
*
185
*/
186
187
188
/* Error codes. */
189
#define BDF_MISSING_START -1
190
#define BDF_MISSING_FONTNAME -2
191
#define BDF_MISSING_SIZE -3
192
#define BDF_MISSING_CHARS -4
193
#define BDF_MISSING_STARTCHAR -5
194
#define BDF_MISSING_ENCODING -6
195
#define BDF_MISSING_BBX -7
196
197
#define BDF_OUT_OF_MEMORY -20
198
199
#define BDF_INVALID_LINE -100
200
201
202
/**************************************************************************
203
*
204
* BDF font API.
205
*
206
*/
207
208
FT_LOCAL( FT_Error )
209
bdf_load_font( FT_Stream stream,
210
FT_Memory memory,
211
unsigned
long
flags,
212
bdf_font_t* *font );
213
214
FT_LOCAL(
void
)
215
bdf_free_font( bdf_font_t* font );
216
217
FT_LOCAL( bdf_property_t * )
218
bdf_get_font_property( bdf_font_t* font,
219
const
char
* name );
220
221
222
FT_END_HEADER
223
224
225
#endif
/* BDF_H_ */
226
227
228
/* END */
fthash.h
ftobjs.h
ftstream.h
bdf_bbx_t_
Definition
bdf.h:111
bdf_font_t_
Definition
bdf.h:139
bdf_glyph_t_
Definition
bdf.h:125
bdf_property_t_
Definition
bdf.h:88
freetype
src
bdf
bdf.h
Generated by
1.18.0