michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* ftmodapi.h */ michael@0: /* */ michael@0: /* FreeType modules public interface (specification). */ michael@0: /* */ michael@0: /* Copyright 1996-2003, 2006, 2008-2010, 2012, 2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTMODAPI_H__ michael@0: #define __FTMODAPI_H__ michael@0: michael@0: michael@0: #include michael@0: #include FT_FREETYPE_H michael@0: michael@0: #ifdef FREETYPE_H michael@0: #error "freetype.h of FreeType 1 has been loaded!" michael@0: #error "Please fix the directory search order for header files" michael@0: #error "so that freetype.h of FreeType 2 is found first." michael@0: #endif michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /*
*/ michael@0: /* module_management */ michael@0: /* */ michael@0: /* */ michael@0: /* Module Management */ michael@0: /* */ michael@0: /* <Abstract> */ michael@0: /* How to add, upgrade, remove, and control modules from FreeType. */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* The definitions below are used to manage modules within FreeType. */ michael@0: /* Modules can be added, upgraded, and removed at runtime. */ michael@0: /* Additionally, some module properties can be controlled also. */ michael@0: /* */ michael@0: /* Here is a list of possible values of the `module_name' field in */ michael@0: /* the @FT_Module_Class structure. */ michael@0: /* */ michael@0: /* { */ michael@0: /* autofitter */ michael@0: /* bdf */ michael@0: /* cff */ michael@0: /* gxvalid */ michael@0: /* otvalid */ michael@0: /* pcf */ michael@0: /* pfr */ michael@0: /* psaux */ michael@0: /* pshinter */ michael@0: /* psnames */ michael@0: /* raster1, raster5 */ michael@0: /* sfnt */ michael@0: /* smooth, smooth-lcd, smooth-lcdv */ michael@0: /* truetype */ michael@0: /* type1 */ michael@0: /* type42 */ michael@0: /* t1cid */ michael@0: /* winfonts */ michael@0: /* } */ michael@0: /* */ michael@0: /* Note that the FreeType Cache sub-system is not a FreeType module. */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /* module bit flags */ michael@0: #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ michael@0: #define FT_MODULE_RENDERER 2 /* this module is a renderer */ michael@0: #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ michael@0: #define FT_MODULE_STYLER 8 /* this module is a styler */ michael@0: michael@0: #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ michael@0: /* scalable fonts */ michael@0: #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ michael@0: /* support vector outlines */ michael@0: #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ michael@0: /* own hinter */ michael@0: michael@0: michael@0: /* deprecated values */ michael@0: #define ft_module_font_driver FT_MODULE_FONT_DRIVER michael@0: #define ft_module_renderer FT_MODULE_RENDERER michael@0: #define ft_module_hinter FT_MODULE_HINTER michael@0: #define ft_module_styler FT_MODULE_STYLER michael@0: michael@0: #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE michael@0: #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES michael@0: #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER michael@0: michael@0: michael@0: typedef FT_Pointer FT_Module_Interface; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <FuncType> */ michael@0: /* FT_Module_Constructor */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A function used to initialize (not create) a new module object. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* module :: The module to initialize. */ michael@0: /* */ michael@0: typedef FT_Error michael@0: (*FT_Module_Constructor)( FT_Module module ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <FuncType> */ michael@0: /* FT_Module_Destructor */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A function used to finalize (not destroy) a given module object. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* module :: The module to finalize. */ michael@0: /* */ michael@0: typedef void michael@0: (*FT_Module_Destructor)( FT_Module module ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <FuncType> */ michael@0: /* FT_Module_Requester */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A function used to query a given module for a specific interface. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* module :: The module to be searched. */ michael@0: /* */ michael@0: /* name :: The name of the interface in the module. */ michael@0: /* */ michael@0: typedef FT_Module_Interface michael@0: (*FT_Module_Requester)( FT_Module module, michael@0: const char* name ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* FT_Module_Class */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* The module class descriptor. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* module_flags :: Bit flags describing the module. */ michael@0: /* */ michael@0: /* module_size :: The size of one module object/instance in */ michael@0: /* bytes. */ michael@0: /* */ michael@0: /* module_name :: The name of the module. */ michael@0: /* */ michael@0: /* module_version :: The version, as a 16.16 fixed number */ michael@0: /* (major.minor). */ michael@0: /* */ michael@0: /* module_requires :: The version of FreeType this module requires, */ michael@0: /* as a 16.16 fixed number (major.minor). Starts */ michael@0: /* at version 2.0, i.e., 0x20000. */ michael@0: /* */ michael@0: /* module_init :: The initializing function. */ michael@0: /* */ michael@0: /* module_done :: The finalizing function. */ michael@0: /* */ michael@0: /* get_interface :: The interface requesting function. */ michael@0: /* */ michael@0: typedef struct FT_Module_Class_ michael@0: { michael@0: FT_ULong module_flags; michael@0: FT_Long module_size; michael@0: const FT_String* module_name; michael@0: FT_Fixed module_version; michael@0: FT_Fixed module_requires; michael@0: michael@0: const void* module_interface; michael@0: michael@0: FT_Module_Constructor module_init; michael@0: FT_Module_Destructor module_done; michael@0: FT_Module_Requester get_interface; michael@0: michael@0: } FT_Module_Class; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Add_Module */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Add a new module to a given library instance. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* library :: A handle to the library object. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* clazz :: A pointer to class descriptor for the module. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* An error will be returned if a module already exists by that name, */ michael@0: /* or if the module requires a version of FreeType that is too great. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Add_Module( FT_Library library, michael@0: const FT_Module_Class* clazz ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_Module */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Find a module by its name. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* library :: A handle to the library object. */ michael@0: /* */ michael@0: /* module_name :: The module's name (as an ASCII string). */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* A module handle. 0~if none was found. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* FreeType's internal modules aren't documented very well, and you */ michael@0: /* should look up the source code for details. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Module ) michael@0: FT_Get_Module( FT_Library library, michael@0: const char* module_name ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Remove_Module */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Remove a given module from a library instance. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* library :: A handle to a library object. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* module :: A handle to a module object. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* The module object is destroyed by the function in case of success. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Remove_Module( FT_Library library, michael@0: FT_Module module ); michael@0: michael@0: michael@0: /********************************************************************** michael@0: * michael@0: * @function: michael@0: * FT_Property_Set michael@0: * michael@0: * @description: michael@0: * Set a property for a given module. michael@0: * michael@0: * @input: michael@0: * library :: michael@0: * A handle to the library the module is part of. michael@0: * michael@0: * module_name :: michael@0: * The module name. michael@0: * michael@0: * property_name :: michael@0: * The property name. Properties are described in the `Synopsis' michael@0: * subsection of the module's documentation. michael@0: * michael@0: * Note that only a few modules have properties. michael@0: * michael@0: * value :: michael@0: * A generic pointer to a variable or structure that gives the new michael@0: * value of the property. The exact definition of `value' is michael@0: * dependent on the property; see the `Synopsis' subsection of the michael@0: * module's documentation. michael@0: * michael@0: * @return: michael@0: * FreeType error code. 0~means success. michael@0: * michael@0: * @note: michael@0: * If `module_name' isn't a valid module name, or `property_name' michael@0: * doesn't specify a valid property, or if `value' doesn't represent a michael@0: * valid value for the given property, an error is returned. michael@0: * michael@0: * The following example sets property `bar' (a simple integer) in michael@0: * module `foo' to value~1. michael@0: * michael@0: * { michael@0: * FT_UInt bar; michael@0: * michael@0: * michael@0: * bar = 1; michael@0: * FT_Property_Set( library, "foo", "bar", &bar ); michael@0: * } michael@0: * michael@0: * Note that the FreeType Cache sub-system doesn't recognize module michael@0: * property changes. To avoid glyph lookup confusion within the cache michael@0: * you should call @FTC_Manager_Reset to completely flush the cache if michael@0: * a module property gets changed after @FTC_Manager_New has been michael@0: * called. michael@0: * michael@0: * It is not possible to set properties of the FreeType Cache michael@0: * sub-system itself with FT_Property_Set; use @FTC_Property_Set michael@0: * instead. michael@0: * michael@0: * @since: michael@0: * 2.4.11 michael@0: * michael@0: */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Property_Set( FT_Library library, michael@0: const FT_String* module_name, michael@0: const FT_String* property_name, michael@0: const void* value ); michael@0: michael@0: michael@0: /********************************************************************** michael@0: * michael@0: * @function: michael@0: * FT_Property_Get michael@0: * michael@0: * @description: michael@0: * Get a module's property value. michael@0: * michael@0: * @input: michael@0: * library :: michael@0: * A handle to the library the module is part of. michael@0: * michael@0: * module_name :: michael@0: * The module name. michael@0: * michael@0: * property_name :: michael@0: * The property name. Properties are described in the `Synopsis' michael@0: * subsection of the module's documentation. michael@0: * michael@0: * @inout: michael@0: * value :: michael@0: * A generic pointer to a variable or structure that gives the michael@0: * value of the property. The exact definition of `value' is michael@0: * dependent on the property; see the `Synopsis' subsection of the michael@0: * module's documentation. michael@0: * michael@0: * @return: michael@0: * FreeType error code. 0~means success. michael@0: * michael@0: * @note: michael@0: * If `module_name' isn't a valid module name, or `property_name' michael@0: * doesn't specify a valid property, or if `value' doesn't represent a michael@0: * valid value for the given property, an error is returned. michael@0: * michael@0: * The following example gets property `baz' (a range) in module `foo'. michael@0: * michael@0: * { michael@0: * typedef range_ michael@0: * { michael@0: * FT_Int32 min; michael@0: * FT_Int32 max; michael@0: * michael@0: * } range; michael@0: * michael@0: * range baz; michael@0: * michael@0: * michael@0: * FT_Property_Get( library, "foo", "baz", &baz ); michael@0: * } michael@0: * michael@0: * It is not possible to retrieve properties of the FreeType Cache michael@0: * sub-system with FT_Property_Get; use @FTC_Property_Get instead. michael@0: * michael@0: * @since: michael@0: * 2.4.11 michael@0: * michael@0: */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Property_Get( FT_Library library, michael@0: const FT_String* module_name, michael@0: const FT_String* property_name, michael@0: void* value ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Reference_Library */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A counter gets initialized to~1 at the time an @FT_Library */ michael@0: /* structure is created. This function increments the counter. */ michael@0: /* @FT_Done_Library then only destroys a library if the counter is~1, */ michael@0: /* otherwise it simply decrements the counter. */ michael@0: /* */ michael@0: /* This function helps in managing life-cycles of structures that */ michael@0: /* reference @FT_Library objects. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* library :: A handle to a target library object. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* <Since> */ michael@0: /* 2.4.2 */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Reference_Library( FT_Library library ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_New_Library */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This function is used to create a new FreeType library instance */ michael@0: /* from a given memory object. It is thus possible to use libraries */ michael@0: /* with distinct memory allocators within the same program. */ michael@0: /* */ michael@0: /* Normally, you would call this function (followed by a call to */ michael@0: /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */ michael@0: /* instead of @FT_Init_FreeType to initialize the FreeType library. */ michael@0: /* */ michael@0: /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */ michael@0: /* library instance. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* memory :: A handle to the original memory object. */ michael@0: /* */ michael@0: /* <Output> */ michael@0: /* alibrary :: A pointer to handle of a new library object. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* See the discussion of reference counters in the description of */ michael@0: /* @FT_Reference_Library. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_New_Library( FT_Memory memory, michael@0: FT_Library *alibrary ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Done_Library */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Discard a given library object. This closes all drivers and */ michael@0: /* discards all resource objects. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* library :: A handle to the target library. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* See the discussion of reference counters in the description of */ michael@0: /* @FT_Reference_Library. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Done_Library( FT_Library library ); michael@0: michael@0: /* */ michael@0: michael@0: typedef void michael@0: (*FT_DebugHook_Func)( void* arg ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Set_Debug_Hook */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Set a debug hook function for debugging the interpreter of a font */ michael@0: /* format. */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* library :: A handle to the library object. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* hook_index :: The index of the debug hook. You should use the */ michael@0: /* values defined in `ftobjs.h', e.g., */ michael@0: /* `FT_DEBUG_HOOK_TRUETYPE'. */ michael@0: /* */ michael@0: /* debug_hook :: The function used to debug the interpreter. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* Currently, four debug hook slots are available, but only two (for */ michael@0: /* the TrueType and the Type~1 interpreter) are defined. */ michael@0: /* */ michael@0: /* Since the internal headers of FreeType are no longer installed, */ michael@0: /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */ michael@0: /* This is a bug and will be fixed in a forthcoming release. */ michael@0: /* */ michael@0: FT_EXPORT( void ) michael@0: FT_Set_Debug_Hook( FT_Library library, michael@0: FT_UInt hook_index, michael@0: FT_DebugHook_Func debug_hook ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Add_Default_Modules */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Add the set of default drivers to a given library object. */ michael@0: /* This is only useful when you create a library object with */ michael@0: /* @FT_New_Library (usually to plug a custom memory manager). */ michael@0: /* */ michael@0: /* <InOut> */ michael@0: /* library :: A handle to a new library object. */ michael@0: /* */ michael@0: FT_EXPORT( void ) michael@0: FT_Add_Default_Modules( FT_Library library ); michael@0: michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @section: michael@0: * truetype_engine michael@0: * michael@0: * @title: michael@0: * The TrueType Engine michael@0: * michael@0: * @abstract: michael@0: * TrueType bytecode support. michael@0: * michael@0: * @description: michael@0: * This section contains a function used to query the level of TrueType michael@0: * bytecode support compiled in this version of the library. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @enum: michael@0: * FT_TrueTypeEngineType michael@0: * michael@0: * @description: michael@0: * A list of values describing which kind of TrueType bytecode michael@0: * engine is implemented in a given FT_Library instance. It is used michael@0: * by the @FT_Get_TrueType_Engine_Type function. michael@0: * michael@0: * @values: michael@0: * FT_TRUETYPE_ENGINE_TYPE_NONE :: michael@0: * The library doesn't implement any kind of bytecode interpreter. michael@0: * michael@0: * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: michael@0: * The library implements a bytecode interpreter that doesn't michael@0: * support the patented operations of the TrueType virtual machine. michael@0: * michael@0: * Its main use is to load certain Asian fonts that position and michael@0: * scale glyph components with bytecode instructions. It produces michael@0: * bad output for most other fonts. michael@0: * michael@0: * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: michael@0: * The library implements a bytecode interpreter that covers michael@0: * the full instruction set of the TrueType virtual machine (this michael@0: * was governed by patents until May 2010, hence the name). michael@0: * michael@0: * @since: michael@0: * 2.2 michael@0: * michael@0: */ michael@0: typedef enum FT_TrueTypeEngineType_ michael@0: { michael@0: FT_TRUETYPE_ENGINE_TYPE_NONE = 0, michael@0: FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, michael@0: FT_TRUETYPE_ENGINE_TYPE_PATENTED michael@0: michael@0: } FT_TrueTypeEngineType; michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @func: michael@0: * FT_Get_TrueType_Engine_Type michael@0: * michael@0: * @description: michael@0: * Return an @FT_TrueTypeEngineType value to indicate which level of michael@0: * the TrueType virtual machine a given library instance supports. michael@0: * michael@0: * @input: michael@0: * library :: michael@0: * A library instance. michael@0: * michael@0: * @return: michael@0: * A value indicating which level is supported. michael@0: * michael@0: * @since: michael@0: * 2.2 michael@0: * michael@0: */ michael@0: FT_EXPORT( FT_TrueTypeEngineType ) michael@0: FT_Get_TrueType_Engine_Type( FT_Library library ); michael@0: michael@0: michael@0: /* */ michael@0: michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __FTMODAPI_H__ */ michael@0: michael@0: michael@0: /* END */