/src/compiler/android-ndk/jni/freetype/src/psnames/pspic.c
C | 77 lines | 44 code | 13 blank | 20 comment | 5 complexity | 1699b1155ecf82b22148bc2dc0c236f0 MD5 | raw file
1/***************************************************************************/ 2/* */ 3/* pspic.c */ 4/* */ 5/* The FreeType position independent code services for psnames module. */ 6/* */ 7/* Copyright 2009 by */ 8/* Oran Agra and Mickey Gabel. */ 9/* */ 10/* This file is part of the FreeType project, and may only be used, */ 11/* modified, and distributed under the terms of the FreeType project */ 12/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13/* this file you indicate that you have read the license and */ 14/* understand and accept it fully. */ 15/* */ 16/***************************************************************************/ 17 18 19#include <ft2build.h> 20#include FT_FREETYPE_H 21#include FT_INTERNAL_OBJECTS_H 22#include "pspic.h" 23 24#ifdef FT_CONFIG_OPTION_PIC 25 26 /* forward declaration of PIC init functions from psmodule.c */ 27 FT_Error FT_Create_Class_pscmaps_services( FT_Library, FT_ServiceDescRec**); 28 void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec*); 29 void FT_Init_Class_pscmaps_interface( FT_Library, FT_Service_PsCMapsRec*); 30 31 void 32 psnames_module_class_pic_free( FT_Library library ) 33 { 34 FT_PIC_Container* pic_container = &library->pic_container; 35 FT_Memory memory = library->memory; 36 if ( pic_container->psnames ) 37 { 38 PSModulePIC* container = (PSModulePIC*)pic_container->psnames; 39 if(container->pscmaps_services) 40 FT_Destroy_Class_pscmaps_services(library, container->pscmaps_services); 41 container->pscmaps_services = NULL; 42 FT_FREE( container ); 43 pic_container->psnames = NULL; 44 } 45 } 46 47 FT_Error 48 psnames_module_class_pic_init( FT_Library library ) 49 { 50 FT_PIC_Container* pic_container = &library->pic_container; 51 FT_Error error = FT_Err_Ok; 52 PSModulePIC* container; 53 FT_Memory memory = library->memory; 54 55 /* allocate pointer, clear and set global container pointer */ 56 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) 57 return error; 58 FT_MEM_SET( container, 0, sizeof(*container) ); 59 pic_container->psnames = container; 60 61 /* initialize pointer table - this is how the module usually expects this data */ 62 error = FT_Create_Class_pscmaps_services(library, &container->pscmaps_services); 63 if(error) 64 goto Exit; 65 FT_Init_Class_pscmaps_interface(library, &container->pscmaps_interface); 66 67Exit: 68 if(error) 69 psnames_module_class_pic_free(library); 70 return error; 71 } 72 73 74#endif /* FT_CONFIG_OPTION_PIC */ 75 76 77/* END */