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