From 5987445073894155e3a1811e84f60b2804fd4fa8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 29 Jul 2012 13:15:53 +0200 Subject: [PATCH] Formatting, comment fixes. --- include/freetype/internal/autohint.h | 49 +- include/freetype/internal/ftdriver.h | 366 +++++++------ include/freetype/internal/ftobjs.h | 754 +++++++++++++++++---------- include/freetype/internal/ftpic.h | 32 +- include/freetype/internal/ftrfork.h | 41 +- include/freetype/internal/ftserv.h | 7 +- include/freetype/internal/pshints.h | 42 +- include/freetype/internal/sfnt.h | 315 ++++++----- src/truetype/ttdriver.c | 33 +- src/truetype/ttpic.c | 9 +- src/truetype/ttpic.h | 31 +- 11 files changed, 1024 insertions(+), 655 deletions(-) diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h index 231bdd4a5..8ac85d33c 100644 --- a/include/freetype/internal/autohint.h +++ b/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2007 by */ +/* Copyright 1996-2002, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -196,29 +196,42 @@ FT_BEGIN_HEADER } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_AutoHinter_ServiceRec class_ = \ - { \ - reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \ +#define FT_DEFINE_AUTOHINTER_SERVICE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_AutoHinter_ServiceRec class_ = \ + { \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_AutoHinter_ServiceRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->reset_face = reset_face_; \ - clazz->get_global_hints = get_global_hints_; \ - clazz->done_global_hints = done_global_hints_; \ - clazz->load_glyph = load_glyph_; \ +#define FT_DEFINE_AUTOHINTER_SERVICE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_AutoHinter_ServiceRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->reset_face = reset_face_; \ + clazz->get_global_hints = get_global_hints_; \ + clazz->done_global_hints = done_global_hints_; \ + clazz->load_glyph = load_glyph_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h index 6f6b20622..8d396bea1 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver interface (specification). */ /* */ -/* Copyright 1996-2003, 2006, 2008, 2011 by */ +/* Copyright 1996-2003, 2006, 2008, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -181,37 +181,37 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Driver_ClassRec_ { - FT_Module_Class root; + FT_Module_Class root; - FT_Long face_object_size; - FT_Long size_object_size; - FT_Long slot_object_size; + FT_Long face_object_size; + FT_Long size_object_size; + FT_Long slot_object_size; - FT_Face_InitFunc init_face; - FT_Face_DoneFunc done_face; + FT_Face_InitFunc init_face; + FT_Face_DoneFunc done_face; - FT_Size_InitFunc init_size; - FT_Size_DoneFunc done_size; + FT_Size_InitFunc init_size; + FT_Size_DoneFunc done_size; - FT_Slot_InitFunc init_slot; - FT_Slot_DoneFunc done_slot; + FT_Slot_InitFunc init_slot; + FT_Slot_DoneFunc done_slot; #ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_Size_ResetPointsFunc set_char_sizes; - FT_Size_ResetPixelsFunc set_pixel_sizes; + FT_Size_ResetPointsFunc set_char_sizes; + FT_Size_ResetPixelsFunc set_pixel_sizes; #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - FT_Slot_LoadFunc load_glyph; + FT_Slot_LoadFunc load_glyph; - FT_Face_GetKerningFunc get_kerning; - FT_Face_AttachFunc attach_file; - FT_Face_GetAdvancesFunc get_advances; + FT_Face_GetKerningFunc get_kerning; + FT_Face_AttachFunc attach_file; + FT_Face_GetAdvancesFunc get_advances; /* since version 2.2 */ - FT_Size_RequestFunc request_size; - FT_Size_SelectFunc select_size; + FT_Size_RequestFunc request_size; + FT_Size_SelectFunc select_size; } FT_Driver_ClassRec, *FT_Driver_Class; @@ -239,14 +239,15 @@ FT_BEGIN_HEADER #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + /*************************************************************************/ /* */ /* */ /* FT_DECLARE_DRIVER */ /* */ /* */ - /* Used to create a forward declaration of a */ - /* FT_Driver_ClassRec stract instance. */ + /* Used to create a forward declaration of an FT_Driver_ClassRec */ + /* struct instance. */ /* */ /* */ /* FT_DEFINE_DRIVER */ @@ -254,160 +255,219 @@ FT_BEGIN_HEADER /* */ /* Used to initialize an instance of FT_Driver_ClassRec struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ - /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */ + /* called with a pointer where the allocated structure is returned. */ + /* And when it is no longer needed a `destroy' function needs to be */ + /* called to release that allocation. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* `fcinit.c' (ft_create_default_module_classes) already contains a */ + /* mechanism to call these functions for the default modules */ + /* described in `ftmodule.h'. */ + /* */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by driver */ - /* definition calling FT_DEFINE_DRIVER() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by driver definition calling `FT_DEFINE_DRIVER' in following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ + /* allocated in the global scope (or the scope where the macro is */ + /* used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ - a_, b_, +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \ + a_, b_, #else - #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ #endif -#define FT_DECLARE_DRIVER(class_) \ - FT_CALLBACK_TABLE \ +#define FT_DECLARE_DRIVER( class_ ) \ + FT_CALLBACK_TABLE \ const FT_Driver_ClassRec class_; -#define FT_DEFINE_DRIVER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - face_object_size_, size_object_size_, \ - slot_object_size_, init_face_, done_face_, \ - init_size_, done_size_, init_slot_, done_slot_, \ - old_set_char_sizes_, old_set_pixel_sizes_, \ - load_glyph_, get_kerning_, attach_file_, \ - get_advances_, request_size_, select_size_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Driver_ClassRec class_ = \ - { \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \ - init_,done_,get_interface_) \ - \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - \ - init_face_, \ - done_face_, \ - \ - init_size_, \ - done_size_, \ - \ - init_slot_, \ - done_slot_, \ - \ - FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \ - \ - load_glyph_, \ - \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - \ - request_size_, \ - select_size_ \ +#define FT_DEFINE_DRIVER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + init_face_, \ + done_face_, \ + init_size_, \ + done_size_, \ + init_slot_, \ + done_slot_, \ + old_set_char_sizes_, \ + old_set_pixel_sizes_, \ + load_glyph_, \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + request_size_, \ + select_size_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Driver_ClassRec class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + \ + init_face_, \ + done_face_, \ + \ + init_size_, \ + done_size_, \ + \ + init_slot_, \ + done_slot_, \ + \ + FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_, \ + old_set_pixel_sizes_ ) \ + \ + load_glyph_, \ + \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + \ + request_size_, \ + select_size_ \ }; #else /* FT_CONFIG_OPTION_PIC */ #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ - clazz->set_char_sizes = a_; \ - clazz->set_pixel_sizes = b_; +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \ + clazz->set_char_sizes = a_; \ + clazz->set_pixel_sizes = b_; #else - #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ #endif -#define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_) +#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ ) -#define FT_DEFINE_DRIVER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - face_object_size_, size_object_size_, \ - slot_object_size_, init_face_, done_face_, \ - init_size_, done_size_, init_slot_, done_slot_, \ - old_set_char_sizes_, old_set_pixel_sizes_, \ - load_glyph_, get_kerning_, attach_file_, \ - get_advances_, request_size_, select_size_ ) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ - class_##_pic_free( library ); \ - if ( dclazz ) \ - FT_FREE( dclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Driver_Class clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \ - init_,done_,get_interface_) \ - \ - clazz->face_object_size = face_object_size_; \ - clazz->size_object_size = size_object_size_; \ - clazz->slot_object_size = slot_object_size_; \ - \ - clazz->init_face = init_face_; \ - clazz->done_face = done_face_; \ - \ - clazz->init_size = init_size_; \ - clazz->done_size = done_size_; \ - \ - clazz->init_slot = init_slot_; \ - clazz->done_slot = done_slot_; \ - \ - FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \ - \ - clazz->load_glyph = load_glyph_; \ - \ - clazz->get_kerning = get_kerning_; \ - clazz->attach_file = attach_file_; \ - clazz->get_advances = get_advances_; \ - \ - clazz->request_size = request_size_; \ - clazz->select_size = select_size_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ +#define FT_DEFINE_DRIVER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + init_face_, \ + done_face_, \ + init_size_, \ + done_size_, \ + init_slot_, \ + done_slot_, \ + old_set_char_sizes_, \ + old_set_pixel_sizes_, \ + load_glyph_, \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + request_size_, \ + select_size_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( dclazz ) \ + FT_FREE( dclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Driver_Class clazz; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_) \ + \ + clazz->face_object_size = face_object_size_; \ + clazz->size_object_size = size_object_size_; \ + clazz->slot_object_size = slot_object_size_; \ + \ + clazz->init_face = init_face_; \ + clazz->done_face = done_face_; \ + \ + clazz->init_size = init_size_; \ + clazz->done_size = done_size_; \ + \ + clazz->init_slot = init_slot_; \ + clazz->done_slot = done_slot_; \ + \ + FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_, \ + old_set_pixel_sizes_ ) \ + \ + clazz->load_glyph = load_glyph_; \ + \ + clazz->get_kerning = get_kerning_; \ + clazz->attach_file = attach_file_; \ + clazz->get_advances = get_advances_; \ + \ + clazz->request_size = request_size_; \ + clazz->select_size = select_size_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ } diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index eee3d24f1..a369b49c9 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -206,46 +206,79 @@ FT_BEGIN_HEADER } FT_CMap_ClassRec; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_CMAP_CLASS(class_) \ - FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_CMap_ClassRec class_ = \ - { \ - size_, init_, done_, char_index_, char_next_, char_var_index_, \ - char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \ +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_CMap_ClassRec class_ = \ + { \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ \ }; + #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_CMAP_CLASS(class_) \ - void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz); +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ); -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_CMap_ClassRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->size = size_; \ - clazz->init = init_; \ - clazz->done = done_; \ - clazz->char_index = char_index_; \ - clazz->char_next = char_next_; \ - clazz->char_var_index = char_var_index_; \ - clazz->char_var_default = char_var_default_; \ - clazz->variant_list = variant_list_; \ - clazz->charvariant_list = charvariant_list_; \ - clazz->variantchar_list = variantchar_list_; \ +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->size = size_; \ + clazz->init = init_; \ + clazz->done = done_; \ + clazz->char_index = char_index_; \ + clazz->char_next = char_next_; \ + clazz->char_var_index = char_var_index_; \ + clazz->char_var_default = char_var_default_; \ + clazz->variant_list = variant_list_; \ + clazz->charvariant_list = charvariant_list_; \ + clazz->variantchar_list = variantchar_list_; \ } + #endif /* FT_CONFIG_OPTION_PIC */ + /* create a new charmap and add it to charmap->face */ FT_BASE( FT_Error ) FT_CMap_New( FT_CMap_Class clazz, @@ -926,6 +959,7 @@ FT_BEGIN_HEADER FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; #endif + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -947,38 +981,57 @@ FT_BEGIN_HEADER /* */ /* Used to initialize an instance of FT_Outline_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static const FT_Outline_Funcs class_ = \ - { \ - move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \ +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static const FT_Outline_Funcs class_ = \ + { \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static FT_Error \ - Init_Class_##class_( FT_Outline_Funcs* clazz ) \ - { \ - clazz->move_to = move_to_; \ - clazz->line_to = line_to_; \ - clazz->conic_to = conic_to_; \ - clazz->cubic_to = cubic_to_; \ - clazz->shift = shift_; \ - clazz->delta = delta_; \ - return FT_Err_Ok; \ +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static FT_Error \ + Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \ + { \ + clazz->move_to = move_to_; \ + clazz->line_to = line_to_; \ + clazz->conic_to = conic_to_; \ + clazz->cubic_to = cubic_to_; \ + clazz->shift = shift_; \ + clazz->delta = delta_; \ + \ + return FT_Err_Ok; \ } #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* */ @@ -987,39 +1040,55 @@ FT_BEGIN_HEADER /* */ /* Used to initialize an instance of FT_Raster_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, \ - raster_render_, raster_done_) \ - const FT_Raster_Funcs class_ = \ - { \ - glyph_format_, raster_new_, raster_reset_, \ - raster_set_mode_, raster_render_, raster_done_ \ +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + const FT_Raster_Funcs class_ = \ + { \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, raster_render_, raster_done_) \ - void \ - FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \ - { \ - clazz->glyph_format = glyph_format_; \ - clazz->raster_new = raster_new_; \ - clazz->raster_reset = raster_reset_; \ - clazz->raster_set_mode = raster_set_mode_; \ - clazz->raster_render = raster_render_; \ - clazz->raster_done = raster_done_; \ +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \ + { \ + clazz->glyph_format = glyph_format_; \ + clazz->raster_new = raster_new_; \ + clazz->raster_reset = raster_reset_; \ + clazz->raster_set_mode = raster_set_mode_; \ + clazz->raster_render = raster_render_; \ + clazz->raster_done = raster_done_; \ } #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1033,7 +1102,6 @@ FT_BEGIN_HEADER /*************************************************************************/ - /*************************************************************************/ /* */ /* */ @@ -1042,40 +1110,64 @@ FT_BEGIN_HEADER /* */ /* Used to initialize an instance of FT_Glyph_Class struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated stcture to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Glyph_Class class_ = \ - { \ - size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \ +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Glyph_Class class_ = \ + { \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - void \ - FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \ - { \ - clazz->glyph_size = size_; \ - clazz->glyph_format = format_; \ - clazz->glyph_init = init_; \ - clazz->glyph_done = done_; \ - clazz->glyph_copy = copy_; \ - clazz->glyph_transform = transform_; \ - clazz->glyph_bbox = bbox_; \ - clazz->glyph_prepare = prepare_; \ +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \ + { \ + clazz->glyph_size = size_; \ + clazz->glyph_format = format_; \ + clazz->glyph_init = init_; \ + clazz->glyph_done = done_; \ + clazz->glyph_copy = copy_; \ + clazz->glyph_transform = transform_; \ + clazz->glyph_bbox = bbox_; \ + clazz->glyph_prepare = prepare_; \ } #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* */ @@ -1083,7 +1175,7 @@ FT_BEGIN_HEADER /* */ /* */ /* Used to create a forward declaration of a */ - /* FT_Renderer_Class stract instance. */ + /* FT_Renderer_Class struct instance. */ /* */ /* */ /* FT_DEFINE_RENDERER */ @@ -1091,22 +1183,23 @@ FT_BEGIN_HEADER /* */ /* Used to initialize an instance of FT_Renderer_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */ + /* to be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by renderer */ - /* definition calling FT_DEFINE_RENDERER() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1114,88 +1207,129 @@ FT_BEGIN_HEADER /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_RENDERER(class_) \ - FT_EXPORT_VAR( const FT_Renderer_Class ) class_; +#define FT_DECLARE_RENDERER( class_ ) \ + FT_EXPORT_VAR( const FT_Renderer_Class ) class_; -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Renderer_Class class_ = \ - { \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - glyph_format_, \ - \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - \ - raster_class_ \ +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Renderer_Class class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + glyph_format_, \ + \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + \ + raster_class_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_) +#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ ) -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( rclazz ) \ - FT_FREE( rclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Renderer_Class* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - \ - clazz->glyph_format = glyph_format_; \ - \ - clazz->render_glyph = render_glyph_; \ - clazz->transform_glyph = transform_glyph_; \ - clazz->get_glyph_cbox = get_glyph_cbox_; \ - clazz->set_mode = set_mode_; \ - \ - clazz->raster_class = raster_class_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( rclazz ) \ + FT_FREE( rclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Renderer_Class* clazz; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + clazz->glyph_format = glyph_format_; \ + \ + clazz->render_glyph = render_glyph_; \ + clazz->transform_glyph = transform_glyph_; \ + clazz->get_glyph_cbox = get_glyph_cbox_; \ + clazz->set_mode = set_mode_; \ + \ + clazz->raster_class = raster_class_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ } - - #endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1247,6 +1381,7 @@ FT_BEGIN_HEADER #endif + /*************************************************************************/ /* */ /* */ @@ -1254,30 +1389,31 @@ FT_BEGIN_HEADER /* */ /* */ /* Used to create a forward declaration of a */ - /* FT_Module_Class stract instance. */ + /* FT_Module_Class struct instance. */ /* */ /* */ /* FT_DEFINE_MODULE */ /* */ /* */ - /* Used to initialize an instance of FT_Module_Class struct. */ + /* Used to initialize an instance of an FT_Module_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */ + /* be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. Also the pic_init and pic_free */ - /* functions should be declared in pic.h, to be referred by module */ - /* definition calling FT_DEFINE_MODULE() in following. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the module definition calling `FT_DEFINE_MODULE' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1287,119 +1423,159 @@ FT_BEGIN_HEADER /* FT_DEFINE_ROOT_MODULE */ /* */ /* */ - /* Used to initialize an instance of FT_Module_Class struct inside */ - /* another stract that contains it or in a function that initializes */ - /* that containing stract */ + /* Used to initialize an instance of an FT_Module_Class struct inside */ + /* another struct that contains it or in a function that initializes */ + /* that containing struct. */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_MODULE(class_) \ - FT_CALLBACK_TABLE \ - const FT_Module_Class class_; \ +#define FT_DECLARE_MODULE( class_ ) \ + FT_CALLBACK_TABLE \ + const FT_Module_Class class_; -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }, -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Module_Class class_ = \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Module_Class class_ = \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_MODULE(class_) \ - FT_Error FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ); \ - void FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ); +#define FT_DECLARE_MODULE( class_ ) \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ); \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ); -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - clazz->root.module_flags = flags_; \ - clazz->root.module_size = size_; \ - clazz->root.module_name = name_; \ - clazz->root.module_version = version_; \ - clazz->root.module_requires = requires_; \ - \ - clazz->root.module_interface = interface_; \ - \ - clazz->root.module_init = init_; \ - clazz->root.module_done = done_; \ - clazz->root.get_interface = get_interface_; +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + clazz->root.module_flags = flags_; \ + clazz->root.module_size = size_; \ + clazz->root.module_name = name_; \ + clazz->root.module_version = version_; \ + clazz->root.module_requires = requires_; \ + \ + clazz->root.module_interface = interface_; \ + \ + clazz->root.module_init = init_; \ + clazz->root.module_done = done_; \ + clazz->root.get_interface = get_interface_; -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Module_Class* clazz; \ - FT_Error error; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - clazz->module_flags = flags_; \ - clazz->module_size = size_; \ - clazz->module_name = name_; \ - clazz->module_version = version_; \ - clazz->module_requires = requires_; \ - \ - clazz->module_interface = interface_; \ - \ - clazz->module_init = init_; \ - clazz->module_done = done_; \ - clazz->get_interface = get_interface_; \ - \ - *output_class = clazz; \ - return FT_Err_Ok; \ +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Module_Class* clazz; \ + FT_Error error; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + clazz->module_flags = flags_; \ + clazz->module_size = size_; \ + clazz->module_name = name_; \ + clazz->module_version = version_; \ + clazz->module_requires = requires_; \ + \ + clazz->module_interface = interface_; \ + \ + clazz->module_init = init_; \ + clazz->module_done = done_; \ + clazz->get_interface = get_interface_; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftpic.h b/include/freetype/internal/ftpic.h index 5b674e6a5..485ce7a24 100644 --- a/include/freetype/internal/ftpic.h +++ b/include/freetype/internal/ftpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,29 +31,33 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC - typedef struct FT_PIC_Container_ + typedef struct FT_PIC_Container_ { /* pic containers for base */ - void* base; + void* base; + /* pic containers for modules */ - void* autofit; - void* cff; - void* pshinter; - void* psnames; - void* raster; - void* sfnt; - void* smooth; - void* truetype; + void* autofit; + void* cff; + void* pshinter; + void* psnames; + void* raster; + void* sfnt; + void* smooth; + void* truetype; + } FT_PIC_Container; - /* Initialize the various function tables, structs, etc. stored in the container. */ + + /* Initialize the various function tables, structs, etc. */ + /* stored in the container. */ FT_BASE( FT_Error ) - ft_pic_container_init( FT_Library library ); + ft_pic_container_init( FT_Library library ); /* Destroy the contents of the container. */ FT_BASE( void ) - ft_pic_container_destroy( FT_Library library ); + ft_pic_container_destroy( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h index 77e10206a..6307f2d0c 100644 --- a/include/freetype/internal/ftrfork.h +++ b/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004, 2006, 2007 by */ +/* Copyright 2004, 2006, 2007, 2012 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -80,26 +80,37 @@ FT_BEGIN_HEADER } ft_raccess_guess_rec; #ifndef FT_CONFIG_OPTION_PIC + /* this array is a storage in non-PIC mode, so ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - const type name[] = { -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - { raccess_guess_##func_suffix, FT_RFork_Rule_##type_suffix }, -#define CONST_FT_RFORK_RULE_ARRAY_END }; +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + const type name[] = { +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + { raccess_guess_ ## func_suffix, \ + FT_RFork_Rule_ ## type_suffix }, +#define CONST_FT_RFORK_RULE_ARRAY_END }; + #else /* FT_CONFIG_OPTION_PIC */ + /* this array is a function in PIC mode, so no ; is needed in END */ -#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ - void FT_Init_##name ( type* storage ) { \ - type *local = storage; \ - int i = 0; -#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ - local[i].func = raccess_guess_##func_suffix; \ - local[i].type = FT_RFork_Rule_##type_suffix; \ - i++; -#define CONST_FT_RFORK_RULE_ARRAY_END } +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + void \ + FT_Init_ ## name( type* storage ) \ + { \ + type* local = storage; \ + \ + \ + int i = 0; +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + local[i].func = raccess_guess_ ## func_suffix; \ + local[i].type = FT_RFork_Rule_ ## type_suffix; \ + i++; +#define CONST_FT_RFORK_RULE_ARRAY_END } + #endif /* FT_CONFIG_OPTION_PIC */ + #endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ + /*************************************************************************/ /* */ /* */ diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 4f481db02..12bef6f93 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -167,7 +167,12 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* */ - /* FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6 */ + /* FT_DEFINE_SERVICEDESCREC1 */ + /* FT_DEFINE_SERVICEDESCREC2 */ + /* FT_DEFINE_SERVICEDESCREC3 */ + /* FT_DEFINE_SERVICEDESCREC4 */ + /* FT_DEFINE_SERVICEDESCREC5 */ + /* FT_DEFINE_SERVICEDESCREC6 */ /* */ /* */ /* Used to initialize an array of FT_ServiceDescRec structures. */ diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h index 5b7b6984c..3fb18dc2d 100644 --- a/include/freetype/internal/pshints.h +++ b/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ /* recorders (specification only). These are used to support native */ /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ /* */ -/* Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by */ +/* Copyright 2001-2003, 2005-2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -679,27 +679,37 @@ FT_BEGIN_HEADER typedef PSHinter_Interface* PSHinter_Service; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - static const PSHinter_Interface class_ = \ - { \ - get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \ +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + static const PSHinter_Interface class_ = \ + { \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - PSHinter_Interface* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_globals_funcs = get_globals_funcs_; \ - clazz->get_t1_funcs = get_t1_funcs_; \ - clazz->get_t2_funcs = get_t2_funcs_; \ +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + PSHinter_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_globals_funcs = get_globals_funcs_; \ + clazz->get_t1_funcs = get_t1_funcs_; \ + clazz->get_t2_funcs = get_t2_funcs_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 905ca8ccd..aab4f8531 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 1996-2006, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -756,135 +756,212 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \ - a, +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a ) \ + a, #else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a ) /* empty */ #endif -#define FT_INTERNAL(a) \ - a, -#define FT_DEFINE_SFNT_INTERFACE(class_, \ - goto_table_, init_face_, load_face_, done_face_, get_interface_, \ - load_any_, load_sfnt_header_, load_directory_, load_head_, \ - load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ - load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ - load_kern_, load_gasp_, load_pclt_, load_bhed_, \ - set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ - load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ - get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ - get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ - set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ - static const SFNT_Interface class_ = \ - { \ - FT_INTERNAL(goto_table_) \ - FT_INTERNAL(init_face_) \ - FT_INTERNAL(load_face_) \ - FT_INTERNAL(done_face_) \ - FT_INTERNAL(get_interface_) \ - FT_INTERNAL(load_any_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \ - FT_INTERNAL(load_head_) \ - FT_INTERNAL(load_hhea_) \ - FT_INTERNAL(load_cmap_) \ - FT_INTERNAL(load_maxp_) \ - FT_INTERNAL(load_os2_) \ - FT_INTERNAL(load_post_) \ - FT_INTERNAL(load_name_) \ - FT_INTERNAL(free_name_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \ - FT_INTERNAL(load_kern_) \ - FT_INTERNAL(load_gasp_) \ - FT_INTERNAL(load_pclt_) \ - FT_INTERNAL(load_bhed_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \ - FT_INTERNAL(load_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \ - FT_INTERNAL(get_psname_) \ - FT_INTERNAL(free_psnames_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \ - FT_INTERNAL(get_kerning_) \ - FT_INTERNAL(load_font_dir_) \ - FT_INTERNAL(load_hmtx_) \ - FT_INTERNAL(load_eblc_) \ - FT_INTERNAL(free_eblc_) \ - FT_INTERNAL(set_sbit_strike_) \ - FT_INTERNAL(load_strike_metrics_) \ - FT_INTERNAL(get_metrics_) \ +#define FT_INTERNAL( a ) \ + a, + +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_sfnt_header_, \ + load_directory_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_hdmx_stub_, \ + free_hdmx_stub_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + set_sbit_strike_stub_, \ + load_sbits_stub_, \ + find_sbit_image_, \ + load_sbit_metrics_, \ + load_sbit_image_, \ + free_sbits_stub_, \ + get_psname_, \ + free_psnames_, \ + load_charmap_stub_, \ + free_charmap_stub_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + static const SFNT_Interface class_ = \ + { \ + FT_INTERNAL( goto_table_ ) \ + FT_INTERNAL( init_face_ ) \ + FT_INTERNAL( load_face_ ) \ + FT_INTERNAL( done_face_ ) \ + FT_INTERNAL( get_interface_ ) \ + FT_INTERNAL( load_any_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory_ ) \ + FT_INTERNAL( load_head_ ) \ + FT_INTERNAL( load_hhea_ ) \ + FT_INTERNAL( load_cmap_ ) \ + FT_INTERNAL( load_maxp_ ) \ + FT_INTERNAL( load_os2_ ) \ + FT_INTERNAL( load_post_ ) \ + FT_INTERNAL( load_name_ ) \ + FT_INTERNAL( free_name_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub_ ) \ + FT_INTERNAL( load_kern_ ) \ + FT_INTERNAL( load_gasp_ ) \ + FT_INTERNAL( load_pclt_ ) \ + FT_INTERNAL( load_bhed_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics_ ) \ + FT_INTERNAL( load_sbit_image_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub_ ) \ + FT_INTERNAL( get_psname_ ) \ + FT_INTERNAL( free_psnames_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub_ ) \ + FT_INTERNAL( get_kerning_ ) \ + FT_INTERNAL( load_font_dir_ ) \ + FT_INTERNAL( load_hmtx_ ) \ + FT_INTERNAL( load_eblc_ ) \ + FT_INTERNAL( free_eblc_ ) \ + FT_INTERNAL( set_sbit_strike_ ) \ + FT_INTERNAL( load_strike_metrics_ ) \ + FT_INTERNAL( get_metrics_ ) \ }; #else /* FT_CONFIG_OPTION_PIC */ #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \ - clazz->a = a_; +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ ) \ + clazz->a = a_; #else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ ) /* empty */ #endif -#define FT_INTERNAL(a, a_) \ - clazz->a = a_; -#define FT_DEFINE_SFNT_INTERFACE(class_, \ - goto_table_, init_face_, load_face_, done_face_, get_interface_, \ - load_any_, load_sfnt_header_, load_directory_, load_head_, \ - load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \ - load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \ - load_kern_, load_gasp_, load_pclt_, load_bhed_, \ - set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \ - load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \ - get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \ - get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \ - set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \ - void \ - FT_Init_Class_##class_( FT_Library library, SFNT_Interface* clazz ) \ - { \ - FT_UNUSED(library); \ - FT_INTERNAL(goto_table,goto_table_) \ - FT_INTERNAL(init_face,init_face_) \ - FT_INTERNAL(load_face,load_face_) \ - FT_INTERNAL(done_face,done_face_) \ - FT_INTERNAL(get_interface,get_interface_) \ - FT_INTERNAL(load_any,load_any_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \ - FT_INTERNAL(load_head,load_head_) \ - FT_INTERNAL(load_hhea,load_hhea_) \ - FT_INTERNAL(load_cmap,load_cmap_) \ - FT_INTERNAL(load_maxp,load_maxp_) \ - FT_INTERNAL(load_os2,load_os2_) \ - FT_INTERNAL(load_post,load_post_) \ - FT_INTERNAL(load_name,load_name_) \ - FT_INTERNAL(free_name,free_name_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \ - FT_INTERNAL(load_kern,load_kern_) \ - FT_INTERNAL(load_gasp,load_gasp_) \ - FT_INTERNAL(load_pclt,load_pclt_) \ - FT_INTERNAL(load_bhed,load_bhed_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \ - FT_INTERNAL(load_sbit_image,load_sbit_image_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \ - FT_INTERNAL(get_psname,get_psname_) \ - FT_INTERNAL(free_psnames,free_psnames_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \ - FT_INTERNAL(get_kerning,get_kerning_) \ - FT_INTERNAL(load_font_dir,load_font_dir_) \ - FT_INTERNAL(load_hmtx,load_hmtx_) \ - FT_INTERNAL(load_eblc,load_eblc_) \ - FT_INTERNAL(free_eblc,free_eblc_) \ - FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \ - FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \ - FT_INTERNAL(get_metrics,get_metrics_) \ +#define FT_INTERNAL( a, a_ ) \ + clazz->a = a_; + +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_sfnt_header_, \ + load_directory_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_hdmx_stub_, \ + free_hdmx_stub_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + set_sbit_strike_stub_, \ + load_sbits_stub_, \ + find_sbit_image_, \ + load_sbit_metrics_, \ + load_sbit_image_, \ + free_sbits_stub_, \ + get_psname_, \ + free_psnames_, \ + load_charmap_stub_, \ + free_charmap_stub_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + SFNT_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + FT_INTERNAL( goto_table, goto_table_ ) \ + FT_INTERNAL( init_face, init_face_ ) \ + FT_INTERNAL( load_face, load_face_ ) \ + FT_INTERNAL( done_face, done_face_ ) \ + FT_INTERNAL( get_interface, get_interface_ ) \ + FT_INTERNAL( load_any, load_any_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header, \ + load_sfnt_header_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory, \ + load_directory_ ) \ + FT_INTERNAL( load_head, load_head_ ) \ + FT_INTERNAL( load_hhea, load_hhea_ ) \ + FT_INTERNAL( load_cmap, load_cmap_ ) \ + FT_INTERNAL( load_maxp, load_maxp_ ) \ + FT_INTERNAL( load_os2, load_os2_ ) \ + FT_INTERNAL( load_post, load_post_ ) \ + FT_INTERNAL( load_name, load_name_ ) \ + FT_INTERNAL( free_name, free_name_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub, \ + load_hdmx_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub, \ + free_hdmx_stub_ ) \ + FT_INTERNAL( load_kern, load_kern_ ) \ + FT_INTERNAL( load_gasp, load_gasp_ ) \ + FT_INTERNAL( load_pclt, load_pclt_ ) \ + FT_INTERNAL( load_bhed, load_bhed_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub, \ + set_sbit_strike_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub, \ + load_sbits_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image, \ + find_sbit_image_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics, \ + load_sbit_metrics_ ) \ + FT_INTERNAL( load_sbit_image, load_sbit_image_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub, \ + free_sbits_stub_ ) \ + FT_INTERNAL( get_psname, get_psname_ ) \ + FT_INTERNAL( free_psnames, free_psnames_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub, \ + load_charmap_stub_ ) \ + FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub, \ + free_charmap_stub_ ) \ + FT_INTERNAL( get_kerning, get_kerning_ ) \ + FT_INTERNAL( load_font_dir, load_font_dir_ ) \ + FT_INTERNAL( load_hmtx, load_hmtx_ ) \ + FT_INTERNAL( load_eblc, load_eblc_ ) \ + FT_INTERNAL( free_eblc, free_eblc_ ) \ + FT_INTERNAL( set_sbit_strike, set_sbit_strike_ ) \ + FT_INTERNAL( load_strike_metrics, load_strike_metrics_ ) \ + FT_INTERNAL( get_metrics, get_metrics_ ) \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 3669d4582..6f3bffbd0 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -353,13 +353,13 @@ /*************************************************************************/ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICE_MULTIMASTERSREC(tt_service_gx_multi_masters, + FT_DEFINE_SERVICE_MULTIMASTERSREC( + tt_service_gx_multi_masters, (FT_Get_MM_Func) NULL, (FT_Set_MM_Design_Func) NULL, (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, (FT_Get_MM_Var_Func) TT_Get_MM_Var, - (FT_Set_Var_Design_Func)TT_Set_Var_Design - ) + (FT_Set_Var_Design_Func)TT_Set_Var_Design ) #endif static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine = @@ -379,25 +379,26 @@ #endif /* TT_USE_BYTECODE_INTERPRETER */ }; - FT_DEFINE_SERVICE_TTGLYFREC(tt_service_truetype_glyf, - (TT_Glyf_GetLocationFunc)tt_face_get_location - ) + FT_DEFINE_SERVICE_TTGLYFREC( + tt_service_truetype_glyf, + (TT_Glyf_GetLocationFunc)tt_face_get_location ) #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC4(tt_services, + FT_DEFINE_SERVICEDESCREC4( + tt_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE, FT_SERVICE_ID_MULTI_MASTERS, &FT_TT_SERVICE_GX_MULTI_MASTERS_GET, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET - ) + FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET ) #else - FT_DEFINE_SERVICEDESCREC3(tt_services, + FT_DEFINE_SERVICEDESCREC3( + tt_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET - ) + FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET ) #endif + FT_CALLBACK_DEF( FT_Module_Interface ) tt_get_interface( FT_Module driver, /* TT_Driver */ const char* tt_interface ) @@ -445,15 +446,15 @@ /* The FT_DriverInterface structure is defined in ftdriver.h. */ #ifdef TT_USE_BYTECODE_INTERPRETER -#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER +#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER #else -#define TT_HINTER_FLAG 0 +#define TT_HINTER_FLAG 0 #endif #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS -#define TT_SIZE_SELECT tt_size_select +#define TT_SIZE_SELECT tt_size_select #else -#define TT_SIZE_SELECT 0 +#define TT_SIZE_SELECT 0 #endif FT_DEFINE_DRIVER( tt_driver_class, diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index 65ca845aa..47e0758e3 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,11 +41,12 @@ FT_Init_Class_tt_service_truetype_glyf( FT_Service_TTGlyfRec* sv_ttglyf ); + void tt_driver_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; if ( pic_container->truetype ) @@ -77,7 +78,8 @@ FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->truetype = container; - /* initialize pointer table - this is how the module usually expects this data */ + /* initialize pointer table - this is how the module usually */ + /* expects this data */ error = FT_Create_Class_tt_services( library, &container->tt_services ); if ( error ) @@ -88,6 +90,7 @@ #endif FT_Init_Class_tt_service_truetype_glyf( &container->tt_service_truetype_glyf ); + Exit: if ( error ) tt_driver_class_pic_free( library ); diff --git a/src/truetype/ttpic.h b/src/truetype/ttpic.h index 48f43a5f9..11392316b 100644 --- a/src/truetype/ttpic.h +++ b/src/truetype/ttpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,9 +23,10 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define FT_TT_SERVICES_GET tt_services -#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters -#define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf + +#define FT_TT_SERVICES_GET tt_services +#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters +#define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf #else /* FT_CONFIG_OPTION_PIC */ @@ -33,19 +34,27 @@ FT_BEGIN_HEADER #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_TRUETYPE_GLYF_H - typedef struct TTModulePIC_ + + typedef struct TTModulePIC_ { - FT_ServiceDescRec* tt_services; + FT_ServiceDescRec* tt_services; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Service_MultiMastersRec tt_service_gx_multi_masters; #endif - FT_Service_TTGlyfRec tt_service_truetype_glyf; + FT_Service_TTGlyfRec tt_service_truetype_glyf; + } TTModulePIC; -#define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype)) -#define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services) -#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters) -#define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf) + +#define GET_PIC( lib ) \ + ( (TTModulePIC*)((lib)->pic_container.truetype) ) +#define FT_TT_SERVICES_GET \ + ( GET_PIC( library )->tt_services ) +#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET \ + ( GET_PIC( library )->tt_service_gx_multi_masters ) +#define FT_TT_SERVICE_TRUETYPE_GLYF_GET \ + ( GET_PIC( library )->tt_service_truetype_glyf ) + /* see ttpic.c for the implementation */ void