pshmod.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  pshmod.c                                                               */
00004 /*                                                                         */
00005 /*    FreeType PostScript hinter module implementation (body).             */
00006 /*                                                                         */
00007 /*  Copyright 2001, 2002, 2007 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 #include <ft2build.h>
00020 #include FT_INTERNAL_OBJECTS_H
00021 #include "pshrec.h"
00022 #include "pshalgo.h"
00023 #include "pshpic.h"
00024 
00025 
00026   /* the Postscript Hinter module structure */
00027   typedef struct  PS_Hinter_Module_Rec_
00028   {
00029     FT_ModuleRec          root;
00030     PS_HintsRec           ps_hints;
00031 
00032     PSH_Globals_FuncsRec  globals_funcs;
00033     T1_Hints_FuncsRec     t1_funcs;
00034     T2_Hints_FuncsRec     t2_funcs;
00035 
00036   } PS_Hinter_ModuleRec, *PS_Hinter_Module;
00037 
00038 
00039   /* finalize module */
00040   FT_CALLBACK_DEF( void )
00041   ps_hinter_done( PS_Hinter_Module  module )
00042   {
00043     module->t1_funcs.hints = NULL;
00044     module->t2_funcs.hints = NULL;
00045 
00046     ps_hints_done( &module->ps_hints );
00047   }
00048 
00049 
00050   /* initialize module, create hints recorder and the interface */
00051   FT_CALLBACK_DEF( FT_Error )
00052   ps_hinter_init( PS_Hinter_Module  module )
00053   {
00054     FT_Memory  memory = module->root.memory;
00055     void*      ph     = &module->ps_hints;
00056 
00057 
00058     ps_hints_init( &module->ps_hints, memory );
00059 
00060     psh_globals_funcs_init( &module->globals_funcs );
00061 
00062     t1_hints_funcs_init( &module->t1_funcs );
00063     module->t1_funcs.hints = (T1_Hints)ph;
00064 
00065     t2_hints_funcs_init( &module->t2_funcs );
00066     module->t2_funcs.hints = (T2_Hints)ph;
00067 
00068     return 0;
00069   }
00070 
00071 
00072   /* returns global hints interface */
00073   FT_CALLBACK_DEF( PSH_Globals_Funcs )
00074   pshinter_get_globals_funcs( FT_Module  module )
00075   {
00076     return &((PS_Hinter_Module)module)->globals_funcs;
00077   }
00078 
00079 
00080   /* return Type 1 hints interface */
00081   FT_CALLBACK_DEF( T1_Hints_Funcs )
00082   pshinter_get_t1_funcs( FT_Module  module )
00083   {
00084     return &((PS_Hinter_Module)module)->t1_funcs;
00085   }
00086 
00087 
00088   /* return Type 2 hints interface */
00089   FT_CALLBACK_DEF( T2_Hints_Funcs )
00090   pshinter_get_t2_funcs( FT_Module  module )
00091   {
00092     return &((PS_Hinter_Module)module)->t2_funcs;
00093   }
00094 
00095 
00096   FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface,
00097     pshinter_get_globals_funcs,
00098     pshinter_get_t1_funcs,
00099     pshinter_get_t2_funcs
00100   )
00101 
00102 
00103   FT_DEFINE_MODULE(pshinter_module_class,
00104 
00105     0,
00106     sizeof ( PS_Hinter_ModuleRec ),
00107     "pshinter",
00108     0x10000L,
00109     0x20000L,
00110 
00111     &FTPSHINTER_INTERFACE_GET,            /* module-specific interface */
00112 
00113     (FT_Module_Constructor)ps_hinter_init,
00114     (FT_Module_Destructor) ps_hinter_done,
00115     (FT_Module_Requester)  0        /* no additional interface for now */
00116   )
00117 
00118 /* END */

Generated on Tue Jul 5 14:13:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1