1 /***************************************************************************/
5 /* The FreeType position independent code services for autofit module. */
7 /* Copyright 2009, 2010, 2011 by */
8 /* Oran Agra and Mickey Gabel. */
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 */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
20 #include FT_FREETYPE_H
21 #include FT_INTERNAL_OBJECTS_H
25 #ifdef FT_CONFIG_OPTION_PIC
27 /* forward declaration of PIC init functions from afmodule.c */
28 void FT_Init_Class_af_autofitter_service(
30 FT_AutoHinter_ServiceRec* clazz );
32 /* forward declaration of PIC init functions from script classes */
34 #ifdef FT_OPTION_AUTOFIT2
42 autofit_module_class_pic_free( FT_Library library )
44 FT_PIC_Container* pic_container = &library->pic_container;
45 FT_Memory memory = library->memory;
48 if ( pic_container->autofit )
50 FT_FREE( pic_container->autofit );
51 pic_container->autofit = NULL;
57 autofit_module_class_pic_init( FT_Library library )
59 FT_PIC_Container* pic_container = &library->pic_container;
61 FT_Error error = AF_Err_Ok;
62 AFModulePIC* container;
63 FT_Memory memory = library->memory;
66 /* allocate pointer, clear and set global container pointer */
67 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
69 FT_MEM_SET( container, 0, sizeof ( *container ) );
70 pic_container->autofit = container;
72 /* initialize pointer table - */
73 /* this is how the module usually expects this data */
74 for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )
76 container->af_script_classes[ss] =
77 &container->af_script_classes_rec[ss];
79 container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL;
81 /* add call to initialization function when you add new scripts */
83 FT_Init_Class_af_dummy_script_class(
84 &container->af_script_classes_rec[ss++] );
85 #ifdef FT_OPTION_AUTOFIT2
86 FT_Init_Class_af_latin2_script_class(
87 &container->af_script_classes_rec[ss++] );
89 FT_Init_Class_af_latin_script_class(
90 &container->af_script_classes_rec[ss++] );
91 FT_Init_Class_af_cjk_script_class(
92 &container->af_script_classes_rec[ss++] );
93 FT_Init_Class_af_indic_script_class(
94 &container->af_script_classes_rec[ss++] );
96 FT_Init_Class_af_autofitter_service(
97 library, &container->af_autofitter_service );
102 autofit_module_class_pic_free( library );
107 #endif /* FT_CONFIG_OPTION_PIC */