1/****************************************************************************
2 *
3 * t1parse.h
4 *
5 * Type 1 parser (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 T1PARSE_H_
20#define T1PARSE_H_
21
22
23#include <freetype/internal/t1types.h>
24#include <freetype/internal/ftstream.h>
25
26
27FT_BEGIN_HEADER
28
29
30 /**************************************************************************
31 *
32 * @Struct:
33 * T1_ParserRec
34 *
35 * @Description:
36 * A PS_ParserRec is an object used to parse a Type 1 fonts very
37 * quickly.
38 *
39 * @Fields:
40 * root ::
41 * The root parser.
42 *
43 * stream ::
44 * The current input stream.
45 *
46 * base_dict ::
47 * A pointer to the top-level dictionary.
48 *
49 * base_len ::
50 * The length in bytes of the top dictionary.
51 *
52 * private_dict ::
53 * A pointer to the private dictionary.
54 *
55 * private_len ::
56 * The length in bytes of the private dictionary.
57 *
58 * in_pfb ::
59 * A boolean. Indicates that we are handling a PFB
60 * file.
61 *
62 * in_memory ::
63 * A boolean. Indicates a memory-based stream.
64 *
65 * single_block ::
66 * A boolean. Indicates that the private dictionary
67 * is stored in lieu of the base dictionary.
68 */
69 typedef struct T1_ParserRec_
70 {
71 PS_ParserRec root;
72 FT_Stream stream;
73
74 FT_Byte* base_dict;
75 FT_ULong base_len;
76
77 FT_Byte* private_dict;
78 FT_ULong private_len;
79
80 FT_Bool in_pfb;
81 FT_Bool in_memory;
82 FT_Bool single_block;
83
84 } T1_ParserRec, *T1_Parser;
85
86
87#define T1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
88#define T1_Release_Table( p ) \
89 do \
90 { \
91 if ( (p)->funcs.release ) \
92 (p)->funcs.release( p ); \
93 } while ( 0 )
94
95
96#define T1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
97#define T1_Skip_PS_Token( p ) (p)->root.funcs.skip_PS_token( &(p)->root )
98
99#define T1_ToInt( p ) (p)->root.funcs.to_int( &(p)->root )
100#define T1_ToFixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
101
102#define T1_ToCoordArray( p, m, c ) \
103 (p)->root.funcs.to_coord_array( &(p)->root, m, c )
104#define T1_ToFixedArray( p, m, f, t ) \
105 (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
106#define T1_ToToken( p, t ) \
107 (p)->root.funcs.to_token( &(p)->root, t )
108#define T1_ToTokenArray( p, t, m, c ) \
109 (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
110
111#define T1_Load_Field( p, f, o, m, pf ) \
112 (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
113
114#define T1_Load_Field_Table( p, f, o, m, pf ) \
115 (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
116
117
118 FT_LOCAL( FT_Error )
119 T1_New_Parser( T1_Parser parser,
120 FT_Stream stream,
121 FT_Memory memory,
122 PSAux_Service psaux );
123
124 FT_LOCAL( FT_Error )
125 T1_Get_Private_Dict( T1_Parser parser,
126 PSAux_Service psaux );
127
128 FT_LOCAL( void )
129 T1_Finalize_Parser( T1_Parser parser );
130
131
132FT_END_HEADER
133
134#endif /* T1PARSE_H_ */
135
136
137/* END */
138