| Index: src/autofit/afpic.c
|
| diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c
|
| index 87074afcfe2446963e58a65965f8144b11b8f1a4..45e1448c089f0fad26ea104b8e4defd546420ae7 100644
|
| --- a/src/autofit/afpic.c
|
| +++ b/src/autofit/afpic.c
|
| @@ -4,7 +4,7 @@
|
| /* */
|
| /* The FreeType position independent code services for autofit module. */
|
| /* */
|
| -/* Copyright 2009, 2010, 2011 by */
|
| +/* Copyright 2009-2013 by */
|
| /* Oran Agra and Mickey Gabel. */
|
| /* */
|
| /* This file is part of the FreeType project, and may only be used, */
|
| @@ -22,12 +22,25 @@
|
| #include "afpic.h"
|
| #include "aferrors.h"
|
|
|
| +
|
| #ifdef FT_CONFIG_OPTION_PIC
|
|
|
| /* forward declaration of PIC init functions from afmodule.c */
|
| - void FT_Init_Class_af_autofitter_service(
|
| - FT_Library library,
|
| - FT_AutoHinter_ServiceRec* clazz );
|
| + FT_Error
|
| + FT_Create_Class_af_services( FT_Library library,
|
| + FT_ServiceDescRec** output_class );
|
| +
|
| + void
|
| + FT_Destroy_Class_af_services( FT_Library library,
|
| + FT_ServiceDescRec* clazz );
|
| +
|
| + void
|
| + FT_Init_Class_af_service_properties( FT_Service_PropertiesRec* clazz );
|
| +
|
| + void FT_Init_Class_af_autofitter_interface(
|
| + FT_Library library,
|
| + FT_AutoHinter_InterfaceRec* clazz );
|
| +
|
|
|
| /* forward declaration of PIC init functions from script classes */
|
| #include "aflatin.h"
|
| @@ -38,6 +51,7 @@
|
| #include "afdummy.h"
|
| #include "afindic.h"
|
|
|
| +
|
| void
|
| autofit_module_class_pic_free( FT_Library library )
|
| {
|
| @@ -47,7 +61,15 @@
|
|
|
| if ( pic_container->autofit )
|
| {
|
| - FT_FREE( pic_container->autofit );
|
| + AFModulePIC* container = (AFModulePIC*)pic_container->autofit;
|
| +
|
| +
|
| + if ( container->af_services )
|
| + FT_Destroy_Class_af_services( library,
|
| + container->af_services );
|
| + container->af_services = NULL;
|
| +
|
| + FT_FREE( container );
|
| pic_container->autofit = NULL;
|
| }
|
| }
|
| @@ -58,8 +80,8 @@
|
| {
|
| FT_PIC_Container* pic_container = &library->pic_container;
|
| FT_UInt ss;
|
| - FT_Error error = AF_Err_Ok;
|
| - AFModulePIC* container;
|
| + FT_Error error = FT_Err_Ok;
|
| + AFModulePIC* container = NULL;
|
| FT_Memory memory = library->memory;
|
|
|
|
|
| @@ -71,6 +93,13 @@
|
|
|
| /* initialize pointer table - */
|
| /* this is how the module usually expects this data */
|
| + error = FT_Create_Class_af_services( library,
|
| + &container->af_services );
|
| + if ( error )
|
| + goto Exit;
|
| +
|
| + FT_Init_Class_af_service_properties( &container->af_service_properties );
|
| +
|
| for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )
|
| {
|
| container->af_script_classes[ss] =
|
| @@ -93,17 +122,15 @@
|
| FT_Init_Class_af_indic_script_class(
|
| &container->af_script_classes_rec[ss++] );
|
|
|
| - FT_Init_Class_af_autofitter_service(
|
| - library, &container->af_autofitter_service );
|
| -
|
| -/* Exit: */
|
| + FT_Init_Class_af_autofitter_interface(
|
| + library, &container->af_autofitter_interface );
|
|
|
| + Exit:
|
| if ( error )
|
| autofit_module_class_pic_free( library );
|
| return error;
|
| }
|
|
|
| -
|
| #endif /* FT_CONFIG_OPTION_PIC */
|
|
|
|
|
|
|