00001 /***************************************************************************/ 00002 /* */ 00003 /* ftmodapi.h */ 00004 /* */ 00005 /* FreeType modules public interface (specification). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __FTMODAPI_H__ 00020 #define __FTMODAPI_H__ 00021 00022 00023 #include <ft2build.h> 00024 #include FT_FREETYPE_H 00025 00026 #ifdef FREETYPE_H 00027 #error "freetype.h of FreeType 1 has been loaded!" 00028 #error "Please fix the directory search order for header files" 00029 #error "so that freetype.h of FreeType 2 is found first." 00030 #endif 00031 00032 00033 FT_BEGIN_HEADER 00034 00035 00036 /*************************************************************************/ 00037 /* */ 00038 /* <Section> */ 00039 /* module_management */ 00040 /* */ 00041 /* <Title> */ 00042 /* Module Management */ 00043 /* */ 00044 /* <Abstract> */ 00045 /* How to add, upgrade, and remove modules from FreeType. */ 00046 /* */ 00047 /* <Description> */ 00048 /* The definitions below are used to manage modules within FreeType. */ 00049 /* Modules can be added, upgraded, and removed at runtime. */ 00050 /* */ 00051 /*************************************************************************/ 00052 00053 00054 /* module bit flags */ 00055 #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ 00056 #define FT_MODULE_RENDERER 2 /* this module is a renderer */ 00057 #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ 00058 #define FT_MODULE_STYLER 8 /* this module is a styler */ 00059 00060 #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ 00061 /* scalable fonts */ 00062 #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ 00063 /* support vector outlines */ 00064 #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ 00065 /* own hinter */ 00066 00067 00068 /* deprecated values */ 00069 #define ft_module_font_driver FT_MODULE_FONT_DRIVER 00070 #define ft_module_renderer FT_MODULE_RENDERER 00071 #define ft_module_hinter FT_MODULE_HINTER 00072 #define ft_module_styler FT_MODULE_STYLER 00073 00074 #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE 00075 #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES 00076 #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER 00077 00078 00079 typedef FT_Pointer FT_Module_Interface; 00080 00081 00082 /*************************************************************************/ 00083 /* */ 00084 /* <FuncType> */ 00085 /* FT_Module_Constructor */ 00086 /* */ 00087 /* <Description> */ 00088 /* A function used to initialize (not create) a new module object. */ 00089 /* */ 00090 /* <Input> */ 00091 /* module :: The module to initialize. */ 00092 /* */ 00093 typedef FT_Error 00094 (*FT_Module_Constructor)( FT_Module module ); 00095 00096 00097 /*************************************************************************/ 00098 /* */ 00099 /* <FuncType> */ 00100 /* FT_Module_Destructor */ 00101 /* */ 00102 /* <Description> */ 00103 /* A function used to finalize (not destroy) a given module object. */ 00104 /* */ 00105 /* <Input> */ 00106 /* module :: The module to finalize. */ 00107 /* */ 00108 typedef void 00109 (*FT_Module_Destructor)( FT_Module module ); 00110 00111 00112 /*************************************************************************/ 00113 /* */ 00114 /* <FuncType> */ 00115 /* FT_Module_Requester */ 00116 /* */ 00117 /* <Description> */ 00118 /* A function used to query a given module for a specific interface. */ 00119 /* */ 00120 /* <Input> */ 00121 /* module :: The module to finalize. */ 00122 /* */ 00123 /* name :: The name of the interface in the module. */ 00124 /* */ 00125 typedef FT_Module_Interface 00126 (*FT_Module_Requester)( FT_Module module, 00127 const char* name ); 00128 00129 00130 /*************************************************************************/ 00131 /* */ 00132 /* <Struct> */ 00133 /* FT_Module_Class */ 00134 /* */ 00135 /* <Description> */ 00136 /* The module class descriptor. */ 00137 /* */ 00138 /* <Fields> */ 00139 /* module_flags :: Bit flags describing the module. */ 00140 /* */ 00141 /* module_size :: The size of one module object/instance in */ 00142 /* bytes. */ 00143 /* */ 00144 /* module_name :: The name of the module. */ 00145 /* */ 00146 /* module_version :: The version, as a 16.16 fixed number */ 00147 /* (major.minor). */ 00148 /* */ 00149 /* module_requires :: The version of FreeType this module requires, */ 00150 /* as a 16.16 fixed number (major.minor). Starts */ 00151 /* at version 2.0, i.e., 0x20000. */ 00152 /* */ 00153 /* module_init :: The initializing function. */ 00154 /* */ 00155 /* module_done :: The finalizing function. */ 00156 /* */ 00157 /* get_interface :: The interface requesting function. */ 00158 /* */ 00159 typedef struct FT_Module_Class_ 00160 { 00161 FT_ULong module_flags; 00162 FT_Long module_size; 00163 const FT_String* module_name; 00164 FT_Fixed module_version; 00165 FT_Fixed module_requires; 00166 00167 const void* module_interface; 00168 00169 FT_Module_Constructor module_init; 00170 FT_Module_Destructor module_done; 00171 FT_Module_Requester get_interface; 00172 00173 } FT_Module_Class; 00174 00175 00176 /*************************************************************************/ 00177 /* */ 00178 /* <Function> */ 00179 /* FT_Add_Module */ 00180 /* */ 00181 /* <Description> */ 00182 /* Add a new module to a given library instance. */ 00183 /* */ 00184 /* <InOut> */ 00185 /* library :: A handle to the library object. */ 00186 /* */ 00187 /* <Input> */ 00188 /* clazz :: A pointer to class descriptor for the module. */ 00189 /* */ 00190 /* <Return> */ 00191 /* FreeType error code. 0~means success. */ 00192 /* */ 00193 /* <Note> */ 00194 /* An error will be returned if a module already exists by that name, */ 00195 /* or if the module requires a version of FreeType that is too great. */ 00196 /* */ 00197 FT_EXPORT( FT_Error ) 00198 FT_Add_Module( FT_Library library, 00199 const FT_Module_Class* clazz ); 00200 00201 00202 /*************************************************************************/ 00203 /* */ 00204 /* <Function> */ 00205 /* FT_Get_Module */ 00206 /* */ 00207 /* <Description> */ 00208 /* Find a module by its name. */ 00209 /* */ 00210 /* <Input> */ 00211 /* library :: A handle to the library object. */ 00212 /* */ 00213 /* module_name :: The module's name (as an ASCII string). */ 00214 /* */ 00215 /* <Return> */ 00216 /* A module handle. 0~if none was found. */ 00217 /* */ 00218 /* <Note> */ 00219 /* FreeType's internal modules aren't documented very well, and you */ 00220 /* should look up the source code for details. */ 00221 /* */ 00222 FT_EXPORT( FT_Module ) 00223 FT_Get_Module( FT_Library library, 00224 const char* module_name ); 00225 00226 00227 /*************************************************************************/ 00228 /* */ 00229 /* <Function> */ 00230 /* FT_Remove_Module */ 00231 /* */ 00232 /* <Description> */ 00233 /* Remove a given module from a library instance. */ 00234 /* */ 00235 /* <InOut> */ 00236 /* library :: A handle to a library object. */ 00237 /* */ 00238 /* <Input> */ 00239 /* module :: A handle to a module object. */ 00240 /* */ 00241 /* <Return> */ 00242 /* FreeType error code. 0~means success. */ 00243 /* */ 00244 /* <Note> */ 00245 /* The module object is destroyed by the function in case of success. */ 00246 /* */ 00247 FT_EXPORT( FT_Error ) 00248 FT_Remove_Module( FT_Library library, 00249 FT_Module module ); 00250 00251 00252 /*************************************************************************/ 00253 /* */ 00254 /* <Function> */ 00255 /* FT_New_Library */ 00256 /* */ 00257 /* <Description> */ 00258 /* This function is used to create a new FreeType library instance */ 00259 /* from a given memory object. It is thus possible to use libraries */ 00260 /* with distinct memory allocators within the same program. */ 00261 /* */ 00262 /* Normally, you would call this function (followed by a call to */ 00263 /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */ 00264 /* instead of @FT_Init_FreeType to initialize the FreeType library. */ 00265 /* */ 00266 /* <Input> */ 00267 /* memory :: A handle to the original memory object. */ 00268 /* */ 00269 /* <Output> */ 00270 /* alibrary :: A pointer to handle of a new library object. */ 00271 /* */ 00272 /* <Return> */ 00273 /* FreeType error code. 0~means success. */ 00274 /* */ 00275 FT_EXPORT( FT_Error ) 00276 FT_New_Library( FT_Memory memory, 00277 FT_Library *alibrary ); 00278 00279 00280 /*************************************************************************/ 00281 /* */ 00282 /* <Function> */ 00283 /* FT_Done_Library */ 00284 /* */ 00285 /* <Description> */ 00286 /* Discard a given library object. This closes all drivers and */ 00287 /* discards all resource objects. */ 00288 /* */ 00289 /* <Input> */ 00290 /* library :: A handle to the target library. */ 00291 /* */ 00292 /* <Return> */ 00293 /* FreeType error code. 0~means success. */ 00294 /* */ 00295 FT_EXPORT( FT_Error ) 00296 FT_Done_Library( FT_Library library ); 00297 00298 /* */ 00299 00300 typedef void 00301 (*FT_DebugHook_Func)( void* arg ); 00302 00303 00304 /*************************************************************************/ 00305 /* */ 00306 /* <Function> */ 00307 /* FT_Set_Debug_Hook */ 00308 /* */ 00309 /* <Description> */ 00310 /* Set a debug hook function for debugging the interpreter of a font */ 00311 /* format. */ 00312 /* */ 00313 /* <InOut> */ 00314 /* library :: A handle to the library object. */ 00315 /* */ 00316 /* <Input> */ 00317 /* hook_index :: The index of the debug hook. You should use the */ 00318 /* values defined in `ftobjs.h', e.g., */ 00319 /* `FT_DEBUG_HOOK_TRUETYPE'. */ 00320 /* */ 00321 /* debug_hook :: The function used to debug the interpreter. */ 00322 /* */ 00323 /* <Note> */ 00324 /* Currently, four debug hook slots are available, but only two (for */ 00325 /* the TrueType and the Type~1 interpreter) are defined. */ 00326 /* */ 00327 /* Since the internal headers of FreeType are no longer installed, */ 00328 /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */ 00329 /* This is a bug and will be fixed in a forthcoming release. */ 00330 /* */ 00331 FT_EXPORT( void ) 00332 FT_Set_Debug_Hook( FT_Library library, 00333 FT_UInt hook_index, 00334 FT_DebugHook_Func debug_hook ); 00335 00336 00337 /*************************************************************************/ 00338 /* */ 00339 /* <Function> */ 00340 /* FT_Add_Default_Modules */ 00341 /* */ 00342 /* <Description> */ 00343 /* Add the set of default drivers to a given library object. */ 00344 /* This is only useful when you create a library object with */ 00345 /* @FT_New_Library (usually to plug a custom memory manager). */ 00346 /* */ 00347 /* <InOut> */ 00348 /* library :: A handle to a new library object. */ 00349 /* */ 00350 FT_EXPORT( void ) 00351 FT_Add_Default_Modules( FT_Library library ); 00352 00353 00354 00355 /************************************************************************** 00356 * 00357 * @section: 00358 * truetype_engine 00359 * 00360 * @title: 00361 * The TrueType Engine 00362 * 00363 * @abstract: 00364 * TrueType bytecode support. 00365 * 00366 * @description: 00367 * This section contains a function used to query the level of TrueType 00368 * bytecode support compiled in this version of the library. 00369 * 00370 */ 00371 00372 00373 /************************************************************************** 00374 * 00375 * @enum: 00376 * FT_TrueTypeEngineType 00377 * 00378 * @description: 00379 * A list of values describing which kind of TrueType bytecode 00380 * engine is implemented in a given FT_Library instance. It is used 00381 * by the @FT_Get_TrueType_Engine_Type function. 00382 * 00383 * @values: 00384 * FT_TRUETYPE_ENGINE_TYPE_NONE :: 00385 * The library doesn't implement any kind of bytecode interpreter. 00386 * 00387 * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: 00388 * The library implements a bytecode interpreter that doesn't 00389 * support the patented operations of the TrueType virtual machine. 00390 * 00391 * Its main use is to load certain Asian fonts which position and 00392 * scale glyph components with bytecode instructions. It produces 00393 * bad output for most other fonts. 00394 * 00395 * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: 00396 * The library implements a bytecode interpreter that covers 00397 * the full instruction set of the TrueType virtual machine. 00398 * See the file `docs/PATENTS' for legal aspects. 00399 * 00400 * @since: 00401 * 2.2 00402 * 00403 */ 00404 typedef enum FT_TrueTypeEngineType_ 00405 { 00406 FT_TRUETYPE_ENGINE_TYPE_NONE = 0, 00407 FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, 00408 FT_TRUETYPE_ENGINE_TYPE_PATENTED 00409 00410 } FT_TrueTypeEngineType; 00411 00412 00413 /************************************************************************** 00414 * 00415 * @func: 00416 * FT_Get_TrueType_Engine_Type 00417 * 00418 * @description: 00419 * Return an @FT_TrueTypeEngineType value to indicate which level of 00420 * the TrueType virtual machine a given library instance supports. 00421 * 00422 * @input: 00423 * library :: 00424 * A library instance. 00425 * 00426 * @return: 00427 * A value indicating which level is supported. 00428 * 00429 * @since: 00430 * 2.2 00431 * 00432 */ 00433 FT_EXPORT( FT_TrueTypeEngineType ) 00434 FT_Get_TrueType_Engine_Type( FT_Library library ); 00435 00436 00437 /* */ 00438 00439 00440 FT_END_HEADER 00441 00442 #endif /* __FTMODAPI_H__ */ 00443 00444 00445 /* END */