1 /***************************************************************************/
5 /* FreeType modules public interface (specification). */
7 /* Copyright 1996-2001 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
19 #ifndef __FTMODULE_H__
20 #define __FTMODULE_H__
24 #include FT_FREETYPE_H
30 /*************************************************************************/
33 /* module_management */
36 /* Module Management */
39 /* How to add, upgrade, and remove modules from FreeType. */
42 /* The definitions below are used to manage modules within FreeType. */
43 /* Modules can be added, upgraded, and removed at runtime. */
45 /*************************************************************************/
48 /* module bit flags */
49 typedef enum FT_Module_Flags_
51 ft_module_font_driver = 1, /* this module is a font driver */
52 ft_module_renderer = 2, /* this module is a renderer */
53 ft_module_hinter = 4, /* this module is a glyph hinter */
54 ft_module_styler = 8, /* this module is a styler */
56 ft_module_driver_scalable = 0x100, /* the driver supports scalable */
58 ft_module_driver_no_outlines = 0x200, /* the driver does not support */
60 ft_module_driver_has_hinter = 0x400 /* the driver provides its own */
67 (*FT_Module_Interface)( void );
70 (*FT_Module_Constructor)( FT_Module module );
73 (*FT_Module_Destructor)( FT_Module module );
75 typedef FT_Module_Interface
76 (*FT_Module_Requester)( FT_Module module,
80 /*************************************************************************/
86 /* The module class descriptor. */
89 /* module_flags :: Bit flags describing the module. */
91 /* module_size :: The size of one module object/instance in */
94 /* module_name :: The name of the module. */
96 /* module_version :: The version, as a 16.16 fixed number */
99 /* module_requires :: The version of FreeType this module requires */
100 /* (starts at version 2.0, i.e 0x20000) */
102 /* module_init :: A function used to initialize (not create) a */
103 /* new module object. */
105 /* module_done :: A function used to finalize (not destroy) a */
106 /* given module object */
108 /* get_interface :: Queries a given module for a specific */
109 /* interface by name. */
111 typedef struct FT_Module_Class_
113 FT_ULong module_flags;
115 const FT_String* module_name;
116 FT_Fixed module_version;
117 FT_Fixed module_requires;
119 const void* module_interface;
121 FT_Module_Constructor module_init;
122 FT_Module_Destructor module_done;
123 FT_Module_Requester get_interface;
128 /*************************************************************************/
134 /* Adds a new module to a given library instance. */
137 /* library :: A handle to the library object. */
140 /* clazz :: A pointer to class descriptor for the module. */
143 /* FreeType error code. 0 means success. */
146 /* An error will be returned if a module already exists by that name, */
147 /* or if the module requires a version of FreeType that is too great. */
149 FT_EXPORT( FT_Error )
150 FT_Add_Module( FT_Library library,
151 const FT_Module_Class* clazz );
154 /*************************************************************************/
160 /* Finds a module by its name. */
163 /* library :: A handle to the library object. */
165 /* module_name :: The module's name (as an ASCII string). */
168 /* A module handle. 0 if none was found. */
171 /* You should better be familiar with FreeType internals to know */
172 /* which module to look for :-) */
174 FT_EXPORT( FT_Module )
175 FT_Get_Module( FT_Library library,
176 const char* module_name );
179 /*************************************************************************/
182 /* FT_Remove_Module */
185 /* Removes a given module from a library instance. */
188 /* library :: A handle to a library object. */
191 /* module :: A handle to a module object. */
194 /* FreeType error code. 0 means success. */
197 /* The module object is destroyed by the function in case of success. */
199 FT_EXPORT( FT_Error )
200 FT_Remove_Module( FT_Library library,
204 /*************************************************************************/
210 /* This function is used to create a new FreeType library instance */
211 /* from a given memory object. It is thus possible to use libraries */
212 /* with distinct memory allocators within the same program. */
215 /* memory :: A handle to the original memory object. */
218 /* alibrary :: A pointer to handle of a new library object. */
221 /* FreeType error code. 0 means success. */
223 FT_EXPORT( FT_Error )
224 FT_New_Library( FT_Memory memory,
225 FT_Library *alibrary );
228 /*************************************************************************/
231 /* FT_Done_Library */
234 /* Discards a given library object. This closes all drivers and */
235 /* discards all resource objects. */
238 /* library :: A handle to the target library. */
241 /* FreeType error code. 0 means success. */
243 FT_EXPORT( FT_Error )
244 FT_Done_Library( FT_Library library );
249 (*FT_DebugHook_Func)( void* arg );
252 /*************************************************************************/
255 /* FT_Set_Debug_Hook */
258 /* Sets a debug hook function for debugging the interpreter of a font */
262 /* library :: A handle to the library object. */
265 /* hook_index :: The index of the debug hook. You should use the */
266 /* values defined in ftobjs.h, e.g. */
267 /* FT_DEBUG_HOOK_TRUETYPE. */
269 /* debug_hook :: The function used to debug the interpreter. */
272 /* Currently, four debug hook slots are available, but only two (for */
273 /* the TrueType and the Type 1 interpreter) are defined. */
276 FT_Set_Debug_Hook( FT_Library library,
278 FT_DebugHook_Func debug_hook );
282 /*************************************************************************/
285 /* FT_Add_Default_Modules */
288 /* Adds the set of default drivers to a given library object. */
289 /* This is only useful when you create a library object with */
290 /* FT_New_Library() (usually to plug a custom memory manager). */
293 /* library :: A handle to a new library object. */
296 FT_Add_Default_Modules( FT_Library library );
304 #endif /* __FTMODULE_H__ */