1 | /**************************************************************************** |
2 | * |
3 | * cidparse.h |
4 | * |
5 | * CID-keyed Type1 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 CIDPARSE_H_ |
20 | #define CIDPARSE_H_ |
21 | |
22 | |
23 | #include <freetype/internal/t1types.h> |
24 | #include <freetype/internal/ftstream.h> |
25 | #include <freetype/internal/psaux.h> |
26 | |
27 | |
28 | FT_BEGIN_HEADER |
29 | |
30 | |
31 | /************************************************************************** |
32 | * |
33 | * @Struct: |
34 | * CID_Parser |
35 | * |
36 | * @Description: |
37 | * A CID_Parser is an object used to parse a Type 1 fonts very |
38 | * quickly. |
39 | * |
40 | * @Fields: |
41 | * root :: |
42 | * The root PS_ParserRec fields. |
43 | * |
44 | * stream :: |
45 | * The current input stream. |
46 | * |
47 | * postscript :: |
48 | * A pointer to the data to be parsed. |
49 | * |
50 | * postscript_len :: |
51 | * The length of the data to be parsed. |
52 | * |
53 | * data_offset :: |
54 | * The start position of the binary data (i.e., the |
55 | * end of the data to be parsed. |
56 | * |
57 | * binary_length :: |
58 | * The length of the data after the `StartData' |
59 | * command if the data format is hexadecimal. |
60 | * |
61 | * cid :: |
62 | * A structure which holds the information about |
63 | * the current font. |
64 | * |
65 | * num_dict :: |
66 | * The number of font dictionaries. |
67 | */ |
68 | typedef struct CID_Parser_ |
69 | { |
70 | PS_ParserRec root; |
71 | FT_Stream stream; |
72 | |
73 | FT_Byte* postscript; |
74 | FT_ULong postscript_len; |
75 | |
76 | FT_ULong data_offset; |
77 | |
78 | FT_ULong binary_length; |
79 | |
80 | CID_FaceInfo cid; |
81 | FT_UInt num_dict; |
82 | |
83 | } CID_Parser; |
84 | |
85 | |
86 | FT_LOCAL( FT_Error ) |
87 | cid_parser_new( CID_Parser* parser, |
88 | FT_Stream stream, |
89 | FT_Memory memory, |
90 | PSAux_Service psaux ); |
91 | |
92 | FT_LOCAL( void ) |
93 | cid_parser_done( CID_Parser* parser ); |
94 | |
95 | |
96 | /************************************************************************** |
97 | * |
98 | * PARSING ROUTINES |
99 | * |
100 | */ |
101 | |
102 | #define cid_parser_skip_spaces( p ) \ |
103 | (p)->root.funcs.skip_spaces( &(p)->root ) |
104 | #define cid_parser_skip_PS_token( p ) \ |
105 | (p)->root.funcs.skip_PS_token( &(p)->root ) |
106 | |
107 | #define cid_parser_to_int( p ) (p)->root.funcs.to_int( &(p)->root ) |
108 | #define cid_parser_to_fixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t ) |
109 | |
110 | #define cid_parser_to_coord_array( p, m, c ) \ |
111 | (p)->root.funcs.to_coord_array( &(p)->root, m, c ) |
112 | #define cid_parser_to_fixed_array( p, m, f, t ) \ |
113 | (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t ) |
114 | #define cid_parser_to_token( p, t ) \ |
115 | (p)->root.funcs.to_token( &(p)->root, t ) |
116 | #define cid_parser_to_token_array( p, t, m, c ) \ |
117 | (p)->root.funcs.to_token_array( &(p)->root, t, m, c ) |
118 | |
119 | #define cid_parser_load_field( p, f, o ) \ |
120 | (p)->root.funcs.load_field( &(p)->root, f, o, 0, 0 ) |
121 | #define cid_parser_load_field_table( p, f, o ) \ |
122 | (p)->root.funcs.load_field_table( &(p)->root, f, o, 0, 0 ) |
123 | |
124 | |
125 | FT_END_HEADER |
126 | |
127 | #endif /* CIDPARSE_H_ */ |
128 | |
129 | |
130 | /* END */ |
131 | |