diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index ae3d352ec..0dd1f5a88 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -2,20 +2,20 @@ /* */ /* ftmm.h */ /* */ -/* FreeType Multiple-Master interface. */ -/* */ +/* FreeType Multiple Master font 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 */ +/* 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 FTMM_H #define FTMM_H @@ -25,22 +25,24 @@ extern "C" { #endif - /********************************************************************** - * - * - * FT_MM_Axis - * - * - * A simple structure used to model a given axis in design space - * for multiple masters fonts.. - * - * - * name :: axis' name - * minimum :: axis' minimum design coordinate - * maximum :: axis's maximum design coordinate - * - */ - typedef struct FT_MM_Axis_ + + /*************************************************************************/ + /* */ + /* */ + /* FT_MM_Axis */ + /* */ + /* */ + /* A simple structure used to model a given axis in design space for */ + /* Multiple Masters fonts. */ + /* */ + /* */ + /* name :: The axis's name. */ + /* */ + /* minimum :: The axis's minimum design coordinate. */ + /* */ + /* maximum :: The axis's maximum design coordinate. */ + /* */ + typedef struct FT_MM_Axis_ { FT_String* name; FT_Long minimum; @@ -48,116 +50,126 @@ } FT_MM_Axis; - /********************************************************************** - * - * - * FT_Multi_Master - * - * - * A structure used to model the axis and space of a multiple - * masters font. - * - * - * num_axis :: number of axis. cannot exceed 4 - * - * num_designs :: number of designs, should ne normally 2^num_axis - * even though the Type 1 specification strangely - * allows for intermediate designs to be present - * this number cannot exceed 16 - * - * axis :: an table of axis descriptors.. - * - */ - typedef struct FT_Multi_Master_ + + /*************************************************************************/ + /* */ + /* */ + /* FT_Multi_Master */ + /* */ + /* */ + /* A structure used to model the axes and space of a Multiple Masters */ + /* font. */ + /* */ + /* */ + /* num_axis :: Number of axes. Cannot exceed 4. */ + /* */ + /* num_designs :: Number of designs; should ne normally 2^num_axis */ + /* even though the Type 1 specification strangely */ + /* allows for intermediate designs to be present. This */ + /* number cannot exceed 16. */ + /* */ + /* axis :: A table of axis descriptors. */ + /* */ + typedef struct FT_Multi_Master_ { FT_UInt num_axis; FT_UInt num_designs; - FT_MM_Axis axis[ T1_MAX_MM_AXIS ]; + FT_MM_Axis axis[T1_MAX_MM_AXIS]; } FT_Multi_Master; - typedef FT_Error (*FT_Get_MM_Func)( FT_Face face, FT_Multi_Master* master ); + typedef FT_Error (*FT_Get_MM_Func)( FT_Face face, + FT_Multi_Master* master ); - typedef FT_Error (*FT_Set_MM_Design_Func)( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); - - typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, + typedef FT_Error (*FT_Set_MM_Design_Func)( FT_Face face, FT_UInt num_coords, FT_Long* coords ); - /************************************************************************* - * - * - * FT_Get_Multi_Master - * - * - * Retrieves the multiple master descriptor of a given font - * - * - * face :: handle to source face - * - * - * master :: multiple masters descriptor - * - * - * Error code. 0 means success. - * - */ - FT_EXPORT_DEF(FT_Error) FT_Get_Multi_Master( FT_Face face, - FT_Multi_Master* master ); + typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); - /************************************************************************* - * - * - * FT_Set_MM_Design_Coordinates - * - * - * For multiple masters fonts, choose an interpolated font design - * through design coordinates - * - * - * face :: handle to source face - * num_coords :: number of design coordinates (must be equal to the - * number of axis in the font). - * coords :: design coordinates - * - * - * Error code. 0 means success. - * - */ - FT_EXPORT_DEF(FT_Error) FT_Set_MM_Design_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Multi_Master */ + /* */ + /* */ + /* Retrieves the Multiple Master descriptor of a given font. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* */ + /* master :: The Multiple Masters descriptor. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Multi_Master( FT_Face face, + FT_Multi_Master* master ); + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_MM_Design_Coordinates */ + /* */ + /* */ + /* For Multiple Masters fonts, choose an interpolated font design */ + /* through design coordinates. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: The design coordinates. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) FT_Set_MM_Design_Coordinates( + FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_MM_Blend_Coordinates */ + /* */ + /* */ + /* For Multiple Masters fonts, choose an interpolated font design */ + /* through normalized blend coordinates. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: The design coordinates (each one must be between 0 */ + /* and 1.0). */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) FT_Set_MM_Blend_Coordinates( + FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); - /************************************************************************* - * - * - * FT_Set_MM_Blend_Coordinates - * - * - * For multiple masters fonts, choose an interpolated font design - * through normalized blend coordinates - * - * - * face :: handle to source face - * num_coords :: number of design coordinates (must be equal to the - * number of axis in the font). - * coords :: design coordinates (each one must be between 0 and 1.0) - * - * - * Error code. 0 means success. - * - */ - FT_EXPORT_DEF(FT_Error) FT_Set_MM_Blend_Coordinates( FT_Face face, - FT_UInt num_coords, - FT_Fixed* coords ); #ifdef __cplusplus } #endif #endif /* FTMM_H */ + + /* END */ diff --git a/include/freetype/ftmodule.h b/include/freetype/ftmodule.h index e1f6c5f3a..258bbf5ca 100644 --- a/include/freetype/ftmodule.h +++ b/include/freetype/ftmodule.h @@ -2,84 +2,90 @@ /* */ /* ftmodule.h */ /* */ -/* FreeType modules public interface. */ +/* 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 */ +/* 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_ + 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_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_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 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.. - * - *************************************************************************/ - + /*************************************************************************/ + /* */ + /* */ + /* FT_Module_Class */ + /* */ + /* */ + /* The module class descriptor. */ + /* */ + /* */ + /* module_flags :: Bit flags describing the module. */ + /* */ + /* module_size :: The size of one module object/instance in */ + /* bytes. */ + /* */ + /* module_name :: The name of the module. */ + /* */ + /* module_version :: The version, as a 16.16 fixed number */ + /* (major.minor). */ + /* */ + /* module_requires :: The version of FreeType this module requires */ + /* (starts at version 2.0, i.e 0x20000) */ + /* */ + /* module_init :: A function used to initialize (not create) a */ + /* new module object. */ + /* */ + /* module_done :: A function used to finalize (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; @@ -97,173 +103,173 @@ } FT_Module_Class; + /*************************************************************************/ + /* */ + /* */ + /* FT_Add_Module */ + /* */ + /* */ + /* Adds a new module to a given library instance. */ + /* */ + /* */ + /* library :: A handle to the library object. */ + /* */ + /* clazz :: A pointer to class descriptor for the module. */ + /* */ + /* */ + /* FreeType 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 */ + /* */ + /* */ + /* Finds a module by its name. */ + /* */ + /* */ + /* library :: A handle to the library object. */ + /* */ + /* module_name :: The module's name (as an ASCII string). */ + /* */ + /* */ + /* A module handle. 0 if none was found. */ + /* */ + /* */ + /* You should 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 */ + /* */ + /* */ + /* Finds a module and returns its specific interface as a typeless */ + /* pointer. */ + /* */ + /* */ + /* library :: A handle to the library object. */ + /* */ + /* module_name :: The module's name (as an ASCII string). */ + /* */ + /* */ + /* A module-specific interface if available, 0 otherwise. */ + /* */ + /* */ + /* You should better be familiar with FreeType internals to know */ + /* which module to look for, and what its 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 :: A handle to a library object. */ + /* */ + /* module :: A handle to a module object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* 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 */ + /* */ + /* */ + /* This function is used to create a new FreeType library instance */ + /* from a given memory object. It is thus possible to use libraries */ + /* with distinct memory allocators within the same program. */ + /* */ + /* */ + /* memory :: A handle to the original memory object. */ + /* */ + /* */ + /* alibrary :: A pointer to handle of a new library object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) FT_New_Library( FT_Memory memory, + FT_Library* library ); + + + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_Library */ + /* */ + /* */ + /* Discards a given library object. This closes all drivers and */ + /* discards all resource objects. */ + /* */ + /* */ + /* library :: A handle to the target library. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) FT_Done_Library( FT_Library library ); + + + + typedef void (*FT_DebugHook_Func)( void* arg ); - /************************************************************************* - * - * - * 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_Set_Debug_Hook */ + /* */ + /* */ + /* Sets a debug hook function for debugging the interpreter of a font */ + /* format. */ + /* */ + /* */ + /* library :: A handle to the library object. */ + /* */ + /* hook_index :: The index of the debug hook. You should use the */ + /* values defined in ftobjs.h, e.g. */ + /* FT_DEBUG_HOOK_TRUETYPE */ + /* */ + /* debug_hook :: The function used to debug the interpreter. */ + /* */ + /* */ + /* Currently, four debug hook slots are available, but only two (for */ + /* the TrueType and the Type 1 interpreter) are defined. */ + /* */ + FT_EXPORT_DEF( void ) FT_Set_Debug_Hook( FT_Library library, + FT_UInt hook_index, + FT_DebugHook_Func debug_hook ); @@ -273,14 +279,14 @@ /* FT_Add_Default_Modules */ /* */ /* */ - /* Adds the set of default modules to a given library object. */ + /* Adds the set of default drivers 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) */ + /* 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 ); + FT_EXPORT_DEF( void ) FT_Add_Default_Modules( FT_Library library ); #ifdef __cplusplus diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 702f2c954..a42be8aaf 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -75,6 +75,8 @@ const FT_Module_Class* ft_default_modules[] = /* */ /* */ /* Adds the set of default drivers 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. */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index a8c6871f1..0f6fddea2 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -30,6 +30,23 @@ #define FT_COMPONENT trace_mm + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Multi_Master */ + /* */ + /* */ + /* Retrieves the Multiple Master descriptor of a given font. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* */ + /* master :: The Multiple Masters descriptor. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT_FUNC( FT_Error ) FT_Get_Multi_Master( FT_Face face, FT_Multi_Master* master ) { @@ -57,6 +74,26 @@ } + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_MM_Design_Coordinates */ + /* */ + /* */ + /* For Multiple Masters fonts, choose an interpolated font design */ + /* through design coordinates. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: The design coordinates. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -86,6 +123,27 @@ } + /*************************************************************************/ + /* */ + /* */ + /* FT_Set_MM_Blend_Coordinates */ + /* */ + /* */ + /* For Multiple Masters fonts, choose an interpolated font design */ + /* through normalized blend coordinates. */ + /* */ + /* */ + /* face :: A handle to the source face. */ + /* */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: The design coordinates (each one must be between 0 */ + /* and 1.0). */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index c3cf1804c..b42be172b 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2722,6 +2722,7 @@ /* */ /* */ /* library :: A handle to the library object. */ + /* */ /* clazz :: A pointer to class descriptor for the module. */ /* */ /* */ diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c index e0e0eebe3..f86030675 100644 --- a/src/type1z/z1load.c +++ b/src/type1z/z1load.c @@ -131,6 +131,7 @@ { FT_UInt nn; + /* allocate the blend `private' and `font_info' dictionaries */ if ( ALLOC_ARRAY( blend->font_infos[1], num_designs, T1_FontInfo ) || ALLOC_ARRAY( blend->privates[1], num_designs, T1_Private ) || @@ -144,8 +145,8 @@ for ( nn = 2; nn <= num_designs; nn++ ) { - blend->privates[nn] = blend->privates[nn-1]+1; - blend->font_infos[nn] = blend->font_infos[nn-1]+1; + blend->privates[nn] = blend->privates [nn - 1] + 1; + blend->font_infos[nn] = blend->font_infos[nn - 1] + 1; } blend->num_designs = num_designs; @@ -1260,10 +1261,10 @@ index = Z1_ToInt( parser ); - /* make sure we get subr index and loop count in sync */ - /* in some cases, the dictionary count is simply the last */ - /* subr index + 1, with possible holes in the table.. */ - if (index > n) + /* make sure we get subr index and loop count in sync -- */ + /* in some cases, the dictionary count is simply the last */ + /* subr index + 1, with possible holes in the table */ + if ( index > n ) n = index; if ( !read_binary_data( parser, &size, &base ) )