sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
ftrfork.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* ftrfork.h
4
*
5
* Embedded resource forks accessor (specification).
6
*
7
* Copyright (C) 2004-2025 by
8
* Masatake YAMATO and Redhat K.K.
9
*
10
* This file is part of the FreeType project, and may only be used,
11
* modified, and distributed under the terms of the FreeType project
12
* license, LICENSE.TXT. By continuing to use, modify, or distribute
13
* this file you indicate that you have read the license and
14
* understand and accept it fully.
15
*
16
*/
17
18
/****************************************************************************
19
* Development of the code in this file is support of
20
* Information-technology Promotion Agency, Japan.
21
*/
22
23
28
#ifndef FTRFORK_H_
29
#define FTRFORK_H_
30
31
32
#include <
freetype/internal/ftobjs.h
>
33
34
35
FT_BEGIN_HEADER
36
37
38
/* Number of guessing rules supported in `FT_Raccess_Guess'. */
39
/* Don't forget to increment the number if you add a new guessing rule. */
40
#define FT_RACCESS_N_RULES 9
41
42
43
/* A structure to describe a reference in a resource by its resource ID */
44
/* and internal offset. The `POST' resource expects to be concatenated */
45
/* by the order of resource IDs instead of its appearance in the file. */
46
47
typedef
struct
FT_RFork_Ref_
48
{
49
FT_Short res_id;
50
FT_Long offset;
51
52
} FT_RFork_Ref;
53
54
55
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
56
typedef
FT_Error
57
(*ft_raccess_guess_func)( FT_Library library,
58
FT_Stream stream,
59
char
*base_file_name,
60
char
**result_file_name,
61
FT_Long *result_offset );
62
63
typedef
enum
FT_RFork_Rule_ {
64
FT_RFork_Rule_invalid = -2,
65
FT_RFork_Rule_uknown,
/* -1 */
66
FT_RFork_Rule_apple_double,
67
FT_RFork_Rule_apple_single,
68
FT_RFork_Rule_darwin_ufs_export,
69
FT_RFork_Rule_darwin_newvfs,
70
FT_RFork_Rule_darwin_hfsplus,
71
FT_RFork_Rule_vfat,
72
FT_RFork_Rule_linux_cap,
73
FT_RFork_Rule_linux_double,
74
FT_RFork_Rule_linux_netatalk
75
} FT_RFork_Rule;
76
77
/* For fast translation between rule index and rule type,
78
* the macros FT_RFORK_xxx should be kept consistent with the
79
* raccess_guess_funcs table
80
*/
81
typedef
struct
ft_raccess_guess_rec_ {
82
ft_raccess_guess_func func;
83
FT_RFork_Rule type;
84
} ft_raccess_guess_rec;
85
86
87
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
88
static const type name[] = {
89
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
90
{ raccess_guess_ ## func_suffix, \
91
FT_RFork_Rule_ ## type_suffix },
92
/* this array is a storage, thus a final `;' is needed */
93
#define CONST_FT_RFORK_RULE_ARRAY_END };
94
95
#endif
/* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
96
97
98
/**************************************************************************
99
*
100
* @function:
101
* FT_Raccess_Guess
102
*
103
* @description:
104
* Guess a file name and offset where the actual resource fork is stored.
105
* The macro FT_RACCESS_N_RULES holds the number of guessing rules; the
106
* guessed result for the Nth rule is represented as a triplet: a new
107
* file name (new_names[N]), a file offset (offsets[N]), and an error
108
* code (errors[N]).
109
*
110
* @input:
111
* library ::
112
* A FreeType library instance.
113
*
114
* stream ::
115
* A file stream containing the resource fork.
116
*
117
* base_name ::
118
* The (base) file name of the resource fork used for some guessing
119
* rules.
120
*
121
* @output:
122
* new_names ::
123
* An array of guessed file names in which the resource forks may
124
* exist. If 'new_names[N]' is `NULL`, the guessed file name is equal
125
* to `base_name`.
126
*
127
* offsets ::
128
* An array of guessed file offsets. 'offsets[N]' holds the file
129
* offset of the possible start of the resource fork in file
130
* 'new_names[N]'.
131
*
132
* errors ::
133
* An array of FreeType error codes. 'errors[N]' is the error code of
134
* Nth guessing rule function. If 'errors[N]' is not FT_Err_Ok,
135
* 'new_names[N]' and 'offsets[N]' are meaningless.
136
*/
137
FT_BASE(
void
)
138
FT_Raccess_Guess( FT_Library library,
139
FT_Stream stream,
140
char
* base_name,
141
char
** new_names,
142
FT_Long* offsets,
143
FT_Error* errors );
144
145
146
/**************************************************************************
147
*
148
* @function:
149
* FT_Raccess_Get_HeaderInfo
150
*
151
* @description:
152
* Get the information from the header of resource fork. The information
153
* includes the file offset where the resource map starts, and the file
154
* offset where the resource data starts. `FT_Raccess_Get_DataOffsets`
155
* requires these two data.
156
*
157
* @input:
158
* library ::
159
* A FreeType library instance.
160
*
161
* stream ::
162
* A file stream containing the resource fork.
163
*
164
* rfork_offset ::
165
* The file offset where the resource fork starts.
166
*
167
* @output:
168
* map_offset ::
169
* The file offset where the resource map starts.
170
*
171
* rdata_pos ::
172
* The file offset where the resource data starts.
173
*
174
* @return:
175
* FreeType error code. FT_Err_Ok means success.
176
*/
177
FT_BASE( FT_Error )
178
FT_Raccess_Get_HeaderInfo( FT_Library library,
179
FT_Stream stream,
180
FT_Long rfork_offset,
181
FT_Long *map_offset,
182
FT_Long *rdata_pos );
183
184
185
/**************************************************************************
186
*
187
* @function:
188
* FT_Raccess_Get_DataOffsets
189
*
190
* @description:
191
* Get the data offsets for a tag in a resource fork. Offsets are stored
192
* in an array because, in some cases, resources in a resource fork have
193
* the same tag.
194
*
195
* @input:
196
* library ::
197
* A FreeType library instance.
198
*
199
* stream ::
200
* A file stream containing the resource fork.
201
*
202
* map_offset ::
203
* The file offset where the resource map starts.
204
*
205
* rdata_pos ::
206
* The file offset where the resource data starts.
207
*
208
* tag ::
209
* The resource tag.
210
*
211
* sort_by_res_id ::
212
* A Boolean to sort the fragmented resource by their ids. The
213
* fragmented resources for 'POST' resource should be sorted to restore
214
* Type1 font properly. For 'sfnt' resources, sorting may induce a
215
* different order of the faces in comparison to that by QuickDraw API.
216
*
217
* @output:
218
* offsets ::
219
* The stream offsets for the resource data specified by 'tag'. This
220
* array is allocated by the function, so you have to call @ft_mem_free
221
* after use.
222
*
223
* count ::
224
* The length of offsets array.
225
*
226
* @return:
227
* FreeType error code. FT_Err_Ok means success.
228
*
229
* @note:
230
* Normally you should use `FT_Raccess_Get_HeaderInfo` to get the value
231
* for `map_offset` and `rdata_pos`.
232
*/
233
FT_BASE( FT_Error )
234
FT_Raccess_Get_DataOffsets( FT_Library library,
235
FT_Stream stream,
236
FT_Long map_offset,
237
FT_Long rdata_pos,
238
FT_Long tag,
239
FT_Bool sort_by_res_id,
240
FT_Long **offsets,
241
FT_Long *count );
242
243
244
FT_END_HEADER
245
246
#endif
/* FTRFORK_H_ */
247
248
249
/* END */
ftobjs.h
FT_RFork_Ref_
Definition
ftrfork.h:48
freetype
include
freetype
internal
ftrfork.h
Generated by
1.18.0