1 | /***************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* ftmodapi.h */
|
---|
4 | /* */
|
---|
5 | /* FreeType modules public interface (specification). */
|
---|
6 | /* */
|
---|
7 | /* Copyright 1996-2001, 2002, 2003 by */
|
---|
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
---|
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 | #ifndef __FTMODAPI_H__
|
---|
20 | #define __FTMODAPI_H__
|
---|
21 |
|
---|
22 |
|
---|
23 | #include <ft2build.h>
|
---|
24 | #include FT_FREETYPE_H
|
---|
25 |
|
---|
26 | #ifdef FREETYPE_H
|
---|
27 | #error "freetype.h of FreeType 1 has been loaded!"
|
---|
28 | #error "Please fix the directory search order for header files"
|
---|
29 | #error "so that freetype.h of FreeType 2 is found first."
|
---|
30 | #endif
|
---|
31 |
|
---|
32 |
|
---|
33 | FT_BEGIN_HEADER
|
---|
34 |
|
---|
35 |
|
---|
36 | /*************************************************************************/
|
---|
37 | /* */
|
---|
38 | /* <Section> */
|
---|
39 | /* module_management */
|
---|
40 | /* */
|
---|
41 | /* <Title> */
|
---|
42 | /* Module Management */
|
---|
43 | /* */
|
---|
44 | /* <Abstract> */
|
---|
45 | /* How to add, upgrade, and remove modules from FreeType. */
|
---|
46 | /* */
|
---|
47 | /* <Description> */
|
---|
48 | /* The definitions below are used to manage modules within FreeType. */
|
---|
49 | /* Modules can be added, upgraded, and removed at runtime. */
|
---|
50 | /* */
|
---|
51 | /*************************************************************************/
|
---|
52 |
|
---|
53 |
|
---|
54 | /* module bit flags */
|
---|
55 | #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */
|
---|
56 | #define FT_MODULE_RENDERER 2 /* this module is a renderer */
|
---|
57 | #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
|
---|
58 | #define FT_MODULE_STYLER 8 /* this module is a styler */
|
---|
59 |
|
---|
60 | #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
|
---|
61 | /* scalable fonts */
|
---|
62 | #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
|
---|
63 | /* support vector outlines */
|
---|
64 | #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
|
---|
65 | /* own hinter */
|
---|
66 |
|
---|
67 |
|
---|
68 | /* deprecated values */
|
---|
69 | #define ft_module_font_driver FT_MODULE_FONT_DRIVER
|
---|
70 | #define ft_module_renderer FT_MODULE_RENDERER
|
---|
71 | #define ft_module_hinter FT_MODULE_HINTER
|
---|
72 | #define ft_module_styler FT_MODULE_STYLER
|
---|
73 |
|
---|
74 | #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
|
---|
75 | #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
|
---|
76 | #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
|
---|
77 |
|
---|
78 |
|
---|
79 | typedef FT_Pointer FT_Module_Interface;
|
---|
80 |
|
---|
81 | typedef FT_Error
|
---|
82 | (*FT_Module_Constructor)( FT_Module module );
|
---|
83 |
|
---|
84 | typedef void
|
---|
85 | (*FT_Module_Destructor)( FT_Module module );
|
---|
86 |
|
---|
87 | typedef FT_Module_Interface
|
---|
88 | (*FT_Module_Requester)( FT_Module module,
|
---|
89 | const char* name );
|
---|
90 |
|
---|
91 |
|
---|
92 | /*************************************************************************/
|
---|
93 | /* */
|
---|
94 | /* <Struct> */
|
---|
95 | /* FT_Module_Class */
|
---|
96 | /* */
|
---|
97 | /* <Description> */
|
---|
98 | /* The module class descriptor. */
|
---|
99 | /* */
|
---|
100 | /* <Fields> */
|
---|
101 | /* module_flags :: Bit flags describing the module. */
|
---|
102 | /* */
|
---|
103 | /* module_size :: The size of one module object/instance in */
|
---|
104 | /* bytes. */
|
---|
105 | /* */
|
---|
106 | /* module_name :: The name of the module. */
|
---|
107 | /* */
|
---|
108 | /* module_version :: The version, as a 16.16 fixed number */
|
---|
109 | /* (major.minor). */
|
---|
110 | /* */
|
---|
111 | /* module_requires :: The version of FreeType this module requires */
|
---|
112 | /* (starts at version 2.0, i.e 0x20000) */
|
---|
113 | /* */
|
---|
114 | /* module_init :: A function used to initialize (not create) a */
|
---|
115 | /* new module object. */
|
---|
116 | /* */
|
---|
117 | /* module_done :: A function used to finalize (not destroy) a */
|
---|
118 | /* given module object */
|
---|
119 | /* */
|
---|
120 | /* get_interface :: Queries a given module for a specific */
|
---|
121 | /* interface by name. */
|
---|
122 | /* */
|
---|
123 | typedef struct FT_Module_Class_
|
---|
124 | {
|
---|
125 | FT_ULong module_flags;
|
---|
126 | FT_Long module_size;
|
---|
127 | const FT_String* module_name;
|
---|
128 | FT_Fixed module_version;
|
---|
129 | FT_Fixed module_requires;
|
---|
130 |
|
---|
131 | const void* module_interface;
|
---|
132 |
|
---|
133 | FT_Module_Constructor module_init;
|
---|
134 | FT_Module_Destructor module_done;
|
---|
135 | FT_Module_Requester get_interface;
|
---|
136 |
|
---|
137 | } FT_Module_Class;
|
---|
138 |
|
---|
139 |
|
---|
140 | /*************************************************************************/
|
---|
141 | /* */
|
---|
142 | /* <Function> */
|
---|
143 | /* FT_Add_Module */
|
---|
144 | /* */
|
---|
145 | /* <Description> */
|
---|
146 | /* Adds a new module to a given library instance. */
|
---|
147 | /* */
|
---|
148 | /* <InOut> */
|
---|
149 | /* library :: A handle to the library object. */
|
---|
150 | /* */
|
---|
151 | /* <Input> */
|
---|
152 | /* clazz :: A pointer to class descriptor for the module. */
|
---|
153 | /* */
|
---|
154 | /* <Return> */
|
---|
155 | /* FreeType error code. 0 means success. */
|
---|
156 | /* */
|
---|
157 | /* <Note> */
|
---|
158 | /* An error will be returned if a module already exists by that name, */
|
---|
159 | /* or if the module requires a version of FreeType that is too great. */
|
---|
160 | /* */
|
---|
161 | FT_EXPORT( FT_Error )
|
---|
162 | FT_Add_Module( FT_Library library,
|
---|
163 | const FT_Module_Class* clazz );
|
---|
164 |
|
---|
165 |
|
---|
166 | /*************************************************************************/
|
---|
167 | /* */
|
---|
168 | /* <Function> */
|
---|
169 | /* FT_Get_Module */
|
---|
170 | /* */
|
---|
171 | /* <Description> */
|
---|
172 | /* Finds a module by its name. */
|
---|
173 | /* */
|
---|
174 | /* <Input> */
|
---|
175 | /* library :: A handle to the library object. */
|
---|
176 | /* */
|
---|
177 | /* module_name :: The module's name (as an ASCII string). */
|
---|
178 | /* */
|
---|
179 | /* <Return> */
|
---|
180 | /* A module handle. 0 if none was found. */
|
---|
181 | /* */
|
---|
182 | /* <Note> */
|
---|
183 | /* You should better be familiar with FreeType internals to know */
|
---|
184 | /* which module to look for :-) */
|
---|
185 | /* */
|
---|
186 | FT_EXPORT( FT_Module )
|
---|
187 | FT_Get_Module( FT_Library library,
|
---|
188 | const char* module_name );
|
---|
189 |
|
---|
190 |
|
---|
191 | /*************************************************************************/
|
---|
192 | /* */
|
---|
193 | /* <Function> */
|
---|
194 | /* FT_Remove_Module */
|
---|
195 | /* */
|
---|
196 | /* <Description> */
|
---|
197 | /* Removes a given module from a library instance. */
|
---|
198 | /* */
|
---|
199 | /* <InOut> */
|
---|
200 | /* library :: A handle to a library object. */
|
---|
201 | /* */
|
---|
202 | /* <Input> */
|
---|
203 | /* module :: A handle to a module object. */
|
---|
204 | /* */
|
---|
205 | /* <Return> */
|
---|
206 | /* FreeType error code. 0 means success. */
|
---|
207 | /* */
|
---|
208 | /* <Note> */
|
---|
209 | /* The module object is destroyed by the function in case of success. */
|
---|
210 | /* */
|
---|
211 | FT_EXPORT( FT_Error )
|
---|
212 | FT_Remove_Module( FT_Library library,
|
---|
213 | FT_Module module );
|
---|
214 |
|
---|
215 |
|
---|
216 | /*************************************************************************/
|
---|
217 | /* */
|
---|
218 | /* <Function> */
|
---|
219 | /* FT_New_Library */
|
---|
220 | /* */
|
---|
221 | /* <Description> */
|
---|
222 | /* This function is used to create a new FreeType library instance */
|
---|
223 | /* from a given memory object. It is thus possible to use libraries */
|
---|
224 | /* with distinct memory allocators within the same program. */
|
---|
225 | /* */
|
---|
226 | /* <Input> */
|
---|
227 | /* memory :: A handle to the original memory object. */
|
---|
228 | /* */
|
---|
229 | /* <Output> */
|
---|
230 | /* alibrary :: A pointer to handle of a new library object. */
|
---|
231 | /* */
|
---|
232 | /* <Return> */
|
---|
233 | /* FreeType error code. 0 means success. */
|
---|
234 | /* */
|
---|
235 | FT_EXPORT( FT_Error )
|
---|
236 | FT_New_Library( FT_Memory memory,
|
---|
237 | FT_Library *alibrary );
|
---|
238 |
|
---|
239 |
|
---|
240 | /*************************************************************************/
|
---|
241 | /* */
|
---|
242 | /* <Function> */
|
---|
243 | /* FT_Done_Library */
|
---|
244 | /* */
|
---|
245 | /* <Description> */
|
---|
246 | /* Discards a given library object. This closes all drivers and */
|
---|
247 | /* discards all resource objects. */
|
---|
248 | /* */
|
---|
249 | /* <Input> */
|
---|
250 | /* library :: A handle to the target library. */
|
---|
251 | /* */
|
---|
252 | /* <Return> */
|
---|
253 | /* FreeType error code. 0 means success. */
|
---|
254 | /* */
|
---|
255 | FT_EXPORT( FT_Error )
|
---|
256 | FT_Done_Library( FT_Library library );
|
---|
257 |
|
---|
258 |
|
---|
259 |
|
---|
260 | typedef void
|
---|
261 | (*FT_DebugHook_Func)( void* arg );
|
---|
262 |
|
---|
263 |
|
---|
264 | /*************************************************************************/
|
---|
265 | /* */
|
---|
266 | /* <Function> */
|
---|
267 | /* FT_Set_Debug_Hook */
|
---|
268 | /* */
|
---|
269 | /* <Description> */
|
---|
270 | /* Sets a debug hook function for debugging the interpreter of a font */
|
---|
271 | /* format. */
|
---|
272 | /* */
|
---|
273 | /* <InOut> */
|
---|
274 | /* library :: A handle to the library object. */
|
---|
275 | /* */
|
---|
276 | /* <Input> */
|
---|
277 | /* hook_index :: The index of the debug hook. You should use the */
|
---|
278 | /* values defined in ftobjs.h, e.g. */
|
---|
279 | /* FT_DEBUG_HOOK_TRUETYPE. */
|
---|
280 | /* */
|
---|
281 | /* debug_hook :: The function used to debug the interpreter. */
|
---|
282 | /* */
|
---|
283 | /* <Note> */
|
---|
284 | /* Currently, four debug hook slots are available, but only two (for */
|
---|
285 | /* the TrueType and the Type 1 interpreter) are defined. */
|
---|
286 | /* */
|
---|
287 | FT_EXPORT( void )
|
---|
288 | FT_Set_Debug_Hook( FT_Library library,
|
---|
289 | FT_UInt hook_index,
|
---|
290 | FT_DebugHook_Func debug_hook );
|
---|
291 |
|
---|
292 |
|
---|
293 |
|
---|
294 | /*************************************************************************/
|
---|
295 | /* */
|
---|
296 | /* <Function> */
|
---|
297 | /* FT_Add_Default_Modules */
|
---|
298 | /* */
|
---|
299 | /* <Description> */
|
---|
300 | /* Adds the set of default drivers to a given library object. */
|
---|
301 | /* This is only useful when you create a library object with */
|
---|
302 | /* FT_New_Library() (usually to plug a custom memory manager). */
|
---|
303 | /* */
|
---|
304 | /* <InOut> */
|
---|
305 | /* library :: A handle to a new library object. */
|
---|
306 | /* */
|
---|
307 | FT_EXPORT( void )
|
---|
308 | FT_Add_Default_Modules( FT_Library library );
|
---|
309 |
|
---|
310 |
|
---|
311 | /* */
|
---|
312 |
|
---|
313 |
|
---|
314 | FT_END_HEADER
|
---|
315 |
|
---|
316 | #endif /* __FTMODAPI_H__ */
|
---|
317 |
|
---|
318 |
|
---|
319 | /* END */
|
---|