1 /***************************************************************************/
2 /*                                                                         */
3 /*  psauxmod.c                                                             */
4 /*                                                                         */
5 /*    FreeType auxiliary PostScript module implementation (body).          */
6 /*                                                                         */
7 /*  Copyright 2000-2018 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 "psauxmod.h"
21 #include "psobjs.h"
22 #include "t1decode.h"
23 #include "t1cmap.h"
24 #include "psft.h"
25 #include "cffdecode.h"
26 
27 #ifndef T1_CONFIG_OPTION_NO_AFM
28 #include "afmparse.h"
29 #endif
30 
31 
32   FT_CALLBACK_TABLE_DEF
33   const PS_Table_FuncsRec  ps_table_funcs =
34   {
35     ps_table_new,     /* init    */
36     ps_table_done,    /* done    */
37     ps_table_add,     /* add     */
38     ps_table_release  /* release */
39   };
40 
41 
42   FT_CALLBACK_TABLE_DEF
43   const PS_Parser_FuncsRec  ps_parser_funcs =
44   {
45     ps_parser_init,             /* init             */
46     ps_parser_done,             /* done             */
47 
48     ps_parser_skip_spaces,      /* skip_spaces      */
49     ps_parser_skip_PS_token,    /* skip_PS_token    */
50 
51     ps_parser_to_int,           /* to_int           */
52     ps_parser_to_fixed,         /* to_fixed         */
53     ps_parser_to_bytes,         /* to_bytes         */
54     ps_parser_to_coord_array,   /* to_coord_array   */
55     ps_parser_to_fixed_array,   /* to_fixed_array   */
56     ps_parser_to_token,         /* to_token         */
57     ps_parser_to_token_array,   /* to_token_array   */
58 
59     ps_parser_load_field,       /* load_field       */
60     ps_parser_load_field_table  /* load_field_table */
61   };
62 
63 
64   FT_CALLBACK_TABLE_DEF
65   const PS_Builder_FuncsRec  ps_builder_funcs =
66   {
67     ps_builder_init,          /* init */
68     ps_builder_done           /* done */
69   };
70 
71 
72   FT_CALLBACK_TABLE_DEF
73   const T1_Builder_FuncsRec  t1_builder_funcs =
74   {
75     t1_builder_init,          /* init */
76     t1_builder_done,          /* done */
77 
78     t1_builder_check_points,  /* check_points  */
79     t1_builder_add_point,     /* add_point     */
80     t1_builder_add_point1,    /* add_point1    */
81     t1_builder_add_contour,   /* add_contour   */
82     t1_builder_start_point,   /* start_point   */
83     t1_builder_close_contour  /* close_contour */
84   };
85 
86 
87   FT_CALLBACK_TABLE_DEF
88   const T1_Decoder_FuncsRec  t1_decoder_funcs =
89   {
90     t1_decoder_init,               /* init                  */
91     t1_decoder_done,               /* done                  */
92 #ifdef T1_CONFIG_OPTION_OLD_ENGINE
93     t1_decoder_parse_charstrings,  /* parse_charstrings_old */
94 #else
95     t1_decoder_parse_metrics,      /* parse_metrics         */
96 #endif
97     cf2_decoder_parse_charstrings  /* parse_charstrings     */
98   };
99 
100 
101 #ifndef T1_CONFIG_OPTION_NO_AFM
102   FT_CALLBACK_TABLE_DEF
103   const AFM_Parser_FuncsRec  afm_parser_funcs =
104   {
105     afm_parser_init,  /* init  */
106     afm_parser_done,  /* done  */
107     afm_parser_parse  /* parse */
108   };
109 #endif
110 
111 
112   FT_CALLBACK_TABLE_DEF
113   const T1_CMap_ClassesRec  t1_cmap_classes =
114   {
115     &t1_cmap_standard_class_rec,
116     &t1_cmap_expert_class_rec,
117     &t1_cmap_custom_class_rec,
118     &t1_cmap_unicode_class_rec
119   };
120 
121 
122   FT_CALLBACK_TABLE_DEF
123   const CFF_Builder_FuncsRec  cff_builder_funcs =
124   {
125     cff_builder_init,          /* init */
126     cff_builder_done,          /* done */
127 
128     cff_check_points,          /* check_points  */
129     cff_builder_add_point,     /* add_point     */
130     cff_builder_add_point1,    /* add_point1    */
131     cff_builder_add_contour,   /* add_contour   */
132     cff_builder_start_point,   /* start_point   */
133     cff_builder_close_contour  /* close_contour */
134   };
135 
136 
137   FT_CALLBACK_TABLE_DEF
138   const CFF_Decoder_FuncsRec  cff_decoder_funcs =
139   {
140     cff_decoder_init,              /* init    */
141     cff_decoder_prepare,           /* prepare */
142 
143 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
144     cff_decoder_parse_charstrings, /* parse_charstrings_old */
145 #endif
146     cf2_decoder_parse_charstrings  /* parse_charstrings     */
147   };
148 
149 
150   static
151   const PSAux_Interface  psaux_interface =
152   {
153     &ps_table_funcs,
154     &ps_parser_funcs,
155     &t1_builder_funcs,
156     &t1_decoder_funcs,
157     t1_decrypt,
158     cff_random,
159     ps_decoder_init,
160     t1_make_subfont,
161 
162     (const T1_CMap_ClassesRec*) &t1_cmap_classes,
163 
164 #ifndef T1_CONFIG_OPTION_NO_AFM
165     &afm_parser_funcs,
166 #else
167     0,
168 #endif
169 
170     &cff_decoder_funcs,
171   };
172 
173 
174   FT_CALLBACK_TABLE_DEF
175   const FT_Module_Class  psaux_module_class =
176   {
177     0,
178     sizeof ( FT_ModuleRec ),
179     "psaux",
180     0x20000L,
181     0x20000L,
182 
183     &psaux_interface,  /* module-specific interface */
184 
185     (FT_Module_Constructor)NULL,  /* module_init   */
186     (FT_Module_Destructor) NULL,  /* module_done   */
187     (FT_Module_Requester)  NULL   /* get_interface */
188   };
189 
190 
191 /* END */
192