• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  *
3  * psobjs.h
4  *
5  *   Auxiliary functions for PostScript fonts (specification).
6  *
7  * Copyright (C) 1996-2023 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 #ifndef PSOBJS_H_
20 #define PSOBJS_H_
21 
22 
23 #include <freetype/internal/psaux.h>
24 #include <freetype/internal/cffotypes.h>
25 
26 
27 FT_BEGIN_HEADER
28 
29 
30   /*************************************************************************/
31   /*************************************************************************/
32   /*****                                                               *****/
33   /*****                             T1_TABLE                          *****/
34   /*****                                                               *****/
35   /*************************************************************************/
36   /*************************************************************************/
37 
38 
39   FT_CALLBACK_TABLE
40   const PS_Table_FuncsRec    ps_table_funcs;
41 
42   FT_CALLBACK_TABLE
43   const PS_Parser_FuncsRec   ps_parser_funcs;
44 
45   FT_CALLBACK_TABLE
46   const T1_Builder_FuncsRec  t1_builder_funcs;
47 
48 
49   FT_LOCAL( FT_Error )
50   ps_table_new( PS_Table   table,
51                 FT_Int     count,
52                 FT_Memory  memory );
53 
54   FT_LOCAL( FT_Error )
55   ps_table_add( PS_Table     table,
56                 FT_Int       idx,
57                 const void*  object,
58                 FT_UInt      length );
59 
60   FT_LOCAL( void )
61   ps_table_done( PS_Table  table );
62 
63 
64   FT_LOCAL( void )
65   ps_table_release( PS_Table  table );
66 
67 
68   /*************************************************************************/
69   /*************************************************************************/
70   /*****                                                               *****/
71   /*****                            T1 PARSER                          *****/
72   /*****                                                               *****/
73   /*************************************************************************/
74   /*************************************************************************/
75 
76 
77   FT_LOCAL( void )
78   ps_parser_skip_spaces( PS_Parser  parser );
79 
80   FT_LOCAL( void )
81   ps_parser_skip_PS_token( PS_Parser  parser );
82 
83   FT_LOCAL( void )
84   ps_parser_to_token( PS_Parser  parser,
85                       T1_Token   token );
86 
87   FT_LOCAL( void )
88   ps_parser_to_token_array( PS_Parser  parser,
89                             T1_Token   tokens,
90                             FT_UInt    max_tokens,
91                             FT_Int*    pnum_tokens );
92 
93   FT_LOCAL( FT_Error )
94   ps_parser_load_field( PS_Parser       parser,
95                         const T1_Field  field,
96                         void**          objects,
97                         FT_UInt         max_objects,
98                         FT_ULong*       pflags );
99 
100   FT_LOCAL( FT_Error )
101   ps_parser_load_field_table( PS_Parser       parser,
102                               const T1_Field  field,
103                               void**          objects,
104                               FT_UInt         max_objects,
105                               FT_ULong*       pflags );
106 
107   FT_LOCAL( FT_Long )
108   ps_parser_to_int( PS_Parser  parser );
109 
110 
111   FT_LOCAL( FT_Error )
112   ps_parser_to_bytes( PS_Parser  parser,
113                       FT_Byte*   bytes,
114                       FT_Offset  max_bytes,
115                       FT_ULong*  pnum_bytes,
116                       FT_Bool    delimiters );
117 
118 
119   FT_LOCAL( FT_Fixed )
120   ps_parser_to_fixed( PS_Parser  parser,
121                       FT_Int     power_ten );
122 
123 
124   FT_LOCAL( FT_Int )
125   ps_parser_to_coord_array( PS_Parser  parser,
126                             FT_Int     max_coords,
127                             FT_Short*  coords );
128 
129   FT_LOCAL( FT_Int )
130   ps_parser_to_fixed_array( PS_Parser  parser,
131                             FT_Int     max_values,
132                             FT_Fixed*  values,
133                             FT_Int     power_ten );
134 
135 
136   FT_LOCAL( void )
137   ps_parser_init( PS_Parser  parser,
138                   FT_Byte*   base,
139                   FT_Byte*   limit,
140                   FT_Memory  memory );
141 
142   FT_LOCAL( void )
143   ps_parser_done( PS_Parser  parser );
144 
145 
146   /*************************************************************************/
147   /*************************************************************************/
148   /*****                                                               *****/
149   /*****                            T1 BUILDER                         *****/
150   /*****                                                               *****/
151   /*************************************************************************/
152   /*************************************************************************/
153 
154   FT_LOCAL( void )
155   t1_builder_init( T1_Builder    builder,
156                    FT_Face       face,
157                    FT_Size       size,
158                    FT_GlyphSlot  glyph,
159                    FT_Bool       hinting );
160 
161   FT_LOCAL( void )
162   t1_builder_done( T1_Builder  builder );
163 
164   FT_LOCAL( FT_Error )
165   t1_builder_check_points( T1_Builder  builder,
166                            FT_Int      count );
167 
168   FT_LOCAL( void )
169   t1_builder_add_point( T1_Builder  builder,
170                         FT_Pos      x,
171                         FT_Pos      y,
172                         FT_Byte     flag );
173 
174   FT_LOCAL( FT_Error )
175   t1_builder_add_point1( T1_Builder  builder,
176                          FT_Pos      x,
177                          FT_Pos      y );
178 
179   FT_LOCAL( FT_Error )
180   t1_builder_add_contour( T1_Builder  builder );
181 
182 
183   FT_LOCAL( FT_Error )
184   t1_builder_start_point( T1_Builder  builder,
185                           FT_Pos      x,
186                           FT_Pos      y );
187 
188 
189   FT_LOCAL( void )
190   t1_builder_close_contour( T1_Builder  builder );
191 
192 
193   /*************************************************************************/
194   /*************************************************************************/
195   /*****                                                               *****/
196   /*****                           CFF BUILDER                         *****/
197   /*****                                                               *****/
198   /*************************************************************************/
199   /*************************************************************************/
200 
201   FT_LOCAL( void )
202   cff_builder_init( CFF_Builder*   builder,
203                     TT_Face        face,
204                     CFF_Size       size,
205                     CFF_GlyphSlot  glyph,
206                     FT_Bool        hinting );
207 
208   FT_LOCAL( void )
209   cff_builder_done( CFF_Builder*  builder );
210 
211   FT_LOCAL( FT_Error )
212   cff_check_points( CFF_Builder*  builder,
213                     FT_Int        count );
214 
215   FT_LOCAL( void )
216   cff_builder_add_point( CFF_Builder*  builder,
217                          FT_Pos        x,
218                          FT_Pos        y,
219                          FT_Byte       flag );
220   FT_LOCAL( FT_Error )
221   cff_builder_add_point1( CFF_Builder*  builder,
222                           FT_Pos        x,
223                           FT_Pos        y );
224   FT_LOCAL( FT_Error )
225   cff_builder_start_point( CFF_Builder*  builder,
226                            FT_Pos        x,
227                            FT_Pos        y );
228   FT_LOCAL( void )
229   cff_builder_close_contour( CFF_Builder*  builder );
230 
231   FT_LOCAL( FT_Error )
232   cff_builder_add_contour( CFF_Builder*  builder );
233 
234 
235   /*************************************************************************/
236   /*************************************************************************/
237   /*****                                                               *****/
238   /*****                            PS BUILDER                         *****/
239   /*****                                                               *****/
240   /*************************************************************************/
241   /*************************************************************************/
242 
243   FT_LOCAL( void )
244   ps_builder_init( PS_Builder*  ps_builder,
245                    void*        builder,
246                    FT_Bool      is_t1 );
247 
248 
249   FT_LOCAL( void )
250   ps_builder_done( PS_Builder*  builder );
251 
252   FT_LOCAL( FT_Error )
253   ps_builder_check_points( PS_Builder*  builder,
254                            FT_Int       count );
255 
256   FT_LOCAL( void )
257   ps_builder_add_point( PS_Builder*  builder,
258                         FT_Pos       x,
259                         FT_Pos       y,
260                         FT_Byte      flag );
261 
262   FT_LOCAL( FT_Error )
263   ps_builder_add_point1( PS_Builder*  builder,
264                          FT_Pos       x,
265                          FT_Pos       y );
266 
267   FT_LOCAL( FT_Error )
268   ps_builder_add_contour( PS_Builder*  builder );
269 
270   FT_LOCAL( FT_Error )
271   ps_builder_start_point( PS_Builder*  builder,
272                           FT_Pos       x,
273                           FT_Pos       y );
274 
275   FT_LOCAL( void )
276   ps_builder_close_contour( PS_Builder*  builder );
277 
278 
279   /*************************************************************************/
280   /*************************************************************************/
281   /*****                                                               *****/
282   /*****                            OTHER                              *****/
283   /*****                                                               *****/
284   /*************************************************************************/
285   /*************************************************************************/
286 
287   FT_LOCAL( void )
288   ps_decoder_init( PS_Decoder*  ps_decoder,
289                    void*        decoder,
290                    FT_Bool      is_t1 );
291 
292   FT_LOCAL( void )
293   t1_make_subfont( FT_Face      face,
294                    PS_Private   priv,
295                    CFF_SubFont  subfont );
296 
297   FT_LOCAL( void )
298   t1_decrypt( FT_Byte*   buffer,
299               FT_Offset  length,
300               FT_UShort  seed );
301 
302 
303   FT_LOCAL( FT_UInt32 )
304   cff_random( FT_UInt32  r );
305 
306 
307 FT_END_HEADER
308 
309 #endif /* PSOBJS_H_ */
310 
311 
312 /* END */
313