| 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, 2012 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 |
| 24 #ifdef FT_CONFIG_OPTION_PIC | 25 #ifdef FT_CONFIG_OPTION_PIC |
| 25 | 26 |
| 26 /* forward declaration of PIC init functions from ftglyph.c */ | 27 /* forward declaration of PIC init functions from ftglyph.c */ |
| 27 void FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); | 28 void |
| 28 void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); | 29 FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); |
| 29 | 30 |
| 30 /* forward declaration of PIC init function from ftrfork.c (not modularized) *
/ | 31 void |
| 31 void FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); | 32 FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); |
| 33 |
| 34 #ifdef FT_CONFIG_OPTION_MAC_FONTS |
| 35 /* forward declaration of PIC init function from ftrfork.c */ |
| 36 /* (not modularized) */ |
| 37 void |
| 38 FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); |
| 39 #endif |
| 32 | 40 |
| 33 /* forward declaration of PIC init functions from ftinit.c */ | 41 /* forward declaration of PIC init functions from ftinit.c */ |
| 34 FT_Error | 42 FT_Error |
| 35 ft_create_default_module_classes( FT_Library library ); | 43 ft_create_default_module_classes( FT_Library library ); |
| 36 | 44 |
| 37 void | 45 void |
| 38 ft_destroy_default_module_classes( FT_Library library ); | 46 ft_destroy_default_module_classes( FT_Library library ); |
| 39 | 47 |
| 48 |
| 40 void | 49 void |
| 41 ft_base_pic_free( FT_Library library ) | 50 ft_base_pic_free( FT_Library library ) |
| 42 { | 51 { |
| 43 FT_PIC_Container* pic_container = &library->pic_container; | 52 FT_PIC_Container* pic_container = &library->pic_container; |
| 44 FT_Memory memory = library->memory; | 53 FT_Memory memory = library->memory; |
| 54 |
| 55 |
| 45 if ( pic_container->base ) | 56 if ( pic_container->base ) |
| 46 { | 57 { |
| 47 /* Destroy default module classes (in case FT_Add_Default_Modules was used
) */ | 58 /* destroy default module classes */ |
| 59 /* (in case FT_Add_Default_Modules was used) */ |
| 48 ft_destroy_default_module_classes( library ); | 60 ft_destroy_default_module_classes( library ); |
| 49 | 61 |
| 50 FT_FREE( pic_container->base ); | 62 FT_FREE( pic_container->base ); |
| 51 pic_container->base = NULL; | 63 pic_container->base = NULL; |
| 52 } | 64 } |
| 53 } | 65 } |
| 54 | 66 |
| 55 | 67 |
| 56 FT_Error | 68 FT_Error |
| 57 ft_base_pic_init( FT_Library library ) | 69 ft_base_pic_init( FT_Library library ) |
| 58 { | 70 { |
| 59 FT_PIC_Container* pic_container = &library->pic_container; | 71 FT_PIC_Container* pic_container = &library->pic_container; |
| 60 FT_Error error = FT_Err_Ok; | 72 FT_Error error = FT_Err_Ok; |
| 61 BasePIC* container; | 73 BasePIC* container = NULL; |
| 62 FT_Memory memory = library->memory; | 74 FT_Memory memory = library->memory; |
| 75 |
| 63 | 76 |
| 64 /* allocate pointer, clear and set global container pointer */ | 77 /* allocate pointer, clear and set global container pointer */ |
| 65 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) | 78 if ( FT_ALLOC( container, sizeof ( *container ) ) ) |
| 66 return error; | 79 return error; |
| 67 FT_MEM_SET( container, 0, sizeof ( *container ) ); | 80 FT_MEM_SET( container, 0, sizeof ( *container ) ); |
| 68 pic_container->base = container; | 81 pic_container->base = container; |
| 69 | 82 |
| 70 /* initialize default modules list and pointers */ | 83 /* initialize default modules list and pointers */ |
| 71 error = ft_create_default_module_classes( library ); | 84 error = ft_create_default_module_classes( library ); |
| 72 if ( error ) | 85 if ( error ) |
| 73 goto Exit; | 86 goto Exit; |
| 74 | 87 |
| 75 /* initialize pointer table - this is how the module usually expects this da
ta */ | 88 /* initialize pointer table - */ |
| 89 /* this is how the module usually expects this data */ |
| 76 FT_Init_Class_ft_outline_glyph_class( | 90 FT_Init_Class_ft_outline_glyph_class( |
| 77 &container->ft_outline_glyph_class ); | 91 &container->ft_outline_glyph_class ); |
| 78 FT_Init_Class_ft_bitmap_glyph_class( | 92 FT_Init_Class_ft_bitmap_glyph_class( |
| 79 &container->ft_bitmap_glyph_class ); | 93 &container->ft_bitmap_glyph_class ); |
| 94 #ifdef FT_CONFIG_OPTION_MAC_FONTS |
| 80 FT_Init_Table_raccess_guess_table( | 95 FT_Init_Table_raccess_guess_table( |
| 81 (ft_raccess_guess_rec*)&container->ft_raccess_guess_table); | 96 (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); |
| 97 #endif |
| 82 | 98 |
| 83 Exit: | 99 Exit: |
| 84 if( error ) | 100 if ( error ) |
| 85 ft_base_pic_free( library ); | 101 ft_base_pic_free( library ); |
| 86 return error; | 102 return error; |
| 87 } | 103 } |
| 88 | 104 |
| 89 | |
| 90 #endif /* FT_CONFIG_OPTION_PIC */ | 105 #endif /* FT_CONFIG_OPTION_PIC */ |
| 91 | 106 |
| 92 | 107 |
| 93 /* END */ | 108 /* END */ |
| OLD | NEW |