54876
|
1 |
/****************************************************************************
|
|
2 |
*
|
|
3 |
* ftmoderr.h
|
|
4 |
*
|
|
5 |
* FreeType module error offsets (specification).
|
|
6 |
*
|
|
7 |
* Copyright (C) 2001-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 |
*/
|
49234
|
17 |
|
|
18 |
|
54876
|
19 |
/**************************************************************************
|
|
20 |
*
|
|
21 |
* This file is used to define the FreeType module error codes.
|
|
22 |
*
|
|
23 |
* If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is
|
|
24 |
* set, the lower byte of an error value identifies the error code as
|
|
25 |
* usual. In addition, the higher byte identifies the module. For
|
|
26 |
* example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the
|
|
27 |
* error `TT_Err_Invalid_File_Format` has value 0x1303, the error
|
|
28 |
* `T1_Err_Invalid_File_Format` has value 0x1403, etc.
|
|
29 |
*
|
|
30 |
* Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero,
|
|
31 |
* including the high byte.
|
|
32 |
*
|
|
33 |
* If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an
|
|
34 |
* error value is set to zero.
|
|
35 |
*
|
|
36 |
* To hide the various `XXX_Err_` prefixes in the source code, FreeType
|
|
37 |
* provides some macros in `fttypes.h`.
|
|
38 |
*
|
|
39 |
* FT_ERR( err )
|
|
40 |
*
|
|
41 |
* Add current error module prefix (as defined with the `FT_ERR_PREFIX`
|
|
42 |
* macro) to `err`. For example, in the BDF module the line
|
|
43 |
*
|
|
44 |
* ```
|
|
45 |
* error = FT_ERR( Invalid_Outline );
|
|
46 |
* ```
|
|
47 |
*
|
|
48 |
* expands to
|
|
49 |
*
|
|
50 |
* ```
|
|
51 |
* error = BDF_Err_Invalid_Outline;
|
|
52 |
* ```
|
|
53 |
*
|
|
54 |
* For simplicity, you can always use `FT_Err_Ok` directly instead of
|
|
55 |
* `FT_ERR( Ok )`.
|
|
56 |
*
|
|
57 |
* FT_ERR_EQ( errcode, err )
|
|
58 |
* FT_ERR_NEQ( errcode, err )
|
|
59 |
*
|
|
60 |
* Compare error code `errcode` with the error `err` for equality and
|
|
61 |
* inequality, respectively. Example:
|
|
62 |
*
|
|
63 |
* ```
|
|
64 |
* if ( FT_ERR_EQ( error, Invalid_Outline ) )
|
|
65 |
* ...
|
|
66 |
* ```
|
|
67 |
*
|
|
68 |
* Using this macro you don't have to think about error prefixes. Of
|
|
69 |
* course, if module errors are not active, the above example is the
|
|
70 |
* same as
|
|
71 |
*
|
|
72 |
* ```
|
|
73 |
* if ( error == FT_Err_Invalid_Outline )
|
|
74 |
* ...
|
|
75 |
* ```
|
|
76 |
*
|
|
77 |
* FT_ERROR_BASE( errcode )
|
|
78 |
* FT_ERROR_MODULE( errcode )
|
|
79 |
*
|
|
80 |
* Get base error and module error code, respectively.
|
|
81 |
*
|
|
82 |
* It can also be used to create a module error message table easily with
|
|
83 |
* something like
|
|
84 |
*
|
|
85 |
* ```
|
|
86 |
* #undef FTMODERR_H_
|
|
87 |
* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s },
|
|
88 |
* #define FT_MODERR_START_LIST {
|
|
89 |
* #define FT_MODERR_END_LIST { 0, 0 } };
|
|
90 |
*
|
|
91 |
* const struct
|
|
92 |
* {
|
|
93 |
* int mod_err_offset;
|
|
94 |
* const char* mod_err_msg
|
|
95 |
* } ft_mod_errors[] =
|
|
96 |
*
|
|
97 |
* #include FT_MODULE_ERRORS_H
|
|
98 |
* ```
|
|
99 |
*
|
|
100 |
*/
|
49234
|
101 |
|
|
102 |
|
|
103 |
#ifndef FTMODERR_H_
|
|
104 |
#define FTMODERR_H_
|
|
105 |
|
|
106 |
|
|
107 |
/*******************************************************************/
|
|
108 |
/*******************************************************************/
|
|
109 |
/***** *****/
|
|
110 |
/***** SETUP MACROS *****/
|
|
111 |
/***** *****/
|
|
112 |
/*******************************************************************/
|
|
113 |
/*******************************************************************/
|
|
114 |
|
|
115 |
|
|
116 |
#undef FT_NEED_EXTERN_C
|
|
117 |
|
|
118 |
#ifndef FT_MODERRDEF
|
|
119 |
|
|
120 |
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
|
|
121 |
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
|
|
122 |
#else
|
|
123 |
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
|
|
124 |
#endif
|
|
125 |
|
|
126 |
#define FT_MODERR_START_LIST enum {
|
|
127 |
#define FT_MODERR_END_LIST FT_Mod_Err_Max };
|
|
128 |
|
|
129 |
#ifdef __cplusplus
|
|
130 |
#define FT_NEED_EXTERN_C
|
|
131 |
extern "C" {
|
|
132 |
#endif
|
|
133 |
|
|
134 |
#endif /* !FT_MODERRDEF */
|
|
135 |
|
|
136 |
|
|
137 |
/*******************************************************************/
|
|
138 |
/*******************************************************************/
|
|
139 |
/***** *****/
|
|
140 |
/***** LIST MODULE ERROR BASES *****/
|
|
141 |
/***** *****/
|
|
142 |
/*******************************************************************/
|
|
143 |
/*******************************************************************/
|
|
144 |
|
|
145 |
|
|
146 |
#ifdef FT_MODERR_START_LIST
|
|
147 |
FT_MODERR_START_LIST
|
|
148 |
#endif
|
|
149 |
|
|
150 |
|
|
151 |
FT_MODERRDEF( Base, 0x000, "base module" )
|
|
152 |
FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
|
|
153 |
FT_MODERRDEF( BDF, 0x200, "BDF module" )
|
|
154 |
FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" )
|
|
155 |
FT_MODERRDEF( Cache, 0x400, "cache module" )
|
|
156 |
FT_MODERRDEF( CFF, 0x500, "CFF module" )
|
|
157 |
FT_MODERRDEF( CID, 0x600, "CID module" )
|
|
158 |
FT_MODERRDEF( Gzip, 0x700, "Gzip module" )
|
|
159 |
FT_MODERRDEF( LZW, 0x800, "LZW module" )
|
|
160 |
FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" )
|
|
161 |
FT_MODERRDEF( PCF, 0xA00, "PCF module" )
|
|
162 |
FT_MODERRDEF( PFR, 0xB00, "PFR module" )
|
|
163 |
FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" )
|
|
164 |
FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" )
|
|
165 |
FT_MODERRDEF( PSnames, 0xE00, "PS names module" )
|
|
166 |
FT_MODERRDEF( Raster, 0xF00, "raster module" )
|
|
167 |
FT_MODERRDEF( SFNT, 0x1000, "SFNT module" )
|
|
168 |
FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" )
|
|
169 |
FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
|
|
170 |
FT_MODERRDEF( Type1, 0x1300, "Type 1 module" )
|
|
171 |
FT_MODERRDEF( Type42, 0x1400, "Type 42 module" )
|
|
172 |
FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
|
|
173 |
FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
|
|
174 |
|
|
175 |
|
|
176 |
#ifdef FT_MODERR_END_LIST
|
|
177 |
FT_MODERR_END_LIST
|
|
178 |
#endif
|
|
179 |
|
|
180 |
|
|
181 |
/*******************************************************************/
|
|
182 |
/*******************************************************************/
|
|
183 |
/***** *****/
|
|
184 |
/***** CLEANUP *****/
|
|
185 |
/***** *****/
|
|
186 |
/*******************************************************************/
|
|
187 |
/*******************************************************************/
|
|
188 |
|
|
189 |
|
|
190 |
#ifdef FT_NEED_EXTERN_C
|
|
191 |
}
|
|
192 |
#endif
|
|
193 |
|
|
194 |
#undef FT_MODERR_START_LIST
|
|
195 |
#undef FT_MODERR_END_LIST
|
|
196 |
#undef FT_MODERRDEF
|
|
197 |
#undef FT_NEED_EXTERN_C
|
|
198 |
|
|
199 |
|
|
200 |
#endif /* FTMODERR_H_ */
|
|
201 |
|
|
202 |
|
|
203 |
/* END */
|