1 /***************************************************************************/
5 /* FreeType PostScript hinter module implementation (body). */
7 /* Copyright 2001-2018 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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_INTERNAL_OBJECTS_H
26 /* the Postscript Hinter module structure */
27 typedef struct PS_Hinter_Module_Rec_
32 PSH_Globals_FuncsRec globals_funcs
;
33 T1_Hints_FuncsRec t1_funcs
;
34 T2_Hints_FuncsRec t2_funcs
;
36 } PS_Hinter_ModuleRec
, *PS_Hinter_Module
;
40 FT_CALLBACK_DEF( void )
41 ps_hinter_done( PS_Hinter_Module module
)
43 module
->t1_funcs
.hints
= NULL
;
44 module
->t2_funcs
.hints
= NULL
;
46 ps_hints_done( &module
->ps_hints
);
50 /* initialize module, create hints recorder and the interface */
51 FT_CALLBACK_DEF( FT_Error
)
52 ps_hinter_init( PS_Hinter_Module module
)
54 FT_Memory memory
= module
->root
.memory
;
55 void* ph
= &module
->ps_hints
;
58 ps_hints_init( &module
->ps_hints
, memory
);
60 psh_globals_funcs_init( &module
->globals_funcs
);
62 t1_hints_funcs_init( &module
->t1_funcs
);
63 module
->t1_funcs
.hints
= (T1_Hints
)ph
;
65 t2_hints_funcs_init( &module
->t2_funcs
);
66 module
->t2_funcs
.hints
= (T2_Hints
)ph
;
72 /* returns global hints interface */
73 FT_CALLBACK_DEF( PSH_Globals_Funcs
)
74 pshinter_get_globals_funcs( FT_Module module
)
76 return &((PS_Hinter_Module
)module
)->globals_funcs
;
80 /* return Type 1 hints interface */
81 FT_CALLBACK_DEF( T1_Hints_Funcs
)
82 pshinter_get_t1_funcs( FT_Module module
)
84 return &((PS_Hinter_Module
)module
)->t1_funcs
;
88 /* return Type 2 hints interface */
89 FT_CALLBACK_DEF( T2_Hints_Funcs
)
90 pshinter_get_t2_funcs( FT_Module module
)
92 return &((PS_Hinter_Module
)module
)->t2_funcs
;
96 FT_DEFINE_PSHINTER_INTERFACE(
99 pshinter_get_globals_funcs
,
100 pshinter_get_t1_funcs
,
101 pshinter_get_t2_funcs
106 pshinter_module_class
,
109 sizeof ( PS_Hinter_ModuleRec
),
114 &PSHINTER_INTERFACE_GET
, /* module-specific interface */
116 (FT_Module_Constructor
)ps_hinter_init
, /* module_init */
117 (FT_Module_Destructor
) ps_hinter_done
, /* module_done */
118 (FT_Module_Requester
) NULL
/* get_interface */