1 /***************************************************************************/
5 /* The FreeType position independent code services for base. */
7 /* Copyright 2009 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
24 #ifdef FT_CONFIG_OPTION_PIC
26 /* forward declaration of PIC init functions from ftglyph.c */
27 void FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz );
28 void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz );
30 /* forward declaration of PIC init function from ftrfork.c (not modularized) */
31 void FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record );
33 /* forward declaration of PIC init functions from ftinit.c */
35 ft_create_default_module_classes( FT_Library library );
38 ft_destroy_default_module_classes( FT_Library library );
41 ft_base_pic_free( FT_Library library )
43 FT_PIC_Container* pic_container = &library->pic_container;
44 FT_Memory memory = library->memory;
45 if ( pic_container->base )
47 /* Destroy default module classes (in case FT_Add_Default_Modules was used) */
48 ft_destroy_default_module_classes( library );
50 FT_FREE( pic_container->base );
51 pic_container->base = NULL;
57 ft_base_pic_init( FT_Library library )
59 FT_PIC_Container* pic_container = &library->pic_container;
60 FT_Error error = FT_Err_Ok;
62 FT_Memory memory = library->memory;
64 /* allocate pointer, clear and set global container pointer */
65 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
67 FT_MEM_SET( container, 0, sizeof ( *container ) );
68 pic_container->base = container;
70 /* initialize default modules list and pointers */
71 error = ft_create_default_module_classes( library );
75 /* initialize pointer table - this is how the module usually expects this data */
76 FT_Init_Class_ft_outline_glyph_class(
77 &container->ft_outline_glyph_class );
78 FT_Init_Class_ft_bitmap_glyph_class(
79 &container->ft_bitmap_glyph_class );
80 FT_Init_Table_raccess_guess_table(
81 (ft_raccess_guess_rec*)&container->ft_raccess_guess_table);
85 ft_base_pic_free( library );
90 #endif /* FT_CONFIG_OPTION_PIC */