:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / subsys / win32k / freetype / include / freetype / internal / ftextend.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftextend.h                                                             */
4 /*                                                                         */
5 /*    FreeType extensions implementation (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 FTEXTEND_H
20 #define FTEXTEND_H
21
22
23 #include <freetype/internal/ftobjs.h>
24
25
26 #ifdef __cplusplus
27   extern "C" {
28 #endif
29
30
31   /*************************************************************************/
32   /*                                                                       */
33   /* The extensions don't need to be integrated at compile time into the   */
34   /* engine, only at link time.                                            */
35   /*                                                                       */
36   /*************************************************************************/
37
38
39   /*************************************************************************/
40   /*                                                                       */
41   /* <FuncType>                                                            */
42   /*    FT_Extension_Initializer                                           */
43   /*                                                                       */
44   /* <Description>                                                         */
45   /*    Each new face object can have several extensions associated with   */
46   /*    it at creation time.  This function is used to initialize given    */
47   /*    extension data for a given face.                                   */
48   /*                                                                       */
49   /* <InOut>                                                               */
50   /*    ext  :: A typeless pointer to the extension data.                  */
51   /*                                                                       */
52   /*    face :: A handle to the source face object the extension is        */
53   /*            associated with.                                           */
54   /*                                                                       */
55   /* <Return>                                                              */
56   /*    FreeType error code.  0 means success.                             */
57   /*                                                                       */
58   /* <Note>                                                                */
59   /*    In case of error, the initializer should not destroy the extension */
60   /*    data, as the finalizer will get called later by the function's     */
61   /*    caller.                                                            */
62   /*                                                                       */
63   typedef FT_Error  (*FT_Extension_Initializer)( void*    ext,
64                                                  FT_Face  face );
65
66
67   /*************************************************************************/
68   /*                                                                       */
69   /* <FuncType>                                                            */
70   /*    FT_Extension_Finalizer                                             */
71   /*                                                                       */
72   /* <Description>                                                         */
73   /*    Each new face object can have several extensions associated with   */
74   /*    it at creation time.  This function is used to finalize given      */
75   /*    extension data for a given face; it occurs before the face object  */
76   /*    itself is finalized.                                               */
77   /*                                                                       */
78   /* <InOut>                                                               */
79   /*   ext  :: A typeless pointer to the extension data.                   */
80   /*                                                                       */
81   /*   face :: A handle to the source face object the extension is         */
82   /*           associated with.                                            */
83   /*                                                                       */
84   typedef void  (*FT_Extension_Finalizer)( void*    ext,
85                                            FT_Face  face );
86
87
88   /*************************************************************************/
89   /*                                                                       */
90   /* <Struct>                                                              */
91   /*    FT_Extension_Class                                                 */
92   /*                                                                       */
93   /* <Description>                                                         */
94   /*    A simple structure used to describe a given extension to the       */
95   /*    FreeType base layer.  An FT_Extension_Class is used as a parameter */
96   /*    for FT_Register_Extension().                                       */
97   /*                                                                       */
98   /* <Fields>                                                              */
99   /*    id        :: The extension's ID.  This is a normal C string that   */
100   /*                 is used to uniquely reference the extension's         */
101   /*                 interface.                                            */
102   /*                                                                       */
103   /*    size      :: The size in bytes of the extension data that must be  */
104   /*                 associated with each face object.                     */
105   /*                                                                       */
106   /*    init      :: A pointer to the extension data's initializer.        */
107   /*                                                                       */
108   /*    finalize  :: A pointer to the extension data's finalizer.          */
109   /*                                                                       */
110   /*    interface :: This pointer can be anything, but should usually      */
111   /*                 point to a table of function pointers which implement */
112   /*                 the extension's interface.                            */
113   /*                                                                       */
114   /*    offset    :: This field is set and used within the base layer and  */
115   /*                 should be set to 0 when registering an extension      */
116   /*                 through FT_Register_Extension().  It contains an      */
117   /*                 offset within the face's extension block for the      */
118   /*                 current extension's data.                             */
119   /*                                                                       */
120   typedef struct  FT_Extension_Class_
121   {
122     const char*               id;
123     FT_ULong                  size;
124     FT_Extension_Initializer  init;
125     FT_Extension_Finalizer    finalize;
126     void*                     interface;
127
128     FT_ULong                  offset;
129
130   } FT_Extension_Class;
131
132
133   FT_EXPORT_DEF( FT_Error )  FT_Register_Extension(
134                                FT_Driver            driver,
135                                FT_Extension_Class*  clazz );
136
137
138 #ifdef FT_CONFIG_OPTION_EXTEND_ENGINE
139
140
141   /* Initialize the extension component */
142   LOCAL_DEF
143   FT_Error  FT_Init_Extensions( FT_Library  library );
144
145   /* Finalize the extension component */
146   LOCAL_DEF
147   FT_Error  FT_Done_Extensions( FT_Library  library );
148
149   /* Create an extension within a face object.  Called by the */
150   /* face object constructor.                                 */
151   LOCAL_DEF
152   FT_Error  FT_Create_Extensions( FT_Face  face );
153
154   /* Destroy all extensions within a face object.  Called by the */
155   /* face object destructor.                                     */
156   LOCAL_DEF
157   FT_Error  FT_Destroy_Extensions( FT_Face  face );
158
159
160 #endif
161
162
163   /* return an extension's data & interface according to its ID */
164   FT_EXPORT_DEF( void* )  FT_Get_Extension(
165                             FT_Face      face,
166                             const char*  extension_id,
167                             void**       extension_interface );
168
169
170 #ifdef __cplusplus
171   }
172 #endif
173
174
175 #endif /* FTEXTEND_H */
176
177
178 /* END */