basepic.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  basepic.c                                                              */
00004 /*                                                                         */
00005 /*    The FreeType position independent code services for base.            */
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 "basepic.h"
00023 
00024 #ifdef FT_CONFIG_OPTION_PIC
00025 
00026   /* forward declaration of PIC init functions from ftglyph.c */
00027   void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*);
00028   void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*);
00029 
00030   /* forward declaration of PIC init functions from ftinit.c */
00031   FT_Error ft_create_default_module_classes(FT_Library);
00032   void ft_destroy_default_module_classes(FT_Library);
00033 
00034   void
00035   ft_base_pic_free( FT_Library library )
00036   {
00037     FT_PIC_Container* pic_container = &library->pic_container;
00038     FT_Memory    memory = library->memory;
00039     if ( pic_container->base )
00040     {
00041       /* Destroy default module classes (in case FT_Add_Default_Modules was used) */
00042       ft_destroy_default_module_classes( library );
00043 
00044       FT_FREE( pic_container->base );
00045       pic_container->base = NULL;
00046     }
00047   }
00048 
00049 
00050   FT_Error
00051   ft_base_pic_init( FT_Library library )
00052   {
00053     FT_PIC_Container* pic_container = &library->pic_container;
00054     FT_Error        error = FT_Err_Ok;
00055     BasePIC*     container;
00056     FT_Memory    memory = library->memory;
00057 
00058     /* allocate pointer, clear and set global container pointer */
00059     if ( FT_ALLOC ( container, sizeof ( *container ) ) )
00060       return error;
00061     FT_MEM_SET( container, 0, sizeof(*container) );
00062     pic_container->base = container;
00063 
00064     /* initialize default modules list and pointers */
00065     error = ft_create_default_module_classes( library );
00066     if ( error )
00067       goto Exit;
00068 
00069     /* initialize pointer table - this is how the module usually expects this data */
00070     FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class);
00071     FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class);
00072 
00073 Exit:
00074     if(error)
00075       ft_base_pic_free(library);
00076     return error;
00077   }
00078 
00079 
00080 #endif /* FT_CONFIG_OPTION_PIC */
00081 
00082 
00083 /* END */

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