From c24f77ac766092b31617f030e08f5fcbeb08509b Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Mon, 16 Jan 2012 21:13:05 +0900 Subject: [PATCH] Formatting PIC related sources. * src/autofit/afpic.c: Harmonize to FT2 coding conventions. * src/base/basepic.c: Ditto. * src/base/ftpic.c: Ditto. * src/cff/cffpic.c: Ditto. * src/pshinter/pshpic.c: Ditto. * src/psnames/pspic.c: Ditto. * src/raster/rastpic.c: Ditto. * src/sfnt/sfntpic.c: Ditto. * src/smooth/ftspic.c: Ditto. * src/truetype/ttpic.c: Ditto. --- ChangeLog | 15 ++++++ src/autofit/afpic.c | 5 +- src/base/basepic.c | 39 ++++++++------- src/base/ftpic.c | 12 ++--- src/cff/cffpic.c | 113 ++++++++++++++++++++++++++++++------------ src/pshinter/pshpic.c | 19 ++++--- src/psnames/pspic.c | 42 ++++++++++------ src/raster/rastpic.c | 36 ++++++++------ src/sfnt/sfntpic.c | 107 +++++++++++++++++++++++++++------------ src/smooth/ftspic.c | 46 ++++++++++------- src/truetype/ttpic.c | 52 ++++++++++++------- 11 files changed, 325 insertions(+), 161 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67ccfb60..4433a09e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-01-16 suzuki toshiya + + Formatting PIC related sources. + + * src/autofit/afpic.c: Harmonize to FT2 coding conventions. + * src/base/basepic.c: Ditto. + * src/base/ftpic.c: Ditto. + * src/cff/cffpic.c: Ditto. + * src/pshinter/pshpic.c: Ditto. + * src/psnames/pspic.c: Ditto. + * src/raster/rastpic.c: Ditto. + * src/sfnt/sfntpic.c: Ditto. + * src/smooth/ftspic.c: Ditto. + * src/truetype/ttpic.c: Ditto. + 2012-01-16 suzuki toshiya [autofit] Fix the inclusion of "aflatin2.h" in PIC file. diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index cd207c06..966fdd31 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -25,8 +25,9 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from afmodule.c */ - void FT_Init_Class_af_autofitter_service( FT_Library, - FT_AutoHinter_ServiceRec* ); + void FT_Init_Class_af_autofitter_service( + FT_Library library, + FT_AutoHinter_ServiceRec* clazz ); /* forward declaration of PIC init functions from script classes */ #include "aflatin.h" diff --git a/src/base/basepic.c b/src/base/basepic.c index c0bccb69..cc5fbbd6 100644 --- a/src/base/basepic.c +++ b/src/base/basepic.c @@ -24,18 +24,21 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftglyph.c */ - void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*); - void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*); + void FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); + void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); /* forward declaration of PIC init functions from ftinit.c */ - FT_Error ft_create_default_module_classes(FT_Library); - void ft_destroy_default_module_classes(FT_Library); + FT_Error + ft_create_default_module_classes( FT_Library library ); void - ft_base_pic_free( FT_Library library ) + ft_destroy_default_module_classes( FT_Library library ); + + void + ft_base_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; if ( pic_container->base ) { /* Destroy default module classes (in case FT_Add_Default_Modules was used) */ @@ -48,17 +51,17 @@ FT_Error - ft_base_pic_init( FT_Library library ) + ft_base_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - BasePIC* container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; + BasePIC* container; + FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->base = container; /* initialize default modules list and pointers */ @@ -67,12 +70,14 @@ goto Exit; /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class); - FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class); + FT_Init_Class_ft_outline_glyph_class( + &container->ft_outline_glyph_class ); + FT_Init_Class_ft_bitmap_glyph_class( + &container->ft_bitmap_glyph_class ); Exit: - if(error) - ft_base_pic_free(library); + if( error ) + ft_base_pic_free( library ); return error; } diff --git a/src/base/ftpic.c b/src/base/ftpic.c index d5271a97..b74e90da 100644 --- a/src/base/ftpic.c +++ b/src/base/ftpic.c @@ -26,15 +26,15 @@ /* documentation is in ftpic.h */ FT_BASE_DEF( FT_Error ) - ft_pic_container_init( FT_Library library ) + ft_pic_container_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; - FT_MEM_SET( pic_container, 0, sizeof(*pic_container) ); + FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); error = ft_base_pic_init( library ); - if(error) + if ( error ) return error; return FT_Err_Ok; @@ -43,7 +43,7 @@ /* Destroy the contents of the container. */ FT_BASE_DEF( void ) - ft_pic_container_destroy( FT_Library library ) + ft_pic_container_destroy( FT_Library library ) { ft_base_pic_free( library ); } diff --git a/src/cff/cffpic.c b/src/cff/cffpic.c index d29cf907..1c19d58b 100644 --- a/src/cff/cffpic.c +++ b/src/cff/cffpic.c @@ -26,31 +26,71 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from cffdrivr.c */ - FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*); - void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); - void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*); - void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*); - void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*); - - /* forward declaration of PIC init functions from cffparse.c */ - FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**); - void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*); + FT_Error + FT_Create_Class_cff_services( + FT_Library library, + FT_ServiceDescRec** output_class ); void - cff_driver_class_pic_free( FT_Library library ) + FT_Destroy_Class_cff_services( + FT_Library library, + FT_ServiceDescRec* clazz ); + + void + FT_Init_Class_cff_service_ps_info( + FT_Library library, + FT_Service_PsInfoRec* clazz ); + + void + FT_Init_Class_cff_service_glyph_dict( + FT_Library library, + FT_Service_GlyphDictRec* clazz ); + + void + FT_Init_Class_cff_service_ps_name( + FT_Library library, + FT_Service_PsFontNameRec* clazz ); + + void + FT_Init_Class_cff_service_get_cmap_info( + FT_Library library, + FT_Service_TTCMapsRec* clazz ); + + void + FT_Init_Class_cff_service_cid_info( + FT_Library library, + FT_Service_CIDRec* clazz ); + + /* forward declaration of PIC init functions from cffparse.c */ + FT_Error + FT_Create_Class_cff_field_handlers( + FT_Library library, + CFF_Field_Handler** output_class ); + + void + FT_Destroy_Class_cff_field_handlers( + FT_Library library, + CFF_Field_Handler* clazz ); + + void + cff_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->cff ) { - CffModulePIC* container = (CffModulePIC*)pic_container->cff; - if(container->cff_services) - FT_Destroy_Class_cff_services(library, container->cff_services); + CffModulePIC* container = ( CffModulePIC* )pic_container->cff; + + + if ( container->cff_services ) + FT_Destroy_Class_cff_services( library, + container->cff_services ); container->cff_services = NULL; - if(container->cff_field_handlers) - FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers); + if ( container->cff_field_handlers ) + FT_Destroy_Class_cff_field_handlers( + library, container->cff_field_handlers ); container->cff_field_handlers = NULL; FT_FREE( container ); pic_container->cff = NULL; @@ -74,22 +114,31 @@ pic_container->cff = container; /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_cff_services(library, &container->cff_services); - if(error) + error = FT_Create_Class_cff_services( library, + &container->cff_services ); + if ( error ) goto Exit; - error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers); - if(error) + error = FT_Create_Class_cff_field_handlers( + library, &container->cff_field_handlers ); + if ( error ) goto Exit; - FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info); - FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict); - FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name); - FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info); - FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info); - FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec); - FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec); + FT_Init_Class_cff_service_ps_info( + library, &container->cff_service_ps_info ); + FT_Init_Class_cff_service_glyph_dict( + library, &container->cff_service_glyph_dict ); + FT_Init_Class_cff_service_ps_name( + library, &container->cff_service_ps_name ); + FT_Init_Class_cff_service_get_cmap_info( + library, &container->cff_service_get_cmap_info ); + FT_Init_Class_cff_service_cid_info( + library, &container->cff_service_cid_info ); + FT_Init_Class_cff_cmap_encoding_class_rec( + library, &container->cff_cmap_encoding_class_rec ); + FT_Init_Class_cff_cmap_unicode_class_rec( + library, &container->cff_cmap_unicode_class_rec ); Exit: - if(error) - cff_driver_class_pic_free(library); + if ( error ) + cff_driver_class_pic_free( library ); return error; } diff --git a/src/pshinter/pshpic.c b/src/pshinter/pshpic.c index 76db8fb7..5ac5a83b 100644 --- a/src/pshinter/pshpic.c +++ b/src/pshinter/pshpic.c @@ -25,13 +25,17 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from pshmod.c */ - void FT_Init_Class_pshinter_interface( FT_Library, PSHinter_Interface*); + void + FT_Init_Class_pshinter_interface( FT_Library library, + PSHinter_Interface* clazz ); void - pshinter_module_class_pic_free( FT_Library library ) + pshinter_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->pshinter ) { FT_FREE( pic_container->pshinter ); @@ -56,11 +60,12 @@ pic_container->pshinter = container; /* add call to initialization function when you add new scripts */ - FT_Init_Class_pshinter_interface(library, &container->pshinter_interface); + FT_Init_Class_pshinter_interface( + library, &container->pshinter_interface ); /*Exit:*/ - if(error) - pshinter_module_class_pic_free(library); + if( error ) + pshinter_module_class_pic_free( library ); return error; } diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c index f88d415c..ae9175d6 100644 --- a/src/psnames/pspic.c +++ b/src/psnames/pspic.c @@ -25,20 +25,32 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from psmodule.c */ - FT_Error FT_Create_Class_pscmaps_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_pscmaps_interface( FT_Library, FT_Service_PsCMapsRec*); + FT_Error + FT_Create_Class_pscmaps_services( FT_Library library, + FT_ServiceDescRec** output_class ); + void + FT_Destroy_Class_pscmaps_services( FT_Library library, + FT_ServiceDescRec* clazz ); void - psnames_module_class_pic_free( FT_Library library ) + FT_Init_Class_pscmaps_interface( FT_Library library, + FT_Service_PsCMapsRec* clazz ); + + void + psnames_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->psnames ) { - PSModulePIC* container = (PSModulePIC*)pic_container->psnames; + PSModulePIC* container = (PSModulePIC*)pic_container->psnames; + + if(container->pscmaps_services) - FT_Destroy_Class_pscmaps_services(library, container->pscmaps_services); + FT_Destroy_Class_pscmaps_services( library, + container->pscmaps_services ); container->pscmaps_services = NULL; FT_FREE( container ); pic_container->psnames = NULL; @@ -58,18 +70,20 @@ /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->psnames = container; /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_pscmaps_services(library, &container->pscmaps_services); - if(error) + error = FT_Create_Class_pscmaps_services( + library, &container->pscmaps_services ); + if ( error ) goto Exit; - FT_Init_Class_pscmaps_interface(library, &container->pscmaps_interface); + FT_Init_Class_pscmaps_interface( library, + &container->pscmaps_interface ); Exit: - if(error) - psnames_module_class_pic_free(library); + if ( error ) + psnames_module_class_pic_free( library ); return error; } diff --git a/src/raster/rastpic.c b/src/raster/rastpic.c index d12294e6..70398bf4 100644 --- a/src/raster/rastpic.c +++ b/src/raster/rastpic.c @@ -25,17 +25,20 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftraster.c */ - void FT_Init_Class_ft_standard_raster(FT_Raster_Funcs*); + void + FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs ); void - ft_raster1_renderer_class_pic_free( FT_Library library ) + ft_raster1_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->raster ) { RasterPIC* container = (RasterPIC*)pic_container->raster; - if(--container->ref_count) + if ( --container->ref_count ) return; FT_FREE( container ); pic_container->raster = NULL; @@ -44,7 +47,7 @@ FT_Error - ft_raster1_renderer_class_pic_init( FT_Library library ) + ft_raster1_renderer_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = Raster_Err_Ok; @@ -61,28 +64,31 @@ } /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->raster = container; container->ref_count = 1; /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_standard_raster(&container->ft_standard_raster); + FT_Init_Class_ft_standard_raster( &container->ft_standard_raster ); /*Exit:*/ - if(error) - ft_raster1_renderer_class_pic_free(library); + if( error ) + ft_raster1_renderer_class_pic_free( library ); return error; } /* re-route these init and free functions to the above functions */ - FT_Error ft_raster5_renderer_class_pic_init(FT_Library library) + FT_Error + ft_raster5_renderer_class_pic_init( FT_Library library ) { - return ft_raster1_renderer_class_pic_init(library); + return ft_raster1_renderer_class_pic_init( library ); } - void ft_raster5_renderer_class_pic_free(FT_Library library) + + void + ft_raster5_renderer_class_pic_free( FT_Library library ) { - ft_raster1_renderer_class_pic_free(library); + ft_raster1_renderer_class_pic_free( library ); } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/sfnt/sfntpic.c b/src/sfnt/sfntpic.c index b5e20d81..1372376d 100644 --- a/src/sfnt/sfntpic.c +++ b/src/sfnt/sfntpic.c @@ -25,32 +25,68 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from sfdriver.c */ - FT_Error FT_Create_Class_sfnt_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_sfnt_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec*); - void FT_Init_Class_sfnt_interface( FT_Library, SFNT_Interface*); - void FT_Init_Class_sfnt_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); - void FT_Init_Class_sfnt_service_ps_name( FT_Library, FT_Service_PsFontNameRec*); - void FT_Init_Class_tt_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*); - void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec*); - - /* forward declaration of PIC init functions from ttcmap.c */ - FT_Error FT_Create_Class_tt_cmap_classes( FT_Library, TT_CMap_Class**); - void FT_Destroy_Class_tt_cmap_classes( FT_Library, TT_CMap_Class*); + FT_Error + FT_Create_Class_sfnt_services( FT_Library library, + FT_ServiceDescRec** ouput_class ); void - sfnt_module_class_pic_free( FT_Library library ) + FT_Destroy_Class_sfnt_services( FT_Library library, + FT_ServiceDescRec* clazz ); + + void + FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz ); + + void + FT_Init_Class_sfnt_interface( FT_Library library, + SFNT_Interface* clazz ); + + void + FT_Init_Class_sfnt_service_glyph_dict( + FT_Library library, + FT_Service_GlyphDictRec* clazz ); + + void + FT_Init_Class_sfnt_service_ps_name( + FT_Library library, + FT_Service_PsFontNameRec* clazz ); + + void + FT_Init_Class_tt_service_get_cmap_info( + FT_Library library, + FT_Service_TTCMapsRec* clazz ); + + void + FT_Init_Class_sfnt_service_sfnt_table( + FT_Service_SFNT_TableRec* clazz ); + + /* forward declaration of PIC init functions from ttcmap.c */ + FT_Error + FT_Create_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class** output_class ); + + void + FT_Destroy_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class* clazz ); + + void + sfnt_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->sfnt ) { - sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; - if(container->sfnt_services) - FT_Destroy_Class_sfnt_services(library, container->sfnt_services); + sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; + + + if ( container->sfnt_services ) + FT_Destroy_Class_sfnt_services( library, + container->sfnt_services ); container->sfnt_services = NULL; - if(container->tt_cmap_classes) - FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes); + if ( container->tt_cmap_classes ) + FT_Destroy_Class_tt_cmap_classes( library, + container->tt_cmap_classes ); container->tt_cmap_classes = NULL; FT_FREE( container ); pic_container->sfnt = NULL; @@ -74,24 +110,31 @@ pic_container->sfnt = container; /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_sfnt_services(library, &container->sfnt_services); - if(error) + error = FT_Create_Class_sfnt_services( library, + &container->sfnt_services ); + if ( error ) goto Exit; - error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes); - if(error) + error = FT_Create_Class_tt_cmap_classes( library, + &container->tt_cmap_classes ); + if ( error ) goto Exit; - FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict); - FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name); - FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info); - FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table); + + FT_Init_Class_sfnt_service_glyph_dict( + library, &container->sfnt_service_glyph_dict ); + FT_Init_Class_sfnt_service_ps_name( + library, &container->sfnt_service_ps_name ); + FT_Init_Class_tt_service_get_cmap_info( + library, &container->tt_service_get_cmap_info ); + FT_Init_Class_sfnt_service_sfnt_table( + &container->sfnt_service_sfnt_table ); #ifdef TT_CONFIG_OPTION_BDF - FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf); + FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf ); #endif - FT_Init_Class_sfnt_interface(library, &container->sfnt_interface); + FT_Init_Class_sfnt_interface( library, &container->sfnt_interface ); Exit: - if(error) - sfnt_module_class_pic_free(library); + if ( error ) + sfnt_module_class_pic_free( library ); return error; } diff --git a/src/smooth/ftspic.c b/src/smooth/ftspic.c index c54ecd59..407749ae 100644 --- a/src/smooth/ftspic.c +++ b/src/smooth/ftspic.c @@ -25,17 +25,22 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftgrays.c */ - void FT_Init_Class_ft_grays_raster(FT_Raster_Funcs*); + void + FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs ); void - ft_smooth_renderer_class_pic_free( FT_Library library ) + ft_smooth_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->smooth ) { - SmoothPIC* container = (SmoothPIC*)pic_container->smooth; - if(--container->ref_count) + SmoothPIC* container = (SmoothPIC*)pic_container->smooth; + + + if ( --container->ref_count ) return; FT_FREE( container ); pic_container->smooth = NULL; @@ -54,7 +59,7 @@ /* since this function also serve smooth_lcd and smooth_lcdv renderers, it implements reference counting */ - if(pic_container->smooth) + if ( pic_container->smooth ) { ((SmoothPIC*)pic_container->smooth)->ref_count++; return error; @@ -63,34 +68,37 @@ /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->smooth = container; container->ref_count = 1; /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_grays_raster(&container->ft_grays_raster); + FT_Init_Class_ft_grays_raster( &container->ft_grays_raster ); /*Exit:*/ - if(error) - ft_smooth_renderer_class_pic_free(library); + if ( error ) + ft_smooth_renderer_class_pic_free( library ); return error; } /* re-route these init and free functions to the above functions */ - FT_Error ft_smooth_lcd_renderer_class_pic_init(FT_Library library) + FT_Error ft_smooth_lcd_renderer_class_pic_init( FT_Library library ) { - return ft_smooth_renderer_class_pic_init(library); + return ft_smooth_renderer_class_pic_init( library ); } - void ft_smooth_lcd_renderer_class_pic_free(FT_Library library) + + void ft_smooth_lcd_renderer_class_pic_free( FT_Library library ) { - ft_smooth_renderer_class_pic_free(library); + ft_smooth_renderer_class_pic_free( library ); } - FT_Error ft_smooth_lcdv_renderer_class_pic_init(FT_Library library) + + FT_Error ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ) { - return ft_smooth_renderer_class_pic_init(library); + return ft_smooth_renderer_class_pic_init( library ); } - void ft_smooth_lcdv_renderer_class_pic_free(FT_Library library) + + void ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ) { - ft_smooth_renderer_class_pic_free(library); + ft_smooth_renderer_class_pic_free( library ); } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index 700c57bc..65ca845a 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -25,21 +25,36 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ttdriver.c */ - FT_Error FT_Create_Class_tt_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_tt_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*); - void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*); + FT_Error + FT_Create_Class_tt_services( FT_Library library, + FT_ServiceDescRec** output_class ); void - tt_driver_class_pic_free( FT_Library library ) + FT_Destroy_Class_tt_services( FT_Library library, + FT_ServiceDescRec* clazz ); + + void + FT_Init_Class_tt_service_gx_multi_masters( + FT_Service_MultiMastersRec* sv_mm ); + + void + FT_Init_Class_tt_service_truetype_glyf( + FT_Service_TTGlyfRec* sv_ttglyf ); + + void + tt_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->truetype ) { - TTModulePIC* container = (TTModulePIC*)pic_container->truetype; - if(container->tt_services) - FT_Destroy_Class_tt_services(library, container->tt_services); + TTModulePIC* container = (TTModulePIC*)pic_container->truetype; + + + if ( container->tt_services ) + FT_Destroy_Class_tt_services( library, container->tt_services ); container->tt_services = NULL; FT_FREE( container ); pic_container->truetype = NULL; @@ -59,20 +74,23 @@ /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->truetype = container; /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_tt_services(library, &container->tt_services); - if(error) + error = FT_Create_Class_tt_services( library, + &container->tt_services ); + if ( error ) goto Exit; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters); + FT_Init_Class_tt_service_gx_multi_masters( + &container->tt_service_gx_multi_masters ); #endif - FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf); + FT_Init_Class_tt_service_truetype_glyf( + &container->tt_service_truetype_glyf ); Exit: - if(error) - tt_driver_class_pic_free(library); + if ( error ) + tt_driver_class_pic_free( library ); return error; }