1 /***************************************************************************/
5 /* The FreeType position independent code services for cff module. */
7 /* Copyright 2009, 2010, 2012 by */
8 /* Oran Agra and Mickey Gabel. */
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. */
16 /***************************************************************************/
20 #include FT_FREETYPE_H
21 #include FT_INTERNAL_OBJECTS_H
26 #ifdef FT_CONFIG_OPTION_PIC
28 /* forward declaration of PIC init functions from cffdrivr.c */
30 FT_Create_Class_cff_services(
32 FT_ServiceDescRec** output_class );
35 FT_Destroy_Class_cff_services(
37 FT_ServiceDescRec* clazz );
40 FT_Init_Class_cff_service_ps_info(
42 FT_Service_PsInfoRec* clazz );
45 FT_Init_Class_cff_service_glyph_dict(
47 FT_Service_GlyphDictRec* clazz );
50 FT_Init_Class_cff_service_ps_name(
52 FT_Service_PsFontNameRec* clazz );
55 FT_Init_Class_cff_service_get_cmap_info(
57 FT_Service_TTCMapsRec* clazz );
60 FT_Init_Class_cff_service_cid_info(
62 FT_Service_CIDRec* clazz );
64 /* forward declaration of PIC init functions from cffparse.c */
66 FT_Create_Class_cff_field_handlers(
68 CFF_Field_Handler** output_class );
71 FT_Destroy_Class_cff_field_handlers(
73 CFF_Field_Handler* clazz );
76 cff_driver_class_pic_free( FT_Library library )
78 FT_PIC_Container* pic_container = &library->pic_container;
79 FT_Memory memory = library->memory;
82 if ( pic_container->cff )
84 CffModulePIC* container = ( CffModulePIC* )pic_container->cff;
87 if ( container->cff_services )
88 FT_Destroy_Class_cff_services( library,
89 container->cff_services );
90 container->cff_services = NULL;
91 if ( container->cff_field_handlers )
92 FT_Destroy_Class_cff_field_handlers(
93 library, container->cff_field_handlers );
94 container->cff_field_handlers = NULL;
96 pic_container->cff = NULL;
102 cff_driver_class_pic_init( FT_Library library )
104 FT_PIC_Container* pic_container = &library->pic_container;
105 FT_Error error = CFF_Err_Ok;
106 CffModulePIC* container = NULL;
107 FT_Memory memory = library->memory;
110 /* allocate pointer, clear and set global container pointer */
111 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
113 FT_MEM_SET( container, 0, sizeof ( *container ) );
114 pic_container->cff = container;
116 /* initialize pointer table - this is how the module usually expects this data */
117 error = FT_Create_Class_cff_services( library,
118 &container->cff_services );
121 error = FT_Create_Class_cff_field_handlers(
122 library, &container->cff_field_handlers );
125 FT_Init_Class_cff_service_ps_info(
126 library, &container->cff_service_ps_info );
127 FT_Init_Class_cff_service_glyph_dict(
128 library, &container->cff_service_glyph_dict );
129 FT_Init_Class_cff_service_ps_name(
130 library, &container->cff_service_ps_name );
131 FT_Init_Class_cff_service_get_cmap_info(
132 library, &container->cff_service_get_cmap_info );
133 FT_Init_Class_cff_service_cid_info(
134 library, &container->cff_service_cid_info );
135 FT_Init_Class_cff_cmap_encoding_class_rec(
136 library, &container->cff_cmap_encoding_class_rec );
137 FT_Init_Class_cff_cmap_unicode_class_rec(
138 library, &container->cff_cmap_unicode_class_rec );
141 cff_driver_class_pic_free( library );
145 #endif /* FT_CONFIG_OPTION_PIC */