1 /***************************************************************************/
5 /* The FreeType position independent code services for cff module. */
7 /* Copyright 2009, 2010, 2012, 2013 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
27 #ifdef FT_CONFIG_OPTION_PIC
29 /* forward declaration of PIC init functions from cffdrivr.c */
31 FT_Create_Class_cff_services( FT_Library library,
32 FT_ServiceDescRec** output_class );
34 FT_Destroy_Class_cff_services( FT_Library library,
35 FT_ServiceDescRec* clazz );
37 FT_Init_Class_cff_service_ps_info( FT_Library library,
38 FT_Service_PsInfoRec* clazz );
40 FT_Init_Class_cff_service_glyph_dict( FT_Library library,
41 FT_Service_GlyphDictRec* clazz );
43 FT_Init_Class_cff_service_ps_name( FT_Library library,
44 FT_Service_PsFontNameRec* clazz );
46 FT_Init_Class_cff_service_get_cmap_info( FT_Library library,
47 FT_Service_TTCMapsRec* clazz );
49 FT_Init_Class_cff_service_cid_info( FT_Library library,
50 FT_Service_CIDRec* clazz );
52 /* forward declaration of PIC init functions from cffparse.c */
54 FT_Create_Class_cff_field_handlers( FT_Library library,
55 CFF_Field_Handler** output_class );
57 FT_Destroy_Class_cff_field_handlers( FT_Library library,
58 CFF_Field_Handler* clazz );
62 cff_driver_class_pic_free( FT_Library library )
64 FT_PIC_Container* pic_container = &library->pic_container;
65 FT_Memory memory = library->memory;
68 if ( pic_container->cff )
70 CffModulePIC* container = (CffModulePIC*)pic_container->cff;
73 if ( container->cff_services )
74 FT_Destroy_Class_cff_services( library,
75 container->cff_services );
76 container->cff_services = NULL;
77 if ( container->cff_field_handlers )
78 FT_Destroy_Class_cff_field_handlers(
79 library, container->cff_field_handlers );
80 container->cff_field_handlers = NULL;
82 pic_container->cff = NULL;
88 cff_driver_class_pic_init( FT_Library library )
90 FT_PIC_Container* pic_container = &library->pic_container;
91 FT_Error error = FT_Err_Ok;
92 CffModulePIC* container = NULL;
93 FT_Memory memory = library->memory;
96 /* allocate pointer, clear and set global container pointer */
97 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
99 FT_MEM_SET( container, 0, sizeof ( *container ) );
100 pic_container->cff = container;
102 /* initialize pointer table - */
103 /* this is how the module usually expects this data */
104 error = FT_Create_Class_cff_services( library,
105 &container->cff_services );
109 error = FT_Create_Class_cff_field_handlers(
110 library, &container->cff_field_handlers );
114 FT_Init_Class_cff_service_ps_info(
115 library, &container->cff_service_ps_info );
116 FT_Init_Class_cff_service_glyph_dict(
117 library, &container->cff_service_glyph_dict );
118 FT_Init_Class_cff_service_ps_name(
119 library, &container->cff_service_ps_name );
120 FT_Init_Class_cff_service_get_cmap_info(
121 library, &container->cff_service_get_cmap_info );
122 FT_Init_Class_cff_service_cid_info(
123 library, &container->cff_service_cid_info );
124 FT_Init_Class_cff_cmap_encoding_class_rec(
125 library, &container->cff_cmap_encoding_class_rec );
126 FT_Init_Class_cff_cmap_unicode_class_rec(
127 library, &container->cff_cmap_unicode_class_rec );
131 cff_driver_class_pic_free( library );
135 #endif /* FT_CONFIG_OPTION_PIC */