summaryrefslogtreecommitdiff
path: root/include/freetype/fterrors.h
blob: bdfc8b01678d003550ae0442a9ab4ed88db17689 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/***************************************************************************/
/*                                                                         */
/*  fterrors.h                                                             */
/*                                                                         */
/*    FreeType error codes (specification).                                */
/*                                                                         */
/*  Copyright 1996-2000 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.                                        */
/*                                                                         */
/*                                                                         */
/*  This special header file is used to define the FT2 enumeration         */
/*  constants. It can also be used to generate error message strings       */
/*  with a small macro trick explained below.                              */
/*                                                                         */
/*  I - Error Formats:                                                     */
/*  ------------------                                                     */
/*                                                                         */
/*    Since release 2.1, the error constants have changed. The lower byte  */
/*    of the error value gives the "generic" error code, while the higher  */
/*    bytes indicates in which module the error occured.                   */
/*                                                                         */
/*    You can use the macro FT_ERROR_BASE(x) macro to extract the          */
/*    generic error code from a FT_Error                                   */
/*                                                                         */
/*    The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can       */
/*    be undefined in ftoption.h in order to make the higher byte always   */
/*    zero, in case you'd need to be compatible with previous versions     */
/*    of FT2.                                                              */
/*                                                                         */
/*                                                                         */
/*  II - Error Message strings:                                            */
/*  ---------------------------                                            */
/*                                                                         */
/*    The error definitions below are made through special macros that     */
/*    allow client applications to build a table of error message strings  */
/*    if they need it. The strings are not included in a normal build of   */
/*    FT2 to save space (most client apps do not use them)                 */
/*                                                                         */
/*    To do so, you'll need to define the following macros before          */
/*    including this file:                                                 */
/*                                                                         */
/*    FT_ERROR_START_LIST ::                                               */
/*       this macro is called before anything else to define the           */
/*       start of the error list. It is followed by several                */
/*       FT_ERROR_DEF calls (see below)                                    */
/*                                                                         */
/*    FT_ERROR_DEF( e, v, s ) ::                                           */
/*        this macro is called to define one single error.                 */
/*        'e' is the error code identifier (e.g. FT_Err_Invalid_Argument)  */
/*        'v' is the error numerical value                                 */
/*        's' is the corresponding error string                            */
/*                                                                         */
/*    FT_ERROR_END_LIST ::                                                 */
/*        this macro is used to end the list.                              */
/*                                                                         */
/*    Additionally, you'll need to undefine __FTERRORS_H__ before          */
/*    #including this file.                                                */
/*                                                                         */
/*    Here's a simple example:                                             */
/*                                                                         */
/*     {                                                                   */
/*       #undef __FTERRORS_H__                                             */
/*       #define FT_ERRORDEF( e, v, s )   { e, s },                        */
/*       #define FT_ERROR_START_LIST      {                                */
/*       #define FT_ERROR_END_LIST        { 0, 0 } };                      */
/*                                                                         */
/*       const struct                                                      */
/*       {                                                                 */
/*         int          err_code;                                          */
/*         const char*  err_msg                                            */
/*       } ft_errors[] =                                                   */
/*                                                                         */
/*       #include FT_ERRORS_H                                              */
/*     }                                                                   */
/*                                                                         */
/*                                                                         */
/***************************************************************************/

#ifndef __FTERRORS_H__
#define __FTERRORS_H__


  /*******************************************************************/
  /*******************************************************************/
  /*****                                                         *****/
  /*****                       SETUP MACROS                      *****/
  /*****                                                         *****/
  /*******************************************************************/
  /*******************************************************************/

#include FT_MODULE_ERRORS_H

#undef FT_NEED_EXTERN_C
#ifndef FT_ERRORDEF

#  define FT_ERRORDEF( e, v, s )  e = v,

#  ifdef __cplusplus
#  define FT_NEED_EXTERN_C
      extern "C" {
#  endif

#endif /* !FT_ERRORDEF */


#ifndef FT_ERROR_START_LIST
#  define FT_ERROR_START_LIST  enum {
#endif

#ifndef FT_ERROR_END_LIST
#  define FT_ERROR_END_LIST    FT_Err_Max };
#endif



#define FT_ERRORDEF_( e, v, s )   \
        FT_ERRORDEF( FT_Err_ ## e, v + FT_Mod_Err_Base, s )
          
#define FT_NOERRORDEF_( e, v, s ) \
        FT_ERRORDEF( FT_Err_ ## e, v, s )


  /*******************************************************************/
  /*******************************************************************/
  /*****                                                         *****/
  /*****                   LIST ERROR CODES/MESSAGES             *****/
  /*****                                                         *****/
  /*******************************************************************/
  /*******************************************************************/

  FT_ERROR_START_LIST


  /* generic errors */

  FT_NOERRORDEF_( Ok,                                        0x00, \
                  "no error" )

  FT_ERRORDEF_( Cannot_Open_Resource,                        0x01, \
               "cannot open resource" )
  FT_ERRORDEF_( Unknown_File_Format,                         0x02, \
               "unknown file format" )
  FT_ERRORDEF_( Invalid_File_Format,                         0x03, \
               "broken file" )
  FT_ERRORDEF_( Invalid_Version,                             0x04, \
               "invalid FreeType version" )
  FT_ERRORDEF_( Lower_Module_Version,                        0x05, \
               "module version is too low" )
  FT_ERRORDEF_( Invalid_Argument,                            0x06, \
               "invalid argument" )
  FT_ERRORDEF_( Unimplemented_Feature,                       0x07, \
               "unimplemented feature" )

  /* glyph/character errors */

  FT_ERRORDEF_( Invalid_Glyph_Index,                         0x10, \
               "invalid glyph index" )
  FT_ERRORDEF_( Invalid_Character_Code,                      0x11, \
               "invalid character code" )
  FT_ERRORDEF_( Invalid_Glyph_Format,                        0x12, \
               "unsupported glyph image format" )
  FT_ERRORDEF_( Cannot_Render_Glyph,                         0x13, \
               "cannot render this glyph format" )
  FT_ERRORDEF_( Invalid_Outline,                             0x14, \
               "invalid outline" )
  FT_ERRORDEF_( Invalid_Composite,                           0x15, \
               "invalid composite glyph" )
  FT_ERRORDEF_( Too_Many_Hints,                              0x16, \
               "too many hints" )
  FT_ERRORDEF_( Invalid_Pixel_Size,                          0x17, \
               "invalid pixel size" )

  /* handle errors */

  FT_ERRORDEF_( Invalid_Handle,                              0x20, \
               "invalid object handle" )
  FT_ERRORDEF_( Invalid_Library_Handle,                      0x21, \
               "invalid library handle" )
  FT_ERRORDEF_( Invalid_Driver_Handle,                       0x22, \
               "invalid module handle" )
  FT_ERRORDEF_( Invalid_Face_Handle,                         0x23, \
               "invalid face handle" )
  FT_ERRORDEF_( Invalid_Size_Handle,                         0x24, \
               "invalid size handle" )
  FT_ERRORDEF_( Invalid_Slot_Handle,                         0x25, \
               "invalid glyph slot handle" )
  FT_ERRORDEF_( Invalid_CharMap_Handle,                      0x26, \
               "invalid charmap handle" )
  FT_ERRORDEF_( Invalid_Cache_Handle,                        0x27, \
               "invalid cache manager handle" )
  FT_ERRORDEF_( Invalid_Stream_Handle,                       0x28, \
               "invalid stream handle" )

  /* driver errors */

  FT_ERRORDEF_( Too_Many_Drivers,                            0x30, \
               "too many modules" )
  FT_ERRORDEF_( Too_Many_Extensions,                         0x31, \
               "too many extensions" )

  /* memory errors */

  FT_ERRORDEF_( Out_Of_Memory,                               0x40, \
               "out of memory" )
  FT_ERRORDEF_( Unlisted_Object,                             0x41, \
               "unlisted object" )

  /* stream errors */

  FT_ERRORDEF_( Cannot_Open_Stream,                          0x51, \
               "cannot open stream" )
  FT_ERRORDEF_( Invalid_Stream_Seek,                         0x52, \
               "invalid stream seek" )
  FT_ERRORDEF_( Invalid_Stream_Skip,                         0x53, \
               "invalid stream skip" )
  FT_ERRORDEF_( Invalid_Stream_Read,                         0x54, \
               "invalid stream read" )
  FT_ERRORDEF_( Invalid_Stream_Operation,                    0x55, \
               "invalid stream operation" )
  FT_ERRORDEF_( Invalid_Frame_Operation,                     0x56, \
               "invalid frame operation" )
  FT_ERRORDEF_( Nested_Frame_Access,                         0x57, \
               "nested frame access" )
  FT_ERRORDEF_( Invalid_Frame_Read,                          0x58, \
               "invalid frame read" )

  /* raster errors */

  FT_ERRORDEF_( Raster_Uninitialized,                        0x60, \
               "raster uninitialized" )
  FT_ERRORDEF_( Raster_Corrupted,                            0x61, \
               "raster corrupted" )
  FT_ERRORDEF_( Raster_Overflow,                             0x62, \
               "raster overflow" )
  FT_ERRORDEF_( Raster_Negative_Height,                      0x63, \
               "negative height while rastering" )

  /* cache errors */

  FT_ERRORDEF_( Too_Many_Caches,                             0x70, \
               "too many registered caches" )

  /* TrueType and SFNT errors */

  FT_ERRORDEF_( Invalid_Opcode,                              0x80, \
               "invalid opcode" )
  FT_ERRORDEF_( Too_Few_Arguments,                           0x81, \
               "too few arguments" )
  FT_ERRORDEF_( Stack_Overflow,                              0x82, \
               "stack overflow" )
  FT_ERRORDEF_( Code_Overflow,                               0x83, \
               "code overflow" )
  FT_ERRORDEF_( Bad_Argument,                                0x84, \
               "bad argument" )
  FT_ERRORDEF_( Divide_By_Zero,                              0x85, \
               "division by zero" )
  FT_ERRORDEF_( Invalid_Reference,                           0x86, \
               "invalid reference" )
  FT_ERRORDEF_( Debug_OpCode,                                0x87, \
               "found debug opcode" )
  FT_ERRORDEF_( ENDF_In_Exec_Stream,                         0x88, \
               "found ENDF opcode in execution stream" )
  FT_ERRORDEF_( Nested_DEFS,                                 0x89, \
               "nested DEFS" )
  FT_ERRORDEF_( Invalid_CodeRange,                           0x8A, \
               "invalid code range" )
  FT_ERRORDEF_( Execution_Too_Long,                          0x8B, \
               "execution context too long" )
  FT_ERRORDEF_( Too_Many_Function_Defs,                      0x8C, \
               "too many function definitions" )
  FT_ERRORDEF_( Too_Many_Instruction_Defs,                   0x8D, \
               "too many instruction definitions" )
  FT_ERRORDEF_( Table_Missing,                               0x8E, \
               "SFNT font table missing" )
  FT_ERRORDEF_( Horiz_Header_Missing,                        0x8F, \
               "horizontal header (hhea) table missing" )
  FT_ERRORDEF_( Locations_Missing,                           0x90, \
               "locations (loca) table missing" )
  FT_ERRORDEF_( Name_Table_Missing,                          0x91, \
               "name table missing" )
  FT_ERRORDEF_( CMap_Table_Missing,                          0x92, \
               "character map (cmap) table missing" )
  FT_ERRORDEF_( Hmtx_Table_Missing,                          0x93, \
               "horizontal metrics (hmtx) table missing" )
  FT_ERRORDEF_( Post_Table_Missing,                          0x94, \
               "PostScript (post) table missing" )
  FT_ERRORDEF_( Invalid_Horiz_Metrics,                       0x95, \
               "invalid horizontal metrics" )
  FT_ERRORDEF_( Invalid_CharMap_Format,                      0x96, \
               "invalid character map (cmap) format" )
  FT_ERRORDEF_( Invalid_PPem,                                0x97, \
               "invalid ppem value" )
  FT_ERRORDEF_( Invalid_Vert_Metrics,                        0x98, \
               "invalid vertical metrics" )
  FT_ERRORDEF_( Could_Not_Find_Context,                      0x99, \
               "could not find context" )
  FT_ERRORDEF_( Invalid_Post_Table_Format,                   0x9A, \
               "invalid PostScript (post) table format" )
  FT_ERRORDEF_( Invalid_Post_Table,                          0x9B, \
               "invalid PostScript (post) table" )

  /* CFF, CID, and Type 1 errors */

  FT_ERRORDEF_( Syntax_Error,                                0xA0, \
               "opcode syntax error" )
  FT_ERRORDEF_( Stack_Underflow,                             0xA1, \
               "argument stack underflow" )


  FT_ERROR_END_LIST


  /*******************************************************************/
  /*******************************************************************/
  /*****                                                         *****/
  /*****                      SIMPLE CLEANUPP                    *****/
  /*****                                                         *****/
  /*******************************************************************/
  /*******************************************************************/

#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_


#ifdef FT_NEED_EXTERN_C
  }
#endif

#endif /* __FT_ERRORS_H__ */

/* END */