summaryrefslogtreecommitdiffstats
path: root/include/freetype/internal/ftobjs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/freetype/internal/ftobjs.h')
-rw-r--r--include/freetype/internal/ftobjs.h526
1 files changed, 526 insertions, 0 deletions
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 1f22343..574cf58 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -35,6 +35,7 @@
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_SERVICE_H
+#include FT_INTERNAL_PIC_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
@@ -205,6 +206,45 @@ 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_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_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 )
@@ -765,6 +805,10 @@ FT_BEGIN_HEADER
/* */
/* debug_hooks :: XXX */
/* */
+ /* pic_container :: Contains global structs and tables, instead */
+ /* of defining them globallly. */
+ /* */
+
typedef struct FT_LibraryRec_
{
FT_Memory memory; /* library's memory manager */
@@ -795,6 +839,10 @@ FT_BEGIN_HEADER
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif
+#ifdef FT_CONFIG_OPTION_PIC
+ FT_PIC_Container pic_container;
+#endif
+
} FT_LibraryRec;
@@ -866,6 +914,484 @@ FT_BEGIN_HEADER
FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
#endif
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** PIC-Support Macros for ftimage.h ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_OUTLINE_FUNCS */
+ /* */
+ /* <Description> */
+ /* 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. */
+ /* 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_ \
+ };
+
+#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; \
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_RASTER_FUNCS */
+ /* */
+ /* <Description> */
+ /* 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. */
+ /* 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_ \
+ };
+
+#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_; \
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** PIC-Support Macros for ftrender.h ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_GLYPH */
+ /* */
+ /* <Description> */
+ /* 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. */
+ /* 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_ \
+ };
+
+#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_; \
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DECLARE_RENDERER */
+ /* */
+ /* <Description> */
+ /* Used to create a forward declaration of a */
+ /* FT_Renderer_Class stract instance. */
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_RENDERER */
+ /* */
+ /* <Description> */
+ /* 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 */
+ /* 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 function to allow you to manually allocate */
+ /* and initialize any additional global data, like 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. */
+ /* */
+ /* 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_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_ \
+ };
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#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 class_##_pic_free( FT_Library library ); \
+ FT_Error class_##_pic_init( FT_Library library ); \
+ \
+ 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 */
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** PIC-Support Macros for ftmodapi.h ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_Module_Creator */
+ /* */
+ /* <Description> */
+ /* A function used to create (allocate) a new module class object. */
+ /* The object's members are initialized, but the module itself is */
+ /* not. */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to the memory manager. */
+ /* output_class :: Initialized with the newly allocated class. */
+ /* */
+ typedef FT_Error
+ (*FT_Module_Creator)( FT_Memory memory,
+ FT_Module_Class** output_class );
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_Module_Destroyer */
+ /* */
+ /* <Description> */
+ /* A function used to destroy (deallocate) a module class object. */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to the memory manager. */
+ /* clazz :: Module class to destroy. */
+ /* */
+ typedef void
+ (*FT_Module_Destroyer)( FT_Memory memory,
+ FT_Module_Class* clazz );
+
+#endif
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DECLARE_MODULE */
+ /* */
+ /* <Description> */
+ /* Used to create a forward declaration of a */
+ /* FT_Module_Class stract instance. */
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_MODULE */
+ /* */
+ /* <Description> */
+ /* Used to initialize an instance of 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 */
+ /* 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 function to allow you to manually allocate */
+ /* and initialize any additional global data, like 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. */
+ /* */
+ /* 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). */
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_ROOT_MODULE */
+ /* */
+ /* <Description> */
+ /* 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 */
+ /* */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#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_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_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 class_##_pic_free( FT_Library library ); \
+ FT_Error class_##_pic_init( FT_Library library ); \
+ \
+ 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 */
+
FT_END_HEADER