summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
blob: fbc437bc3803530b65e2815c02f051133faead8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/****************************************************************************
 *
 * cidparse.h
 *
 *   CID-keyed Type1 parser (specification).
 *
 * Copyright (C) 1996-2021 by
 * David Turner, Robert Wilhelm, and Werner Lemberg.
 *
 * This file is part of the FreeType project, and may only be used,
 * modified, and distributed under the terms of the FreeType project
 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
 * this file you indicate that you have read the license and
 * understand and accept it fully.
 *
 */


#ifndef CIDPARSE_H_
#define CIDPARSE_H_


#include <freetype/internal/t1types.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/psaux.h>


FT_BEGIN_HEADER


  /**************************************************************************
   *
   * @Struct:
   *   CID_Parser
   *
   * @Description:
   *   A CID_Parser is an object used to parse a Type 1 fonts very
   *   quickly.
   *
   * @Fields:
   *   root ::
   *     The root PS_ParserRec fields.
   *
   *   stream ::
   *     The current input stream.
   *
   *   postscript ::
   *     A pointer to the data to be parsed.
   *
   *   postscript_len ::
   *     The length of the data to be parsed.
   *
   *   data_offset ::
   *     The start position of the binary data (i.e., the
   *     end of the data to be parsed.
   *
   *   binary_length ::
   *     The length of the data after the `StartData'
   *     command if the data format is hexadecimal.
   *
   *   cid ::
   *     A structure which holds the information about
   *     the current font.
   *
   *   num_dict ::
   *     The number of font dictionaries.
   */
  typedef struct  CID_Parser_
  {
    PS_ParserRec  root;
    FT_Stream     stream;

    FT_Byte*      postscript;
    FT_ULong      postscript_len;

    FT_ULong      data_offset;

    FT_ULong      binary_length;

    CID_FaceInfo  cid;
    FT_UInt       num_dict;

  } CID_Parser;


  FT_LOCAL( FT_Error )
  cid_parser_new( CID_Parser*    parser,
                  FT_Stream      stream,
                  FT_Memory      memory,
                  PSAux_Service  psaux );

  FT_LOCAL( void )
  cid_parser_done( CID_Parser*  parser );


  /**************************************************************************
   *
   *                           PARSING ROUTINES
   *
   */

#define cid_parser_skip_spaces( p )                 \
          (p)->root.funcs.skip_spaces( &(p)->root )
#define cid_parser_skip_PS_token( p )                 \
          (p)->root.funcs.skip_PS_token( &(p)->root )

#define cid_parser_to_int( p )       (p)->root.funcs.to_int( &(p)->root )
#define cid_parser_to_fixed( p, t )  (p)->root.funcs.to_fixed( &(p)->root, t )

#define cid_parser_to_coord_array( p, m, c )                 \
          (p)->root.funcs.to_coord_array( &(p)->root, m, c )
#define cid_parser_to_fixed_array( p, m, f, t )                 \
          (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
#define cid_parser_to_token( p, t )                 \
          (p)->root.funcs.to_token( &(p)->root, t )
#define cid_parser_to_token_array( p, t, m, c )                 \
          (p)->root.funcs.to_token_array( &(p)->root, t, m, c )

#define cid_parser_load_field( p, f, o )                       \
          (p)->root.funcs.load_field( &(p)->root, f, o, 0, 0 )
#define cid_parser_load_field_table( p, f, o )                       \
          (p)->root.funcs.load_field_table( &(p)->root, f, o, 0, 0 )


FT_END_HEADER

#endif /* CIDPARSE_H_ */


/* END */