ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ftobjs.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftobjs.h                                                               */
00004 /*                                                                         */
00005 /*    The FreeType private base classes (specification).                   */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by       */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019   /*************************************************************************/
00020   /*                                                                       */
00021   /*  This file contains the definition of all internal FreeType classes.  */
00022   /*                                                                       */
00023   /*************************************************************************/
00024 
00025 
00026 #ifndef __FTOBJS_H__
00027 #define __FTOBJS_H__
00028 
00029 #include <ft2build.h>
00030 #include FT_RENDER_H
00031 #include FT_SIZES_H
00032 #include FT_LCD_FILTER_H
00033 #include FT_INTERNAL_MEMORY_H
00034 #include FT_INTERNAL_GLYPH_LOADER_H
00035 #include FT_INTERNAL_DRIVER_H
00036 #include FT_INTERNAL_AUTOHINT_H
00037 #include FT_INTERNAL_SERVICE_H
00038 #include FT_INTERNAL_PIC_H
00039 
00040 #ifdef FT_CONFIG_OPTION_INCREMENTAL
00041 #include FT_INCREMENTAL_H
00042 #endif
00043 
00044 
00045 FT_BEGIN_HEADER
00046 
00047 
00048   /*************************************************************************/
00049   /*                                                                       */
00050   /* Some generic definitions.                                             */
00051   /*                                                                       */
00052 #ifndef TRUE
00053 #define TRUE  1
00054 #endif
00055 
00056 #ifndef FALSE
00057 #define FALSE  0
00058 #endif
00059 
00060 #ifndef NULL
00061 #define NULL  (void*)0
00062 #endif
00063 
00064 
00065   /*************************************************************************/
00066   /*                                                                       */
00067   /* The min and max functions missing in C.  As usual, be careful not to  */
00068   /* write things like FT_MIN( a++, b++ ) to avoid side effects.           */
00069   /*                                                                       */
00070 #define FT_MIN( a, b )  ( (a) < (b) ? (a) : (b) )
00071 #define FT_MAX( a, b )  ( (a) > (b) ? (a) : (b) )
00072 
00073 #define FT_ABS( a )     ( (a) < 0 ? -(a) : (a) )
00074 
00075 
00076 #define FT_PAD_FLOOR( x, n )  ( (x) & ~((n)-1) )
00077 #define FT_PAD_ROUND( x, n )  FT_PAD_FLOOR( (x) + ((n)/2), n )
00078 #define FT_PAD_CEIL( x, n )   FT_PAD_FLOOR( (x) + ((n)-1), n )
00079 
00080 #define FT_PIX_FLOOR( x )     ( (x) & ~63 )
00081 #define FT_PIX_ROUND( x )     FT_PIX_FLOOR( (x) + 32 )
00082 #define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )
00083 
00084 
00085   /*
00086    *  Return the highest power of 2 that is <= value; this correspond to
00087    *  the highest bit in a given 32-bit value.
00088    */
00089   FT_BASE( FT_UInt32 )
00090   ft_highpow2( FT_UInt32  value );
00091 
00092 
00093   /*
00094    *  character classification functions -- since these are used to parse
00095    *  font files, we must not use those in <ctypes.h> which are
00096    *  locale-dependent
00097    */
00098 #define  ft_isdigit( x )   ( ( (unsigned)(x) - '0' ) < 10U )
00099 
00100 #define  ft_isxdigit( x )  ( ( (unsigned)(x) - '0' ) < 10U || \
00101                              ( (unsigned)(x) - 'a' ) < 6U  || \
00102                              ( (unsigned)(x) - 'A' ) < 6U  )
00103 
00104   /* the next two macros assume ASCII representation */
00105 #define  ft_isupper( x )  ( ( (unsigned)(x) - 'A' ) < 26U )
00106 #define  ft_islower( x )  ( ( (unsigned)(x) - 'a' ) < 26U )
00107 
00108 #define  ft_isalpha( x )  ( ft_isupper( x ) || ft_islower( x ) )
00109 #define  ft_isalnum( x )  ( ft_isdigit( x ) || ft_isalpha( x ) )
00110 
00111 
00112   /*************************************************************************/
00113   /*************************************************************************/
00114   /*************************************************************************/
00115   /****                                                                 ****/
00116   /****                                                                 ****/
00117   /****                       C H A R M A P S                           ****/
00118   /****                                                                 ****/
00119   /****                                                                 ****/
00120   /*************************************************************************/
00121   /*************************************************************************/
00122   /*************************************************************************/
00123 
00124   /* handle to internal charmap object */
00125   typedef struct FT_CMapRec_*              FT_CMap;
00126 
00127   /* handle to charmap class structure */
00128   typedef const struct FT_CMap_ClassRec_*  FT_CMap_Class;
00129 
00130   /* internal charmap object structure */
00131   typedef struct  FT_CMapRec_
00132   {
00133     FT_CharMapRec  charmap;
00134     FT_CMap_Class  clazz;
00135 
00136   } FT_CMapRec;
00137 
00138   /* typecase any pointer to a charmap handle */
00139 #define FT_CMAP( x )              ((FT_CMap)( x ))
00140 
00141   /* obvious macros */
00142 #define FT_CMAP_PLATFORM_ID( x )  FT_CMAP( x )->charmap.platform_id
00143 #define FT_CMAP_ENCODING_ID( x )  FT_CMAP( x )->charmap.encoding_id
00144 #define FT_CMAP_ENCODING( x )     FT_CMAP( x )->charmap.encoding
00145 #define FT_CMAP_FACE( x )         FT_CMAP( x )->charmap.face
00146 
00147 
00148   /* class method definitions */
00149   typedef FT_Error
00150   (*FT_CMap_InitFunc)( FT_CMap     cmap,
00151                        FT_Pointer  init_data );
00152 
00153   typedef void
00154   (*FT_CMap_DoneFunc)( FT_CMap  cmap );
00155 
00156   typedef FT_UInt
00157   (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,
00158                             FT_UInt32  char_code );
00159 
00160   typedef FT_UInt
00161   (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
00162                            FT_UInt32  *achar_code );
00163 
00164   typedef FT_UInt
00165   (*FT_CMap_CharVarIndexFunc)( FT_CMap    cmap,
00166                                FT_CMap    unicode_cmap,
00167                                FT_UInt32  char_code,
00168                                FT_UInt32  variant_selector );
00169 
00170   typedef FT_Bool
00171   (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap    cmap,
00172                                    FT_UInt32  char_code,
00173                                    FT_UInt32  variant_selector );
00174 
00175   typedef FT_UInt32 *
00176   (*FT_CMap_VariantListFunc)( FT_CMap    cmap,
00177                               FT_Memory  mem );
00178 
00179   typedef FT_UInt32 *
00180   (*FT_CMap_CharVariantListFunc)( FT_CMap    cmap,
00181                                   FT_Memory  mem,
00182                                   FT_UInt32  char_code );
00183 
00184   typedef FT_UInt32 *
00185   (*FT_CMap_VariantCharListFunc)( FT_CMap    cmap,
00186                                   FT_Memory  mem,
00187                                   FT_UInt32  variant_selector );
00188 
00189 
00190   typedef struct  FT_CMap_ClassRec_
00191   {
00192     FT_ULong               size;
00193     FT_CMap_InitFunc       init;
00194     FT_CMap_DoneFunc       done;
00195     FT_CMap_CharIndexFunc  char_index;
00196     FT_CMap_CharNextFunc   char_next;
00197 
00198     /* Subsequent entries are special ones for format 14 -- the variant */
00199     /* selector subtable which behaves like no other                    */
00200 
00201     FT_CMap_CharVarIndexFunc      char_var_index;
00202     FT_CMap_CharVarIsDefaultFunc  char_var_default;
00203     FT_CMap_VariantListFunc       variant_list;
00204     FT_CMap_CharVariantListFunc   charvariant_list;
00205     FT_CMap_VariantCharListFunc   variantchar_list;
00206 
00207   } FT_CMap_ClassRec;
00208 
00209 #ifndef FT_CONFIG_OPTION_PIC
00210 
00211 #define FT_DECLARE_CMAP_CLASS(class_) \
00212     FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
00213 
00214 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \
00215         char_next_, char_var_index_, char_var_default_, variant_list_,       \
00216         charvariant_list_, variantchar_list_)                                \
00217   FT_CALLBACK_TABLE_DEF                                                      \
00218   const FT_CMap_ClassRec class_ =                                            \
00219   {                                                                          \
00220     size_, init_, done_, char_index_, char_next_, char_var_index_,           \
00221     char_var_default_, variant_list_, charvariant_list_, variantchar_list_   \
00222   };
00223 #else /* FT_CONFIG_OPTION_PIC */
00224 
00225 #define FT_DECLARE_CMAP_CLASS(class_) \
00226     void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec*  clazz);
00227 
00228 #define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_,       \
00229         char_next_, char_var_index_, char_var_default_, variant_list_,       \
00230         charvariant_list_, variantchar_list_)                                \
00231   void                                                                       \
00232   FT_Init_Class_##class_( FT_Library library,                                \
00233                           FT_CMap_ClassRec*  clazz)                          \
00234   {                                                                          \
00235     FT_UNUSED(library);                                                      \
00236     clazz->size = size_;                                                     \
00237     clazz->init = init_;                                                     \
00238     clazz->done = done_;                                                     \
00239     clazz->char_index = char_index_;                                         \
00240     clazz->char_next = char_next_;                                           \
00241     clazz->char_var_index = char_var_index_;                                 \
00242     clazz->char_var_default = char_var_default_;                             \
00243     clazz->variant_list = variant_list_;                                     \
00244     clazz->charvariant_list = charvariant_list_;                             \
00245     clazz->variantchar_list = variantchar_list_;                             \
00246   } 
00247 #endif /* FT_CONFIG_OPTION_PIC */
00248 
00249   /* create a new charmap and add it to charmap->face */
00250   FT_BASE( FT_Error )
00251   FT_CMap_New( FT_CMap_Class  clazz,
00252                FT_Pointer     init_data,
00253                FT_CharMap     charmap,
00254                FT_CMap       *acmap );
00255 
00256   /* destroy a charmap and remove it from face's list */
00257   FT_BASE( void )
00258   FT_CMap_Done( FT_CMap  cmap );
00259 
00260 
00261   /*************************************************************************/
00262   /*                                                                       */
00263   /* <Struct>                                                              */
00264   /*    FT_Face_InternalRec                                                */
00265   /*                                                                       */
00266   /* <Description>                                                         */
00267   /*    This structure contains the internal fields of each FT_Face        */
00268   /*    object.  These fields may change between different releases of     */
00269   /*    FreeType.                                                          */
00270   /*                                                                       */
00271   /* <Fields>                                                              */
00272   /*    max_points ::                                                      */
00273   /*      The maximal number of points used to store the vectorial outline */
00274   /*      of any glyph in this face.  If this value cannot be known in     */
00275   /*      advance, or if the face isn't scalable, this should be set to 0. */
00276   /*      Only relevant for scalable formats.                              */
00277   /*                                                                       */
00278   /*    max_contours ::                                                    */
00279   /*      The maximal number of contours used to store the vectorial       */
00280   /*      outline of any glyph in this face.  If this value cannot be      */
00281   /*      known in advance, or if the face isn't scalable, this should be  */
00282   /*      set to 0.  Only relevant for scalable formats.                   */
00283   /*                                                                       */
00284   /*    transform_matrix ::                                                */
00285   /*      A 2x2 matrix of 16.16 coefficients used to transform glyph       */
00286   /*      outlines after they are loaded from the font.  Only used by the  */
00287   /*      convenience functions.                                           */
00288   /*                                                                       */
00289   /*    transform_delta ::                                                 */
00290   /*      A translation vector used to transform glyph outlines after they */
00291   /*      are loaded from the font.  Only used by the convenience          */
00292   /*      functions.                                                       */
00293   /*                                                                       */
00294   /*    transform_flags ::                                                 */
00295   /*      Some flags used to classify the transform.  Only used by the     */
00296   /*      convenience functions.                                           */
00297   /*                                                                       */
00298   /*    services ::                                                        */
00299   /*      A cache for frequently used services.  It should be only         */
00300   /*      accessed with the macro `FT_FACE_LOOKUP_SERVICE'.                */
00301   /*                                                                       */
00302   /*    incremental_interface ::                                           */
00303   /*      If non-null, the interface through which glyph data and metrics  */
00304   /*      are loaded incrementally for faces that do not provide all of    */
00305   /*      this data when first opened.  This field exists only if          */
00306   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
00307   /*                                                                       */
00308   /*    ignore_unpatented_hinter ::                                        */
00309   /*      This boolean flag instructs the glyph loader to ignore the       */
00310   /*      native font hinter, if one is found.  This is exclusively used   */
00311   /*      in the case when the unpatented hinter is compiled within the    */
00312   /*      library.                                                         */
00313   /*                                                                       */
00314   /*    refcount ::                                                        */
00315   /*      A counter initialized to~1 at the time an @FT_Face structure is  */
00316   /*      created.  @FT_Reference_Face increments this counter, and        */
00317   /*      @FT_Done_Face only destroys a face if the counter is~1,          */
00318   /*      otherwise it simply decrements it.                               */
00319   /*                                                                       */
00320   typedef struct  FT_Face_InternalRec_
00321   {
00322 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00323     FT_UShort           reserved1;
00324     FT_Short            reserved2;
00325 #endif
00326     FT_Matrix           transform_matrix;
00327     FT_Vector           transform_delta;
00328     FT_Int              transform_flags;
00329 
00330     FT_ServiceCacheRec  services;
00331 
00332 #ifdef FT_CONFIG_OPTION_INCREMENTAL
00333     FT_Incremental_InterfaceRec*  incremental_interface;
00334 #endif
00335 
00336     FT_Bool             ignore_unpatented_hinter;
00337     FT_UInt             refcount;
00338 
00339   } FT_Face_InternalRec;
00340 
00341 
00342   /*************************************************************************/
00343   /*                                                                       */
00344   /* <Struct>                                                              */
00345   /*    FT_Slot_InternalRec                                                */
00346   /*                                                                       */
00347   /* <Description>                                                         */
00348   /*    This structure contains the internal fields of each FT_GlyphSlot   */
00349   /*    object.  These fields may change between different releases of     */
00350   /*    FreeType.                                                          */
00351   /*                                                                       */
00352   /* <Fields>                                                              */
00353   /*    loader            :: The glyph loader object used to load outlines */
00354   /*                         into the glyph slot.                          */
00355   /*                                                                       */
00356   /*    flags             :: Possible values are zero or                   */
00357   /*                         FT_GLYPH_OWN_BITMAP.  The latter indicates    */
00358   /*                         that the FT_GlyphSlot structure owns the      */
00359   /*                         bitmap buffer.                                */
00360   /*                                                                       */
00361   /*    glyph_transformed :: Boolean.  Set to TRUE when the loaded glyph   */
00362   /*                         must be transformed through a specific        */
00363   /*                         font transformation.  This is _not_ the same  */
00364   /*                         as the face transform set through             */
00365   /*                         FT_Set_Transform().                           */
00366   /*                                                                       */
00367   /*    glyph_matrix      :: The 2x2 matrix corresponding to the glyph     */
00368   /*                         transformation, if necessary.                 */
00369   /*                                                                       */
00370   /*    glyph_delta       :: The 2d translation vector corresponding to    */
00371   /*                         the glyph transformation, if necessary.       */
00372   /*                                                                       */
00373   /*    glyph_hints       :: Format-specific glyph hints management.       */
00374   /*                                                                       */
00375 
00376 #define FT_GLYPH_OWN_BITMAP  0x1
00377 
00378   typedef struct  FT_Slot_InternalRec_
00379   {
00380     FT_GlyphLoader  loader;
00381     FT_UInt         flags;
00382     FT_Bool         glyph_transformed;
00383     FT_Matrix       glyph_matrix;
00384     FT_Vector       glyph_delta;
00385     void*           glyph_hints;
00386 
00387   } FT_GlyphSlot_InternalRec;
00388 
00389 
00390 #if 0
00391 
00392   /*************************************************************************/
00393   /*                                                                       */
00394   /* <Struct>                                                              */
00395   /*    FT_Size_InternalRec                                                */
00396   /*                                                                       */
00397   /* <Description>                                                         */
00398   /*    This structure contains the internal fields of each FT_Size        */
00399   /*    object.  Currently, it's empty.                                    */
00400   /*                                                                       */
00401   /*************************************************************************/
00402 
00403   typedef struct  FT_Size_InternalRec_
00404   {
00405     /* empty */
00406 
00407   } FT_Size_InternalRec;
00408 
00409 #endif
00410 
00411 
00412   /*************************************************************************/
00413   /*************************************************************************/
00414   /****                                                                 ****/
00415   /****                                                                 ****/
00416   /****                         M O D U L E S                           ****/
00417   /****                                                                 ****/
00418   /****                                                                 ****/
00419   /*************************************************************************/
00420   /*************************************************************************/
00421   /*************************************************************************/
00422 
00423 
00424   /*************************************************************************/
00425   /*                                                                       */
00426   /* <Struct>                                                              */
00427   /*    FT_ModuleRec                                                       */
00428   /*                                                                       */
00429   /* <Description>                                                         */
00430   /*    A module object instance.                                          */
00431   /*                                                                       */
00432   /* <Fields>                                                              */
00433   /*    clazz   :: A pointer to the module's class.                        */
00434   /*                                                                       */
00435   /*    library :: A handle to the parent library object.                  */
00436   /*                                                                       */
00437   /*    memory  :: A handle to the memory manager.                         */
00438   /*                                                                       */
00439   /*    generic :: A generic structure for user-level extensibility (?).   */
00440   /*                                                                       */
00441   typedef struct  FT_ModuleRec_
00442   {
00443     FT_Module_Class*  clazz;
00444     FT_Library        library;
00445     FT_Memory         memory;
00446     FT_Generic        generic;
00447 
00448   } FT_ModuleRec;
00449 
00450 
00451   /* typecast an object to a FT_Module */
00452 #define FT_MODULE( x )          ((FT_Module)( x ))
00453 #define FT_MODULE_CLASS( x )    FT_MODULE( x )->clazz
00454 #define FT_MODULE_LIBRARY( x )  FT_MODULE( x )->library
00455 #define FT_MODULE_MEMORY( x )   FT_MODULE( x )->memory
00456 
00457 
00458 #define FT_MODULE_IS_DRIVER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00459                                     FT_MODULE_FONT_DRIVER )
00460 
00461 #define FT_MODULE_IS_RENDERER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00462                                       FT_MODULE_RENDERER )
00463 
00464 #define FT_MODULE_IS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00465                                     FT_MODULE_HINTER )
00466 
00467 #define FT_MODULE_IS_STYLER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00468                                     FT_MODULE_STYLER )
00469 
00470 #define FT_DRIVER_IS_SCALABLE( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00471                                       FT_MODULE_DRIVER_SCALABLE )
00472 
00473 #define FT_DRIVER_USES_OUTLINES( x )  !( FT_MODULE_CLASS( x )->module_flags & \
00474                                          FT_MODULE_DRIVER_NO_OUTLINES )
00475 
00476 #define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
00477                                      FT_MODULE_DRIVER_HAS_HINTER )
00478 
00479 
00480   /*************************************************************************/
00481   /*                                                                       */
00482   /* <Function>                                                            */
00483   /*    FT_Get_Module_Interface                                            */
00484   /*                                                                       */
00485   /* <Description>                                                         */
00486   /*    Finds a module and returns its specific interface as a typeless    */
00487   /*    pointer.                                                           */
00488   /*                                                                       */
00489   /* <Input>                                                               */
00490   /*    library     :: A handle to the library object.                     */
00491   /*                                                                       */
00492   /*    module_name :: The module's name (as an ASCII string).             */
00493   /*                                                                       */
00494   /* <Return>                                                              */
00495   /*    A module-specific interface if available, 0 otherwise.             */
00496   /*                                                                       */
00497   /* <Note>                                                                */
00498   /*    You should better be familiar with FreeType internals to know      */
00499   /*    which module to look for, and what its interface is :-)            */
00500   /*                                                                       */
00501   FT_BASE( const void* )
00502   FT_Get_Module_Interface( FT_Library   library,
00503                            const char*  mod_name );
00504 
00505   FT_BASE( FT_Pointer )
00506   ft_module_get_service( FT_Module    module,
00507                          const char*  service_id );
00508 
00509  /* */
00510 
00511 
00512   /*************************************************************************/
00513   /*************************************************************************/
00514   /*************************************************************************/
00515   /****                                                                 ****/
00516   /****                                                                 ****/
00517   /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/
00518   /****                                                                 ****/
00519   /****                                                                 ****/
00520   /*************************************************************************/
00521   /*************************************************************************/
00522   /*************************************************************************/
00523 
00524   /* a few macros used to perform easy typecasts with minimal brain damage */
00525 
00526 #define FT_FACE( x )          ((FT_Face)(x))
00527 #define FT_SIZE( x )          ((FT_Size)(x))
00528 #define FT_SLOT( x )          ((FT_GlyphSlot)(x))
00529 
00530 #define FT_FACE_DRIVER( x )   FT_FACE( x )->driver
00531 #define FT_FACE_LIBRARY( x )  FT_FACE_DRIVER( x )->root.library
00532 #define FT_FACE_MEMORY( x )   FT_FACE( x )->memory
00533 #define FT_FACE_STREAM( x )   FT_FACE( x )->stream
00534 
00535 #define FT_SIZE_FACE( x )     FT_SIZE( x )->face
00536 #define FT_SLOT_FACE( x )     FT_SLOT( x )->face
00537 
00538 #define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
00539 #define FT_FACE_SIZE( x )     FT_FACE( x )->size
00540 
00541 
00542   /*************************************************************************/
00543   /*                                                                       */
00544   /* <Function>                                                            */
00545   /*    FT_New_GlyphSlot                                                   */
00546   /*                                                                       */
00547   /* <Description>                                                         */
00548   /*    It is sometimes useful to have more than one glyph slot for a      */
00549   /*    given face object.  This function is used to create additional     */
00550   /*    slots.  All of them are automatically discarded when the face is   */
00551   /*    destroyed.                                                         */
00552   /*                                                                       */
00553   /* <Input>                                                               */
00554   /*    face  :: A handle to a parent face object.                         */
00555   /*                                                                       */
00556   /* <Output>                                                              */
00557   /*    aslot :: A handle to a new glyph slot object.                      */
00558   /*                                                                       */
00559   /* <Return>                                                              */
00560   /*    FreeType error code.  0 means success.                             */
00561   /*                                                                       */
00562   FT_BASE( FT_Error )
00563   FT_New_GlyphSlot( FT_Face        face,
00564                     FT_GlyphSlot  *aslot );
00565 
00566 
00567   /*************************************************************************/
00568   /*                                                                       */
00569   /* <Function>                                                            */
00570   /*    FT_Done_GlyphSlot                                                  */
00571   /*                                                                       */
00572   /* <Description>                                                         */
00573   /*    Destroys a given glyph slot.  Remember however that all slots are  */
00574   /*    automatically destroyed with its parent.  Using this function is   */
00575   /*    not always mandatory.                                              */
00576   /*                                                                       */
00577   /* <Input>                                                               */
00578   /*    slot :: A handle to a target glyph slot.                           */
00579   /*                                                                       */
00580   FT_BASE( void )
00581   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
00582 
00583  /* */
00584 
00585 #define FT_REQUEST_WIDTH( req )                                            \
00586           ( (req)->horiResolution                                          \
00587               ? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \
00588               : (req)->width )
00589 
00590 #define FT_REQUEST_HEIGHT( req )                                            \
00591           ( (req)->vertResolution                                           \
00592               ? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \
00593               : (req)->height )
00594 
00595 
00596   /* Set the metrics according to a bitmap strike. */
00597   FT_BASE( void )
00598   FT_Select_Metrics( FT_Face   face,
00599                      FT_ULong  strike_index );
00600 
00601 
00602   /* Set the metrics according to a size request. */
00603   FT_BASE( void )
00604   FT_Request_Metrics( FT_Face          face,
00605                       FT_Size_Request  req );
00606 
00607 
00608   /* Match a size request against `available_sizes'. */
00609   FT_BASE( FT_Error )
00610   FT_Match_Size( FT_Face          face,
00611                  FT_Size_Request  req,
00612                  FT_Bool          ignore_width,
00613                  FT_ULong*        size_index );
00614 
00615 
00616   /* Use the horizontal metrics to synthesize the vertical metrics. */
00617   /* If `advance' is zero, it is also synthesized.                  */
00618   FT_BASE( void )
00619   ft_synthesize_vertical_metrics( FT_Glyph_Metrics*  metrics,
00620                                   FT_Pos             advance );
00621 
00622 
00623   /* Free the bitmap of a given glyphslot when needed (i.e., only when it */
00624   /* was allocated with ft_glyphslot_alloc_bitmap).                       */
00625   FT_BASE( void )
00626   ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
00627 
00628 
00629   /* Allocate a new bitmap buffer in a glyph slot. */
00630   FT_BASE( FT_Error )
00631   ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,
00632                              FT_ULong      size );
00633 
00634 
00635   /* Set the bitmap buffer in a glyph slot to a given pointer.  The buffer */
00636   /* will not be freed by a later call to ft_glyphslot_free_bitmap.        */
00637   FT_BASE( void )
00638   ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,
00639                            FT_Byte*      buffer );
00640 
00641 
00642   /*************************************************************************/
00643   /*************************************************************************/
00644   /*************************************************************************/
00645   /****                                                                 ****/
00646   /****                                                                 ****/
00647   /****                        R E N D E R E R S                        ****/
00648   /****                                                                 ****/
00649   /****                                                                 ****/
00650   /*************************************************************************/
00651   /*************************************************************************/
00652   /*************************************************************************/
00653 
00654 
00655 #define FT_RENDERER( x )      ((FT_Renderer)( x ))
00656 #define FT_GLYPH( x )         ((FT_Glyph)( x ))
00657 #define FT_BITMAP_GLYPH( x )  ((FT_BitmapGlyph)( x ))
00658 #define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
00659 
00660 
00661   typedef struct  FT_RendererRec_
00662   {
00663     FT_ModuleRec            root;
00664     FT_Renderer_Class*      clazz;
00665     FT_Glyph_Format         glyph_format;
00666     FT_Glyph_Class          glyph_class;
00667 
00668     FT_Raster               raster;
00669     FT_Raster_Render_Func   raster_render;
00670     FT_Renderer_RenderFunc  render;
00671 
00672   } FT_RendererRec;
00673 
00674 
00675   /*************************************************************************/
00676   /*************************************************************************/
00677   /*************************************************************************/
00678   /****                                                                 ****/
00679   /****                                                                 ****/
00680   /****                    F O N T   D R I V E R S                      ****/
00681   /****                                                                 ****/
00682   /****                                                                 ****/
00683   /*************************************************************************/
00684   /*************************************************************************/
00685   /*************************************************************************/
00686 
00687 
00688   /* typecast a module into a driver easily */
00689 #define FT_DRIVER( x )        ((FT_Driver)(x))
00690 
00691   /* typecast a module as a driver, and get its driver class */
00692 #define FT_DRIVER_CLASS( x )  FT_DRIVER( x )->clazz
00693 
00694 
00695   /*************************************************************************/
00696   /*                                                                       */
00697   /* <Struct>                                                              */
00698   /*    FT_DriverRec                                                       */
00699   /*                                                                       */
00700   /* <Description>                                                         */
00701   /*    The root font driver class.  A font driver is responsible for      */
00702   /*    managing and loading font files of a given format.                 */
00703   /*                                                                       */
00704   /*  <Fields>                                                             */
00705   /*     root         :: Contains the fields of the root module class.     */
00706   /*                                                                       */
00707   /*     clazz        :: A pointer to the font driver's class.  Note that  */
00708   /*                     this is NOT root.clazz.  `class' wasn't used      */
00709   /*                     as it is a reserved word in C++.                  */
00710   /*                                                                       */
00711   /*     faces_list   :: The list of faces currently opened by this        */
00712   /*                     driver.                                           */
00713   /*                                                                       */
00714   /*     extensions   :: A typeless pointer to the driver's extensions     */
00715   /*                     registry, if they are supported through the       */
00716   /*                     configuration macro FT_CONFIG_OPTION_EXTENSIONS.  */
00717   /*                                                                       */
00718   /*     glyph_loader :: The glyph loader for all faces managed by this    */
00719   /*                     driver.  This object isn't defined for unscalable */
00720   /*                     formats.                                          */
00721   /*                                                                       */
00722   typedef struct  FT_DriverRec_
00723   {
00724     FT_ModuleRec     root;
00725     FT_Driver_Class  clazz;
00726 
00727     FT_ListRec       faces_list;
00728     void*            extensions;
00729 
00730     FT_GlyphLoader   glyph_loader;
00731 
00732   } FT_DriverRec;
00733 
00734 
00735   /*************************************************************************/
00736   /*************************************************************************/
00737   /*************************************************************************/
00738   /****                                                                 ****/
00739   /****                                                                 ****/
00740   /****                       L I B R A R I E S                         ****/
00741   /****                                                                 ****/
00742   /****                                                                 ****/
00743   /*************************************************************************/
00744   /*************************************************************************/
00745   /*************************************************************************/
00746 
00747 
00748   /* This hook is used by the TrueType debugger.  It must be set to an */
00749   /* alternate truetype bytecode interpreter function.                 */
00750 #define FT_DEBUG_HOOK_TRUETYPE            0
00751 
00752 
00753   /* Set this debug hook to a non-null pointer to force unpatented hinting */
00754   /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */
00755   /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */
00756   /* during debugging.                                                     */
00757 #define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
00758 
00759 
00760   typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,
00761                                             FT_Render_Mode  render_mode,
00762                                             FT_Library      library );
00763 
00764 
00765   /*************************************************************************/
00766   /*                                                                       */
00767   /* <Struct>                                                              */
00768   /*    FT_LibraryRec                                                      */
00769   /*                                                                       */
00770   /* <Description>                                                         */
00771   /*    The FreeType library class.  This is the root of all FreeType      */
00772   /*    data.  Use FT_New_Library() to create a library object, and        */
00773   /*    FT_Done_Library() to discard it and all child objects.             */
00774   /*                                                                       */
00775   /* <Fields>                                                              */
00776   /*    memory           :: The library's memory object.  Manages memory   */
00777   /*                        allocation.                                    */
00778   /*                                                                       */
00779   /*    generic          :: Client data variable.  Used to extend the      */
00780   /*                        Library class by higher levels and clients.    */
00781   /*                                                                       */
00782   /*    version_major    :: The major version number of the library.       */
00783   /*                                                                       */
00784   /*    version_minor    :: The minor version number of the library.       */
00785   /*                                                                       */
00786   /*    version_patch    :: The current patch level of the library.        */
00787   /*                                                                       */
00788   /*    num_modules      :: The number of modules currently registered     */
00789   /*                        within this library.  This is set to 0 for new */
00790   /*                        libraries.  New modules are added through the  */
00791   /*                        FT_Add_Module() API function.                  */
00792   /*                                                                       */
00793   /*    modules          :: A table used to store handles to the currently */
00794   /*                        registered modules. Note that each font driver */
00795   /*                        contains a list of its opened faces.           */
00796   /*                                                                       */
00797   /*    renderers        :: The list of renderers currently registered     */
00798   /*                        within the library.                            */
00799   /*                                                                       */
00800   /*    cur_renderer     :: The current outline renderer.  This is a       */
00801   /*                        shortcut used to avoid parsing the list on     */
00802   /*                        each call to FT_Outline_Render().  It is a     */
00803   /*                        handle to the current renderer for the         */
00804   /*                        FT_GLYPH_FORMAT_OUTLINE format.                */
00805   /*                                                                       */
00806   /*    auto_hinter      :: XXX                                            */
00807   /*                                                                       */
00808   /*    raster_pool      :: The raster object's render pool.  This can     */
00809   /*                        ideally be changed dynamically at run-time.    */
00810   /*                                                                       */
00811   /*    raster_pool_size :: The size of the render pool in bytes.          */
00812   /*                                                                       */
00813   /*    debug_hooks      :: XXX                                            */
00814   /*                                                                       */
00815   /*    lcd_filter       :: If subpixel rendering is activated, the        */
00816   /*                        selected LCD filter mode.                      */
00817   /*                                                                       */
00818   /*    lcd_extra        :: If subpixel rendering is activated, the number */
00819   /*                        of extra pixels needed for the LCD filter.     */
00820   /*                                                                       */
00821   /*    lcd_weights      :: If subpixel rendering is activated, the LCD    */
00822   /*                        filter weights, if any.                        */
00823   /*                                                                       */
00824   /*    lcd_filter_func  :: If subpixel rendering is activated, the LCD    */
00825   /*                        filtering callback function.                   */
00826   /*                                                                       */
00827   /*    pic_container    :: Contains global structs and tables, instead    */
00828   /*                        of defining them globallly.                    */
00829   /*                                                                       */
00830   /*    refcount         :: A counter initialized to~1 at the time an      */
00831   /*                        @FT_Library structure is created.              */
00832   /*                        @FT_Reference_Library increments this counter, */
00833   /*                        and @FT_Done_Library only destroys a library   */
00834   /*                        if the counter is~1, otherwise it simply       */
00835   /*                        decrements it.                                 */
00836   /*                                                                       */
00837   typedef struct  FT_LibraryRec_
00838   {
00839     FT_Memory          memory;           /* library's memory manager */
00840 
00841     FT_Generic         generic;
00842 
00843     FT_Int             version_major;
00844     FT_Int             version_minor;
00845     FT_Int             version_patch;
00846 
00847     FT_UInt            num_modules;
00848     FT_Module          modules[FT_MAX_MODULES];  /* module objects  */
00849 
00850     FT_ListRec         renderers;        /* list of renderers        */
00851     FT_Renderer        cur_renderer;     /* current outline renderer */
00852     FT_Module          auto_hinter;
00853 
00854     FT_Byte*           raster_pool;      /* scan-line conversion */
00855                                          /* render pool          */
00856     FT_ULong           raster_pool_size; /* size of render pool in bytes */
00857 
00858     FT_DebugHook_Func  debug_hooks[4];
00859 
00860 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
00861     FT_LcdFilter             lcd_filter;
00862     FT_Int                   lcd_extra;        /* number of extra pixels */
00863     FT_Byte                  lcd_weights[7];   /* filter weights, if any */
00864     FT_Bitmap_LcdFilterFunc  lcd_filter_func;  /* filtering callback     */
00865 #endif
00866 
00867 #ifdef FT_CONFIG_OPTION_PIC
00868     FT_PIC_Container   pic_container;
00869 #endif
00870 
00871     FT_UInt            refcount;
00872 
00873   } FT_LibraryRec;
00874 
00875 
00876   FT_BASE( FT_Renderer )
00877   FT_Lookup_Renderer( FT_Library       library,
00878                       FT_Glyph_Format  format,
00879                       FT_ListNode*     node );
00880 
00881   FT_BASE( FT_Error )
00882   FT_Render_Glyph_Internal( FT_Library      library,
00883                             FT_GlyphSlot    slot,
00884                             FT_Render_Mode  render_mode );
00885 
00886   typedef const char*
00887   (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );
00888 
00889   typedef FT_Error
00890   (*FT_Face_GetGlyphNameFunc)( FT_Face     face,
00891                                FT_UInt     glyph_index,
00892                                FT_Pointer  buffer,
00893                                FT_UInt     buffer_max );
00894 
00895   typedef FT_UInt
00896   (*FT_Face_GetGlyphNameIndexFunc)( FT_Face     face,
00897                                     FT_String*  glyph_name );
00898 
00899 
00900 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
00901 
00902   /*************************************************************************/
00903   /*                                                                       */
00904   /* <Function>                                                            */
00905   /*    FT_New_Memory                                                      */
00906   /*                                                                       */
00907   /* <Description>                                                         */
00908   /*    Creates a new memory object.                                       */
00909   /*                                                                       */
00910   /* <Return>                                                              */
00911   /*    A pointer to the new memory object.  0 in case of error.           */
00912   /*                                                                       */
00913   FT_BASE( FT_Memory )
00914   FT_New_Memory( void );
00915 
00916 
00917   /*************************************************************************/
00918   /*                                                                       */
00919   /* <Function>                                                            */
00920   /*    FT_Done_Memory                                                     */
00921   /*                                                                       */
00922   /* <Description>                                                         */
00923   /*    Discards memory manager.                                           */
00924   /*                                                                       */
00925   /* <Input>                                                               */
00926   /*    memory :: A handle to the memory manager.                          */
00927   /*                                                                       */
00928   FT_BASE( void )
00929   FT_Done_Memory( FT_Memory  memory );
00930 
00931 #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
00932 
00933 
00934   /* Define default raster's interface.  The default raster is located in  */
00935   /* `src/base/ftraster.c'.                                                */
00936   /*                                                                       */
00937   /* Client applications can register new rasters through the              */
00938   /* FT_Set_Raster() API.                                                  */
00939 
00940 #ifndef FT_NO_DEFAULT_RASTER
00941   FT_EXPORT_VAR( FT_Raster_Funcs )  ft_default_raster;
00942 #endif
00943 
00944   /*************************************************************************/
00945   /*************************************************************************/
00946   /*************************************************************************/
00947   /****                                                                 ****/
00948   /****                                                                 ****/
00949   /****              PIC-Support Macros for ftimage.h                   ****/
00950   /****                                                                 ****/
00951   /****                                                                 ****/
00952   /*************************************************************************/
00953   /*************************************************************************/
00954   /*************************************************************************/
00955 
00956 
00957   /*************************************************************************/
00958   /*                                                                       */
00959   /* <Macro>                                                               */
00960   /*    FT_DEFINE_OUTLINE_FUNCS                                            */
00961   /*                                                                       */
00962   /* <Description>                                                         */
00963   /*    Used to initialize an instance of FT_Outline_Funcs struct.         */
00964   /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
00965   /*    called with a pre-allocated stracture to be filled.                */
00966   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
00967   /*    allocated in the global scope (or the scope where the macro        */
00968   /*    is used).                                                          */
00969   /*                                                                       */
00970 #ifndef FT_CONFIG_OPTION_PIC
00971 
00972 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \
00973                                 cubic_to_, shift_, delta_)                   \
00974   static const FT_Outline_Funcs class_ =                                     \
00975   {                                                                          \
00976     move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_                 \
00977   };
00978 
00979 #else /* FT_CONFIG_OPTION_PIC */ 
00980 
00981 #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_,       \
00982                                 cubic_to_, shift_, delta_)                   \
00983   static FT_Error                                                            \
00984   Init_Class_##class_( FT_Outline_Funcs*  clazz )                            \
00985   {                                                                          \
00986     clazz->move_to = move_to_;                                               \
00987     clazz->line_to = line_to_;                                               \
00988     clazz->conic_to = conic_to_;                                             \
00989     clazz->cubic_to = cubic_to_;                                             \
00990     clazz->shift = shift_;                                                   \
00991     clazz->delta = delta_;                                                   \
00992     return FT_Err_Ok;                                                        \
00993   } 
00994 
00995 #endif /* FT_CONFIG_OPTION_PIC */ 
00996 
00997   /*************************************************************************/
00998   /*                                                                       */
00999   /* <Macro>                                                               */
01000   /*    FT_DEFINE_RASTER_FUNCS                                             */
01001   /*                                                                       */
01002   /* <Description>                                                         */
01003   /*    Used to initialize an instance of FT_Raster_Funcs struct.          */
01004   /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
01005   /*    called with a pre-allocated stracture to be filled.                */
01006   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
01007   /*    allocated in the global scope (or the scope where the macro        */
01008   /*    is used).                                                          */
01009   /*                                                                       */
01010 #ifndef FT_CONFIG_OPTION_PIC
01011 
01012 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \
01013                                raster_reset_, raster_set_mode_,              \
01014                                raster_render_, raster_done_)                 \
01015   const FT_Raster_Funcs class_ =                                      \
01016   {                                                                          \
01017     glyph_format_, raster_new_, raster_reset_,                               \
01018     raster_set_mode_, raster_render_, raster_done_                           \
01019   };
01020 
01021 #else /* FT_CONFIG_OPTION_PIC */ 
01022 
01023 #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_,           \
01024     raster_reset_, raster_set_mode_, raster_render_, raster_done_)           \
01025   void                                                                       \
01026   FT_Init_Class_##class_( FT_Raster_Funcs*  clazz )                          \
01027   {                                                                          \
01028     clazz->glyph_format = glyph_format_;                                     \
01029     clazz->raster_new = raster_new_;                                         \
01030     clazz->raster_reset = raster_reset_;                                     \
01031     clazz->raster_set_mode = raster_set_mode_;                               \
01032     clazz->raster_render = raster_render_;                                   \
01033     clazz->raster_done = raster_done_;                                       \
01034   } 
01035 
01036 #endif /* FT_CONFIG_OPTION_PIC */ 
01037 
01038   /*************************************************************************/
01039   /*************************************************************************/
01040   /*************************************************************************/
01041   /****                                                                 ****/
01042   /****                                                                 ****/
01043   /****              PIC-Support Macros for ftrender.h                  ****/
01044   /****                                                                 ****/
01045   /****                                                                 ****/
01046   /*************************************************************************/
01047   /*************************************************************************/
01048   /*************************************************************************/
01049 
01050 
01051 
01052   /*************************************************************************/
01053   /*                                                                       */
01054   /* <Macro>                                                               */
01055   /*    FT_DEFINE_GLYPH                                                    */
01056   /*                                                                       */
01057   /* <Description>                                                         */
01058   /*    Used to initialize an instance of FT_Glyph_Class struct.           */
01059   /*    When FT_CONFIG_OPTION_PIC is defined an init funtion will need to  */
01060   /*    called with a pre-allocated stracture to be filled.                */
01061   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
01062   /*    allocated in the global scope (or the scope where the macro        */
01063   /*    is used).                                                          */
01064   /*                                                                       */
01065 #ifndef FT_CONFIG_OPTION_PIC
01066 
01067 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \
01068                         transform_, bbox_, prepare_)                         \
01069   FT_CALLBACK_TABLE_DEF                                                      \
01070   const FT_Glyph_Class class_ =                                              \
01071   {                                                                          \
01072     size_, format_, init_, done_, copy_, transform_, bbox_, prepare_         \
01073   };
01074 
01075 #else /* FT_CONFIG_OPTION_PIC */ 
01076 
01077 #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_,         \
01078                         transform_, bbox_, prepare_)                         \
01079   void                                                                       \
01080   FT_Init_Class_##class_( FT_Glyph_Class*  clazz )                           \
01081   {                                                                          \
01082     clazz->glyph_size = size_;                                               \
01083     clazz->glyph_format = format_;                                           \
01084     clazz->glyph_init = init_;                                               \
01085     clazz->glyph_done = done_;                                               \
01086     clazz->glyph_copy = copy_;                                               \
01087     clazz->glyph_transform = transform_;                                     \
01088     clazz->glyph_bbox = bbox_;                                               \
01089     clazz->glyph_prepare = prepare_;                                         \
01090   } 
01091 
01092 #endif /* FT_CONFIG_OPTION_PIC */ 
01093 
01094   /*************************************************************************/
01095   /*                                                                       */
01096   /* <Macro>                                                               */
01097   /*    FT_DECLARE_RENDERER                                                */
01098   /*                                                                       */
01099   /* <Description>                                                         */
01100   /*    Used to create a forward declaration of a                          */
01101   /*    FT_Renderer_Class stract instance.                                 */
01102   /*                                                                       */
01103   /* <Macro>                                                               */
01104   /*    FT_DEFINE_RENDERER                                                 */
01105   /*                                                                       */
01106   /* <Description>                                                         */
01107   /*    Used to initialize an instance of FT_Renderer_Class struct.        */
01108   /*                                                                       */
01109   /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
01110   /*    to called with a pointer where the allocated stracture is returned.*/
01111   /*    And when it is no longer needed a Destroy function needs           */
01112   /*    to be called to release that allocation.                           */
01113   /*    fcinit.c (ft_create_default_module_classes) already contains       */
01114   /*    a mechanism to call these functions for the default modules        */
01115   /*    described in ftmodule.h                                            */
01116   /*                                                                       */
01117   /*    Notice that the created Create and Destroy functions call          */
01118   /*    pic_init and pic_free function to allow you to manually allocate   */
01119   /*    and initialize any additional global data, like module specific    */
01120   /*    interface, and put them in the global pic container defined in     */
01121   /*    ftpic.h. if you don't need them just implement the functions as    */
01122   /*    empty to resolve the link error.                                   */
01123   /*                                                                       */
01124   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
01125   /*    allocated in the global scope (or the scope where the macro        */
01126   /*    is used).                                                          */
01127   /*                                                                       */
01128 #ifndef FT_CONFIG_OPTION_PIC
01129 
01130 #define FT_DECLARE_RENDERER(class_)                                          \
01131     FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
01132 
01133 #define FT_DEFINE_RENDERER(class_,                                           \
01134                            flags_, size_, name_, version_, requires_,        \
01135                            interface_, init_, done_, get_interface_,         \
01136                            glyph_format_, render_glyph_, transform_glyph_,   \
01137                            get_glyph_cbox_, set_mode_, raster_class_ )       \
01138   FT_CALLBACK_TABLE_DEF                                                      \
01139   const FT_Renderer_Class  class_ =                                          \
01140   {                                                                          \
01141     FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \
01142                           interface_,init_,done_,get_interface_)             \
01143     glyph_format_,                                                           \
01144                                                                              \
01145     render_glyph_,                                                           \
01146     transform_glyph_,                                                        \
01147     get_glyph_cbox_,                                                         \
01148     set_mode_,                                                               \
01149                                                                              \
01150     raster_class_                                                            \
01151   };
01152 
01153 #else /* FT_CONFIG_OPTION_PIC */ 
01154 
01155 #define FT_DECLARE_RENDERER(class_)  FT_DECLARE_MODULE(class_)
01156 
01157 #define FT_DEFINE_RENDERER(class_, \
01158                            flags_, size_, name_, version_, requires_,        \
01159                            interface_, init_, done_, get_interface_,         \
01160                            glyph_format_, render_glyph_, transform_glyph_,   \
01161                            get_glyph_cbox_, set_mode_, raster_class_ )       \
01162   void class_##_pic_free( FT_Library library );                              \
01163   FT_Error class_##_pic_init( FT_Library library );                          \
01164                                                                              \
01165   void                                                                       \
01166   FT_Destroy_Class_##class_( FT_Library        library,                      \
01167                         FT_Module_Class*  clazz )                            \
01168   {                                                                          \
01169     FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz;                   \
01170     FT_Memory         memory = library->memory;                              \
01171     class_##_pic_free( library );                                            \
01172     if ( rclazz )                                                            \
01173       FT_FREE( rclazz );                                                     \
01174   }                                                                          \
01175                                                                              \
01176   FT_Error                                                                   \
01177   FT_Create_Class_##class_( FT_Library         library,                      \
01178                             FT_Module_Class**  output_class )                \
01179   {                                                                          \
01180     FT_Renderer_Class*  clazz;                                               \
01181     FT_Error            error;                                               \
01182     FT_Memory           memory = library->memory;                            \
01183                                                                              \
01184     if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
01185       return error;                                                          \
01186                                                                              \
01187     error = class_##_pic_init( library );                                    \
01188     if(error)                                                                \
01189     {                                                                        \
01190       FT_FREE( clazz );                                                      \
01191       return error;                                                          \
01192     }                                                                        \
01193                                                                              \
01194     FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,             \
01195                           interface_,init_,done_,get_interface_)             \
01196                                                                              \
01197     clazz->glyph_format       = glyph_format_;                               \
01198                                                                              \
01199     clazz->render_glyph       = render_glyph_;                               \
01200     clazz->transform_glyph    = transform_glyph_;                            \
01201     clazz->get_glyph_cbox     = get_glyph_cbox_;                             \
01202     clazz->set_mode           = set_mode_;                                   \
01203                                                                              \
01204     clazz->raster_class       = raster_class_;                               \
01205                                                                              \
01206     *output_class = (FT_Module_Class*)clazz;                                 \
01207     return FT_Err_Ok;                                                        \
01208   } 
01209 
01210 
01211 
01212 #endif /* FT_CONFIG_OPTION_PIC */ 
01213 
01214   /*************************************************************************/
01215   /*************************************************************************/
01216   /*************************************************************************/
01217   /****                                                                 ****/
01218   /****                                                                 ****/
01219   /****              PIC-Support Macros for ftmodapi.h                  ****/
01220   /****                                                                 ****/
01221   /****                                                                 ****/
01222   /*************************************************************************/
01223   /*************************************************************************/
01224   /*************************************************************************/
01225 
01226 
01227 #ifdef FT_CONFIG_OPTION_PIC
01228 
01229   /*************************************************************************/
01230   /*                                                                       */
01231   /* <FuncType>                                                            */
01232   /*    FT_Module_Creator                                                  */
01233   /*                                                                       */
01234   /* <Description>                                                         */
01235   /*    A function used to create (allocate) a new module class object.    */
01236   /*    The object's members are initialized, but the module itself is     */
01237   /*    not.                                                               */
01238   /*                                                                       */
01239   /* <Input>                                                               */
01240   /*    memory       :: A handle to the memory manager.                    */
01241   /*    output_class :: Initialized with the newly allocated class.        */
01242   /*                                                                       */
01243   typedef FT_Error
01244   (*FT_Module_Creator)( FT_Memory          memory,
01245                         FT_Module_Class**  output_class );
01246 
01247   /*************************************************************************/
01248   /*                                                                       */
01249   /* <FuncType>                                                            */
01250   /*    FT_Module_Destroyer                                                */
01251   /*                                                                       */
01252   /* <Description>                                                         */
01253   /*    A function used to destroy (deallocate) a module class object.     */
01254   /*                                                                       */
01255   /* <Input>                                                               */
01256   /*    memory :: A handle to the memory manager.                          */
01257   /*    clazz  :: Module class to destroy.                                 */
01258   /*                                                                       */
01259   typedef void
01260   (*FT_Module_Destroyer)( FT_Memory         memory,
01261                           FT_Module_Class*  clazz );
01262 
01263 #endif
01264 
01265   /*************************************************************************/
01266   /*                                                                       */
01267   /* <Macro>                                                               */
01268   /*    FT_DECLARE_MODULE                                                  */
01269   /*                                                                       */
01270   /* <Description>                                                         */
01271   /*    Used to create a forward declaration of a                          */
01272   /*    FT_Module_Class stract instance.                                   */
01273   /*                                                                       */
01274   /* <Macro>                                                               */
01275   /*    FT_DEFINE_MODULE                                                   */
01276   /*                                                                       */
01277   /* <Description>                                                         */
01278   /*    Used to initialize an instance of FT_Module_Class struct.          */
01279   /*                                                                       */
01280   /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
01281   /*    to called with a pointer where the allocated stracture is returned.*/
01282   /*    And when it is no longer needed a Destroy function needs           */
01283   /*    to be called to release that allocation.                           */
01284   /*    fcinit.c (ft_create_default_module_classes) already contains       */
01285   /*    a mechanism to call these functions for the default modules        */
01286   /*    described in ftmodule.h                                            */
01287   /*                                                                       */
01288   /*    Notice that the created Create and Destroy functions call          */
01289   /*    pic_init and pic_free function to allow you to manually allocate   */
01290   /*    and initialize any additional global data, like module specific    */
01291   /*    interface, and put them in the global pic container defined in     */
01292   /*    ftpic.h. if you don't need them just implement the functions as    */
01293   /*    empty to resolve the link error.                                   */
01294   /*                                                                       */
01295   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
01296   /*    allocated in the global scope (or the scope where the macro        */
01297   /*    is used).                                                          */
01298   /*                                                                       */
01299   /* <Macro>                                                               */
01300   /*    FT_DEFINE_ROOT_MODULE                                              */
01301   /*                                                                       */
01302   /* <Description>                                                         */
01303   /*    Used to initialize an instance of FT_Module_Class struct inside    */
01304   /*    another stract that contains it or in a function that initializes  */
01305   /*    that containing stract                                             */
01306   /*                                                                       */
01307 #ifndef FT_CONFIG_OPTION_PIC
01308 
01309 #define FT_DECLARE_MODULE(class_)                                            \
01310   FT_CALLBACK_TABLE                                                          \
01311   const FT_Module_Class  class_;                                             \
01312 
01313 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \
01314                               interface_, init_, done_, get_interface_)      \
01315   {                                                                          \
01316     flags_,                                                                  \
01317     size_,                                                                   \
01318                                                                              \
01319     name_,                                                                   \
01320     version_,                                                                \
01321     requires_,                                                               \
01322                                                                              \
01323     interface_,                                                              \
01324                                                                              \
01325     init_,                                                                   \
01326     done_,                                                                   \
01327     get_interface_,                                                          \
01328   },
01329 
01330 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \
01331                          interface_, init_, done_, get_interface_)           \
01332   FT_CALLBACK_TABLE_DEF                                                      \
01333   const FT_Module_Class class_ =                                             \
01334   {                                                                          \
01335     flags_,                                                                  \
01336     size_,                                                                   \
01337                                                                              \
01338     name_,                                                                   \
01339     version_,                                                                \
01340     requires_,                                                               \
01341                                                                              \
01342     interface_,                                                              \
01343                                                                              \
01344     init_,                                                                   \
01345     done_,                                                                   \
01346     get_interface_,                                                          \
01347   };
01348 
01349 
01350 #else /* FT_CONFIG_OPTION_PIC */
01351 
01352 #define FT_DECLARE_MODULE(class_)                                            \
01353   FT_Error FT_Create_Class_##class_( FT_Library library,                     \
01354                                      FT_Module_Class** output_class );       \
01355   void     FT_Destroy_Class_##class_( FT_Library library,                    \
01356                                       FT_Module_Class*  clazz );
01357 
01358 #define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_,     \
01359                               interface_, init_, done_, get_interface_)      \
01360     clazz->root.module_flags       = flags_;                                 \
01361     clazz->root.module_size        = size_;                                  \
01362     clazz->root.module_name        = name_;                                  \
01363     clazz->root.module_version     = version_;                               \
01364     clazz->root.module_requires    = requires_;                              \
01365                                                                              \
01366     clazz->root.module_interface   = interface_;                             \
01367                                                                              \
01368     clazz->root.module_init        = init_;                                  \
01369     clazz->root.module_done        = done_;                                  \
01370     clazz->root.get_interface      = get_interface_;               
01371 
01372 #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_,  \
01373                          interface_, init_, done_, get_interface_)           \
01374   void class_##_pic_free( FT_Library library );                              \
01375   FT_Error class_##_pic_init( FT_Library library );                          \
01376                                                                              \
01377   void                                                                       \
01378   FT_Destroy_Class_##class_( FT_Library library,                             \
01379                              FT_Module_Class*  clazz )                       \
01380   {                                                                          \
01381     FT_Memory memory = library->memory;                                      \
01382     class_##_pic_free( library );                                            \
01383     if ( clazz )                                                             \
01384       FT_FREE( clazz );                                                      \
01385   }                                                                          \
01386                                                                              \
01387   FT_Error                                                                   \
01388   FT_Create_Class_##class_( FT_Library library,                              \
01389                             FT_Module_Class**  output_class )                \
01390   {                                                                          \
01391     FT_Memory memory = library->memory;                                      \
01392     FT_Module_Class*  clazz;                                                 \
01393     FT_Error          error;                                                 \
01394                                                                              \
01395     if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
01396       return error;                                                          \
01397     error = class_##_pic_init( library );                                    \
01398     if(error)                                                                \
01399     {                                                                        \
01400       FT_FREE( clazz );                                                      \
01401       return error;                                                          \
01402     }                                                                        \
01403                                                                              \
01404     clazz->module_flags       = flags_;                                      \
01405     clazz->module_size        = size_;                                       \
01406     clazz->module_name        = name_;                                       \
01407     clazz->module_version     = version_;                                    \
01408     clazz->module_requires    = requires_;                                   \
01409                                                                              \
01410     clazz->module_interface   = interface_;                                  \
01411                                                                              \
01412     clazz->module_init        = init_;                                       \
01413     clazz->module_done        = done_;                                       \
01414     clazz->get_interface      = get_interface_;                              \
01415                                                                              \
01416     *output_class = clazz;                                                   \
01417     return FT_Err_Ok;                                                        \
01418   } 
01419 
01420 #endif /* FT_CONFIG_OPTION_PIC */
01421 
01422 
01423 FT_END_HEADER
01424 
01425 #endif /* __FTOBJS_H__ */
01426 
01427 
01428 /* END */

Generated on Sat May 26 2012 04:32:27 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.