/***************************************************************************/ /* */ /* ftmodule.h */ /* */ /* FreeType modules public interface. */ /* */ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ /* modified and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef FTMODULE_H #define FTMODULE_H #include #ifdef __cplusplus extern "C" { #endif /* module bit flags */ typedef enum FT_Module_Flags_ { ft_module_font_driver = 1, /* this module is a font driver */ ft_module_renderer = 2, /* this module is a renderer */ ft_module_hinter = 4, /* this module is a glyph hinter */ ft_module_styler = 8, /* this module is a styler */ ft_module_driver_scalable = 0x100, /* the driver supports scalable fonts */ ft_module_driver_no_outlines = 0x200, /* the driver does not support vector outlines */ ft_module_driver_has_hinter = 0x400 /* the driver provides its own hinter */ } FT_Module_Flags; typedef void (*FT_Module_Interface)( void ); typedef FT_Error (*FT_Module_Constructor)( FT_Module module ); typedef void (*FT_Module_Destructor)( FT_Module module ); typedef FT_Module_Interface (*FT_Module_Requester)( FT_Module module, const char* name ); /************************************************************************* * * * FT_Module_Class * * * The module class descriptor. * * * module_flags :: bit flags describing the module * module_size :: size of one module object/instance in bytes * module_name :: name of the module * module_version :: version, as a 16.16 fixed number (major.minor) * module_requires :: the version of FreeType this module requires * (starts at 2.0, a.k.a. 0x20000) * * module_init :: a function used to initialise (not create) a * new module object * * module_done :: a function used to finalise (not destroy) a * given module object * * get_interface :: queries a given module for a specific interface * by name.. * *************************************************************************/ typedef struct FT_Module_Class_ { FT_ULong module_flags; FT_Int module_size; const FT_String* module_name; FT_Fixed module_version; FT_Fixed module_requires; const void* module_interface; FT_Module_Constructor module_init; FT_Module_Destructor module_done; FT_Module_Requester get_interface; } FT_Module_Class; /************************************************************************* * * * FT_Add_Module * * * Add a new module to a given library instance. * * * library :: handle to library object * clazz :: pointer to class descriptor for the module * * * Error code. 0 means success * * * An error will be returned if a module already exists by that * name, or if the module requires a version of freetype that is * too great * *************************************************************************/ FT_EXPORT_DEF(FT_Error) FT_Add_Module( FT_Library library, const FT_Module_Class* clazz ); /************************************************************************* * * * FT_Get_Module * * * Find a module by its name. * * * library :: handle to library object * module_name :: the module's ASCII name. * * * Module handle, 0 if none was found. * * * You'd better be familiar with FreeType internals to know which * module to look for :-) * *************************************************************************/ FT_EXPORT_DEF(FT_Module) FT_Get_Module( FT_Library library, const char* module_name ); /************************************************************************* * * * FT_Get_Module_Interface * * * Find a module and returns it's specific interface as a void* * * * library :: handle to library object * module_name :: the module's ASCII name. * * * Module specific interface, if any * * * You'd better be familiar with FreeType internals to know which * module to look for, and what it's interface is :-) * *************************************************************************/ FT_EXPORT_DEF(const void*) FT_Get_Module_Interface( FT_Library library, const char* mod_name ); /************************************************************************* * * * FT_Remove_Module * * * Removes a given module from a library instance. * * * library :: handle to library object * module :: handle to module object * * * Error code (module not listed) * * * The module object is destroyed by the function in case of success * *************************************************************************/ FT_EXPORT_DEF(FT_Error) FT_Remove_Module( FT_Library library, FT_Module module ); /************************************************************************* * * * FT_New_Library * * * Creates a new "virgin" library that uses a custom memory manager. * The library has no registered driver, those can be added with a * call to FT_Add_Default_Modules * * * memory :: handle to custom memory manager * * * library :: handle to fresh new library object * * * Error code (module not listed) * *************************************************************************/ FT_EXPORT_DEF(FT_Error) FT_New_Library( FT_Memory memory, FT_Library* library ); /************************************************************************* * * * FT_Done_Library * * * Destroys a given library, and all child objects, except the * memory manager. * * * library :: handle to target library object * * * Error code (module not listed) * *************************************************************************/ FT_EXPORT_DEF(FT_Error) FT_Done_Library( FT_Library library ); /************************************************************************* * * * FT_Set_Debug_Hook * * * Used only by the TrueType debugger. This function is private and * should never be called by normal applications.. * * * library :: handle to target library object * hook_index :: hook index * debug_hook :: debug hook functions * *************************************************************************/ typedef void (*FT_DebugHook_Func)( void* arg ); FT_EXPORT_DEF(void) FT_Set_Debug_Hook( FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook ); /*************************************************************************/ /* */ /* */ /* FT_Add_Default_Modules */ /* */ /* */ /* Adds the set of default modules to a given library object. */ /* This is only useful when you create a library object with */ /* FT_New_Library (usually to plug a custom memory manager) */ /* */ /* */ /* library :: A handle to a new library object. */ /* */ FT_EXPORT_DEF(void) FT_Add_Default_Modules( FT_Library library ); #ifdef __cplusplus } #endif #endif /* FTMODULE_H */ /* END */