1 /****************************************************************************
5 * CFF token stream parser (specification)
7 * Copyright (C) 1996-2020 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
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.
23 #include <freetype/internal/cfftypes.h>
24 #include <freetype/internal/ftobjs.h>
30 /* CFF uses constant parser stack size; */
31 /* CFF2 can increase from default 193 */
32 #define CFF_MAX_STACK_DEPTH 96
35 * There are plans to remove the `maxstack' operator in a forthcoming
36 * revision of the CFF2 specification, increasing the (then static) stack
37 * size to 513. By making the default stack size equal to the maximum
38 * stack size, the operator is essentially disabled, which has the
39 * desired effect in FreeType.
41 #define CFF2_MAX_STACK 513
42 #define CFF2_DEFAULT_STACK 513
44 #define CFF_CODE_TOPDICT 0x1000
45 #define CFF_CODE_PRIVATE 0x2000
46 #define CFF2_CODE_TOPDICT 0x3000
47 #define CFF2_CODE_FONTDICT 0x4000
48 #define CFF2_CODE_PRIVATE 0x5000
51 typedef struct CFF_ParserRec_
60 FT_UInt stackSize; /* allocated size */
62 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
63 FT_ListRec t2_strings;
64 #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
69 FT_UShort num_designs; /* a copy of `CFF_FontRecDict->num_designs' */
70 FT_UShort num_axes; /* a copy of `CFF_FontRecDict->num_axes' */
72 } CFF_ParserRec, *CFF_Parser;
76 cff_parse_num( CFF_Parser parser,
80 cff_parser_init( CFF_Parser parser,
85 FT_UShort num_designs,
89 cff_parser_done( CFF_Parser parser );
92 cff_parser_run( CFF_Parser parser,
102 cff_kind_fixed_thousand,
109 cff_kind_max /* do not remove */
113 /* now generate handlers for the most simple fields */
114 typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
116 typedef struct CFF_Field_Handler_
122 CFF_Field_Reader reader;
124 FT_UInt count_offset;
126 #ifdef FT_DEBUG_LEVEL_TRACE
136 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
137 typedef struct CFF_T2_String_
142 } CFF_T2_StringRec, *CFF_T2_String;
143 #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
145 #endif /* CFFPARSE_H_ */