ReactOS 0.4.16-dev-2354-g16de117
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-2020 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
24#ifndef FTRFORK_H_
25#define FTRFORK_H_
26
27
29
30
32
33
34 /* Number of guessing rules supported in `FT_Raccess_Guess'. */
35 /* Don't forget to increment the number if you add a new guessing rule. */
36#define FT_RACCESS_N_RULES 9
37
38
39 /* A structure to describe a reference in a resource by its resource ID */
40 /* and internal offset. The `POST' resource expects to be concatenated */
41 /* by the order of resource IDs instead of its appearance in the file. */
42
43 typedef struct FT_RFork_Ref_
44 {
47
49
50
51#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
52 typedef FT_Error
53 (*ft_raccess_guess_func)( FT_Library library,
55 char *base_file_name,
56 char **result_file_name,
57 FT_Long *result_offset );
58
59 typedef enum FT_RFork_Rule_ {
60 FT_RFork_Rule_invalid = -2,
61 FT_RFork_Rule_uknown, /* -1 */
62 FT_RFork_Rule_apple_double,
63 FT_RFork_Rule_apple_single,
64 FT_RFork_Rule_darwin_ufs_export,
65 FT_RFork_Rule_darwin_newvfs,
66 FT_RFork_Rule_darwin_hfsplus,
67 FT_RFork_Rule_vfat,
68 FT_RFork_Rule_linux_cap,
69 FT_RFork_Rule_linux_double,
70 FT_RFork_Rule_linux_netatalk
71 } FT_RFork_Rule;
72
73 /* For fast translation between rule index and rule type,
74 * the macros FT_RFORK_xxx should be kept consistent with the
75 * raccess_guess_funcs table
76 */
77 typedef struct ft_raccess_guess_rec_ {
78 ft_raccess_guess_func func;
79 FT_RFork_Rule type;
80 } ft_raccess_guess_rec;
81
82
83#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
84 static const type name[] = {
85#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
86 { raccess_guess_ ## func_suffix, \
87 FT_RFork_Rule_ ## type_suffix },
88 /* this array is a storage, thus a final `;' is needed */
89#define CONST_FT_RFORK_RULE_ARRAY_END };
90
91#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
92
93
94 /**************************************************************************
95 *
96 * @function:
97 * FT_Raccess_Guess
98 *
99 * @description:
100 * Guess a file name and offset where the actual resource fork is stored.
101 * The macro FT_RACCESS_N_RULES holds the number of guessing rules; the
102 * guessed result for the Nth rule is represented as a triplet: a new
103 * file name (new_names[N]), a file offset (offsets[N]), and an error
104 * code (errors[N]).
105 *
106 * @input:
107 * library ::
108 * A FreeType library instance.
109 *
110 * stream ::
111 * A file stream containing the resource fork.
112 *
113 * base_name ::
114 * The (base) file name of the resource fork used for some guessing
115 * rules.
116 *
117 * @output:
118 * new_names ::
119 * An array of guessed file names in which the resource forks may
120 * exist. If 'new_names[N]' is `NULL`, the guessed file name is equal
121 * to `base_name`.
122 *
123 * offsets ::
124 * An array of guessed file offsets. 'offsets[N]' holds the file
125 * offset of the possible start of the resource fork in file
126 * 'new_names[N]'.
127 *
128 * errors ::
129 * An array of FreeType error codes. 'errors[N]' is the error code of
130 * Nth guessing rule function. If 'errors[N]' is not FT_Err_Ok,
131 * 'new_names[N]' and 'offsets[N]' are meaningless.
132 */
133 FT_BASE( void )
136 char* base_name,
137 char** new_names,
139 FT_Error* errors );
140
141
142 /**************************************************************************
143 *
144 * @function:
145 * FT_Raccess_Get_HeaderInfo
146 *
147 * @description:
148 * Get the information from the header of resource fork. The information
149 * includes the file offset where the resource map starts, and the file
150 * offset where the resource data starts. `FT_Raccess_Get_DataOffsets`
151 * requires these two data.
152 *
153 * @input:
154 * library ::
155 * A FreeType library instance.
156 *
157 * stream ::
158 * A file stream containing the resource fork.
159 *
160 * rfork_offset ::
161 * The file offset where the resource fork starts.
162 *
163 * @output:
164 * map_offset ::
165 * The file offset where the resource map starts.
166 *
167 * rdata_pos ::
168 * The file offset where the resource data starts.
169 *
170 * @return:
171 * FreeType error code. FT_Err_Ok means success.
172 */
176 FT_Long rfork_offset,
177 FT_Long *map_offset,
178 FT_Long *rdata_pos );
179
180
181 /**************************************************************************
182 *
183 * @function:
184 * FT_Raccess_Get_DataOffsets
185 *
186 * @description:
187 * Get the data offsets for a tag in a resource fork. Offsets are stored
188 * in an array because, in some cases, resources in a resource fork have
189 * the same tag.
190 *
191 * @input:
192 * library ::
193 * A FreeType library instance.
194 *
195 * stream ::
196 * A file stream containing the resource fork.
197 *
198 * map_offset ::
199 * The file offset where the resource map starts.
200 *
201 * rdata_pos ::
202 * The file offset where the resource data starts.
203 *
204 * tag ::
205 * The resource tag.
206 *
207 * sort_by_res_id ::
208 * A Boolean to sort the fragmented resource by their ids. The
209 * fragmented resources for 'POST' resource should be sorted to restore
210 * Type1 font properly. For 'sfnt' resources, sorting may induce a
211 * different order of the faces in comparison to that by QuickDraw API.
212 *
213 * @output:
214 * offsets ::
215 * The stream offsets for the resource data specified by 'tag'. This
216 * array is allocated by the function, so you have to call @ft_mem_free
217 * after use.
218 *
219 * count ::
220 * The length of offsets array.
221 *
222 * @return:
223 * FreeType error code. FT_Err_Ok means success.
224 *
225 * @note:
226 * Normally you should use `FT_Raccess_Get_HeaderInfo` to get the value
227 * for `map_offset` and `rdata_pos`.
228 */
232 FT_Long map_offset,
233 FT_Long rdata_pos,
234 FT_Long tag,
235 FT_Bool sort_by_res_id,
237 FT_Long *count );
238
239
241
242#endif /* FTRFORK_H_ */
243
244
245/* END */
FT_Library library
Definition: cffdrivr.c:660
#define FT_BASE(x)
#define FT_END_HEADER
Definition: ftheader.h:57
#define FT_BEGIN_HEADER
Definition: ftheader.h:37
struct FT_RFork_Ref_ FT_RFork_Ref
FT_Raccess_Guess(FT_Library library, FT_Stream stream, char *base_name, char **new_names, FT_Long *offsets, FT_Error *errors)
Definition: ftrfork.c:916
FT_Raccess_Get_HeaderInfo(FT_Library library, FT_Stream stream, FT_Long rfork_offset, FT_Long *map_offset, FT_Long *rdata_pos)
Definition: ftrfork.c:50
FT_Raccess_Get_DataOffsets(FT_Library library, FT_Stream stream, FT_Long map_offset, FT_Long rdata_pos, FT_Long tag, FT_Bool sort_by_res_id, FT_Long **offsets, FT_Long *count)
Definition: ftrfork.c:184
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
int FT_Error
Definition: fttypes.h:299
signed long FT_Long
Definition: fttypes.h:242
signed short FT_Short
Definition: fttypes.h:198
static const FxOffsetAndName offsets[]
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
FT_Long offset
Definition: ftrfork.h:46
FT_Short res_id
Definition: ftrfork.h:45
Definition: parse.h:23
Definition: ecma_167.h:138