diff options
author | Werner Lemberg <wl@gnu.org> | 2012-08-31 00:20:29 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2012-08-31 00:20:29 +0200 |
commit | 7f316f22d1222484af9f7f62face6cb94be777b2 (patch) | |
tree | 6e458b0aa39b8748bb9941742b870e9a348658dd /src/autofit/afpic.c | |
parent | 0f8fd88e83a9a465f9433f3e0561031bb03f8980 (diff) | |
download | freetype2-7f316f22d1222484af9f7f62face6cb94be777b2.tar.gz |
[autofit] Implement properties service framework.
No properties are added yet.
* src/autofit/afmodule.c: Include FT_SERVICE_PROPERTIES_H.
(af_property_set, af_property_get): New dummy functions.
(af_service_properties, af_services, af_get_interface): Provide
service setup.
(autofit_moduleclass): Add service interface.
* src/autofit/afpic.c: Add necessary forward declarations.
(autofit_module_class_pic_init): Add code for service addition.
(autofit_module_pic_free): Add code for service removal.
* src/autofit/afpic.h (AF_SERVICES_GET, AF_SERVICE_PROPERTIES_GET):
New macros which provide necessary syntactical sugar for PIC
support.
Diffstat (limited to 'src/autofit/afpic.c')
-rw-r--r-- | src/autofit/afpic.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 36a9cca99..e6022f930 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -26,10 +26,22 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from afmodule.c */ + 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" #ifdef FT_OPTION_AUTOFIT2 @@ -49,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; } } @@ -73,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] = @@ -98,8 +125,7 @@ FT_Init_Class_af_autofitter_interface( library, &container->af_autofitter_interface ); -/* Exit: */ - + Exit: if ( error ) autofit_module_class_pic_free( library ); return error; |