1 /***************************************************************************/
5 /* FreeType modules public interface (specification). */
7 /* Copyright 1996-2000 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 /***************************************************************************/
22 #include <freetype/freetype.h>
30 /* module bit flags */
31 typedef enum FT_Module_Flags_
33 ft_module_font_driver
= 1, /* this module is a font driver */
34 ft_module_renderer
= 2, /* this module is a renderer */
35 ft_module_hinter
= 4, /* this module is a glyph hinter */
36 ft_module_styler
= 8, /* this module is a styler */
38 ft_module_driver_scalable
= 0x100, /* the driver supports scalable */
40 ft_module_driver_no_outlines
= 0x200, /* the driver does not support */
42 ft_module_driver_has_hinter
= 0x400 /* the driver provides its own */
48 typedef void (*FT_Module_Interface
)( void );
50 typedef FT_Error (*FT_Module_Constructor
)( FT_Module
module );
52 typedef void (*FT_Module_Destructor
)( FT_Module
module );
54 typedef FT_Module_Interface (*FT_Module_Requester
)( FT_Module
module,
58 /*************************************************************************/
64 /* The module class descriptor. */
67 /* module_flags :: Bit flags describing the module. */
69 /* module_size :: The size of one module object/instance in */
72 /* module_name :: The name of the module. */
74 /* module_version :: The version, as a 16.16 fixed number */
77 /* module_requires :: The version of FreeType this module requires */
78 /* (starts at version 2.0, i.e 0x20000) */
80 /* module_init :: A function used to initialize (not create) a */
81 /* new module object. */
83 /* module_done :: A function used to finalize (not destroy) a */
84 /* given module object */
86 /* get_interface :: Queries a given module for a specific */
87 /* interface by name. */
89 typedef struct FT_Module_Class_
91 FT_ULong module_flags
;
93 const FT_String
* module_name
;
94 FT_Fixed module_version
;
95 FT_Fixed module_requires
;
97 const void* module_interface
;
99 FT_Module_Constructor module_init
;
100 FT_Module_Destructor module_done
;
101 FT_Module_Requester get_interface
;
106 /*************************************************************************/
112 /* Adds a new module to a given library instance. */
115 /* library :: A handle to the library object. */
117 /* clazz :: A pointer to class descriptor for the module. */
120 /* FreeType error code. 0 means success. */
123 /* An error will be returned if a module already exists by that name, */
124 /* or if the module requires a version of FreeType that is too great. */
126 FT_EXPORT_DEF( FT_Error
) FT_Add_Module( FT_Library library
,
127 const FT_Module_Class
* clazz
);
130 /*************************************************************************/
136 /* Finds a module by its name. */
139 /* library :: A handle to the library object. */
141 /* module_name :: The module's name (as an ASCII string). */
144 /* A module handle. 0 if none was found. */
147 /* You should better be familiar with FreeType internals to know */
148 /* which module to look for :-) */
150 FT_EXPORT_DEF( FT_Module
) FT_Get_Module( FT_Library library
,
151 const char* module_name
);
154 /*************************************************************************/
157 /* FT_Remove_Module */
160 /* Removes a given module from a library instance. */
163 /* library :: A handle to a library object. */
165 /* module :: A handle to a module object. */
168 /* FreeType error code. 0 means success. */
171 /* The module object is destroyed by the function in case of success. */
173 FT_EXPORT_DEF( FT_Error
) FT_Remove_Module( FT_Library library
,
177 /*************************************************************************/
183 /* This function is used to create a new FreeType library instance */
184 /* from a given memory object. It is thus possible to use libraries */
185 /* with distinct memory allocators within the same program. */
188 /* memory :: A handle to the original memory object. */
191 /* alibrary :: A pointer to handle of a new library object. */
194 /* FreeType error code. 0 means success. */
196 FT_EXPORT_DEF( FT_Error
) FT_New_Library( FT_Memory memory
,
197 FT_Library
* library
);
200 /*************************************************************************/
203 /* FT_Done_Library */
206 /* Discards a given library object. This closes all drivers and */
207 /* discards all resource objects. */
210 /* library :: A handle to the target library. */
213 /* FreeType error code. 0 means success. */
215 FT_EXPORT_DEF( FT_Error
) FT_Done_Library( FT_Library library
);
219 typedef void (*FT_DebugHook_Func
)( void* arg
);
222 /*************************************************************************/
225 /* FT_Set_Debug_Hook */
228 /* Sets a debug hook function for debugging the interpreter of a font */
232 /* library :: A handle to the library object. */
234 /* hook_index :: The index of the debug hook. You should use the */
235 /* values defined in ftobjs.h, e.g. */
236 /* FT_DEBUG_HOOK_TRUETYPE */
238 /* debug_hook :: The function used to debug the interpreter. */
241 /* Currently, four debug hook slots are available, but only two (for */
242 /* the TrueType and the Type 1 interpreter) are defined. */
244 FT_EXPORT_DEF( void ) FT_Set_Debug_Hook( FT_Library library
,
246 FT_DebugHook_Func debug_hook
);
250 /*************************************************************************/
253 /* FT_Add_Default_Modules */
256 /* Adds the set of default drivers to a given library object. */
257 /* This is only useful when you create a library object with */
258 /* FT_New_Library() (usually to plug a custom memory manager). */
261 /* library :: A handle to a new library object. */
263 FT_EXPORT_DEF( void ) FT_Add_Default_Modules( FT_Library library
);
271 #endif /* FTMODULE_H */