OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* basepic.c */ | 3 /* basepic.c */ |
4 /* */ | 4 /* */ |
5 /* The FreeType position independent code services for base. */ | 5 /* The FreeType position independent code services for base. */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2009 by */ | 7 /* Copyright 2009 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 "basepic.h" | 22 #include "basepic.h" |
23 | 23 |
24 #ifdef FT_CONFIG_OPTION_PIC | 24 #ifdef FT_CONFIG_OPTION_PIC |
25 | 25 |
26 /* forward declaration of PIC init functions from ftglyph.c */ | 26 /* forward declaration of PIC init functions from ftglyph.c */ |
27 void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*); | 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*); | 28 void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); |
| 29 |
| 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 ); |
29 | 32 |
30 /* forward declaration of PIC init functions from ftinit.c */ | 33 /* forward declaration of PIC init functions from ftinit.c */ |
31 FT_Error ft_create_default_module_classes(FT_Library); | 34 FT_Error |
32 void ft_destroy_default_module_classes(FT_Library); | 35 ft_create_default_module_classes( FT_Library library ); |
33 | 36 |
34 void | 37 void |
35 ft_base_pic_free( FT_Library library ) | 38 ft_destroy_default_module_classes( FT_Library library ); |
| 39 |
| 40 void |
| 41 ft_base_pic_free( FT_Library library ) |
36 { | 42 { |
37 FT_PIC_Container* pic_container = &library->pic_container; | 43 FT_PIC_Container* pic_container = &library->pic_container; |
38 FT_Memory memory = library->memory; | 44 FT_Memory memory = library->memory; |
39 if ( pic_container->base ) | 45 if ( pic_container->base ) |
40 { | 46 { |
41 /* Destroy default module classes (in case FT_Add_Default_Modules was used
) */ | 47 /* Destroy default module classes (in case FT_Add_Default_Modules was used
) */ |
42 ft_destroy_default_module_classes( library ); | 48 ft_destroy_default_module_classes( library ); |
43 | 49 |
44 FT_FREE( pic_container->base ); | 50 FT_FREE( pic_container->base ); |
45 pic_container->base = NULL; | 51 pic_container->base = NULL; |
46 } | 52 } |
47 } | 53 } |
48 | 54 |
49 | 55 |
50 FT_Error | 56 FT_Error |
51 ft_base_pic_init( FT_Library library ) | 57 ft_base_pic_init( FT_Library library ) |
52 { | 58 { |
53 FT_PIC_Container* pic_container = &library->pic_container; | 59 FT_PIC_Container* pic_container = &library->pic_container; |
54 FT_Error error = FT_Err_Ok; | 60 FT_Error error = FT_Err_Ok; |
55 BasePIC* container; | 61 BasePIC* container; |
56 FT_Memory memory = library->memory; | 62 FT_Memory memory = library->memory; |
57 | 63 |
58 /* allocate pointer, clear and set global container pointer */ | 64 /* allocate pointer, clear and set global container pointer */ |
59 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) | 65 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) |
60 return error; | 66 return error; |
61 FT_MEM_SET( container, 0, sizeof(*container) ); | 67 FT_MEM_SET( container, 0, sizeof ( *container ) ); |
62 pic_container->base = container; | 68 pic_container->base = container; |
63 | 69 |
64 /* initialize default modules list and pointers */ | 70 /* initialize default modules list and pointers */ |
65 error = ft_create_default_module_classes( library ); | 71 error = ft_create_default_module_classes( library ); |
66 if ( error ) | 72 if ( error ) |
67 goto Exit; | 73 goto Exit; |
68 | 74 |
69 /* initialize pointer table - this is how the module usually expects this da
ta */ | 75 /* initialize pointer table - this is how the module usually expects this da
ta */ |
70 FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class); | 76 FT_Init_Class_ft_outline_glyph_class( |
71 FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_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); |
72 | 82 |
73 Exit: | 83 Exit: |
74 if(error) | 84 if( error ) |
75 ft_base_pic_free(library); | 85 ft_base_pic_free( library ); |
76 return error; | 86 return error; |
77 } | 87 } |
78 | 88 |
79 | 89 |
80 #endif /* FT_CONFIG_OPTION_PIC */ | 90 #endif /* FT_CONFIG_OPTION_PIC */ |
81 | 91 |
82 | 92 |
83 /* END */ | 93 /* END */ |
OLD | NEW |