update for HEAD-2003091401
[reactos.git] / lib / freetype / src / pshinter / pshmod.c
1 /***************************************************************************/
2 /*                                                                         */
3 /*  pshmod.c                                                               */
4 /*                                                                         */
5 /*    FreeType PostScript hinter module implementation (body).             */
6 /*                                                                         */
7 /*  Copyright 2001, 2002 by                                                */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
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.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #include <ft2build.h>
20 #include FT_INTERNAL_OBJECTS_H
21 #include "pshrec.h"
22 #include "pshalgo.h"
23
24
25   /* the Postscript Hinter module structure */
26   typedef struct  PS_Hinter_Module_Rec_
27   {
28     FT_ModuleRec          root;
29     PS_HintsRec           ps_hints;
30
31     PSH_Globals_FuncsRec  globals_funcs;
32     T1_Hints_FuncsRec     t1_funcs;
33     T2_Hints_FuncsRec     t2_funcs;
34
35   } PS_Hinter_ModuleRec, *PS_Hinter_Module;
36
37
38   /* finalize module */
39   FT_CALLBACK_DEF( void )
40   ps_hinter_done( PS_Hinter_Module  module )
41   {
42     module->t1_funcs.hints = NULL;
43     module->t2_funcs.hints = NULL;
44
45     ps_hints_done( &module->ps_hints );
46   }
47
48
49   /* initialize module, create hints recorder and the interface */
50   FT_CALLBACK_DEF( FT_Error )
51   ps_hinter_init( PS_Hinter_Module  module )
52   {
53     FT_Memory  memory = module->root.memory;
54
55
56     ps_hints_init( &module->ps_hints, memory );
57
58     psh_globals_funcs_init( &module->globals_funcs );
59
60     t1_hints_funcs_init( &module->t1_funcs );
61     module->t1_funcs.hints = (T1_Hints)&module->ps_hints;
62
63     t2_hints_funcs_init( &module->t2_funcs );
64     module->t2_funcs.hints = (T2_Hints)&module->ps_hints;
65
66     return 0;
67   }
68
69
70   /* returns global hints interface */
71   FT_CALLBACK_DEF( PSH_Globals_Funcs )
72   pshinter_get_globals_funcs( FT_Module  module )
73   {
74     return &((PS_Hinter_Module)module)->globals_funcs;
75   }
76
77
78   /* return Type 1 hints interface */
79   FT_CALLBACK_DEF( T1_Hints_Funcs )
80   pshinter_get_t1_funcs( FT_Module  module )
81   {
82     return &((PS_Hinter_Module)module)->t1_funcs;
83   }
84
85
86   /* return Type 2 hints interface */
87   FT_CALLBACK_DEF( T2_Hints_Funcs )
88   pshinter_get_t2_funcs( FT_Module  module )
89   {
90     return &((PS_Hinter_Module)module)->t2_funcs;
91   }
92
93
94   static
95   const PSHinter_Interface  pshinter_interface =
96   {
97     pshinter_get_globals_funcs,
98     pshinter_get_t1_funcs,
99     pshinter_get_t2_funcs
100   };
101
102
103   FT_CALLBACK_TABLE_DEF
104   const FT_Module_Class  pshinter_module_class =
105   {
106     0,
107     sizeof ( PS_Hinter_ModuleRec ),
108     "pshinter",
109     0x10000L,
110     0x20000L,
111
112     &pshinter_interface,            /* module-specific interface */
113
114     (FT_Module_Constructor)ps_hinter_init,
115     (FT_Module_Destructor) ps_hinter_done,
116     (FT_Module_Requester)  0        /* no additional interface for now */
117   };
118
119
120 /* END */