shithub: freetype+ttf2subf

Download patch

ref: 636c294befc6df661a6496af49b8f7341fb2717f
parent: 2589e5fd94a24cc175fa7690cb3dbf16c7844229
author: Oran Agra <[email protected]>
date: Sun Apr 5 13:59:26 EDT 2009

Position Independent Code (PIC) support and infrastructure in base.

* include/freetype/config/ftoption.h add FT_CONFIG_OPTION_PIC
* include/freetype/internal/ftobjs.h Add pic_container member to
FT_LibraryRec.
Add macros to declare and init instances of FT_CMap_ClassRec.
Add macros to init instances of FT_Outline_Funcs and FT_Raster_Funcs.
Add macros to declare, allocate and initialize modules
(FT_Module_Class).
Add macros to declare, allocate and initialize renderers
(FT_Renderer_Class).
Add macro to init instances of FT_Glyph_Class.
Add macros to declare, allocate and initialize drivers
(FT_Driver_ClassRec).
* include/freetype/internal/ftpic.h new file to declare the
FT_PIC_Container struct and the functions to allocate and detroy it.
* include/freetype/internal/ftserv.h add macros to allocate and
destory arrays of FT_ServiceDescRec.
* include/freetype/internal/internal.h define macro to include
ftpic.h.

New Files:
* src/base/ftpic.c implement functions to allocate and destory the
global pic_container.
* src/base/basepic.h declare struct to hold PIC globals for base and
macros to access them.
* src/base/basepic.c implement functions to allocate, destroy and
initialize PIC globals for base.

* src/base/ftinit.c when FT_CONFIG_OPTION_PIC is defined implement
functions that allocate and destroy ft_default_modules according to
FT_CONFIG_MODULES_H in the pic_container instead of the global scope
and use macro from basepic.h to access it.
* src/base/ftobjs.c add calls to the functions that allocate and
destroy the global pic_container when the library is created and
destroyed.

* src/base/jamfile add new files to FT2_MULTI build:
ftpic.c and basepic.c.
* src/base/ftbase.c add new files to build:
ftpic.c and basepic.c.

* src/base/ftglyph.c when FT_CONFIG_OPTION_PIC is defined
ft_bitmap_glyph_class and ft_outline_glyph_class will be allocated
in the pic_container instead of the global scope and use macros from
basepic.h to access them.
* src/base/ftbbox.c allocate bbox_interface stract on the stack
instead of the global scope when FT_CONFIG_OPTION_PIC is defined.
* src/base/ftstroke.c access ft_outline_glyph_class allocated in
ftglyph.c via macros from basepic.h

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,58 @@
 2009-04-05  Oran Agra  <[email protected]>
 
+	Position Independent Code (PIC) support and infrastructure in base.
+
+	* include/freetype/config/ftoption.h add FT_CONFIG_OPTION_PIC
+	* include/freetype/internal/ftobjs.h Add pic_container member to 
+	FT_LibraryRec.
+	Add macros to declare and init instances of FT_CMap_ClassRec.
+	Add macros to init instances of FT_Outline_Funcs and FT_Raster_Funcs.
+	Add macros to declare, allocate and initialize modules 
+	(FT_Module_Class).
+	Add macros to declare, allocate and initialize renderers 
+	(FT_Renderer_Class).
+	Add macro to init instances of FT_Glyph_Class.
+	Add macros to declare, allocate and initialize drivers 
+	(FT_Driver_ClassRec).
+	* include/freetype/internal/ftpic.h new file to declare the 
+	FT_PIC_Container struct and the functions to allocate and detroy it.
+	* include/freetype/internal/ftserv.h add macros to allocate and 
+	destory arrays of FT_ServiceDescRec.
+	* include/freetype/internal/internal.h define macro to include 
+	ftpic.h.
+
+	New Files:
+	* src/base/ftpic.c implement functions to allocate and destory the 
+	global pic_container.
+	* src/base/basepic.h declare struct to hold PIC globals for base and 
+	macros to access them.
+	* src/base/basepic.c implement functions to allocate, destroy and 
+	initialize PIC globals for base.
+
+	* src/base/ftinit.c when FT_CONFIG_OPTION_PIC is defined implement 
+	functions that allocate and destroy ft_default_modules according to 
+	FT_CONFIG_MODULES_H in the pic_container instead of the global scope
+	and use macro from basepic.h to access it.
+	* src/base/ftobjs.c add calls to the functions that allocate and 
+	destroy the global pic_container when the library is created and 
+	destroyed.
+
+	* src/base/jamfile add new files to FT2_MULTI build: 
+	ftpic.c and basepic.c.
+	* src/base/ftbase.c add new files to build: 
+	ftpic.c and basepic.c.
+
+	* src/base/ftglyph.c when FT_CONFIG_OPTION_PIC is defined 
+	ft_bitmap_glyph_class and ft_outline_glyph_class will be allocated
+	in the pic_container instead of the global scope and use macros from
+ 	basepic.h to access them.
+	* src/base/ftbbox.c allocate bbox_interface stract on the stack 
+	instead of the global scope when FT_CONFIG_OPTION_PIC is defined.
+	* src/base/ftstroke.c access ft_outline_glyph_class allocated in
+	ftglyph.c via macros from basepic.h
+
+2009-04-05  Oran Agra  <[email protected]>
+
 	Preparing changes in cff parser later needed for PIC version.
 
 	* src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -396,6 +396,20 @@
 #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* Position Independent Code                                             */
+  /*                                                                       */
+  /*   If this macro is set (which is _not_ the default), FreeType2 will   */
+  /*   avoid creating constants that require address fixups. Instead the   */
+  /*   constants will be moved into a struct and additional intialization  */
+  /*   code will be used.                                                  */
+  /*                                                                       */
+  /*   Setting this macro is needed for systems that prohibit address      */
+  /*   fixups, such as BREW.                                               */
+  /*                                                                       */
+/* #define FT_CONFIG_OPTION_PIC */
+
 
   /*************************************************************************/
   /*************************************************************************/
--- a/include/freetype/internal/ftdriver.h
+++ b/include/freetype/internal/ftdriver.h
@@ -240,6 +240,179 @@
 
 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DECLARE_DRIVER                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to create a forward declaration of a                          */
+  /*    FT_Driver_ClassRec stract instance.                                */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_DRIVER                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    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                                            */
+  /*                                                                       */
+  /*    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
+
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
+  a_, b_,
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
+#endif
+
+#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_                                                             \
+  };
+
+#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_;
+#else
+  #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
+#endif
+
+#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 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;                                \
+    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;                                                        \
+  }                
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
 
 FT_END_HEADER
 
--- 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,7 +206,46 @@
 
   } 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 )
   FT_CMap_New( FT_CMap_Class  clazz,
@@ -765,6 +805,10 @@
   /*                                                                       */
   /*    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_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
 #endif
 
+#ifdef FT_CONFIG_OPTION_PIC
+    FT_PIC_Container   pic_container;
+#endif
+
   } FT_LibraryRec;
 
 
@@ -865,6 +913,484 @@
 #ifndef FT_NO_DEFAULT_RASTER
   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
--- /dev/null
+++ b/include/freetype/internal/ftpic.h
@@ -1,0 +1,67 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftpic.h                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services (declaration).       */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /*  Modules that ordinarily have const global data that need address     */
+  /*  can instead define pointers here.                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+
+#ifndef __FTPIC_H__
+#define __FTPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  typedef struct FT_PIC_Container_
+  {
+    /* pic containers for base */
+    void* base;
+    /* pic containers for modules */
+    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. */
+  FT_BASE( FT_Error )
+  ft_pic_container_init( FT_Library library );
+
+
+  /* Destroy the contents of the container. */
+  FT_BASE( void )
+  ft_pic_container_destroy( FT_Library library );
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FTPIC_H__ */
+
+
+/* END */
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -163,6 +163,298 @@
 
   typedef const FT_ServiceDescRec*  FT_ServiceDesc;
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an array of FT_ServiceDescRec structs.          */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
+  /*    to called with a pointer where the allocated array is returned.    */
+  /*    And when it is no longer needed a Destroy function needs           */
+  /*    to be called to release that allocation.                           */
+  /*                                                                       */
+  /*    These functions should be manyally called from the pic_init and    */
+  /*    pic_free functions of your module (see FT_DEFINE_MODULE)           */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the array will be         */
+  /*    allocated in the global scope (or the scope where the macro        */
+  /*    is used).                                                          */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5)                      \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {serv_id_5, serv_data_5},                                                  \
+  {NULL, NULL}                                                               \
+  };
+#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
+        serv_id_6, serv_data_6)                                              \
+  static const FT_ServiceDescRec class_[] =                                  \
+  {                                                                          \
+  {serv_id_1, serv_data_1},                                                  \
+  {serv_id_2, serv_data_2},                                                  \
+  {serv_id_3, serv_data_3},                                                  \
+  {serv_id_4, serv_data_4},                                                  \
+  {serv_id_5, serv_data_5},                                                  \
+  {serv_id_6, serv_data_6},                                                  \
+  {NULL, NULL}                                                               \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */ 
+
+#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = NULL;                                                 \
+    clazz[1].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = NULL;                                                 \
+    clazz[2].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = NULL;                                                 \
+    clazz[3].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = NULL;                                                 \
+    clazz[4].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4,           \
+        serv_data_4, serv_id_5, serv_data_5)                                 \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = serv_id_5;                                            \
+    clazz[4].serv_data = serv_data_5;                                        \
+    clazz[5].serv_id = NULL;                                                 \
+    clazz[5].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+
+#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
+        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
+        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
+        serv_id_6, serv_data_6)                                              \
+  void                                                                       \
+  FT_Destroy_Class_##class_( FT_Library library,                             \
+                             FT_ServiceDescRec* clazz )                      \
+  {                                                                          \
+    FT_Memory memory = library->memory;                                      \
+    if ( clazz )                                                             \
+      FT_FREE( clazz );                                                      \
+  }                                                                          \
+                                                                             \
+  FT_Error                                                                   \
+  FT_Create_Class_##class_( FT_Library library,                              \
+                            FT_ServiceDescRec** output_class)                \
+  {                                                                          \
+    FT_ServiceDescRec*  clazz;                                               \
+    FT_Error          error;                                                 \
+    FT_Memory memory = library->memory;                                      \
+                                                                             \
+    if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) )                               \
+      return error;                                                          \
+    clazz[0].serv_id = serv_id_1;                                            \
+    clazz[0].serv_data = serv_data_1;                                        \
+    clazz[1].serv_id = serv_id_2;                                            \
+    clazz[1].serv_data = serv_data_2;                                        \
+    clazz[2].serv_id = serv_id_3;                                            \
+    clazz[2].serv_data = serv_data_3;                                        \
+    clazz[3].serv_id = serv_id_4;                                            \
+    clazz[3].serv_data = serv_data_4;                                        \
+    clazz[4].serv_id = serv_id_5;                                            \
+    clazz[4].serv_data = serv_data_5;                                        \
+    clazz[5].serv_id = serv_id_6;                                            \
+    clazz[5].serv_data = serv_data_6;                                        \
+    clazz[6].serv_id = NULL;                                                 \
+    clazz[6].serv_data = NULL;                                               \
+    *output_class = clazz;                                                   \
+    return FT_Err_Ok;                                                        \
+  } 
+#endif /* FT_CONFIG_OPTION_PIC */ 
 
   /*
    *  Parse a list of FT_ServiceDescRec descriptors and look for
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -25,6 +25,7 @@
 
 
 #define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>
+#define FT_INTERNAL_PIC_H                 <freetype/internal/ftpic.h>
 #define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>
 #define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>
 #define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -20,6 +20,7 @@
     _sources = ftadvanc ftcalc   ftdbgmem ftgloadr
                ftobjs   ftoutln  ftrfork  ftsnames
                ftstream fttrigon ftutil
+               basepic  ftpic
                ;
   }
   else
--- /dev/null
+++ b/src/base/basepic.c
@@ -1,0 +1,83 @@
+/***************************************************************************/
+/*                                                                         */
+/*  basepic.c                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for base.            */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "basepic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* forward declaration of PIC init functions from ftglyph.c */
+  void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*);
+  void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*);
+
+  /* forward declaration of PIC init functions from ftinit.c */
+  FT_Error ft_create_default_module_classes(FT_Library);
+  void ft_destroy_default_module_classes(FT_Library);
+
+  void
+  ft_base_pic_free( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Memory    memory = library->memory;
+    if ( pic_container->base )
+    {
+      /* Destroy default module classes (in case FT_Add_Default_Modules was used) */
+      ft_destroy_default_module_classes( library );
+
+      FT_FREE( pic_container->base );
+      pic_container->base = NULL;
+    }
+  }
+
+
+  FT_Error
+  ft_base_pic_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error        error = FT_Err_Ok;
+    BasePIC*     container;
+    FT_Memory    memory = library->memory;
+
+    /* allocate pointer, clear and set global container pointer */
+    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+      return error;
+    FT_MEM_SET( container, 0, sizeof(*container) );
+    pic_container->base = container;
+
+    /* initialize default modules list and pointers */
+    error = ft_create_default_module_classes( library );
+    if ( error )
+      goto Exit;
+
+    /* initialize pointer table - this is how the module usually expects this data */
+    FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class);
+    FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class);
+
+Exit:
+    if(error)
+      ft_base_pic_free(library);
+    return error;
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
--- /dev/null
+++ b/src/base/basepic.h
@@ -1,0 +1,62 @@
+/***************************************************************************/
+/*                                                                         */
+/*  basepic.h                                                              */
+/*                                                                         */
+/*    The FreeType position independent code services for base.            */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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 __BASEPIC_H__
+#define __BASEPIC_H__
+
+  
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class
+#define FT_BITMAP_GLYPH_CLASS_GET  &ft_bitmap_glyph_class
+#define FT_DEFAULT_MODULES_GET     ft_default_modules
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_GLYPH_H
+
+  typedef struct BasePIC_
+  {
+    FT_Module_Class** default_module_classes;
+    FT_Glyph_Class ft_outline_glyph_class;
+    FT_Glyph_Class ft_bitmap_glyph_class;
+  } BasePIC;
+
+#define GET_PIC(lib)                  ((BasePIC*)((lib)->pic_container.base))
+#define FT_OUTLINE_GLYPH_CLASS_GET    (&GET_PIC(library)->ft_outline_glyph_class)
+#define FT_BITMAP_GLYPH_CLASS_GET     (&GET_PIC(library)->ft_bitmap_glyph_class)
+#define FT_DEFAULT_MODULES_GET        (GET_PIC(library)->default_module_classes)
+
+  void
+  ft_base_pic_free( FT_Library library );
+
+  FT_Error
+  ft_base_pic_init( FT_Library library );
+
+#endif /* FT_CONFIG_OPTION_PIC */
+ /* */
+
+FT_END_HEADER
+
+#endif /* __BASEPIC_H__ */
+
+
+/* END */
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -20,6 +20,8 @@
 
 #define  FT_MAKE_OPTION_SINGLE_OBJECT
 
+#include "ftpic.c"
+#include "basepic.c"
 #include "ftadvanc.c"
 #include "ftcalc.c"
 #include "ftdbgmem.c"
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -29,6 +29,7 @@
 #include FT_IMAGE_H
 #include FT_OUTLINE_H
 #include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_OBJECTS_H
 
 
   typedef struct  TBBox_Rec_
@@ -559,6 +560,13 @@
     return 0;
   }
 
+FT_DEFINE_OUTLINE_FUNCS(bbox_interface,
+    (FT_Outline_MoveTo_Func) BBox_Move_To,
+    (FT_Outline_LineTo_Func) BBox_Move_To,
+    (FT_Outline_ConicTo_Func)BBox_Conic_To,
+    (FT_Outline_CubicTo_Func)BBox_Cubic_To,
+    0, 0
+  )
 
   /* documentation is in ftbbox.h */
 
@@ -628,18 +636,13 @@
       /* the two boxes are different, now walk over the outline to */
       /* get the Bezier arc extrema.                               */
 
-      static const FT_Outline_Funcs  bbox_interface =
-      {
-        (FT_Outline_MoveTo_Func) BBox_Move_To,
-        (FT_Outline_LineTo_Func) BBox_Move_To,
-        (FT_Outline_ConicTo_Func)BBox_Conic_To,
-        (FT_Outline_CubicTo_Func)BBox_Cubic_To,
-        0, 0
-      };
-
       FT_Error   error;
       TBBox_Rec  user;
 
+#ifdef FT_CONFIG_OPTION_PIC
+      FT_Outline_Funcs bbox_interface;
+      Init_Class_bbox_interface(&bbox_interface);
+#endif
 
       user.bbox = bbox;
 
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -34,6 +34,7 @@
 #include FT_BITMAP_H
 #include FT_INTERNAL_OBJECTS_H
 
+#include "basepic.h"
 
   /*************************************************************************/
   /*                                                                       */
@@ -129,9 +130,7 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Glyph_Class  ft_bitmap_glyph_class =
-  {
+  FT_DEFINE_GLYPH(ft_bitmap_glyph_class,
     sizeof ( FT_BitmapGlyphRec ),
     FT_GLYPH_FORMAT_BITMAP,
 
@@ -141,7 +140,7 @@
     0,                          /* FT_Glyph_TransformFunc */
     ft_bitmap_glyph_bbox,
     0                           /* FT_Glyph_PrepareFunc   */
-  };
+  )
 
 
   /*************************************************************************/
@@ -255,9 +254,7 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Glyph_Class  ft_outline_glyph_class =
-  {
+  FT_DEFINE_GLYPH( ft_outline_glyph_class, 
     sizeof ( FT_OutlineGlyphRec ),
     FT_GLYPH_FORMAT_OUTLINE,
 
@@ -267,7 +264,7 @@
     ft_outline_glyph_transform,
     ft_outline_glyph_bbox,
     ft_outline_glyph_prepare
-  };
+  )
 
 
   /*************************************************************************/
@@ -373,11 +370,11 @@
 
     /* if it is a bitmap, that's easy :-) */
     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
-      clazz = &ft_bitmap_glyph_class;
+      clazz = FT_BITMAP_GLYPH_CLASS_GET;
 
     /* it it is an outline too */
     else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
-      clazz = &ft_outline_glyph_class;
+      clazz = FT_OUTLINE_GLYPH_CLASS_GET;
 
     else
     {
@@ -510,6 +507,7 @@
                       FT_Vector*      origin,
                       FT_Bool         destroy )
   {
+    FT_Library                library;
     FT_GlyphSlotRec           dummy;
     FT_GlyphSlot_InternalRec  dummy_internal;
     FT_Error                  error = FT_Err_Ok;
@@ -530,10 +528,11 @@
     if ( !glyph )
       goto Bad;
 
+    library = glyph->library;
     clazz = glyph->clazz;
 
     /* when called with a bitmap glyph, do nothing and return successfully */
-    if ( clazz == &ft_bitmap_glyph_class )
+    if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
       goto Exit;
 
     if ( !clazz || !clazz->glyph_prepare )
@@ -546,7 +545,7 @@
     dummy.format   = clazz->glyph_format;
 
     /* create result bitmap glyph */
-    error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
+    error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET,
                           (FT_Glyph*)(void*)&bitmap );
     if ( error )
       goto Exit;
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -42,6 +42,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_MODULE_H
+#include "basepic.h"
 
 
   /*************************************************************************/
@@ -53,6 +54,8 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_init
 
+#ifndef FT_CONFIG_OPTION_PIC
+
 #undef  FT_USE_MODULE
 #ifdef __cplusplus
 #define FT_USE_MODULE( type, x )  extern "C" const type  x;
@@ -74,7 +77,100 @@
     0
   };
 
+#else /* FT_CONFIG_OPTION_PIC */
 
+#ifdef __cplusplus
+#define FT_EXTERNC  extern "C"
+#else
+#define FT_EXTERNC  extern
+#endif
+
+  /* declare the module's class creation/destruction functions */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  \
+  FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \
+  FT_EXTERNC void     FT_Destroy_Class_##x( FT_Library library, FT_Module_Class*  clazz );
+
+#include FT_CONFIG_MODULES_H
+
+
+  /* count all module classes */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  MODULE_CLASS_##x,
+
+  enum {
+#include FT_CONFIG_MODULES_H
+    FT_NUM_MODULE_CLASSES
+  };
+
+  /* destroy all module classes */  
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )  \
+  if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \
+  i++;                                                             \
+
+  FT_BASE_DEF( void )
+  ft_destroy_default_module_classes( FT_Library  library )
+  {
+    FT_Module_Class** classes;
+    FT_Memory         memory;
+    FT_UInt           i;
+    BasePIC*          pic_container = library->pic_container.base;
+
+    if ( !pic_container->default_module_classes )
+      return;
+
+    memory = library->memory;
+    classes = pic_container->default_module_classes;
+    i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+    FT_FREE( classes );
+    pic_container->default_module_classes = 0;
+  }
+
+  /* initialize all module classes and the pointer table */
+#undef  FT_USE_MODULE
+#define FT_USE_MODULE( type, x )                \
+  error = FT_Create_Class_##x(library, &clazz); \
+  if (error) goto Exit;                         \
+  classes[i++] = clazz;
+
+  FT_BASE_DEF( FT_Error )
+  ft_create_default_module_classes( FT_Library  library )
+  {
+    FT_Error          error;
+    FT_Memory         memory;
+    FT_Module_Class** classes;
+    FT_Module_Class*  clazz;
+    FT_UInt           i;
+    BasePIC*          pic_container = library->pic_container.base;
+
+    memory = library->memory;  
+    pic_container->default_module_classes = 0;
+
+    if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) )
+      return error;
+    /* initialize all pointers to 0, especially the last one */
+    for (i = 0; i < FT_NUM_MODULE_CLASSES; i++)
+      classes[i] = 0;
+    classes[FT_NUM_MODULE_CLASSES] = 0;
+
+    i = 0;
+
+#include FT_CONFIG_MODULES_H
+
+Exit:    
+    if (error) ft_destroy_default_module_classes( library );
+    else pic_container->default_module_classes = classes;
+
+    return error;    
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
   /* documentation is in ftmodapi.h */
 
   FT_EXPORT_DEF( void )
@@ -86,7 +182,7 @@
 
     /* test for valid `library' delayed to FT_Add_Module() */
 
-    cur = ft_default_modules;
+    cur = FT_DEFAULT_MODULES_GET;
     while ( *cur )
     {
       error = FT_Add_Module( library, *cur );
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4123,6 +4123,13 @@
 
     library->memory = memory;
 
+#ifdef FT_CONFIG_OPTION_PIC
+    /* initialize position independent code containers */
+    error = ft_pic_container_init( library );
+    if ( error )
+      goto Fail;
+#endif
+
     /* allocate the render pool */
     library->raster_pool_size = FT_RENDER_POOL_SIZE;
 #if FT_RENDER_POOL_SIZE > 0
@@ -4136,6 +4143,9 @@
     return FT_Err_Ok;
 
   Fail:
+#ifdef FT_CONFIG_OPTION_PIC
+    ft_pic_container_destroy( library );
+#endif
     FT_FREE( library );
     return error;
   }
@@ -4251,6 +4261,11 @@
     /* Destroy raster objects */
     FT_FREE( library->raster_pool );
     library->raster_pool_size = 0;
+
+#ifdef FT_CONFIG_OPTION_PIC
+    /* Destroy pic container contents */
+    ft_pic_container_destroy( library );
+#endif
 
     FT_FREE( library );
     return FT_Err_Ok;
--- /dev/null
+++ b/src/base/ftpic.c
@@ -1,0 +1,54 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftpic.c                                                                */
+/*                                                                         */
+/*    The FreeType position independent code services (body).              */
+/*                                                                         */
+/*  Copyright 2009 by                                                      */
+/*  Oran Agra and Mickey Gabel.                                            */
+/*                                                                         */
+/*  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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "basepic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+  /* documentation is in ftpic.h */
+
+  FT_BASE_DEF( FT_Error )
+  ft_pic_container_init( FT_Library library )
+  {
+    FT_PIC_Container* pic_container = &library->pic_container;
+    FT_Error error = FT_Err_Ok;
+
+    FT_MEM_SET( pic_container, 0, sizeof(*pic_container) );
+
+    error = ft_base_pic_init( library );
+    if(error)
+      return error;
+
+    return FT_Err_Ok;
+  }
+
+
+  /* Destroy the contents of the container. */
+  FT_BASE_DEF( void )
+  ft_pic_container_destroy( FT_Library library )
+  {
+    ft_base_pic_free( library );
+  }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -1844,8 +1844,13 @@
     return FT_Err_Invalid_Outline;
   }
 
-
+/* declare an extern to access ft_outline_glyph_class global allocated 
+   in ftglyph.c, and use the FT_OUTLINE_GLYPH_CLASS_GET macro to access 
+   it when FT_CONFIG_OPTION_PIC is defined */
+#ifndef FT_CONFIG_OPTION_PIC
   extern const FT_Glyph_Class  ft_outline_glyph_class;
+#endif
+#include "basepic.h"
 
 
   /* documentation is in ftstroke.h */
@@ -1857,13 +1862,14 @@
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
+    FT_Library library = stroker->library;
+    FT_UNUSED(library);
 
-
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
-    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
       goto Exit;
 
     {
@@ -1930,13 +1936,14 @@
   {
     FT_Error  error = FT_Err_Invalid_Argument;
     FT_Glyph  glyph = NULL;
+    FT_Library library = stroker->library;
+    FT_UNUSED(library);
 
-
     if ( pglyph == NULL )
       goto Exit;
 
     glyph = *pglyph;
-    if ( glyph == NULL || glyph->clazz != &ft_outline_glyph_class )
+    if ( glyph == NULL || glyph->clazz != FT_OUTLINE_GLYPH_CLASS_GET )
       goto Exit;
 
     {