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