1 /***************************************************************************/
5 /* FreeType error codes (specification). */
7 /* Copyright 1996-2001 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. */
16 /***************************************************************************/
19 /*************************************************************************/
21 /* This special header file is used to define the FT2 enumeration */
22 /* constants. It can also be used to generate error message strings */
23 /* with a small macro trick explained below. */
25 /* I - Error Formats */
26 /* ----------------- */
28 /* Since release 2.1, the error constants have changed. The lower */
29 /* byte of the error value gives the "generic" error code, while the */
30 /* higher byte indicates in which module the error occured. */
32 /* You can use the macro FT_ERROR_BASE(x) macro to extract the generic */
33 /* error code from an FT_Error value. */
35 /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
36 /* undefined in ftoption.h in order to make the higher byte always */
37 /* zero, in case you need to be compatible with previous versions of */
41 /* II - Error Message strings */
42 /* -------------------------- */
44 /* The error definitions below are made through special macros that */
45 /* allow client applications to build a table of error message strings */
46 /* if they need it. The strings are not included in a normal build of */
47 /* FreeType 2 to save space (most client applications do not use */
50 /* To do so, you have to define the following macros before including */
53 /* FT_ERROR_START_LIST :: */
54 /* This macro is called before anything else to define the start of */
55 /* the error list. It is followed by several FT_ERROR_DEF calls */
58 /* FT_ERROR_DEF( e, v, s ) :: */
59 /* This macro is called to define one single error. */
60 /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
61 /* `v' is the error numerical value. */
62 /* `s' is the corresponding error string. */
64 /* FT_ERROR_END_LIST :: */
65 /* This macro ends the list. */
67 /* Additionally, you have to undefine __FTERRORS_H__ before #including */
70 /* Here is a simple example: */
73 /* #undef __FTERRORS_H__ */
74 /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
75 /* #define FT_ERROR_START_LIST { */
76 /* #define FT_ERROR_END_LIST { 0, 0 } }; */
81 /* const char* err_msg */
84 /* #include FT_ERRORS_H */
87 /*************************************************************************/
90 #ifndef __FTERRORS_H__
91 #define __FTERRORS_H__
94 /* include module base error codes */
95 #include FT_MODULE_ERRORS_H
98 /*******************************************************************/
99 /*******************************************************************/
101 /***** SETUP MACROS *****/
103 /*******************************************************************/
104 /*******************************************************************/
107 #undef FT_NEED_EXTERN_C
108 #define FT_ERR_XCAT( x, y ) x ## y
109 #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
112 /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
113 /* By default, we use `FT_Err_'. */
115 #ifndef FT_ERR_PREFIX
116 #define FT_ERR_PREFIX FT_Err_
120 /* FT_ERR_BASE is used as the base for module-specific errors. */
122 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
125 #define FT_ERR_BASE FT_Mod_Err_Base
131 #define FT_ERR_BASE 0
133 #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
136 /* If FT_ERRORDEF is not defined, we need to define a simple */
137 /* enumeration type. */
141 #define FT_ERRORDEF( e, v, s ) e = v,
142 #define FT_ERROR_START_LIST enum {
143 #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
146 #define FT_NEED_EXTERN_C
150 #endif /* !FT_ERRORDEF */
153 /* this macro is used to define an error */
154 #define FT_ERRORDEF_( e, v, s ) \
155 FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
157 /* this is only used for FT_Err_Ok, which must be 0! */
158 #define FT_NOERRORDEF_( e, v, s ) \
159 FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
162 /*******************************************************************/
163 /*******************************************************************/
165 /***** LIST OF ERROR CODES/MESSAGES *****/
167 /*******************************************************************/
168 /*******************************************************************/
171 #ifdef FT_ERROR_START_LIST
178 FT_NOERRORDEF_( Ok, 0x00, \
181 FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
182 "cannot open resource" )
183 FT_ERRORDEF_( Unknown_File_Format, 0x02, \
184 "unknown file format" )
185 FT_ERRORDEF_( Invalid_File_Format, 0x03, \
187 FT_ERRORDEF_( Invalid_Version, 0x04, \
188 "invalid FreeType version" )
189 FT_ERRORDEF_( Lower_Module_Version, 0x05, \
190 "module version is too low" )
191 FT_ERRORDEF_( Invalid_Argument, 0x06, \
193 FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
194 "unimplemented feature" )
196 /* glyph/character errors */
198 FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
199 "invalid glyph index" )
200 FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
201 "invalid character code" )
202 FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
203 "unsupported glyph image format" )
204 FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
205 "cannot render this glyph format" )
206 FT_ERRORDEF_( Invalid_Outline, 0x14, \
208 FT_ERRORDEF_( Invalid_Composite, 0x15, \
209 "invalid composite glyph" )
210 FT_ERRORDEF_( Too_Many_Hints, 0x16, \
212 FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
213 "invalid pixel size" )
217 FT_ERRORDEF_( Invalid_Handle, 0x20, \
218 "invalid object handle" )
219 FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
220 "invalid library handle" )
221 FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
222 "invalid module handle" )
223 FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
224 "invalid face handle" )
225 FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
226 "invalid size handle" )
227 FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
228 "invalid glyph slot handle" )
229 FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
230 "invalid charmap handle" )
231 FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
232 "invalid cache manager handle" )
233 FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
234 "invalid stream handle" )
238 FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
240 FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
241 "too many extensions" )
245 FT_ERRORDEF_( Out_Of_Memory, 0x40, \
247 FT_ERRORDEF_( Unlisted_Object, 0x41, \
252 FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
253 "cannot open stream" )
254 FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
255 "invalid stream seek" )
256 FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
257 "invalid stream skip" )
258 FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
259 "invalid stream read" )
260 FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
261 "invalid stream operation" )
262 FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
263 "invalid frame operation" )
264 FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
265 "nested frame access" )
266 FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
267 "invalid frame read" )
271 FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
272 "raster uninitialized" )
273 FT_ERRORDEF_( Raster_Corrupted, 0x61, \
275 FT_ERRORDEF_( Raster_Overflow, 0x62, \
277 FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
278 "negative height while rastering" )
282 FT_ERRORDEF_( Too_Many_Caches, 0x70, \
283 "too many registered caches" )
285 /* TrueType and SFNT errors */
287 FT_ERRORDEF_( Invalid_Opcode, 0x80, \
289 FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
290 "too few arguments" )
291 FT_ERRORDEF_( Stack_Overflow, 0x82, \
293 FT_ERRORDEF_( Code_Overflow, 0x83, \
295 FT_ERRORDEF_( Bad_Argument, 0x84, \
297 FT_ERRORDEF_( Divide_By_Zero, 0x85, \
299 FT_ERRORDEF_( Invalid_Reference, 0x86, \
300 "invalid reference" )
301 FT_ERRORDEF_( Debug_OpCode, 0x87, \
302 "found debug opcode" )
303 FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
304 "found ENDF opcode in execution stream" )
305 FT_ERRORDEF_( Nested_DEFS, 0x89, \
307 FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
308 "invalid code range" )
309 FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
310 "execution context too long" )
311 FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
312 "too many function definitions" )
313 FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
314 "too many instruction definitions" )
315 FT_ERRORDEF_( Table_Missing, 0x8E, \
316 "SFNT font table missing" )
317 FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
318 "horizontal header (hhea) table missing" )
319 FT_ERRORDEF_( Locations_Missing, 0x90, \
320 "locations (loca) table missing" )
321 FT_ERRORDEF_( Name_Table_Missing, 0x91, \
322 "name table missing" )
323 FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
324 "character map (cmap) table missing" )
325 FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
326 "horizontal metrics (hmtx) table missing" )
327 FT_ERRORDEF_( Post_Table_Missing, 0x94, \
328 "PostScript (post) table missing" )
329 FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
330 "invalid horizontal metrics" )
331 FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
332 "invalid character map (cmap) format" )
333 FT_ERRORDEF_( Invalid_PPem, 0x97, \
334 "invalid ppem value" )
335 FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
336 "invalid vertical metrics" )
337 FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
338 "could not find context" )
339 FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
340 "invalid PostScript (post) table format" )
341 FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
342 "invalid PostScript (post) table" )
344 /* CFF, CID, and Type 1 errors */
346 FT_ERRORDEF_( Syntax_Error, 0xA0, \
347 "opcode syntax error" )
348 FT_ERRORDEF_( Stack_Underflow, 0xA1, \
349 "argument stack underflow" )
352 #ifdef FT_ERROR_END_LIST
357 /*******************************************************************/
358 /*******************************************************************/
360 /***** SIMPLE CLEANUP *****/
362 /*******************************************************************/
363 /*******************************************************************/
365 #ifdef FT_NEED_EXTERN_C
369 #undef FT_ERROR_START_LIST
370 #undef FT_ERROR_END_LIST
374 #undef FT_NOERRORDEF_
376 #undef FT_NEED_EXTERN_C
381 #endif /* __FTERRORS_H__ */