1 /***************************************************************************/
5 /* The FreeType position independent code services for base. */
7 /* Copyright 2009, 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
25 #ifdef FT_CONFIG_OPTION_PIC
27 /* forward declaration of PIC init functions from ftglyph.c */
29 FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class
* clazz
);
32 FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class
* clazz
);
34 #ifdef FT_CONFIG_OPTION_MAC_FONTS
35 /* forward declaration of PIC init function from ftrfork.c */
36 /* (not modularized) */
38 FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec
* record
);
41 /* forward declaration of PIC init functions from ftinit.c */
43 ft_create_default_module_classes( FT_Library library
);
46 ft_destroy_default_module_classes( FT_Library library
);
50 ft_base_pic_free( FT_Library library
)
52 FT_PIC_Container
* pic_container
= &library
->pic_container
;
53 FT_Memory memory
= library
->memory
;
56 if ( pic_container
->base
)
58 /* destroy default module classes */
59 /* (in case FT_Add_Default_Modules was used) */
60 ft_destroy_default_module_classes( library
);
62 FT_FREE( pic_container
->base
);
63 pic_container
->base
= NULL
;
69 ft_base_pic_init( FT_Library library
)
71 FT_PIC_Container
* pic_container
= &library
->pic_container
;
72 FT_Error error
= FT_Err_Ok
;
73 BasePIC
* container
= NULL
;
74 FT_Memory memory
= library
->memory
;
77 /* allocate pointer, clear and set global container pointer */
78 if ( FT_ALLOC( container
, sizeof ( *container
) ) )
80 FT_MEM_SET( container
, 0, sizeof ( *container
) );
81 pic_container
->base
= container
;
83 /* initialize default modules list and pointers */
84 error
= ft_create_default_module_classes( library
);
88 /* initialize pointer table - */
89 /* this is how the module usually expects this data */
90 FT_Init_Class_ft_outline_glyph_class(
91 &container
->ft_outline_glyph_class
);
92 FT_Init_Class_ft_bitmap_glyph_class(
93 &container
->ft_bitmap_glyph_class
);
94 #ifdef FT_CONFIG_OPTION_MAC_FONTS
95 FT_Init_Table_ft_raccess_guess_table(
96 (ft_raccess_guess_rec
*)&container
->ft_raccess_guess_table
);
101 ft_base_pic_free( library
);
105 #endif /* FT_CONFIG_OPTION_PIC */