cffpic.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  cffpic.c                                                               */
00004 /*                                                                         */
00005 /*    The FreeType position independent code services for cff module.      */
00006 /*                                                                         */
00007 /*  Copyright 2009 by                                                      */
00008 /*  Oran Agra and Mickey Gabel.                                            */
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_FREETYPE_H
00021 #include FT_INTERNAL_OBJECTS_H
00022 #include "cffpic.h"
00023 
00024 #ifdef FT_CONFIG_OPTION_PIC
00025 
00026   /* forward declaration of PIC init functions from cffdrivr.c */
00027   FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**);
00028   void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*);
00029   void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*);
00030   void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
00031   void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
00032   void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
00033   void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
00034 
00035   /* forward declaration of PIC init functions from cffparse.c */
00036   FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
00037   void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
00038 
00039   /* forward declaration of PIC init functions from cffcmap.c */
00040   void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
00041   void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
00042 
00043   void
00044   cff_driver_class_pic_free(  FT_Library library )
00045   {
00046     FT_PIC_Container* pic_container = &library->pic_container;
00047     FT_Memory memory = library->memory;
00048     if ( pic_container->cff )
00049     {
00050       CffModulePIC* container = (CffModulePIC*)pic_container->cff;
00051       if(container->cff_services)
00052         FT_Destroy_Class_cff_services(library, container->cff_services);
00053       container->cff_services = NULL;
00054       if(container->cff_field_handlers)
00055         FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers);
00056       container->cff_field_handlers = NULL;
00057       FT_FREE( container );
00058       pic_container->cff = NULL;
00059     }
00060   }
00061 
00062   FT_Error
00063   cff_driver_class_pic_init(  FT_Library library )
00064   {
00065     FT_PIC_Container* pic_container = &library->pic_container;
00066     FT_Error        error = FT_Err_Ok;
00067     CffModulePIC* container;
00068     FT_Memory memory = library->memory;
00069 
00070     /* allocate pointer, clear and set global container pointer */
00071     if ( FT_ALLOC ( container, sizeof ( *container ) ) )
00072       return error;
00073     FT_MEM_SET( container, 0, sizeof(*container) );
00074     pic_container->cff = container;
00075 
00076     /* initialize pointer table - this is how the module usually expects this data */
00077     error = FT_Create_Class_cff_services(library, &container->cff_services);
00078     if(error) 
00079       goto Exit;
00080     error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers);
00081     if(error) 
00082       goto Exit;
00083     FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info);
00084     FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict);
00085     FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name);
00086     FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info);
00087     FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info);
00088     FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec);
00089     FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec);
00090 Exit:
00091     if(error)
00092       cff_driver_class_pic_free(library);
00093     return error;
00094   }
00095 
00096 #endif /* FT_CONFIG_OPTION_PIC */
00097 
00098 
00099 /* END */

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