update for HEAD-2003021201
[reactos.git] / include / freetype / ftmodule.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftmodule.h                                                             */
4 /*                                                                         */
5 /*    FreeType modules public interface (specification).                   */
6 /*                                                                         */
7 /*  Copyright 1996-2000 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 FTMODULE_H
20 #define FTMODULE_H
21
22 #include <freetype/freetype.h>
23
24
25 #ifdef __cplusplus
26   extern "C" {
27 #endif
28
29
30   /* module bit flags */
31   typedef enum  FT_Module_Flags_
32   {
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       */
37
38     ft_module_driver_scalable     = 0x100, /* the driver supports scalable  */
39                                            /* fonts                         */
40     ft_module_driver_no_outlines  = 0x200, /* the driver does not support   */
41                                            /* vector outlines               */
42     ft_module_driver_has_hinter   = 0x400  /* the driver provides its own   */
43                                            /* hinter                        */
44
45   } FT_Module_Flags;
46
47
48   typedef void  (*FT_Module_Interface)( void );
49
50   typedef FT_Error  (*FT_Module_Constructor)( FT_Module  module );
51
52   typedef void  (*FT_Module_Destructor)( FT_Module  module );
53
54   typedef FT_Module_Interface (*FT_Module_Requester)( FT_Module    module,
55                                                       const char*  name );
56
57
58   /*************************************************************************/
59   /*                                                                       */
60   /* <Struct>                                                              */
61   /*    FT_Module_Class                                                    */
62   /*                                                                       */
63   /* <Description>                                                         */
64   /*    The module class descriptor.                                       */
65   /*                                                                       */
66   /* <Fields>                                                              */
67   /*    module_flags      :: Bit flags describing the module.              */
68   /*                                                                       */
69   /*    module_size       :: The size of one module object/instance in     */
70   /*                         bytes.                                        */
71   /*                                                                       */
72   /*    module_name       :: The name of the module.                       */
73   /*                                                                       */
74   /*    module_version    :: The version, as a 16.16 fixed number          */
75   /*                         (major.minor).                                */
76   /*                                                                       */
77   /*    module_requires   :: The version of FreeType this module requires  */
78   /*                         (starts at version 2.0, i.e 0x20000)          */
79   /*                                                                       */
80   /*    module_init       :: A function used to initialize (not create) a  */
81   /*                         new module object.                            */
82   /*                                                                       */
83   /*    module_done       :: A function used to finalize (not destroy) a   */
84   /*                         given module object                           */
85   /*                                                                       */
86   /*    get_interface     :: Queries a given module for a specific         */
87   /*                         interface by name.                            */
88   /*                                                                       */
89   typedef struct  FT_Module_Class_
90   {
91     FT_ULong               module_flags;
92     FT_Int                 module_size;
93     const FT_String*       module_name;
94     FT_Fixed               module_version;
95     FT_Fixed               module_requires;
96
97     const void*            module_interface;
98
99     FT_Module_Constructor  module_init;
100     FT_Module_Destructor   module_done;
101     FT_Module_Requester    get_interface;
102
103   } FT_Module_Class;
104
105
106   /*************************************************************************/
107   /*                                                                       */
108   /* <Function>                                                            */
109   /*    FT_Add_Module                                                      */
110   /*                                                                       */
111   /* <Description>                                                         */
112   /*    Adds a new module to a given library instance.                     */
113   /*                                                                       */
114   /* <Input>                                                               */
115   /*    library :: A handle to the library object.                         */
116   /*                                                                       */
117   /*    clazz   :: A pointer to class descriptor for the module.           */
118   /*                                                                       */
119   /* <Return>                                                              */
120   /*    FreeType error code.  0 means success.                             */
121   /*                                                                       */
122   /* <Note>                                                                */
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. */
125   /*                                                                       */
126   FT_EXPORT_DEF( FT_Error )  FT_Add_Module( FT_Library              library,
127                                             const FT_Module_Class*  clazz );
128
129
130   /*************************************************************************/
131   /*                                                                       */
132   /* <Function>                                                            */
133   /*    FT_Get_Module                                                      */
134   /*                                                                       */
135   /* <Description>                                                         */
136   /*    Finds a module by its name.                                        */
137   /*                                                                       */
138   /* <Input>                                                               */
139   /*    library     :: A handle to the library object.                     */
140   /*                                                                       */
141   /*    module_name :: The module's name (as an ASCII string).             */
142   /*                                                                       */
143   /* <Return>                                                              */
144   /*    A module handle.  0 if none was found.                             */
145   /*                                                                       */
146   /* <Note>                                                                */
147   /*    You should better be familiar with FreeType internals to know      */
148   /*    which module to look for :-)                                       */
149   /*                                                                       */
150   FT_EXPORT_DEF( FT_Module )  FT_Get_Module( FT_Library   library,
151                                              const char*  module_name );
152
153
154   /*************************************************************************/
155   /*                                                                       */
156   /* <Function>                                                            */
157   /*    FT_Remove_Module                                                   */
158   /*                                                                       */
159   /* <Description>                                                         */
160   /*    Removes a given module from a library instance.                    */
161   /*                                                                       */
162   /* <Input>                                                               */
163   /*    library :: A handle to a library object.                           */
164   /*                                                                       */
165   /*    module  :: A handle to a module object.                            */
166   /*                                                                       */
167   /* <Return>                                                              */
168   /*    FreeType error code.  0 means success.                             */
169   /*                                                                       */
170   /* <Note>                                                                */
171   /*    The module object is destroyed by the function in case of success. */
172   /*                                                                       */
173   FT_EXPORT_DEF( FT_Error )  FT_Remove_Module( FT_Library  library,
174                                                FT_Module   module );
175
176
177   /*************************************************************************/
178   /*                                                                       */
179   /* <Function>                                                            */
180   /*    FT_New_Library                                                     */
181   /*                                                                       */
182   /* <Description>                                                         */
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.           */
186   /*                                                                       */
187   /* <Input>                                                               */
188   /*    memory   :: A handle to the original memory object.                */
189   /*                                                                       */
190   /* <Output>                                                              */
191   /*    alibrary :: A pointer to handle of a new library object.           */
192   /*                                                                       */
193   /* <Return>                                                              */
194   /*    FreeType error code.  0 means success.                             */
195   /*                                                                       */
196   FT_EXPORT_DEF( FT_Error )  FT_New_Library( FT_Memory    memory,
197                                              FT_Library*  library );
198
199
200   /*************************************************************************/
201   /*                                                                       */
202   /* <Function>                                                            */
203   /*    FT_Done_Library                                                    */
204   /*                                                                       */
205   /* <Description>                                                         */
206   /*    Discards a given library object.  This closes all drivers and      */
207   /*    discards all resource objects.                                     */
208   /*                                                                       */
209   /* <Input>                                                               */
210   /*    library :: A handle to the target library.                         */
211   /*                                                                       */
212   /* <Return>                                                              */
213   /*    FreeType error code.  0 means success.                             */
214   /*                                                                       */
215   FT_EXPORT_DEF( FT_Error )  FT_Done_Library( FT_Library  library );
216
217
218
219   typedef void  (*FT_DebugHook_Func)( void*  arg );
220
221
222   /*************************************************************************/
223   /*                                                                       */
224   /* <Function>                                                            */
225   /*    FT_Set_Debug_Hook                                                  */
226   /*                                                                       */
227   /* <Description>                                                         */
228   /*    Sets a debug hook function for debugging the interpreter of a font */
229   /*    format.                                                            */
230   /*                                                                       */
231   /* <Input>                                                               */
232   /*    library    :: A handle to the library object.                      */
233   /*                                                                       */
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                               */
237   /*                                                                       */
238   /*    debug_hook :: The function used to debug the interpreter.          */
239   /*                                                                       */
240   /* <Note>                                                                */
241   /*    Currently, four debug hook slots are available, but only two (for  */
242   /*    the TrueType and the Type 1 interpreter) are defined.              */
243   /*                                                                       */
244   FT_EXPORT_DEF( void )  FT_Set_Debug_Hook( FT_Library         library,
245                                             FT_UInt            hook_index,
246                                             FT_DebugHook_Func  debug_hook );
247
248
249
250   /*************************************************************************/
251   /*                                                                       */
252   /* <Function>                                                            */
253   /*    FT_Add_Default_Modules                                             */
254   /*                                                                       */
255   /* <Description>                                                         */
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).        */
259   /*                                                                       */
260   /* <InOut>                                                               */
261   /*    library :: A handle to a new library object.                       */
262   /*                                                                       */
263   FT_EXPORT_DEF( void )  FT_Add_Default_Modules( FT_Library  library );
264
265
266 #ifdef __cplusplus
267   }
268 #endif
269
270
271 #endif /* FTMODULE_H */
272
273
274 /* END */