1 /***************************************************************************/
5 /* FreeType extensions implementation (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 /***************************************************************************/
23 #include <freetype/internal/ftobjs.h>
31 /*************************************************************************/
33 /* The extensions don't need to be integrated at compile time into the */
34 /* engine, only at link time. */
36 /*************************************************************************/
39 /*************************************************************************/
42 /* FT_Extension_Initializer */
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. */
50 /* ext :: A typeless pointer to the extension data. */
52 /* face :: A handle to the source face object the extension is */
53 /* associated with. */
56 /* FreeType error code. 0 means success. */
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 */
63 typedef FT_Error (*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. */
84 typedef void (*FT_Extension_Finalizer)( void* ext,
88 /*************************************************************************/
91 /* FT_Extension_Class */
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(). */
99 /* id :: The extension's ID. This is a normal C string that */
100 /* is used to uniquely reference the extension's */
103 /* size :: The size in bytes of the extension data that must be */
104 /* associated with each face object. */
106 /* init :: A pointer to the extension data's initializer. */
108 /* finalize :: A pointer to the extension data's finalizer. */
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. */
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. */
120 typedef struct FT_Extension_Class_
124 FT_Extension_Initializer init;
125 FT_Extension_Finalizer finalize;
130 } FT_Extension_Class;
133 FT_EXPORT_DEF( FT_Error ) FT_Register_Extension(
135 FT_Extension_Class* clazz );
138 #ifdef FT_CONFIG_OPTION_EXTEND_ENGINE
141 /* Initialize the extension component */
143 FT_Error FT_Init_Extensions( FT_Library library );
145 /* Finalize the extension component */
147 FT_Error FT_Done_Extensions( FT_Library library );
149 /* Create an extension within a face object. Called by the */
150 /* face object constructor. */
152 FT_Error FT_Create_Extensions( FT_Face face );
154 /* Destroy all extensions within a face object. Called by the */
155 /* face object destructor. */
157 FT_Error FT_Destroy_Extensions( FT_Face face );
163 /* return an extension's data & interface according to its ID */
164 FT_EXPORT_DEF( void* ) FT_Get_Extension(
166 const char* extension_id,
167 void** extension_interface );
175 #endif /* FTEXTEND_H */