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