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

ftdriver.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftdriver.h                                                             */
00004 /*                                                                         */
00005 /*    FreeType font driver interface (specification).                      */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2003, 2006, 2008 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 #ifndef __FTDRIVER_H__
00020 #define __FTDRIVER_H__
00021 
00022 
00023 #include <ft2build.h>
00024 #include FT_MODULE_H
00025 
00026 
00027 FT_BEGIN_HEADER
00028 
00029 
00030   typedef FT_Error
00031   (*FT_Face_InitFunc)( FT_Stream      stream,
00032                        FT_Face        face,
00033                        FT_Int         typeface_index,
00034                        FT_Int         num_params,
00035                        FT_Parameter*  parameters );
00036 
00037   typedef void
00038   (*FT_Face_DoneFunc)( FT_Face  face );
00039 
00040 
00041   typedef FT_Error
00042   (*FT_Size_InitFunc)( FT_Size  size );
00043 
00044   typedef void
00045   (*FT_Size_DoneFunc)( FT_Size  size );
00046 
00047 
00048   typedef FT_Error
00049   (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );
00050 
00051   typedef void
00052   (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );
00053 
00054 
00055   typedef FT_Error
00056   (*FT_Size_RequestFunc)( FT_Size          size,
00057                           FT_Size_Request  req );
00058 
00059   typedef FT_Error
00060   (*FT_Size_SelectFunc)( FT_Size   size,
00061                          FT_ULong  size_index );
00062 
00063 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00064 
00065   typedef FT_Error
00066   (*FT_Size_ResetPointsFunc)( FT_Size     size,
00067                               FT_F26Dot6  char_width,
00068                               FT_F26Dot6  char_height,
00069                               FT_UInt     horz_resolution,
00070                               FT_UInt     vert_resolution );
00071 
00072   typedef FT_Error
00073   (*FT_Size_ResetPixelsFunc)( FT_Size  size,
00074                               FT_UInt  pixel_width,
00075                               FT_UInt  pixel_height );
00076 
00077 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
00078 
00079   typedef FT_Error
00080   (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
00081                        FT_Size       size,
00082                        FT_UInt       glyph_index,
00083                        FT_Int32      load_flags );
00084 
00085 
00086   typedef FT_UInt
00087   (*FT_CharMap_CharIndexFunc)( FT_CharMap  charmap,
00088                                FT_Long     charcode );
00089 
00090   typedef FT_Long
00091   (*FT_CharMap_CharNextFunc)( FT_CharMap  charmap,
00092                               FT_Long     charcode );
00093 
00094 
00095   typedef FT_Error
00096   (*FT_Face_GetKerningFunc)( FT_Face     face,
00097                              FT_UInt     left_glyph,
00098                              FT_UInt     right_glyph,
00099                              FT_Vector*  kerning );
00100 
00101 
00102   typedef FT_Error
00103   (*FT_Face_AttachFunc)( FT_Face    face,
00104                          FT_Stream  stream );
00105 
00106 
00107   typedef FT_Error
00108   (*FT_Face_GetAdvancesFunc)( FT_Face    face,
00109                               FT_UInt    first,
00110                               FT_UInt    count,
00111                               FT_Int32   flags,
00112                               FT_Fixed*  advances );
00113 
00114 
00115   /*************************************************************************/
00116   /*                                                                       */
00117   /* <Struct>                                                              */
00118   /*    FT_Driver_ClassRec                                                 */
00119   /*                                                                       */
00120   /* <Description>                                                         */
00121   /*    The font driver class.  This structure mostly contains pointers to */
00122   /*    driver methods.                                                    */
00123   /*                                                                       */
00124   /* <Fields>                                                              */
00125   /*    root             :: The parent module.                             */
00126   /*                                                                       */
00127   /*    face_object_size :: The size of a face object in bytes.            */
00128   /*                                                                       */
00129   /*    size_object_size :: The size of a size object in bytes.            */
00130   /*                                                                       */
00131   /*    slot_object_size :: The size of a glyph object in bytes.           */
00132   /*                                                                       */
00133   /*    init_face        :: The format-specific face constructor.          */
00134   /*                                                                       */
00135   /*    done_face        :: The format-specific face destructor.           */
00136   /*                                                                       */
00137   /*    init_size        :: The format-specific size constructor.          */
00138   /*                                                                       */
00139   /*    done_size        :: The format-specific size destructor.           */
00140   /*                                                                       */
00141   /*    init_slot        :: The format-specific slot constructor.          */
00142   /*                                                                       */
00143   /*    done_slot        :: The format-specific slot destructor.           */
00144   /*                                                                       */
00145   /*                                                                       */
00146   /*    load_glyph       :: A function handle to load a glyph to a slot.   */
00147   /*                        This field is mandatory!                       */
00148   /*                                                                       */
00149   /*    get_kerning      :: A function handle to return the unscaled       */
00150   /*                        kerning for a given pair of glyphs.  Can be    */
00151   /*                        set to 0 if the format doesn't support         */
00152   /*                        kerning.                                       */
00153   /*                                                                       */
00154   /*    attach_file      :: This function handle is used to read           */
00155   /*                        additional data for a face from another        */
00156   /*                        file/stream.  For example, this can be used to */
00157   /*                        add data from AFM or PFM files on a Type 1     */
00158   /*                        face, or a CIDMap on a CID-keyed face.         */
00159   /*                                                                       */
00160   /*    get_advances     :: A function handle used to return advance       */
00161   /*                        widths of `count' glyphs (in font units),      */
00162   /*                        starting at `first'.  The `vertical' flag must */
00163   /*                        be set to get vertical advance heights.  The   */
00164   /*                        `advances' buffer is caller-allocated.         */
00165   /*                        Currently not implemented.  The idea of this   */
00166   /*                        function is to be able to perform              */
00167   /*                        device-independent text layout without loading */
00168   /*                        a single glyph image.                          */
00169   /*                                                                       */
00170   /*    request_size     :: A handle to a function used to request the new */
00171   /*                        character size.  Can be set to 0 if the        */
00172   /*                        scaling done in the base layer suffices.       */
00173   /*                                                                       */
00174   /*    select_size      :: A handle to a function used to select a new    */
00175   /*                        fixed size.  It is used only if                */
00176   /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */
00177   /*                        to 0 if the scaling done in the base layer     */
00178   /*                        suffices.                                      */
00179   /* <Note>                                                                */
00180   /*    Most function pointers, with the exception of `load_glyph', can be */
00181   /*    set to 0 to indicate a default behaviour.                          */
00182   /*                                                                       */
00183   typedef struct  FT_Driver_ClassRec_
00184   {
00185     FT_Module_Class           root;
00186 
00187     FT_Long                   face_object_size;
00188     FT_Long                   size_object_size;
00189     FT_Long                   slot_object_size;
00190 
00191     FT_Face_InitFunc          init_face;
00192     FT_Face_DoneFunc          done_face;
00193 
00194     FT_Size_InitFunc          init_size;
00195     FT_Size_DoneFunc          done_size;
00196 
00197     FT_Slot_InitFunc          init_slot;
00198     FT_Slot_DoneFunc          done_slot;
00199 
00200 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00201 
00202     FT_Size_ResetPointsFunc   set_char_sizes;
00203     FT_Size_ResetPixelsFunc   set_pixel_sizes;
00204 
00205 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
00206 
00207     FT_Slot_LoadFunc          load_glyph;
00208 
00209     FT_Face_GetKerningFunc    get_kerning;
00210     FT_Face_AttachFunc        attach_file;
00211     FT_Face_GetAdvancesFunc   get_advances;
00212 
00213     /* since version 2.2 */
00214     FT_Size_RequestFunc       request_size;
00215     FT_Size_SelectFunc        select_size;
00216 
00217   } FT_Driver_ClassRec, *FT_Driver_Class;
00218 
00219 
00220   /*
00221    *  The following functions are used as stubs for `set_char_sizes' and
00222    *  `set_pixel_sizes'; the code uses `request_size' and `select_size'
00223    *  functions instead.
00224    *
00225    *  Implementation is in `src/base/ftobjs.c'.
00226    */
00227 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00228 
00229   FT_BASE( FT_Error )
00230   ft_stub_set_char_sizes( FT_Size     size,
00231                           FT_F26Dot6  width,
00232                           FT_F26Dot6  height,
00233                           FT_UInt     horz_res,
00234                           FT_UInt     vert_res );
00235 
00236   FT_BASE( FT_Error )
00237   ft_stub_set_pixel_sizes( FT_Size  size,
00238                            FT_UInt  width,
00239                            FT_UInt  height );
00240 
00241 #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
00242 
00243   /*************************************************************************/
00244   /*                                                                       */
00245   /* <Macro>                                                               */
00246   /*    FT_DECLARE_DRIVER                                                  */
00247   /*                                                                       */
00248   /* <Description>                                                         */
00249   /*    Used to create a forward declaration of a                          */
00250   /*    FT_Driver_ClassRec stract instance.                                */
00251   /*                                                                       */
00252   /* <Macro>                                                               */
00253   /*    FT_DEFINE_DRIVER                                                   */
00254   /*                                                                       */
00255   /* <Description>                                                         */
00256   /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */
00257   /*                                                                       */
00258   /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
00259   /*    to called with a pointer where the allocated stracture is returned.*/
00260   /*    And when it is no longer needed a Destroy function needs           */
00261   /*    to be called to release that allocation.                           */
00262   /*    fcinit.c (ft_create_default_module_classes) already contains       */
00263   /*    a mechanism to call these functions for the default modules        */
00264   /*    described in ftmodule.h                                            */
00265   /*                                                                       */
00266   /*    Notice that the created Create and Destroy functions call          */
00267   /*    pic_init and pic_free function to allow you to manually allocate   */
00268   /*    and initialize any additional global data, like module specific    */
00269   /*    interface, and put them in the global pic container defined in     */
00270   /*    ftpic.h. if you don't need them just implement the functions as    */
00271   /*    empty to resolve the link error.                                   */
00272   /*                                                                       */
00273   /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
00274   /*    allocated in the global scope (or the scope where the macro        */
00275   /*    is used).                                                          */
00276   /*                                                                       */
00277 #ifndef FT_CONFIG_OPTION_PIC
00278 
00279 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00280 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
00281   a_, b_,
00282 #else
00283   #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
00284 #endif
00285 
00286 #define FT_DECLARE_DRIVER(class_)    \
00287   FT_CALLBACK_TABLE                  \
00288   const FT_Driver_ClassRec  class_;  
00289 
00290 #define FT_DEFINE_DRIVER(class_,                                             \
00291                          flags_, size_, name_, version_, requires_,          \
00292                          interface_, init_, done_, get_interface_,           \
00293                          face_object_size_, size_object_size_,               \
00294                          slot_object_size_, init_face_, done_face_,          \
00295                          init_size_, done_size_, init_slot_, done_slot_,     \
00296                          old_set_char_sizes_, old_set_pixel_sizes_,          \
00297                          load_glyph_, get_kerning_, attach_file_,            \
00298                          get_advances_, request_size_, select_size_ )        \
00299   FT_CALLBACK_TABLE_DEF                                                      \
00300   const FT_Driver_ClassRec class_ =                                          \
00301   {                                                                          \
00302     FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \
00303                           init_,done_,get_interface_)                        \
00304                                                                              \
00305     face_object_size_,                                                       \
00306     size_object_size_,                                                       \
00307     slot_object_size_,                                                       \
00308                                                                              \
00309     init_face_,                                                              \
00310     done_face_,                                                              \
00311                                                                              \
00312     init_size_,                                                              \
00313     done_size_,                                                              \
00314                                                                              \
00315     init_slot_,                                                              \
00316     done_slot_,                                                              \
00317                                                                              \
00318     FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
00319                                                                              \
00320     load_glyph_,                                                             \
00321                                                                              \
00322     get_kerning_,                                                            \
00323     attach_file_,                                                            \
00324     get_advances_,                                                           \
00325                                                                              \
00326     request_size_,                                                           \
00327     select_size_                                                             \
00328   };
00329 
00330 #else /* FT_CONFIG_OPTION_PIC */ 
00331 
00332 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
00333 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
00334   clazz->set_char_sizes = a_; \
00335   clazz->set_pixel_sizes = b_;
00336 #else
00337   #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_)
00338 #endif
00339 
00340 #define FT_DECLARE_DRIVER(class_)    FT_DECLARE_MODULE(class_)
00341 
00342 #define FT_DEFINE_DRIVER(class_,                                             \
00343                          flags_, size_, name_, version_, requires_,          \
00344                          interface_, init_, done_, get_interface_,           \
00345                          face_object_size_, size_object_size_,               \
00346                          slot_object_size_, init_face_, done_face_,          \
00347                          init_size_, done_size_, init_slot_, done_slot_,     \
00348                          old_set_char_sizes_, old_set_pixel_sizes_,          \
00349                          load_glyph_, get_kerning_, attach_file_,            \
00350                          get_advances_, request_size_, select_size_ )        \
00351   void class_##_pic_free( FT_Library library );                              \
00352   FT_Error class_##_pic_init( FT_Library library );                          \
00353                                                                              \
00354   void                                                                       \
00355   FT_Destroy_Class_##class_( FT_Library        library,                      \
00356                              FT_Module_Class*  clazz )                       \
00357   {                                                                          \
00358     FT_Memory       memory = library->memory;                                \
00359     FT_Driver_Class dclazz = (FT_Driver_Class)clazz;                         \
00360     class_##_pic_free( library );                                            \
00361     if ( dclazz )                                                            \
00362       FT_FREE( dclazz );                                                     \
00363   }                                                                          \
00364                                                                              \
00365   FT_Error                                                                   \
00366   FT_Create_Class_##class_( FT_Library        library,                       \
00367                             FT_Module_Class**  output_class )                \
00368   {                                                                          \
00369     FT_Driver_Class  clazz;                                                  \
00370     FT_Error         error;                                                  \
00371     FT_Memory        memory = library->memory;                               \
00372                                                                              \
00373     if ( FT_ALLOC( clazz, sizeof(*clazz) ) )                                 \
00374       return error;                                                          \
00375                                                                              \
00376     error = class_##_pic_init( library );                                    \
00377     if(error)                                                                \
00378     {                                                                        \
00379       FT_FREE( clazz );                                                      \
00380       return error;                                                          \
00381     }                                                                        \
00382                                                                              \
00383     FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_,  \
00384                           init_,done_,get_interface_)                        \
00385                                                                              \
00386     clazz->face_object_size    = face_object_size_;                          \
00387     clazz->size_object_size    = size_object_size_;                          \
00388     clazz->slot_object_size    = slot_object_size_;                          \
00389                                                                              \
00390     clazz->init_face           = init_face_;                                 \
00391     clazz->done_face           = done_face_;                                 \
00392                                                                              \
00393     clazz->init_size           = init_size_;                                 \
00394     clazz->done_size           = done_size_;                                 \
00395                                                                              \
00396     clazz->init_slot           = init_slot_;                                 \
00397     clazz->done_slot           = done_slot_;                                 \
00398                                                                              \
00399     FT_DEFINE_DRIVERS_OLD_INTERNALS(old_set_char_sizes_, old_set_pixel_sizes_) \
00400                                                                              \
00401     clazz->load_glyph          = load_glyph_;                                \
00402                                                                              \
00403     clazz->get_kerning         = get_kerning_;                               \
00404     clazz->attach_file         = attach_file_;                               \
00405     clazz->get_advances        = get_advances_;                              \
00406                                                                              \
00407     clazz->request_size        = request_size_;                              \
00408     clazz->select_size         = select_size_;                               \
00409                                                                              \
00410     *output_class = (FT_Module_Class*)clazz;                                 \
00411     return FT_Err_Ok;                                                        \
00412   }                
00413 
00414 
00415 #endif /* FT_CONFIG_OPTION_PIC */
00416 
00417 FT_END_HEADER
00418 
00419 #endif /* __FTDRIVER_H__ */
00420 
00421 
00422 /* END */

Generated on Sat May 26 2012 04:32:26 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.