1 /***************************************************************************/
5 /* FreeType extensions implementation (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 __FTEXTEND_H__
20 #define __FTEXTEND_H__
24 #include FT_INTERNAL_OBJECTS_H
30 /*************************************************************************/
32 /* The extensions don't need to be integrated at compile time into the */
33 /* engine, only at link time. */
35 /*************************************************************************/
38 /*************************************************************************/
41 /* FT_Extension_Initializer */
44 /* Each new face object can have several extensions associated with */
45 /* it at creation time. This function is used to initialize given */
46 /* extension data for a given face. */
49 /* ext :: A typeless pointer to the extension data. */
51 /* face :: A handle to the source face object the extension is */
52 /* associated with. */
55 /* FreeType error code. 0 means success. */
58 /* In case of error, the initializer should not destroy the extension */
59 /* data, as the finalizer will get called later by the function's */
63 (*FT_Extension_Initializer)( void* ext,
67 /*************************************************************************/
70 /* FT_Extension_Finalizer */
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. */
79 /* ext :: A typeless pointer to the extension data. */
81 /* face :: A handle to the source face object the extension is */
82 /* associated with. */
85 (*FT_Extension_Finalizer)( void* ext,
89 /*************************************************************************/
92 /* FT_Extension_Class */
95 /* A simple structure used to describe a given extension to the */
96 /* FreeType base layer. An FT_Extension_Class is used as a parameter */
97 /* for FT_Register_Extension(). */
100 /* id :: The extension's ID. This is a normal C string that */
101 /* is used to uniquely reference the extension's */
104 /* size :: The size in bytes of the extension data that must be */
105 /* associated with each face object. */
107 /* init :: A pointer to the extension data's initializer. */
109 /* finalize :: A pointer to the extension data's finalizer. */
111 /* interface :: This pointer can be anything, but should usually */
112 /* point to a table of function pointers which implement */
113 /* the extension's interface. */
115 /* offset :: This field is set and used within the base layer and */
116 /* should be set to 0 when registering an extension */
117 /* through FT_Register_Extension(). It contains an */
118 /* offset within the face's extension block for the */
119 /* current extension's data. */
121 typedef struct FT_Extension_Class_
125 FT_Extension_Initializer init;
126 FT_Extension_Finalizer finalize;
131 } FT_Extension_Class;
134 /*************************************************************************/
137 /* FT_Register_Extension */
140 /* Registers a new extension. */
143 /* driver :: A handle to the driver object. */
145 /* class :: A pointer to a class describing the extension. */
148 /* FreeType error code. 0 means success. */
150 FT_EXPORT( FT_Error )
151 FT_Register_Extension( FT_Driver driver,
152 FT_Extension_Class* clazz );
155 #ifdef FT_CONFIG_OPTION_EXTEND_ENGINE
158 /* Initialize the extension component */
160 FT_Init_Extensions( FT_Library library );
162 /* Finalize the extension component */
164 FT_Done_Extensions( FT_Library library );
166 /* Create an extension within a face object. Called by the */
167 /* face object constructor. */
169 FT_Create_Extensions( FT_Face face );
171 /* Destroy all extensions within a face object. Called by the */
172 /* face object destructor. */
174 FT_Destroy_Extensions( FT_Face face );
180 /*************************************************************************/
183 /* FT_Get_Extension */
186 /* Queries an extension block by an extension ID string. */
189 /* face :: A handle to the face object. */
190 /* extension_id :: An ID string identifying the extension. */
193 /* extension_interface :: A generic pointer, usually pointing to a */
194 /* table of functions implementing the */
195 /* extension interface. */
198 /* A generic pointer to the extension block. */
201 FT_Get_Extension( FT_Face face,
202 const char* extension_id,
203 void** extension_interface );
208 #endif /* __FTEXTEND_H__ */