From 1f7f0e87e58168b2e739e2622db0ee06e0c9accc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 6 Jun 2001 17:30:41 +0000 Subject: [PATCH] Complete redesign of error codes. Please check ftmoderr.h for more details. * include/freetype/internal/cfferrs.h, include/freetype/internal/tterrors.h, include/freetype/internal/t1errors.h: Removed. Replaced with files local to the module. All extra error codes have been moved to `fterrors.h'. * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, src/smooth/ftsmerrs.h, src/truetype/tterrors.h, src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the error names for the module it belongs to. * include/freetype/ftmoderr.h: New file, defining the module error offsets. Its structure is similar to `fterrors.h'. * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. (FT_ERRORDEF): Redefined to use module error offsets. All internal error codes are now public; unused error codes have been removed, some are new. * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New macro. * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. All other source files have been updated to use the new error codes; some already existing (internal) error codes local to a module have been renamed to give them the same name as in the base module. All make files have been updated to include the local error files. * src/cid/cidtokens.h: Replaced with... * src/cid/cidtoken.h: This file for 8+3 consistency. * src/raster/ftraster.c: Use macros for header file names. --- ChangeLog | 44 +++++++ include/freetype/config/ftheader.h | 12 ++ include/freetype/config/ftoption.h | 16 +++ include/freetype/fterrors.h | 186 +++++++++++++++++++-------- include/freetype/ftmoderr.h | 123 ++++++++++++++++++ include/freetype/internal/cfferrs.h | 136 -------------------- include/freetype/internal/internal.h | 7 +- include/freetype/internal/t1errors.h | 76 ----------- include/freetype/internal/tterrors.h | 131 ------------------- src/autohint/aherrors.h | 43 +++++++ src/autohint/ahglyph.c | 13 +- src/autohint/ahhint.c | 5 +- src/autohint/rules.mk | 3 +- src/cache/ftcchunk.c | 6 +- src/cache/ftcerror.h | 43 +++++++ src/cache/ftcglyph.c | 4 +- src/cache/ftcimage.c | 6 +- src/cache/ftcmanag.c | 10 +- src/cache/ftcsbits.c | 6 +- src/cache/ftlru.c | 8 +- src/cache/rules.mk | 3 +- src/cff/cffdrivr.c | 6 +- src/cff/cfferrs.h | 43 +++++++ src/cff/cffgload.c | 2 +- src/cff/cffload.c | 3 +- src/cff/cffobjs.c | 3 +- src/cff/cffobjs.h | 1 - src/cff/cffparse.c | 3 +- src/cff/rules.mk | 3 +- src/cid/ciderrs.h | 43 +++++++ src/cid/cidgload.c | 4 +- src/cid/cidload.c | 14 +- src/cid/cidobjs.c | 6 +- src/cid/cidobjs.h | 1 - src/cid/cidparse.c | 6 +- src/cid/cidriver.c | 4 +- src/cid/{cidtokens.h => cidtoken.h} | 2 +- src/cid/rules.mk | 3 +- src/pcf/pcfdriver.c | 21 +-- src/pcf/pcferror.h | 43 +++++++ src/pcf/pcfread.c | 61 ++++----- src/pcf/rules.mk | 3 +- src/psaux/psauxerr.h | 44 +++++++ src/psaux/psobjs.c | 19 +-- src/psaux/rules.mk | 3 +- src/psaux/t1decode.c | 22 ++-- src/psnames/psmodule.c | 5 +- src/psnames/psnamerr.h | 44 +++++++ src/psnames/rules.mk | 3 +- src/raster/ftraster.c | 24 ++-- src/raster/ftrend1.c | 14 +- src/raster/rasterrs.h | 44 +++++++ src/raster/rules.mk | 3 +- src/sfnt/rules.mk | 3 +- src/sfnt/sferrors.h | 42 ++++++ src/sfnt/sfobjs.c | 13 +- src/sfnt/ttcmap.c | 13 +- src/sfnt/ttload.c | 43 ++++--- src/sfnt/ttpost.c | 22 ++-- src/sfnt/ttpost.h | 4 - src/sfnt/ttsbit.c | 33 ++--- src/smooth/ftgrays.c | 7 +- src/smooth/ftsmerrs.h | 44 +++++++ src/smooth/ftsmooth.c | 10 +- src/smooth/rules.mk | 3 +- src/truetype/rules.mk | 3 +- src/truetype/ttdriver.c | 5 +- src/truetype/tterrors.h | 43 +++++++ src/truetype/ttgload.c | 8 +- src/truetype/ttinterp.c | 4 +- src/truetype/ttobjs.c | 3 +- src/truetype/ttobjs.h | 1 - src/truetype/ttpload.c | 4 +- src/type1/rules.mk | 3 +- src/type1/t1driver.c | 2 + src/type1/t1errors.h | 43 +++++++ src/type1/t1gload.c | 2 + src/type1/t1load.c | 3 +- src/type1/t1objs.c | 2 + src/type1/t1objs.h | 1 - src/type1/t1parse.c | 4 +- src/winfonts/fnterrs.h | 44 +++++++ src/winfonts/rules.mk | 3 +- src/winfonts/winfnt.c | 18 +-- 84 files changed, 1190 insertions(+), 624 deletions(-) create mode 100644 include/freetype/ftmoderr.h delete mode 100644 include/freetype/internal/cfferrs.h delete mode 100644 include/freetype/internal/t1errors.h delete mode 100644 include/freetype/internal/tterrors.h create mode 100644 src/autohint/aherrors.h create mode 100644 src/cache/ftcerror.h create mode 100644 src/cff/cfferrs.h create mode 100644 src/cid/ciderrs.h rename src/cid/{cidtokens.h => cidtoken.h} (98%) create mode 100644 src/pcf/pcferror.h create mode 100644 src/psaux/psauxerr.h create mode 100644 src/psnames/psnamerr.h create mode 100644 src/raster/rasterrs.h create mode 100644 src/sfnt/sferrors.h create mode 100644 src/smooth/ftsmerrs.h create mode 100644 src/truetype/tterrors.h create mode 100644 src/type1/t1errors.h create mode 100644 src/winfonts/fnterrs.h diff --git a/ChangeLog b/ChangeLog index ed3560459..8bdd79692 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,49 @@ 2001-06-06 Werner Lemberg + Complete redesign of error codes. Please check ftmoderr.h for more + details. + + * include/freetype/internal/cfferrs.h, + include/freetype/internal/tterrors.h, + include/freetype/internal/t1errors.h: Removed. Replaced with files + local to the module. All extra error codes have been moved to + `fterrors.h'. + + * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. + + * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, + src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, + src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, + src/smooth/ftsmerrs.h, src/truetype/tterrors.h, + src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the + error names for the module it belongs to. + + * include/freetype/ftmoderr.h: New file, defining the module error + offsets. Its structure is similar to `fterrors.h'. + + * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. + (FT_ERRORDEF): Redefined to use module error offsets. + All internal error codes are now public; unused error codes have + been removed, some are new. + + * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New + macro. + * include/freetype/config/ftoption.h + (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. + + All other source files have been updated to use the new error codes; + some already existing (internal) error codes local to a module have + been renamed to give them the same name as in the base module. + + All make files have been updated to include the local error files. + +2001-06-06 Werner Lemberg + + * src/cid/cidtokens.h: Replaced with... + * src/cid/cidtoken.h: This file for 8+3 consistency. + + * src/raster/ftraster.c: Use macros for header file names. + * src/include/freetype/tttables.h (TT_HoriHeader_, TT_VertHeader_): Fix length of `Reserved' array. Note that this isn't the real fix since recent OpenType specs have introduced a `CaretOffset' field diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index e39c3cd3c..01a0f656f 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -164,6 +164,18 @@ #define FT_ERRORS_H + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_MODULE_ERRORS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the list of FreeType 2 module error offsets (and messages). */ + /* */ +#define FT_MODULE_ERRORS_H + + /*************************************************************************/ /* */ /* @macro: */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index f5f733740..567c865b6 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -73,6 +73,22 @@ FT_BEGIN_HEADER #undef FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS + /*************************************************************************/ + /* */ + /* Module errors */ + /* */ + /* If this macro is set (which is the default), the higher byte of an */ + /* error code gives the module in which the error has occurred, while */ + /* the lower byte is the real error code. */ + /* */ + /* Unsetting this macro makes sense for backwards compatibility; only */ + /* the real error code is emitted, and the higher byte is always zero. */ + /* */ + /* More details can be found in the files ftmoderr.h and fterrors.h. */ + /* */ +#define FT_CONFIG_OPTION_USE_MODULE_ERRORS + + /*************************************************************************/ /* */ /* Alternate Glyph Image Format support */ diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index 5db4509f9..5cd3e090b 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -19,14 +19,25 @@ /*************************************************************************/ /* */ /* This file is used to define the FreeType error enumeration constants. */ + /* */ + /* The lower byte gives the error code, the higher byte gives the */ + /* module. The base module has error offset 0. For example, the error */ + /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ + /* `TT_Err_Invalid_File_Format' has value 0xB03, the error */ + /* `T1_Err_Invalid_File_Format' has value 0xC03, etc. */ + /* */ + /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS (in ftoption.h) */ + /* to make the higher byte always zero. */ + /* */ /* It can also be used to create an error message table easily with */ /* something like */ /* */ /* { */ /* #undef __FTERRORS_H__ */ - /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ - /* #define FT_ERROR_START_LIST { */ - /* #define FT_ERROR_END_LIST { 0, 0 } }; */ + /* #define FT_ERRORDEF( e, v, s ) { FT_Err_ ## e, s }, */ + /* #define FT_NOERRORDEF( e, v, s ) { FT_Err_ ## e, s }, */ + /* #define FT_ERROR_START_LIST { */ + /* #define FT_ERROR_END_LIST { 0, 0 } }; */ /* */ /* const struct */ /* { */ @@ -37,8 +48,8 @@ /* #include FT_ERRORS_H */ /* } */ /* */ - /* For C++ it might be necessary to use `extern "C" {' and to define */ - /* FT_NEED_EXTERN_C also. */ + /* To use such a table, all errors must be ANDed with 0x00FF to remove */ + /* the module error offset. */ /* */ /*************************************************************************/ @@ -46,15 +57,18 @@ #ifndef __FTERRORS_H__ #define __FTERRORS_H__ +#include FT_MODULE_ERRORS_H #undef FT_NEED_EXTERN_C #ifndef FT_ERRORDEF -#define FT_ERRORDEF( e, v, s ) e = v, -#define FT_ERROR_START_LIST enum { -#define FT_ERROR_END_LIST FT_Err_Max }; +#define FT_ERRORDEF( e, v, s ) FT_Err_ ## e = v + FT_Mod_Err_Base, +#define FT_NOERRORDEF( e, v, s ) FT_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FT_Err_Max }; #ifdef __cplusplus #define FT_NEED_EXTERN_C @@ -68,119 +82,182 @@ FT_ERROR_START_LIST #endif + /* generic errors */ - FT_ERRORDEF( FT_Err_Ok, 0x0000, \ - "no error" ) - FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, \ + FT_NOERRORDEF( Ok, 0x00, \ + "no error" ) + + FT_ERRORDEF( Cannot_Open_Resource, 0x01, \ "cannot open resource" ) - FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, \ + FT_ERRORDEF( Unknown_File_Format, 0x02, \ "unknown file format" ) - FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, \ + FT_ERRORDEF( Invalid_File_Format, 0x03, \ "broken file" ) - FT_ERRORDEF( FT_Err_Invalid_Version, 0x0004, \ + FT_ERRORDEF( Invalid_Version, 0x04, \ "invalid FreeType version" ) - FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0005, \ + FT_ERRORDEF( Lower_Module_Version, 0x05, \ "module version is too low" ) - FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0006, \ + FT_ERRORDEF( Invalid_Argument, 0x06, \ "invalid argument" ) - FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0007, \ + FT_ERRORDEF( Unimplemented_Feature, 0x07, \ "unimplemented feature" ) /* glyph/character errors */ - FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0010, \ + FT_ERRORDEF( Invalid_Glyph_Index, 0x10, \ "invalid glyph index" ) - FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0011, \ + FT_ERRORDEF( Invalid_Character_Code, 0x11, \ "invalid character code" ) - FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0012, \ + FT_ERRORDEF( Invalid_Glyph_Format, 0x12, \ "unsupported glyph image format" ) - FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0013, \ + FT_ERRORDEF( Cannot_Render_Glyph, 0x13, \ "cannot render this glyph format" ) - FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0014, \ + FT_ERRORDEF( Invalid_Outline, 0x14, \ "invalid outline" ) - FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0015, \ + FT_ERRORDEF( Invalid_Composite, 0x15, \ "invalid composite glyph" ) - FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0016, \ + FT_ERRORDEF( Too_Many_Hints, 0x16, \ "too many hints" ) - FT_ERRORDEF( FT_Err_Invalid_Pixel_Size, 0x0017, \ + FT_ERRORDEF( Invalid_Pixel_Size, 0x17, \ "invalid pixel size" ) /* handle errors */ - FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0020, \ + FT_ERRORDEF( Invalid_Handle, 0x20, \ "invalid object handle" ) - FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0021, \ + FT_ERRORDEF( Invalid_Library_Handle, 0x21, \ "invalid library handle" ) - FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0022, \ + FT_ERRORDEF( Invalid_Driver_Handle, 0x22, \ "invalid module handle" ) - FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0023, \ + FT_ERRORDEF( Invalid_Face_Handle, 0x23, \ "invalid face handle" ) - FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0024, \ + FT_ERRORDEF( Invalid_Size_Handle, 0x24, \ "invalid size handle" ) - FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0025, \ + FT_ERRORDEF( Invalid_Slot_Handle, 0x25, \ "invalid glyph slot handle" ) - FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0026, \ + FT_ERRORDEF( Invalid_CharMap_Handle, 0x26, \ "invalid charmap handle" ) - FT_ERRORDEF( FT_Err_Invalid_Cache_Handle, 0x0027, \ + FT_ERRORDEF( Invalid_Cache_Handle, 0x27, \ "invalid cache manager handle" ) - FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0028, \ + FT_ERRORDEF( Invalid_Stream_Handle, 0x28, \ "invalid stream handle" ) /* driver errors */ - FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0030, \ + FT_ERRORDEF( Too_Many_Drivers, 0x30, \ "too many modules" ) - FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0031, \ + FT_ERRORDEF( Too_Many_Extensions, 0x31, \ "too many extensions" ) /* memory errors */ - FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0040, \ + FT_ERRORDEF( Out_Of_Memory, 0x40, \ "out of memory" ) - FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0041, \ + FT_ERRORDEF( Unlisted_Object, 0x41, \ "unlisted object" ) /* stream errors */ - FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0051, \ + FT_ERRORDEF( Cannot_Open_Stream, 0x51, \ "cannot open stream" ) - FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0052, \ + FT_ERRORDEF( Invalid_Stream_Seek, 0x52, \ "invalid stream seek" ) - FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0053, \ + FT_ERRORDEF( Invalid_Stream_Skip, 0x53, \ "invalid stream skip" ) - FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0054, \ + FT_ERRORDEF( Invalid_Stream_Read, 0x54, \ "invalid stream read" ) - FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0055, \ + FT_ERRORDEF( Invalid_Stream_Operation, 0x55, \ "invalid stream operation" ) - FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0056, \ + FT_ERRORDEF( Invalid_Frame_Operation, 0x56, \ "invalid frame operation" ) - FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0057, \ + FT_ERRORDEF( Nested_Frame_Access, 0x57, \ "nested frame access" ) - FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0058, \ + FT_ERRORDEF( Invalid_Frame_Read, 0x58, \ "invalid frame read" ) /* raster errors */ - FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0060, \ + FT_ERRORDEF( Raster_Uninitialized, 0x60, \ "raster uninitialized" ) - FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0061, \ + FT_ERRORDEF( Raster_Corrupted, 0x61, \ "raster corrupted" ) - FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0062, \ + FT_ERRORDEF( Raster_Overflow, 0x62, \ "raster overflow" ) - FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0063, \ + FT_ERRORDEF( Raster_Negative_Height, 0x63, \ "negative height while rastering" ) /* cache errors */ - FT_ERRORDEF( FT_Err_Too_Many_Caches, 0x0070, \ + FT_ERRORDEF( Too_Many_Caches, 0x70, \ "too many registered caches" ) - /* range 0x400 - 0x4FF is reserved for TrueType specific stuff */ + /* TrueType and SFNT errors */ - /* range 0x500 - 0x5FF is reserved for CFF specific stuff */ + 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" ) - /* range 0x600 - 0x6FF is reserved for Type1 specific stuff */ #ifdef FT_ERROR_END_LIST FT_ERROR_END_LIST @@ -190,6 +267,7 @@ #undef FT_ERROR_START_LIST #undef FT_ERROR_END_LIST #undef FT_ERRORDEF +#undef FT_NOERRORDEF #ifdef FT_NEED_EXTERN_C diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h new file mode 100644 index 000000000..71252a1cc --- /dev/null +++ b/include/freetype/ftmoderr.h @@ -0,0 +1,123 @@ +/***************************************************************************/ +/* */ +/* ftmoderr.h */ +/* */ +/* FreeType module error offsets (specification). */ +/* */ +/* Copyright 2001 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 file is used to define the FreeType module error offsets. */ + /* */ + /* The lower byte gives the error code, the higher byte gives the */ + /* module. The base module has error offset 0. For example, the error */ + /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ + /* `TT_Err_Invalid_File_Format' has value 0xB03, the error */ + /* `T1_Err_Invalid_File_Format' has value 0xC03, etc. */ + /* */ + /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ + /* to make the higher byte always zero (disabling the module error */ + /* mechanism). */ + /* */ + /* It can also be used to create a module error message table easily */ + /* with something like */ + /* */ + /* { */ + /* #undef __FTMODERR_H__ */ + /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ + /* #define FT_MODERR_START_LIST { */ + /* #define FT_MODERR_END_LIST { 0, 0 } }; */ + /* */ + /* const struct */ + /* { */ + /* int mod_err_offset; */ + /* const char* mod_err_msg */ + /* } ft_mod_errors[] = */ + /* */ + /* #include FT_MODULE_ERRORS_H */ + /* } */ + /* */ + /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ + /* the error code. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTMODERR_H__ +#define __FTMODERR_H__ + + +#undef FT_NEED_EXTERN_C + + + + +#ifndef FT_MODERRDEF + +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, +#else +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, +#endif + +#define FT_MODERR_START_LIST enum { +#define FT_MODERR_END_LIST FT_Mod_Err_Max }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C + extern "C" { +#endif + +#endif /* !FT_MODERRDEF */ + + +#ifdef FT_MODERR_START_LIST + FT_MODERR_START_LIST +#endif + + + FT_MODERRDEF( Base, 0x000, "base module" ) + FT_MODERRDEF( Autohint, 0x100, "autohinter module" ) + FT_MODERRDEF( Cache, 0x200, "cache module" ) + FT_MODERRDEF( CFF, 0x300, "CFF module" ) + FT_MODERRDEF( CID, 0x400, "CID module" ) + FT_MODERRDEF( PCF, 0x500, "PCF module" ) + FT_MODERRDEF( PSaux, 0x600, "PS auxiliary module" ) + FT_MODERRDEF( PSnames, 0x700, "PS names module" ) + FT_MODERRDEF( Raster, 0x800, "raster module" ) + FT_MODERRDEF( SFNT, 0x900, "SFNT module" ) + FT_MODERRDEF( Smooth, 0xA00, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0xB00, "TrueType module" ) + FT_MODERRDEF( Type1, 0xC00, "Type 1 module" ) + FT_MODERRDEF( Winfonts, 0xD00, "Windows FON/FNT module" ) + + +#ifdef FT_MODERR_END_LIST + FT_MODERR_END_LIST +#endif + + +#undef FT_MODERR_START_LIST +#undef FT_MODERR_END_LIST +#undef FT_MODERRDEF + + +#ifdef FT_NEED_EXTERN_C + } +#endif + +#endif /* __FTMODERR_H__ */ + + +/* END */ diff --git a/include/freetype/internal/cfferrs.h b/include/freetype/internal/cfferrs.h deleted file mode 100644 index c84e87563..000000000 --- a/include/freetype/internal/cfferrs.h +++ /dev/null @@ -1,136 +0,0 @@ -/***************************************************************************/ -/* */ -/* cfferrs.h */ -/* */ -/* OpenType error ID definitions (specification only). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#ifndef __CFFERRORS_H__ -#define __CFFERRORS_H__ - - -#include - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* Error codes declaration */ - /* */ - /* The error codes are grouped in `classes' used to indicate the `level' */ - /* at which the error happened. The class is given by an error code's */ - /* high byte. */ - /* */ - /*************************************************************************/ - - - /* Success is always 0. */ - -#define CFF_Err_Ok FT_Err_Ok - - /* High level API errors. */ - -#define CFF_Err_Unknown_File_Format FT_Err_Unknown_File_Format -#define CFF_Err_Invalid_File_Format FT_Err_Invalid_File_Format -#define CFF_Err_Invalid_Argument FT_Err_Invalid_Argument -#define CFF_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle -#define CFF_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define CFF_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle -#define CFF_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle -#define CFF_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle -#define CFF_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index - -#define CFF_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature - -#define CFF_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle - - /* Internal errors. */ - -#define CFF_Err_Out_Of_Memory FT_Err_Out_Of_Memory -#define CFF_Err_Unlisted_Object FT_Err_Unlisted_Object - - /* General glyph outline errors. */ - -#define CFF_Err_Invalid_Composite FT_Err_Invalid_Composite - - /* CFF parser errors. */ - -#define CFF_Err_Stack_Underflow FT_Err_Invalid_Argument -#define CFF_Err_Syntax_Error FT_Err_Invalid_Argument - - /* Bytecode interpreter error codes. */ - - /* These error codes are produced by the TrueType */ - /* bytecode interpreter. They usually indicate a */ - /* broken font file, a broken glyph within a font */ - /* file, or a bug in the interpreter! */ - -#define CFF_Err_Invalid_Opcode 0x500 -#define CFF_Err_Too_Few_Arguments 0x501 -#define CFF_Err_Stack_Overflow 0x502 -#define CFF_Err_Code_Overflow 0x503 -#define CFF_Err_Bad_Argument 0x504 -#define CFF_Err_Divide_By_Zero 0x505 -#define CFF_Err_Storage_Overflow 0x506 -#define CFF_Err_Cvt_Overflow 0x507 -#define CFF_Err_Invalid_Reference 0x508 -#define CFF_Err_Invalid_Distance 0x509 -#define CFF_Err_Interpolate_Twilight 0x50A -#define CFF_Err_Debug_OpCode 0x50B -#define CFF_Err_ENDF_In_Exec_Stream 0x50C -#define CFF_Err_Out_Of_CodeRanges 0x50D -#define CFF_Err_Nested_DEFS 0x50E -#define CFF_Err_Invalid_CodeRange 0x50F -#define CFF_Err_Invalid_Displacement 0x510 -#define CFF_Err_Execution_Too_Long 0x511 - -#define CFF_Err_Too_Many_Instruction_Defs 0x512 -#define CFF_Err_Too_Many_Function_Defs 0x513 - - /* Other TrueType specific error codes. */ - -#define CFF_Err_Table_Missing 0x520 -#define CFF_Err_Too_Many_Extensions 0x521 -#define CFF_Err_Extensions_Unsupported 0x522 -#define CFF_Err_Invalid_Extension_Id 0x523 - -#define CFF_Err_No_Vertical_Data 0x524 - -#define CFF_Err_Max_Profile_Missing 0x530 -#define CFF_Err_Header_Table_Missing 0x531 -#define CFF_Err_Horiz_Header_Missing 0x532 -#define CFF_Err_Locations_Missing 0x533 -#define CFF_Err_Name_Table_Missing 0x534 -#define CFF_Err_CMap_Table_Missing 0x535 -#define CFF_Err_Hmtx_Table_Missing 0x536 -#define CFF_Err_OS2_Table_Missing 0x537 -#define CFF_Err_Post_Table_Missing 0x538 - -#define CFF_Err_Invalid_Horiz_Metrics 0x540 -#define CFF_Err_Invalid_CharMap_Format 0x541 -#define CFF_Err_Invalid_PPem 0x542 -#define CFF_Err_Invalid_Vert_Metrics 0x543 - -#define CFF_Err_Could_Not_Find_Context 0x550 - - -FT_END_HEADER - - -#endif /* __CFFERRORS_H__ */ - - -/* END */ diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h index ecda8a729..58003e900 100644 --- a/include/freetype/internal/internal.h +++ b/include/freetype/internal/internal.h @@ -36,19 +36,14 @@ #define FT_INTERNAL_SFNT_H #define FT_INTERNAL_TRUETYPE_TYPES_H -#define FT_INTERNAL_TRUETYPE_ERRORS_H - -#define FT_INTERNAL_TYPE1_ERRORS_H #define FT_INTERNAL_TYPE1_TYPES_H - -#define FT_INTERNAL_CFF_ERRORS_H #define FT_INTERNAL_CFF_TYPES_H +#define FT_INTERNAL_FNT_TYPES_H #define FT_INTERNAL_POSTSCRIPT_NAMES_H #define FT_INTERNAL_POSTSCRIPT_AUX_H #define FT_INTERNAL_AUTOHINT_H -#define FT_INTERNAL_FNT_TYPES_H /* END */ diff --git a/include/freetype/internal/t1errors.h b/include/freetype/internal/t1errors.h deleted file mode 100644 index 20a64ae47..000000000 --- a/include/freetype/internal/t1errors.h +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************/ -/* */ -/* t1errors.h */ -/* */ -/* Type 1 error ID definitions (specification only). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#ifndef __T1ERRORS_H__ -#define __T1ERRORS_H__ - - -#include - - -FT_BEGIN_HEADER - - - /************************ error codes declaration **************/ - - /* The error codes are grouped into `classes' used to indicate the */ - /* `level' at which the error happened. */ - /* */ - /* The class is given by an error code's high byte. */ - - - /* ------------- Success is always 0 -------- */ - -#define T1_Err_Ok FT_Err_Ok - - /* ----------- high level API errors -------- */ - -#define T1_Err_Unknown_File_Format FT_Err_Unknown_File_Format -#define T1_Err_Invalid_File_Format FT_Err_Invalid_File_Format -#define T1_Err_Invalid_Argument FT_Err_Invalid_Argument -#define T1_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle -#define T1_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define T1_Err_Invalid_Size_Handle FT_Err_Invalid_Size_Handle -#define T1_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle -#define T1_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle -#define T1_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index - -#define T1_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature - -#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle - - /* ------------- internal errors ------------ */ - -#define T1_Err_Out_Of_Memory FT_Err_Out_Of_Memory -#define T1_Err_Unlisted_Object FT_Err_Unlisted_Object - - /* ------------ general glyph outline errors ------ */ - -#define T1_Err_Invalid_Composite FT_Err_Invalid_Composite - -#define T1_Err_Syntax_Error FT_Err_Invalid_File_Format -#define T1_Err_Stack_Underflow FT_Err_Invalid_File_Format -#define T1_Err_Stack_Overflow FT_Err_Invalid_File_Format - - -FT_END_HEADER - -#endif /* __T1ERRORS_H__ */ - - -/* END */ diff --git a/include/freetype/internal/tterrors.h b/include/freetype/internal/tterrors.h deleted file mode 100644 index d4da57665..000000000 --- a/include/freetype/internal/tterrors.h +++ /dev/null @@ -1,131 +0,0 @@ -/***************************************************************************/ -/* */ -/* tterrors.h */ -/* */ -/* TrueType error ID definitions (specification only). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#ifndef __TTERRORS_H__ -#define __TTERRORS_H__ - - -#include - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /* Error codes declaration */ - /* */ - /* The error codes are grouped in `classes' used to indicate the `level' */ - /* at which the error happened. The class is given by an error code's */ - /* high byte. */ - /* */ - /*************************************************************************/ - - - /* Success is always 0. */ - -#define TT_Err_Ok FT_Err_Ok - - /* High level API errors. */ - -#define TT_Err_Unknown_File_Format FT_Err_Unknown_File_Format -#define TT_Err_Invalid_File_Format FT_Err_Invalid_File_Format -#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument -#define TT_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle -#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define TT_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle -#define TT_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle -#define TT_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle -#define TT_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index - -#define TT_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature - -#define TT_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle - - /* Internal errors. */ - -#define TT_Err_Out_Of_Memory FT_Err_Out_Of_Memory -#define TT_Err_Unlisted_Object FT_Err_Unlisted_Object - - /* General glyph outline errors. */ - -#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints -#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite - - /* Bytecode interpreter error codes. */ - - /* These error codes are produced by the TrueType */ - /* bytecode interpreter. They usually indicate a */ - /* broken font file, a broken glyph within a font */ - /* file, or a bug in the interpreter! */ - -#define TT_Err_Invalid_Opcode 0x400 -#define TT_Err_Too_Few_Arguments 0x401 -#define TT_Err_Stack_Overflow 0x402 -#define TT_Err_Code_Overflow 0x403 -#define TT_Err_Bad_Argument 0x404 -#define TT_Err_Divide_By_Zero 0x405 -#define TT_Err_Storage_Overflow 0x406 -#define TT_Err_Cvt_Overflow 0x407 -#define TT_Err_Invalid_Reference 0x408 -#define TT_Err_Invalid_Distance 0x409 -#define TT_Err_Interpolate_Twilight 0x40A -#define TT_Err_Debug_OpCode 0x40B -#define TT_Err_ENDF_In_Exec_Stream 0x40C -#define TT_Err_Out_Of_CodeRanges 0x40D -#define TT_Err_Nested_DEFS 0x40E -#define TT_Err_Invalid_CodeRange 0x40F -#define TT_Err_Invalid_Displacement 0x410 -#define TT_Err_Execution_Too_Long 0x411 -#define TT_Err_Too_Many_Function_Defs 0x412 -#define TT_Err_Too_Many_Instruction_Defs 0x413 - - /* Other TrueType specific error codes. */ - -#define TT_Err_Table_Missing 0x420 -#define TT_Err_Too_Many_Extensions 0x421 -#define TT_Err_Extensions_Unsupported 0x422 -#define TT_Err_Invalid_Extension_Id 0x423 - -#define TT_Err_No_Vertical_Data 0x424 - -#define TT_Err_Max_Profile_Missing 0x430 -#define TT_Err_Header_Table_Missing 0x431 -#define TT_Err_Horiz_Header_Missing 0x432 -#define TT_Err_Locations_Missing 0x433 -#define TT_Err_Name_Table_Missing 0x434 -#define TT_Err_CMap_Table_Missing 0x435 -#define TT_Err_Hmtx_Table_Missing 0x436 -#define TT_Err_OS2_Table_Missing 0x437 -#define TT_Err_Post_Table_Missing 0x438 - -#define TT_Err_Invalid_Horiz_Metrics 0x440 -#define TT_Err_Invalid_CharMap_Format 0x441 -#define TT_Err_Invalid_PPem 0x442 -#define TT_Err_Invalid_Vert_Metrics 0x443 - -#define TT_Err_Could_Not_Find_Context 0x450 - - -FT_END_HEADER - - -#endif /* __TTERRORS_H__ */ - - -/* END */ diff --git a/src/autohint/aherrors.h b/src/autohint/aherrors.h new file mode 100644 index 000000000..25a6f8b15 --- /dev/null +++ b/src/autohint/aherrors.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* aherrors.h */ +/* */ +/* Autohinter error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the Autohinter error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __AHERRORS_H__ +#define __AHERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) AH_Err_ ## e = v + FT_Mod_Err_Autohint, +#define FT_NOERRORDEF( e, v, s ) AH_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST AH_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __AHERRORS_H__ */ + +/* END */ diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 6656ba48b..7df9e4126 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -24,6 +24,7 @@ #include "ahglyph.h" #include "ahangles.h" #include "ahglobal.h" +#include "aherrors.h" #include @@ -388,7 +389,7 @@ FT_Face face ) { FT_Memory memory = outline->memory; - FT_Error error = FT_Err_Ok; + FT_Error error = AH_Err_Ok; FT_Outline* source = &face->glyph->outline; FT_Int num_points = source->n_points; FT_Int num_contours = source->n_contours; @@ -399,7 +400,7 @@ if ( !face || !face->size || face->glyph->format != ft_glyph_format_outline ) - return FT_Err_Invalid_Argument; + return AH_Err_Invalid_Argument; /* first of all, reallocate the contours array if necessary */ if ( num_contours > outline->max_contours ) @@ -1316,7 +1317,7 @@ AH_Globals* globals = &face_globals->design; FT_Fixed y_scale = outline->y_scale; - FT_Bool blue_active[ ah_blue_max ]; + FT_Bool blue_active[ah_blue_max]; /* compute which blue zones are active, i.e. have their scaled */ @@ -1325,14 +1326,16 @@ AH_Blue blue; FT_Bool check = 0; + for ( blue = ah_blue_capital_top; blue < ah_blue_max; blue++ ) { FT_Pos ref, shoot, dist; + ref = globals->blue_refs[blue]; shoot = globals->blue_shoots[blue]; dist = ref-shoot; - if (dist < 0) + if ( dist < 0 ) dist = -dist; blue_active[blue] = 0; @@ -1345,7 +1348,7 @@ } /* return immediately if no blue zone is active */ - if (!check) + if ( !check ) return; } diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index ead32fde5..5f177d19b 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -23,6 +23,7 @@ #include "ahhint.h" #include "ahglyph.h" #include "ahangles.h" +#include "aherrors.h" #include FT_OUTLINE_H @@ -1241,7 +1242,7 @@ if ( start_point + k >= num_base_points || l >= (FT_UInt)num_new_points ) { - error = FT_Err_Invalid_Composite; + error = AH_Err_Invalid_Composite; goto Exit; } @@ -1279,7 +1280,7 @@ default: /* we don't support other formats (yet?) */ - error = FT_Err_Unimplemented_Feature; + error = AH_Err_Unimplemented_Feature; } Hint_Metrics: diff --git a/src/autohint/rules.mk b/src/autohint/rules.mk index c6f275bf0..5b8d46ce7 100644 --- a/src/autohint/rules.mk +++ b/src/autohint/rules.mk @@ -39,7 +39,8 @@ AUTO_DRV_SRC := $(AUTO_DIR_)ahangles.c \ # AUTO_DRV_H := $(AUTO_DRV_SRC:%c=%h) \ $(AUTO_DIR_)ahloader.h \ - $(AUTO_DIR_)ahtypes.h + $(AUTO_DIR_)ahtypes.h \ + $(AUTO_DIR_)aherrors.h # AUTO driver object(s) diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c index f7bb541d8..788098d64 100644 --- a/src/cache/ftcchunk.c +++ b/src/cache/ftcchunk.c @@ -23,6 +23,8 @@ #include FT_ERRORS_H #include FT_INTERNAL_OBJECTS_H +#include "ftcerror.h" + /*************************************************************************/ /*************************************************************************/ @@ -223,7 +225,7 @@ *anode = 0; if ( glyph_index >= cset->element_max ) - error = FT_Err_Invalid_Argument; + error = FTC_Err_Invalid_Argument; else { FT_UInt chunk_size = cset->element_count; @@ -401,7 +403,7 @@ /* check for valid `desc' delayed to FT_Lru_Lookup() */ if ( !cache || !anode || !aindex ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; *anode = 0; *aindex = 0; diff --git a/src/cache/ftcerror.h b/src/cache/ftcerror.h new file mode 100644 index 000000000..456c249d2 --- /dev/null +++ b/src/cache/ftcerror.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* ftcerror.h */ +/* */ +/* Caching sub-system error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the caching sub-system error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __FTCERROR_H__ +#define __FTCERROR_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) FTC_Err_ ## e = v + FT_Mod_Err_Cache, +#define FT_NOERRORDEF( e, v, s ) FTC_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FTC_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __FTCERROR_H__ */ + +/* END */ diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 40633e6b2..9af2af9e1 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -24,6 +24,8 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H +#include "ftcerror.h" + /*************************************************************************/ /*************************************************************************/ @@ -433,7 +435,7 @@ /* check for valid `desc' delayed to FT_Lru_Lookup() */ if ( !cache || !anode ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; *anode = 0; gset = cache->last_gset; diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 9d48bbec6..1ad044f98 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -21,6 +21,8 @@ #include FT_CACHE_IMAGE_H #include FT_INTERNAL_MEMORY_H +#include "ftcerror.h" + #include /* memcmp() */ #include /* labs() */ @@ -143,7 +145,7 @@ node->ft_glyph = glyph; } else - error = FT_Err_Invalid_Argument; + error = FTC_Err_Invalid_Argument; } } @@ -284,7 +286,7 @@ /* some argument checks are delayed to FTC_Glyph_Cache_Lookup */ if (!aglyph) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; error = FTC_Glyph_Cache_Lookup( (FTC_Glyph_Cache)cache, desc, gindex, &node ); diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index a39e7fab9..dad724aef 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -23,6 +23,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_LIST_H +#include "ftcerror.h" + #undef FT_COMPONENT #define FT_COMPONENT trace_cache @@ -224,7 +226,7 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FTC_Err_Invalid_Library_Handle; memory = library->memory; @@ -328,7 +330,7 @@ FT_Face *aface ) { if ( !manager ) - return FT_Err_Invalid_Cache_Handle; + return FTC_Err_Invalid_Cache_Handle; return FT_Lru_Lookup( manager->faces_lru, (FT_LruKey)face_id, @@ -436,7 +438,7 @@ FTC_Cache_Class* clazz, FTC_Cache *acache ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FTC_Err_Invalid_Argument; if ( manager && clazz && acache ) @@ -459,7 +461,7 @@ /* return an error if there are too many registered caches */ if ( index >= FTC_MAX_CACHES ) { - error = FT_Err_Too_Many_Caches; + error = FTC_Err_Too_Many_Caches; FT_ERROR(( "FTC_Manager_Register_Cache:" )); FT_ERROR(( " too many registered caches\n" )); goto Exit; diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index adb295ba3..7d22b6e52 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -23,6 +23,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_ERRORS_H +#include "ftcerror.h" + #include /* memcmp() */ @@ -144,7 +146,7 @@ { FT_ERROR(( "FTC_SBit_Cache: cannot load scalable glyphs in an" " sbit cache, please check your arguments!\n" )); - error = FT_Err_Invalid_Argument; + error = FTC_Err_Invalid_Argument; goto Exit; } @@ -378,7 +380,7 @@ /* argument checks delayed to FTC_Chunk_Cache_Lookup */ if ( !ansbit ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; *ansbit = 0; error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex, diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c index 783ccbece..57575ae4d 100644 --- a/src/cache/ftlru.c +++ b/src/cache/ftlru.c @@ -22,6 +22,8 @@ #include FT_LIST_H #include FT_INTERNAL_OBJECTS_H +#include "ftcerror.h" + static void lru_build_free_list( FT_LruNode nodes, @@ -50,7 +52,7 @@ if ( !anlru ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; *anlru = 0; if ( !ALLOC( lru, sizeof ( *lru ) ) ) @@ -146,7 +148,7 @@ if ( !lru || !key || !anode ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; node = lru->elements.head; clazz = lru->clazz; @@ -271,7 +273,7 @@ /* check for valid `lru' and `key' delayed to FT_Lru_Lookup_Node() */ if ( !anobject ) - return FT_Err_Invalid_Argument; + return FTC_Err_Invalid_Argument; *anobject = 0; error = FT_Lru_Lookup_Node( lru, key, &node ); diff --git a/src/cache/rules.mk b/src/cache/rules.mk index a83416a32..1e84af2f1 100644 --- a/src/cache/rules.mk +++ b/src/cache/rules.mk @@ -40,7 +40,8 @@ Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c \ Cache_DRV_H := $(CACHE_H_DIR_)ftlru.h \ $(CACHE_H_DIR_)ftcmanag.h \ $(CACHE_H_DIR_)ftcglyph.h \ - $(CACHE_H_DIR_)ftcimage.h + $(CACHE_H_DIR_)ftcimage.h \ + $(CACHE_DIR_)ftcerror.h # Cache driver object(s) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 6016ee197..e7648b117 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,12 +22,14 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H -#include FT_INTERNAL_CFF_ERRORS_H #include "cffdrivr.h" #include "cffgload.h" #include "cffload.h" +#include "cfferrs.h" + + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -180,7 +182,7 @@ if ( !slot ) - return CFF_Err_Invalid_Glyph_Handle; + return CFF_Err_Invalid_Slot_Handle; /* check whether we want a scaled outline or bitmap */ if ( !size ) diff --git a/src/cff/cfferrs.h b/src/cff/cfferrs.h new file mode 100644 index 000000000..99c0c3d4c --- /dev/null +++ b/src/cff/cfferrs.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* cfferrs.h */ +/* */ +/* CFF error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the CFF error enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __CFFERRS_H__ +#define __CFFERRS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) CFF_Err_ ## e = v + FT_Mod_Err_CFF, +#define FT_NOERRORDEF( e, v, s ) CFF_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST CFF_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __CFFERRS_H__ */ + + +/* END */ diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4764e7106..557cd6e31 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -27,7 +27,7 @@ #include "cffload.h" #include "cffgload.h" -#include FT_INTERNAL_CFF_ERRORS_H +#include "cfferrs.h" /*************************************************************************/ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 301b2d816..e469dc788 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -21,12 +21,13 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include FT_INTERNAL_CFF_ERRORS_H #include FT_TRUETYPE_TAGS_H #include "cffload.h" #include "cffparse.h" +#include "cfferrs.h" + /*************************************************************************/ /* */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 97e823718..aa2457d9c 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -27,7 +27,8 @@ #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include "cffobjs.h" #include "cffload.h" -#include FT_INTERNAL_CFF_ERRORS_H + +#include "cfferrs.h" #include /* for strlen() */ diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index fef2b79a3..d8f560842 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -23,7 +23,6 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_CFF_TYPES_H -#include FT_INTERNAL_CFF_ERRORS_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 833676bce..5121b2345 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -18,9 +18,10 @@ #include #include "cffparse.h" -#include FT_INTERNAL_CFF_ERRORS_H #include FT_INTERNAL_STREAM_H +#include "cfferrs.h" + /*************************************************************************/ /* */ diff --git a/src/cff/rules.mk b/src/cff/rules.mk index f87634f62..73fea4d95 100644 --- a/src/cff/rules.mk +++ b/src/cff/rules.mk @@ -33,7 +33,8 @@ CFF_DRV_SRC := $(CFF_DIR_)cffobjs.c \ # CFF driver headers # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ - $(CFF_DIR_)cfftoken.h + $(CFF_DIR_)cfftoken.h \ + $(CFF_DIR_)cfferrs.h # CFF driver object(s) diff --git a/src/cid/ciderrs.h b/src/cid/ciderrs.h new file mode 100644 index 000000000..25a043ae3 --- /dev/null +++ b/src/cid/ciderrs.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* ciderrs.h */ +/* */ +/* CID error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the CID error enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __CIDERRS_H__ +#define __CIDERRS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) CID_Err_ ## e = v + FT_Mod_Err_CID, +#define FT_NOERRORDEF( e, v, s ) CID_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST CID_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __CIDERRS_H__ */ + + +/* END */ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 27327840e..73187f06c 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -23,6 +23,8 @@ #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H +#include "ciderrs.h" + /*************************************************************************/ /* */ @@ -175,7 +177,7 @@ *max_advance = decoder.builder.advance.x; - return T1_Err_Ok; + return CID_Err_Ok; } diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 5e7b1885b..a0e937f0e 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -21,9 +21,11 @@ #include FT_CONFIG_CONFIG_H #include FT_MULTIPLE_MASTERS_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE1_ERRORS_H + #include "cidload.h" +#include "ciderrs.h" + #include #include /* for isspace(), isalnum() */ @@ -125,7 +127,7 @@ { FT_ERROR(( "cid_load_keyword: invalid use of `%s'!\n", keyword->ident )); - error = T1_Err_Syntax_Error; + error = CID_Err_Syntax_Error; goto Exit; } @@ -170,7 +172,7 @@ bbox->xMax = FT_RoundFix( temp[2] ); bbox->yMax = FT_RoundFix( temp[3] ); - return T1_Err_Ok; /* this is a callback function; */ + return CID_Err_Ok; /* this is a callback function; */ /* we must return an error code */ } @@ -224,7 +226,7 @@ offset->y = temp[5] >> 16; } - return T1_Err_Ok; /* this is a callback function; */ + return CID_Err_Ok; /* this is a callback function; */ /* we must return an error code */ } @@ -235,7 +237,7 @@ { CID_Info* cid = &face->cid; FT_Memory memory = face->root.memory; - FT_Error error = T1_Err_Ok; + FT_Error error = CID_Err_Ok; FT_Long num_dicts; @@ -271,7 +273,7 @@ const T1_Field cid_field_records[] = { -#include "cidtokens.h" +#include "cidtoken.h" T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox ) T1_FIELD_CALLBACK( "FDArray", parse_fd_array ) diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 6347fbae3..df5395e08 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -24,6 +24,8 @@ #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include "ciderrs.h" + /*************************************************************************/ /* */ @@ -165,7 +167,7 @@ if ( face_index != 0 ) { FT_ERROR(( "CID_Init_Face: invalid face index\n" )); - error = T1_Err_Invalid_Argument; + error = CID_Err_Invalid_Argument; goto Exit; } @@ -356,7 +358,7 @@ { FT_UNUSED( driver ); - return T1_Err_Ok; + return CID_Err_Ok; } diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h index 4b4baaf95..6003cf590 100644 --- a/src/cid/cidobjs.h +++ b/src/cid/cidobjs.h @@ -23,7 +23,6 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_TYPE1_TYPES_H diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index a95a742f6..c243687b9 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -21,9 +21,11 @@ #include FT_INTERNAL_CALC_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TYPE1_ERRORS_H + #include "cidparse.h" +#include "ciderrs.h" + #include /* for strncmp() */ @@ -75,7 +77,7 @@ "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) { FT_TRACE2(( "[not a valid CID-keyed font]\n" )); - error = T1_Err_Unknown_File_Format; + error = CID_Err_Unknown_File_Format; } FORGET_Frame(); diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index c86f0a2e6..566fba8fc 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -23,6 +23,8 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include "ciderrs.h" + #include /* for strcmp() */ @@ -65,7 +67,7 @@ if ( afm ) CID_Get_Kerning( afm, left_glyph, right_glyph, kerning ); - return T1_Err_Ok; + return CID_Err_Ok; } diff --git a/src/cid/cidtokens.h b/src/cid/cidtoken.h similarity index 98% rename from src/cid/cidtokens.h rename to src/cid/cidtoken.h index 81f9f362d..5a3981e43 100644 --- a/src/cid/cidtokens.h +++ b/src/cid/cidtoken.h @@ -1,6 +1,6 @@ /***************************************************************************/ /* */ -/* cidtokens.h */ +/* cidtoken.h */ /* */ /* CID token definitions (specification only). */ /* */ diff --git a/src/cid/rules.mk b/src/cid/rules.mk index d7ab02660..7585afabb 100644 --- a/src/cid/rules.mk +++ b/src/cid/rules.mk @@ -33,7 +33,8 @@ CID_DRV_SRC := $(CID_DIR_)cidparse.c \ # CID driver headers # CID_DRV_H := $(CID_DRV_SRC:%.c=%.h) \ - $(CID_DIR_)cidtokens.h + $(CID_DIR_)cidtoken.h \ + $(CID_DIR_)ciderrs.h # CID driver object(s) diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c index a3c4c930e..7fac5a299 100644 --- a/src/pcf/pcfdriver.c +++ b/src/pcf/pcfdriver.c @@ -27,7 +27,6 @@ THE SOFTWARE. #include -#include FT_ERRORS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H @@ -36,6 +35,8 @@ THE SOFTWARE. #include "pcfdriver.h" #include "pcfutil.h" +#include "pcferror.h" + /*************************************************************************/ /* */ @@ -68,7 +69,7 @@ THE SOFTWARE. FT_TRACE4(( "DONE_FACE!!!\n" )); - return FT_Err_Ok; + return PCF_Err_Ok; } @@ -79,7 +80,7 @@ THE SOFTWARE. FT_Int num_params, FT_Parameter* params ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -90,13 +91,13 @@ THE SOFTWARE. if ( error ) goto Fail; - return FT_Err_Ok; + return PCF_Err_Ok; Fail: FT_TRACE2(( "[not a valid PCF file]\n" )); PCF_Done_Face( face ); - return FT_Err_Unknown_File_Format; /* error */ + return PCF_Err_Unknown_File_Format; /* error */ } @@ -119,12 +120,12 @@ THE SOFTWARE. size->metrics.height = size->metrics.ascender - size->metrics.descender; - return FT_Err_Ok; + return PCF_Err_Ok; } else { FT_TRACE4(( "size WRONG\n" )); - return FT_Err_Invalid_Pixel_Size; + return PCF_Err_Invalid_Pixel_Size; } } @@ -136,7 +137,7 @@ THE SOFTWARE. FT_Int load_flags ) { PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_Bitmap* bitmap = &slot->bitmap; PCF_Metric metric; @@ -151,7 +152,7 @@ THE SOFTWARE. if ( !face ) { - error = FT_Err_Invalid_Argument; + error = PCF_Err_Invalid_Argument; goto Exit; } @@ -186,7 +187,7 @@ THE SOFTWARE. break; default: - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; } /* XXX: to do: are there cases that need repadding the bitmap? */ diff --git a/src/pcf/pcferror.h b/src/pcf/pcferror.h new file mode 100644 index 000000000..c01bcab50 --- /dev/null +++ b/src/pcf/pcferror.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* pcferror.h */ +/* */ +/* PCF error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the PCF error enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __PCFERROR_H__ +#define __PCFERROR_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) PCF_Err_ ## e = v + FT_Mod_Err_PCF, +#define FT_NOERRORDEF( e, v, s ) PCF_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST PCF_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __PCFERROR_H__ */ + + +/* END */ diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index ca38ca731..b261515ab 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -27,7 +27,6 @@ THE SOFTWARE. #include -#include FT_ERRORS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H @@ -35,6 +34,8 @@ THE SOFTWARE. #include "pcf.h" #include "pcfdriver.h" +#include "pcferror.h" + #include /* strlen(), strcpy() */ /*************************************************************************/ @@ -98,13 +99,13 @@ THE SOFTWARE. if ( FILE_Seek ( 0 ) || READ_Fields ( pcf_toc_header, toc ) ) - return FT_Err_Cannot_Open_Resource; + return PCF_Err_Cannot_Open_Resource; if ( toc->version != PCF_FILE_VERSION ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; if ( ALLOC( face->toc.tables, toc->count * sizeof ( PCF_TableRec ) ) ) - return FT_Err_Out_Of_Memory; + return PCF_Err_Out_Of_Memory; tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) @@ -139,7 +140,7 @@ THE SOFTWARE. #endif - return FT_Err_Ok; + return PCF_Err_Ok; Exit: FREE( face->toc.tables ); @@ -202,13 +203,13 @@ THE SOFTWARE. const FT_Frame_Field* header, PCF_Metric metric ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; if ( READ_Fields( header, metric ) ) return error; - return FT_Err_Ok; + return PCF_Err_Ok; } @@ -217,7 +218,7 @@ THE SOFTWARE. PCF_Metric metric ) { PCF_Compressed_MetricRec compr_metric; - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; if ( READ_Fields( pcf_compressed_metric_header, &compr_metric ) ) @@ -230,7 +231,7 @@ THE SOFTWARE. metric->descent = (FT_Short)compr_metric.descent - 0x80; metric->attributes = 0; - return FT_Err_Ok; + return PCF_Err_Ok; } @@ -239,7 +240,7 @@ THE SOFTWARE. FT_ULong format, PCF_Metric metric ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) @@ -272,15 +273,15 @@ THE SOFTWARE. if ( tables[i].type == type ) { if ( stream->pos > tables[i].offset ) - return FT_Err_Invalid_Stream_Skip; + return PCF_Err_Invalid_Stream_Skip; if ( FILE_Skip( tables[i].offset - stream->pos ) ) - return FT_Err_Invalid_Stream_Skip; + return PCF_Err_Invalid_Stream_Skip; *sizep = tables[i].size; /* unused - to be removed */ *formatp = tables[i].format; - return FT_Err_Ok; + return PCF_Err_Ok; } - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; } @@ -466,7 +467,7 @@ THE SOFTWARE. FREE( props ); FREE( strings ); - return FT_Err_Ok; + return PCF_Err_Ok; Bail: FREE( props ); @@ -480,7 +481,7 @@ THE SOFTWARE. FT_Error pcf_get_metrics( FT_Stream stream, PCF_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_ULong format = 0; FT_ULong size = 0; @@ -502,7 +503,7 @@ THE SOFTWARE. if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { @@ -519,12 +520,12 @@ THE SOFTWARE. (void)READ_UShortLE( nmetrics ); } if ( error || nmetrics == -1 ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; face->nmetrics = nmetrics; if ( ALLOC( face->metrics, nmetrics * sizeof ( PCF_MetricRec ) ) ) - return FT_Err_Out_Of_Memory; + return PCF_Err_Out_Of_Memory; metrics = face->metrics; for ( i = 0; i < nmetrics; i++ ) @@ -557,7 +558,7 @@ THE SOFTWARE. FT_Error pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_Long* offsets; FT_Long bitmapSizes[GLYPHPADOPTIONS]; @@ -580,7 +581,7 @@ THE SOFTWARE. return error; format = GET_ULongLE(); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) nbitmaps = GET_ULong(); @@ -588,7 +589,7 @@ THE SOFTWARE. nbitmaps = GET_ULongLE(); FT_Forget_Frame( stream ); if ( nbitmaps != face->nmetrics ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; if ( ALLOC( offsets, nbitmaps * sizeof ( FT_ULong ) ) ) return error; @@ -647,7 +648,7 @@ THE SOFTWARE. FT_Error pcf_get_encodings( FT_Stream stream, PCF_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_ULong format, size; int firstCol, lastCol; @@ -671,7 +672,7 @@ THE SOFTWARE. return error; format = GET_ULongLE(); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { @@ -698,7 +699,7 @@ THE SOFTWARE. nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) ) - return FT_Err_Out_Of_Memory; + return PCF_Err_Out_Of_Memory; error = FT_Access_Frame( stream, 2 * nencoding ); if ( error ) @@ -799,7 +800,7 @@ THE SOFTWARE. FT_ULong type ) { FT_ULong format, size; - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; PCF_Accel accel = &face->accel; @@ -860,7 +861,7 @@ THE SOFTWARE. FT_Error pcf_load_font( FT_Stream stream, PCF_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_Bool hasBDFAccelerators; @@ -1033,7 +1034,7 @@ THE SOFTWARE. face->charmap.face = root; face->charmap_handle - return FT_Err_Ok; + return PCF_Err_Ok; } #endif } @@ -1047,11 +1048,11 @@ THE SOFTWARE. face->charmap_handle = &face->charmap; root->charmap = face->charmap_handle; } - return FT_Err_Ok; + return PCF_Err_Ok; Bail: PCF_Done_Face( face ); - return FT_Err_Invalid_File_Format; + return PCF_Err_Invalid_File_Format; } diff --git a/src/pcf/rules.mk b/src/pcf/rules.mk index 67a0dce2e..3bd1a25d3 100644 --- a/src/pcf/rules.mk +++ b/src/pcf/rules.mk @@ -44,7 +44,8 @@ PCF_DRV_SRC := $(PCF_DIR_)pcfread.c \ # PCF_DRV_H := $(PCF_DIR_)pcf.h \ $(PCF_DIR_)pcfdriver.h \ - $(PCF_DIR_)pcfutil.h + $(PCF_DIR_)pcfutil.h \ + $(PCF_DIR_)pcferror.h # pcf driver object(s) # diff --git a/src/psaux/psauxerr.h b/src/psaux/psauxerr.h new file mode 100644 index 000000000..720c28cf8 --- /dev/null +++ b/src/psaux/psauxerr.h @@ -0,0 +1,44 @@ +/***************************************************************************/ +/* */ +/* psauxerr.h */ +/* */ +/* PS auxiliary module error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the PS auxiliary module error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __PSAUXERR_H__ +#define __PSAUXERR_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) PSaux_Err_ ## e = v + FT_Mod_Err_PSaux, +#define FT_NOERRORDEF( e, v, s ) PSaux_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST PSaux_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __PSAUXERR_H__ */ + + +/* END */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 4d982888a..a2c668870 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -18,11 +18,12 @@ #include #include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_DEBUG_H -#include FT_ERRORS_H + #include "psobjs.h" +#include "psauxerr.h" + /*************************************************************************/ /*************************************************************************/ @@ -121,7 +122,7 @@ table->capacity = new_size; - return T1_Err_Ok; + return PSaux_Err_Ok; } @@ -156,7 +157,7 @@ if ( index < 0 || index > table->max_elems ) { FT_ERROR(( "PS_Table_Add: invalid index\n" )); - return T1_Err_Invalid_Argument; + return PSaux_Err_Invalid_Argument; } /* grow the base block if needed */ @@ -180,7 +181,7 @@ MEM_Copy( table->block + table->cursor, object, length ); table->cursor += length; - return T1_Err_Ok; + return PSaux_Err_Ok; } @@ -878,13 +879,13 @@ FT_UNUSED( pflags ); #endif - error = T1_Err_Ok; + error = PSaux_Err_Ok; Exit: return error; Fail: - error = T1_Err_Invalid_File_Format; + error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -950,7 +951,7 @@ return error; Fail: - error = T1_Err_Invalid_File_Format; + error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -1191,7 +1192,7 @@ if ( !builder->load_points ) { outline->n_contours++; - return T1_Err_Ok; + return PSaux_Err_Ok; } error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 ); diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk index dd5c8a6eb..671b14d58 100644 --- a/src/psaux/rules.mk +++ b/src/psaux/rules.mk @@ -32,7 +32,8 @@ PSAUX_DRV_SRC := $(PSAUX_DIR_)psobjs.c \ # PSAUX driver headers # -PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) +PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \ + $(PSAUX_DIR_)psauxerr.h # PSAUX driver object(s) diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index a700e377c..04f165404 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -18,11 +18,13 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include FT_OUTLINE_H + #include "t1decode.h" #include "psobjs.h" +#include "psauxerr.h" + /*************************************************************************/ /* */ @@ -193,7 +195,7 @@ { FT_ERROR(( "t1operator_seac:" )); FT_ERROR(( " glyph names table not available in this font!\n" )); - return T1_Err_Syntax_Error; + return PSaux_Err_Syntax_Error; } bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar ); @@ -203,7 +205,7 @@ { FT_ERROR(( "t1operator_seac:" )); FT_ERROR(( " invalid seac character code arguments\n" )); - return T1_Err_Syntax_Error; + return PSaux_Err_Syntax_Error; } /* if we are trying to load a composite glyph, do not load the */ @@ -344,7 +346,7 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; - error = T1_Err_Ok; + error = PSaux_Err_Ok; outline = builder->current; x = builder->pos_x; @@ -713,7 +715,7 @@ /* return now! */ FT_TRACE4(( "\n\n" )); - return T1_Err_Ok; + return PSaux_Err_Ok; case op_hsbw: FT_TRACE4(( " hsbw" )); @@ -729,7 +731,7 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return T1_Err_Ok; + return PSaux_Err_Ok; break; @@ -753,7 +755,7 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return T1_Err_Ok; + return PSaux_Err_Ok; break; @@ -1014,10 +1016,10 @@ return error; Syntax_Error: - return T1_Err_Syntax_Error; + return PSaux_Err_Syntax_Error; Stack_Underflow: - return T1_Err_Stack_Underflow; + return PSaux_Err_Stack_Underflow; Memory_Error: return builder->error; @@ -1054,7 +1056,7 @@ { FT_ERROR(( "T1_Decoder_Init: " )); FT_ERROR(( "the `psnames' module is not available\n" )); - return T1_Err_Unimplemented_Feature; + return PSaux_Err_Unimplemented_Feature; } decoder->psnames = psnames; diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 389e1a0ef..f5c543704 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -19,9 +19,12 @@ #include #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_OBJECTS_H + #include "psmodule.h" #include "pstables.h" +#include "psnamerr.h" + #include /* for qsort() */ #include /* for strcmp(), strncpy() */ @@ -192,7 +195,7 @@ { FREE( table->maps ); if ( !error ) - error = FT_Err_Invalid_Argument; /* no unicode chars here! */ + error = PSnames_Err_Invalid_Argument; /* no unicode chars here! */ } else /* sort the table in increasing order of unicode values */ diff --git a/src/psnames/psnamerr.h b/src/psnames/psnamerr.h new file mode 100644 index 000000000..b95a33ee9 --- /dev/null +++ b/src/psnames/psnamerr.h @@ -0,0 +1,44 @@ +/***************************************************************************/ +/* */ +/* psnamerr.h */ +/* */ +/* PS names module error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the PS names module error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __PSNAMERR_H__ +#define __PSNAMERR_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) PSnames_Err_ ## e = v + FT_Mod_Err_PSnames, +#define FT_NOERRORDEF( e, v, s ) PSnames_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST PSnames_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __PSNAMERR_H__ */ + + +/* END */ diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk index 7612e8286..cb51272bb 100644 --- a/src/psnames/rules.mk +++ b/src/psnames/rules.mk @@ -32,7 +32,8 @@ PSNAMES_DRV_SRC := $(PSNAMES_DIR_)psmodule.c # PSNames driver headers # PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \ - $(PSNAMES_DIR_)pstables.h + $(PSNAMES_DIR_)pstables.h \ + $(PSNAMES_DIR_)psnamerr.h # PSNames driver object(s) diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index d8cf1d790..de4b28b51 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -170,15 +170,17 @@ #else /* _STANDALONE_ */ -#include -#include /* for FT_TRACE() and FT_ERROR() */ +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H /* for FT_TRACE() and FT_ERROR() */ -#define Raster_Err_None FT_Err_Ok -#define Raster_Err_Not_Ini FT_Err_Raster_Uninitialized -#define Raster_Err_Overflow FT_Err_Raster_Overflow -#define Raster_Err_Neg_Height FT_Err_Raster_Negative_Height -#define Raster_Err_Invalid FT_Err_Invalid_Outline -#define Raster_Err_Unsupported FT_Err_Cannot_Render_Glyph +#include "rasterrs.h" + +#define Raster_Err_None Raster_Err_Ok +#define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized +#define Raster_Err_Overflow Raster_Err_Raster_Overflow +#define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height +#define Raster_Err_Invalid Raster_Err_Invalid_Outline +#define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph #endif /* _STANDALONE_ */ @@ -3012,7 +3014,7 @@ return error; } - return FT_Err_Ok; + return Raster_Err_Ok; } @@ -3085,7 +3087,7 @@ return error; } - return FT_Err_Ok; + return Raster_Err_Ok; } #else /* FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3095,7 +3097,7 @@ { FT_UNUSED_RASTER; - return FT_Err_Cannot_Render_Glyph; + return Raster_Err_Cannot_Render_Glyph; } #endif /* FT_RASTER_OPTION_ANTI_ALIASING */ diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 19c741c93..febf943b0 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -22,6 +22,8 @@ #include "ftrend1.h" #include "ftraster.h" +#include "rasterrs.h" + /* initialize renderer -- init its raster */ static @@ -34,7 +36,7 @@ library->raster_pool, library->raster_pool_size ); - return FT_Err_Ok; + return Raster_Err_Ok; } @@ -58,12 +60,12 @@ FT_Matrix* matrix, FT_Vector* delta ) { - FT_Error error = FT_Err_Ok; + FT_Error error = Raster_Err_Ok; if ( slot->format != render->glyph_format ) { - error = FT_Err_Invalid_Argument; + error = Raster_Err_Invalid_Argument; goto Exit; } @@ -111,7 +113,7 @@ /* check glyph image format */ if ( slot->format != render->glyph_format ) { - error = FT_Err_Invalid_Argument; + error = Raster_Err_Invalid_Argument; goto Exit; } @@ -120,13 +122,13 @@ { /* raster1 is only capable of producing monochrome bitmaps */ if ( render->clazz == &ft_raster1_renderer_class ) - return FT_Err_Cannot_Render_Glyph; + return Raster_Err_Cannot_Render_Glyph; } else { /* raster5 is only capable of producing 5-gray-levels bitmaps */ if ( render->clazz == &ft_raster5_renderer_class ) - return FT_Err_Cannot_Render_Glyph; + return Raster_Err_Cannot_Render_Glyph; } outline = &slot->outline; diff --git a/src/raster/rasterrs.h b/src/raster/rasterrs.h new file mode 100644 index 000000000..dd689a286 --- /dev/null +++ b/src/raster/rasterrs.h @@ -0,0 +1,44 @@ +/***************************************************************************/ +/* */ +/* rasterrs.h */ +/* */ +/* monochrome renderer error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the monochrome renderer error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __RASTERRS_H__ +#define __RASTERRS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) Raster_Err_ ## e = v + FT_Mod_Err_Raster, +#define FT_NOERRORDEF( e, v, s ) Raster_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST Raster_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __RASTERRS_H__ */ + + +/* END */ diff --git a/src/raster/rules.mk b/src/raster/rules.mk index 2dba01396..7d3f65c51 100644 --- a/src/raster/rules.mk +++ b/src/raster/rules.mk @@ -31,7 +31,8 @@ RAS1_DRV_SRC := $(RAS1_DIR_)ftraster.c \ # raster1 driver headers # -RAS1_DRV_H := $(RAS1_DRV_SRC:%.c=%.h) +RAS1_DRV_H := $(RAS1_DRV_SRC:%.c=%.h) \ + $(RAS1_DIR_)rasterrs.h # raster1 driver object(s) diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk index 4502b5cde..3089de314 100644 --- a/src/sfnt/rules.mk +++ b/src/sfnt/rules.mk @@ -35,7 +35,8 @@ SFNT_DRV_SRC := $(SFNT_DIR_)ttload.c \ # SFNT driver headers # -SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) +SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \ + $(SFNT_DIR_)sferrors.h # SFNT driver object(s) diff --git a/src/sfnt/sferrors.h b/src/sfnt/sferrors.h new file mode 100644 index 000000000..776e11558 --- /dev/null +++ b/src/sfnt/sferrors.h @@ -0,0 +1,42 @@ +/***************************************************************************/ +/* */ +/* sferrors.h */ +/* */ +/* SFNT error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the SFNT error enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __SFERRORS_H__ +#define __SFERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) SFNT_Err_ ## e = v + FT_Mod_Err_SFNT, +#define FT_NOERRORDEF( e, v, s ) SFNT_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST SFNT_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __SFERRORS_H__ */ + +/* END */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 31b94e6c9..438e47a11 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -23,7 +23,8 @@ #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H + +#include "sferrors.h" /*************************************************************************/ @@ -199,7 +200,7 @@ sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; goto Exit; } @@ -237,7 +238,7 @@ #undef LOAD_ #define LOAD_( x ) ( ( error = sfnt->load_##x( face, stream ) ) \ - != TT_Err_Ok ) + != SFNT_Err_Ok ) FT_LOCAL_DEF @@ -327,8 +328,8 @@ if ( sfnt->load_sbits && LOAD_( sbits ) ) { /* return an error if this font file has no outlines */ - if ( error == TT_Err_Table_Missing && has_outline ) - error = TT_Err_Ok; + if ( error == SFNT_Err_Table_Missing && has_outline ) + error = SFNT_Err_Ok; else goto Exit; } @@ -341,7 +342,7 @@ goto Exit; #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE - if ( ( error = TT_Extension_Create( face ) ) != TT_Err_Ok ) + if ( ( error = TT_Extension_Create( face ) ) != SFNT_Err_Ok ) goto Exit; #endif diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index c9eb94694..37f1034d9 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -18,10 +18,11 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H #include "ttload.h" #include "ttcmap.h" +#include "sferrors.h" + /*************************************************************************/ /* */ @@ -91,7 +92,7 @@ if ( cmap->loaded ) - return TT_Err_Ok; + return SFNT_Err_Ok; memory = stream->memory; @@ -260,11 +261,11 @@ break; default: /* corrupt character mapping table */ - return TT_Err_Invalid_CharMap_Format; + return SFNT_Err_Invalid_CharMap_Format; } - return TT_Err_Ok; + return SFNT_Err_Ok; Fail: TT_CharMap_Free( face, cmap ); @@ -295,7 +296,7 @@ if ( !cmap ) - return TT_Err_Ok; + return SFNT_Err_Ok; memory = face->root.driver->root.memory; @@ -328,7 +329,7 @@ } cmap->loaded = FALSE; - return TT_Err_Ok; + return SFNT_Err_Ok; } diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 9ef433c90..1783b43d2 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -19,12 +19,13 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include "ttload.h" #include "ttcmap.h" +#include "sferrors.h" + /*************************************************************************/ /* */ @@ -122,7 +123,7 @@ goto Exit; } else - error = TT_Err_Table_Missing; + error = SFNT_Err_Table_Missing; Exit: return error; @@ -233,7 +234,7 @@ /* check face index */ if ( face_index >= face->ttc_header.count ) { - error = TT_Err_Bad_Argument; + error = SFNT_Err_Bad_Argument; goto Exit; } @@ -262,7 +263,7 @@ entry_selector * 2 <= num_tables ) { FT_TRACE2(( "TT_Load_SFNT_Header: file is not SFNT!\n" )); - error = TT_Err_Unknown_File_Format; + error = SFNT_Err_Unknown_File_Format; } } @@ -405,7 +406,7 @@ table = TT_LookUp_Table( face, tag ); if ( !table ) { - error = TT_Err_Table_Missing; + error = SFNT_Err_Table_Missing; goto Exit; } @@ -420,7 +421,7 @@ { *length = size; - return TT_Err_Ok; + return SFNT_Err_Ok; } if ( length ) @@ -679,7 +680,7 @@ /* Set number_Of_VMetrics to 0! */ FT_TRACE2(( " no vertical header in file.\n" )); face->vertical.number_Of_VMetrics = 0; - error = TT_Err_Ok; + error = SFNT_Err_Ok; goto Exit; } @@ -693,7 +694,7 @@ if ( error ) { FT_ERROR(( " no horizontal metrics in file!\n" )); - error = TT_Err_Hmtx_Table_Missing; + error = SFNT_Err_Hmtx_Table_Missing; goto Exit; } @@ -713,8 +714,8 @@ vertical ? "Vertical" : "Horizontal" )); - error = vertical ? TT_Err_Invalid_Vert_Metrics - : TT_Err_Invalid_Horiz_Metrics; + error = vertical ? SFNT_Err_Invalid_Vert_Metrics + : SFNT_Err_Invalid_Horiz_Metrics; goto Exit; } @@ -831,7 +832,7 @@ error = face->goto_table( face, TTAG_vhea, stream, 0 ); if ( error ) { - error = TT_Err_Ok; + error = SFNT_Err_Ok; goto Exit; } @@ -845,7 +846,7 @@ error = face->goto_table( face, TTAG_hhea, stream, 0 ); if ( error ) { - error = TT_Err_Horiz_Header_Missing; + error = SFNT_Err_Horiz_Header_Missing; goto Exit; } @@ -931,7 +932,7 @@ { /* The name table is required so indicate failure. */ FT_TRACE2(( "is missing!\n" )); - error = TT_Err_Name_Table_Missing; + error = SFNT_Err_Name_Table_Missing; goto Exit; } @@ -1123,7 +1124,7 @@ error = face->goto_table( face, TTAG_cmap, stream, 0 ); if ( error ) { - error = TT_Err_CMap_Table_Missing; + error = SFNT_Err_CMap_Table_Missing; goto Exit; } @@ -1289,7 +1290,7 @@ { FT_TRACE2(( "is missing!\n" )); face->os2.version = 0xFFFF; - error = TT_Err_Ok; + error = SFNT_Err_Ok; goto Exit; } @@ -1367,7 +1368,7 @@ error = face->goto_table( face, TTAG_post, stream, 0 ); if ( error ) - return TT_Err_Post_Table_Missing; + return SFNT_Err_Post_Table_Missing; if ( READ_Fields( post_fields, post ) ) return error; @@ -1376,7 +1377,7 @@ /* module (ttpost). */ FT_TRACE2(( "loaded\n" )); - return TT_Err_Ok; + return SFNT_Err_Ok; } @@ -1434,7 +1435,7 @@ { FT_TRACE2(( "missing (optional)\n" )); pclt->Version = 0; - return TT_Err_Ok; + return SFNT_Err_Ok; } if ( READ_Fields( pclt_fields, pclt ) ) @@ -1478,7 +1479,7 @@ /* the gasp table is optional */ error = face->goto_table( face, TTAG_gasp, stream, 0 ); if ( error ) - return TT_Err_Ok; + return SFNT_Err_Ok; if ( ACCESS_Frame( 4L ) ) goto Exit; @@ -1547,7 +1548,7 @@ /* the kern table is optional; exit silently if it is missing */ error = face->goto_table( face, TTAG_kern, stream, 0 ); if ( error ) - return TT_Err_Ok; + return SFNT_Err_Ok; if ( ACCESS_Frame( 4L ) ) goto Exit; @@ -1658,7 +1659,7 @@ /* this table is optional */ error = face->goto_table( face, TTAG_hdmx, stream, 0 ); if ( error ) - return TT_Err_Ok; + return SFNT_Err_Ok; if ( ACCESS_Frame( 8L ) ) goto Exit; diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 3f85170ad..8a9df1277 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -27,11 +27,11 @@ #include #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H #include FT_TRUETYPE_TAGS_H #include "ttpost.h" #include "ttload.h" +#include "sferrors.h" /*************************************************************************/ /* */ @@ -176,7 +176,7 @@ if ( num_glyphs > face->root.num_glyphs ) { - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; goto Exit; } @@ -249,7 +249,7 @@ table->glyph_indices = glyph_indices; table->glyph_names = name_strings; } - return TT_Err_Ok; + return SFNT_Err_Ok; Fail1: @@ -288,7 +288,7 @@ /* check the number of glyphs */ if ( num_glyphs > face->root.num_glyphs || num_glyphs > 258 ) { - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; goto Exit; } @@ -308,7 +308,7 @@ if ( index < 0 || index > num_glyphs ) { - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; goto Fail; } } @@ -323,7 +323,7 @@ table->offsets = offset_table; } - return TT_Err_Ok; + return SFNT_Err_Ok; Fail: FREE( offset_table ); @@ -367,7 +367,7 @@ break; default: - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; } face->postscript_names.loaded = 1; @@ -455,15 +455,15 @@ if ( !face ) - return TT_Err_Invalid_Face_Handle; + return SFNT_Err_Invalid_Face_Handle; if ( index >= (FT_UInt)face->root.num_glyphs ) - return TT_Err_Invalid_Glyph_Index; + return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES psnames = (PSNames_Interface*)face->psnames; if ( !psnames ) - return TT_Err_Unimplemented_Feature; + return SFNT_Err_Unimplemented_Feature; #endif names = &face->postscript_names; @@ -527,7 +527,7 @@ break; /* nothing to do */ } - return TT_Err_Ok; + return SFNT_Err_Ok; } diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index 094f239ea..0aa5ab140 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -29,10 +29,6 @@ FT_BEGIN_HEADER -#define TT_Err_Invalid_Post_Table_Format 0x0B00 -#define TT_Err_Invalid_Post_Table 0x0B01 - - FT_LOCAL FT_Error TT_Get_PS_Name( TT_Face face, FT_UInt index, diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index ff5fd930f..46e0f31e7 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -18,11 +18,12 @@ #include #include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include "ttsbit.h" +#include "sferrors.h" + /*************************************************************************/ /* */ @@ -363,7 +364,7 @@ break; default: - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; } Exit: @@ -469,7 +470,7 @@ num_strikes >= 0x10000L ) { FT_ERROR(( "TT_Load_SBit_Strikes: invalid table version!\n" )); - error = TT_Err_Invalid_File_Format; + error = SFNT_Err_Invalid_File_Format; goto Exit; } @@ -630,7 +631,7 @@ if ( x_ppem < 0 || x_ppem > 255 || y_ppem < 1 || y_ppem > 255 ) - return TT_Err_Invalid_PPem; + return SFNT_Err_Invalid_PPem; for ( i = 0; i < face->num_sbit_strikes; i++ ) { @@ -639,11 +640,11 @@ ( face->sbit_strikes[i].x_ppem == x_ppem ) ) ) { *astrike_index = i; - return TT_Err_Ok; + return SFNT_Err_Ok; } } - return TT_Err_Invalid_PPem; + return SFNT_Err_Invalid_PPem; } @@ -746,7 +747,7 @@ *arange = 0; *aglyph_offset = 0; - return TT_Err_Invalid_Argument; + return SFNT_Err_Invalid_Argument; } @@ -775,7 +776,7 @@ /* */ /* */ /* FreeType error code. 0 means success. Returns */ - /* TT_Err_Invalid_Argument if no sbit exists for the requested glyph. */ + /* SFNT_Err_Invalid_Argument if no sbit exists for the requested glyph. */ /* */ static FT_Error Find_SBit_Image( TT_Face face, @@ -802,7 +803,7 @@ *astrike = strike; - return TT_Err_Ok; + return SFNT_Err_Ok; Fail: /* no embedded bitmap for this glyph in face */ @@ -810,7 +811,7 @@ *astrike = 0; *aglyph_offset = 0; - return TT_Err_Invalid_Argument; + return SFNT_Err_Invalid_Argument; } @@ -846,7 +847,7 @@ TT_SBit_Range* range, TT_SBit_Metrics* metrics ) { - FT_Error error = TT_Err_Ok; + FT_Error error = SFNT_Err_Ok; switch ( range->image_format ) @@ -905,7 +906,7 @@ if ( range->index_format == 2 || range->index_format == 5 ) *metrics = range->metrics; else - return TT_Err_Invalid_File_Format; + return SFNT_Err_Invalid_File_Format; } Exit: @@ -1134,7 +1135,7 @@ if ( x_offset < 0 || x_offset + metrics->width > map->width || y_offset < 0 || y_offset + metrics->height > map->rows ) { - error = TT_Err_Invalid_Argument; + error = SFNT_Err_Invalid_Argument; goto Exit; } @@ -1177,7 +1178,7 @@ break; default: /* invalid format */ - return TT_Err_Invalid_File_Format; + return SFNT_Err_Invalid_File_Format; } /* Now read data and draw glyph into target pixmap */ @@ -1256,7 +1257,7 @@ break; default: - return TT_Err_Invalid_File_Format; + return SFNT_Err_Invalid_File_Format; } size = map->rows * map->pitch; @@ -1287,7 +1288,7 @@ break; default: /* invalid image format */ - return TT_Err_Invalid_File_Format; + return SFNT_Err_Invalid_File_Format; } /* All right, we have a compound format. First of all, read */ diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index fa2ef7734..584d767d0 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -122,14 +122,17 @@ #else /* _STANDALONE_ */ + #include #include "ftgrays.h" #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_OUTLINE_H -#define ErrRaster_Invalid_Mode FT_Err_Cannot_Render_Glyph -#define ErrRaster_Invalid_Outline FT_Err_Invalid_Outline +#include "ftsmerrs.h" + +#define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph +#define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline #endif /* _STANDALONE_ */ diff --git a/src/smooth/ftsmerrs.h b/src/smooth/ftsmerrs.h new file mode 100644 index 000000000..a319c9edf --- /dev/null +++ b/src/smooth/ftsmerrs.h @@ -0,0 +1,44 @@ +/***************************************************************************/ +/* */ +/* ftsmerrs.h */ +/* */ +/* smooth renderer error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the smooth renderer error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __FTSMERRS_H__ +#define __FTSMERRS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) Smooth_Err_ ## e = v + FT_Mod_Err_Smooth, +#define FT_NOERRORDEF( e, v, s ) Smooth_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST Smooth_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __FTSMERRS_H__ */ + + +/* END */ diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index cc2985d68..9dd460c5e 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -22,6 +22,8 @@ #include "ftsmooth.h" #include "ftgrays.h" +#include "ftsmerrs.h" + /* initialize renderer -- init its raster */ static @@ -57,12 +59,12 @@ FT_Matrix* matrix, FT_Vector* delta ) { - FT_Error error = FT_Err_Ok; + FT_Error error = Smooth_Err_Ok; if ( slot->format != render->glyph_format ) { - error = FT_Err_Invalid_Argument; + error = Smooth_Err_Invalid_Argument; goto Exit; } @@ -110,13 +112,13 @@ /* check glyph image format */ if ( slot->format != render->glyph_format ) { - error = FT_Err_Invalid_Argument; + error = Smooth_Err_Invalid_Argument; goto Exit; } /* check mode */ if ( mode != ft_render_mode_normal ) - return FT_Err_Cannot_Render_Glyph; + return Smooth_Err_Cannot_Render_Glyph; outline = &slot->outline; diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk index cf751f592..445882323 100644 --- a/src/smooth/rules.mk +++ b/src/smooth/rules.mk @@ -31,7 +31,8 @@ SMOOTH_DRV_SRC := $(SMOOTH_DIR_)ftgrays.c \ # smooth driver headers # -SMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h) +SMOOTH_DRV_H := $(SMOOTH_DRV_SRC:%c=%h) \ + $(SMOOTH_DIR_)ftsmerrs.h # smooth driver object(s) diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk index a9f6c3683..4ef367846 100644 --- a/src/truetype/rules.mk +++ b/src/truetype/rules.mk @@ -34,7 +34,8 @@ TT_DRV_SRC := $(TT_DIR_)ttobjs.c \ # TrueType driver headers # -TT_DRV_H := $(TT_DRV_SRC:%.c=%.h) +TT_DRV_H := $(TT_DRV_SRC:%.c=%.h) \ + $(TT_DIR_)tterrors.h # TrueType driver object(s) diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index d21d02fee..16c1ac2e3 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -21,9 +21,12 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H + #include "ttdriver.h" #include "ttgload.h" +#include "tterrors.h" + /*************************************************************************/ /* */ @@ -298,7 +301,7 @@ if ( !slot ) - return TT_Err_Invalid_Glyph_Handle; + return TT_Err_Invalid_Slot_Handle; /* check whether we want a scaled outline or bitmap */ if ( !size ) diff --git a/src/truetype/tterrors.h b/src/truetype/tterrors.h new file mode 100644 index 000000000..ace9f7810 --- /dev/null +++ b/src/truetype/tterrors.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* tterrors.h */ +/* */ +/* TrueType error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the TrueType error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __TTERRORS_H__ +#define __TTERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) TT_Err_ ## e = v + FT_Mod_Err_TrueType, +#define FT_NOERRORDEF( e, v, s ) TT_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST TT_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __TTERRORS_H__ */ + +/* END */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index ec81e1e73..63bf703ec 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -26,6 +26,8 @@ #include "ttgload.h" +#include "tterrors.h" + /*************************************************************************/ /* */ @@ -300,14 +302,14 @@ if ( n_ins > face->max_profile.maxSizeOfInstructions ) { FT_TRACE0(( "ERROR: Too many instructions!\n" )); - error = TT_Err_Too_Many_Ins; + error = TT_Err_Too_Many_Hints; goto Fail; } if ( stream->cursor + n_ins > stream->limit ) { FT_TRACE0(( "ERROR: Instruction count mismatch!\n" )); - error = TT_Err_Too_Many_Ins; + error = TT_Err_Too_Many_Hints; goto Fail; } @@ -1019,7 +1021,7 @@ { FT_TRACE0(( "Too many instructions (%d) in composite glyph %ld\n", n_ins, subglyph->index )); - return TT_Err_Too_Many_Ins; + return TT_Err_Too_Many_Hints; } /* read the instructions */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 320c78338..1f5b6c79f 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -20,8 +20,10 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H #include FT_SYSTEM_H + #include "ttinterp.h" -#include FT_INTERNAL_TRUETYPE_ERRORS_H + +#include "tterrors.h" #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index af15bf8c9..6dcce38ff 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -24,11 +24,12 @@ #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H #include "ttgload.h" #include "ttpload.h" +#include "tterrors.h" + #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #include "ttinterp.h" #endif diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index 67d294011..51df3c7f4 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -23,7 +23,6 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TRUETYPE_TYPES_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H FT_BEGIN_HEADER diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index aecd3c266..6ca3cbd8a 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -21,8 +21,10 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H + #include "ttpload.h" -#include FT_INTERNAL_TRUETYPE_ERRORS_H + +#include "tterrors.h" /*************************************************************************/ diff --git a/src/type1/rules.mk b/src/type1/rules.mk index aff446f9a..5f4ce9f21 100644 --- a/src/type1/rules.mk +++ b/src/type1/rules.mk @@ -36,7 +36,8 @@ T1_DRV_SRC := $(T1_DIR_)t1parse.c \ # Type1 driver headers # T1_DRV_H := $(T1_DRV_SRC:%.c=%.h) \ - $(T1_DIR_)t1tokens.h + $(T1_DIR_)t1tokens.h \ + $(T1_DIR_)t1errors.h # Type1 driver object(s) diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 5146192f2..c83a5019f 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -21,6 +21,8 @@ #include "t1gload.h" #include "t1load.h" +#include "t1errors.h" + #ifndef T1_CONFIG_OPTION_NO_AFM #include "t1afm.h" #endif diff --git a/src/type1/t1errors.h b/src/type1/t1errors.h new file mode 100644 index 000000000..ebd0a81be --- /dev/null +++ b/src/type1/t1errors.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* t1errors.h */ +/* */ +/* Type 1 error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the Type 1 error enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __T1ERRORS_H__ +#define __T1ERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) T1_Err_ ## e = v + FT_Mod_Err_Type1, +#define FT_NOERRORDEF( e, v, s ) T1_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST T1_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __T1ERRORS_H__ */ + + +/* END */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 881c99801..695897f90 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -23,6 +23,8 @@ #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include "t1errors.h" + #include /* for strcmp() */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index b848c9786..faff55230 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -66,10 +66,11 @@ #include FT_CONFIG_CONFIG_H #include FT_MULTIPLE_MASTERS_H #include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include "t1load.h" +#include "t1errors.h" + #include /* for strncmp(), strcmp() */ #include /* for isalnum() */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index b830092a5..1c9f45bab 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -25,6 +25,8 @@ #include "t1gload.h" #include "t1load.h" +#include "t1errors.h" + #ifndef T1_CONFIG_OPTION_NO_AFM #include "t1afm.h" #endif diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index 8c83fa7a3..810380a03 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -23,7 +23,6 @@ #include #include FT_INTERNAL_OBJECTS_H #include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_TYPE1_TYPES_H diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index 2ec6ba3f4..fee1b380c 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -37,10 +37,12 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H + #include "t1parse.h" +#include "t1errors.h" + #include /* for strncmp() */ diff --git a/src/winfonts/fnterrs.h b/src/winfonts/fnterrs.h new file mode 100644 index 000000000..8d8cf337a --- /dev/null +++ b/src/winfonts/fnterrs.h @@ -0,0 +1,44 @@ +/***************************************************************************/ +/* */ +/* fnterrs.h */ +/* */ +/* Win FNT/FON error codes (specification only). */ +/* */ +/* Copyright 2001 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 file is used to define the Windows FNT/FON error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __FNTERRS_H__ +#define __FNTERRS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERRORDEF( e, v, s ) FNT_Err_ ## e = v + FT_Mod_Err_Winfonts, +#define FT_NOERRORDEF( e, v, s ) FNT_Err_ ## e = v, + +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FNT_Err_Max }; + +#include FT_ERRORS_H + +#endif /* __FNTERRS_H__ */ + + +/* END */ diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk index aa015f4c8..3574ad866 100644 --- a/src/winfonts/rules.mk +++ b/src/winfonts/rules.mk @@ -28,7 +28,8 @@ FNT_DRV_SRC := $(FNT_DIR_)winfnt.c # Windows driver headers # -FNT_DRV_H := $(FNT_DRV_SRC:%.c=%.h) +FNT_DRV_H := $(FNT_DRV_SRC:%.c=%.h) \ + $(FNT_DIR_)fnterrs.h # Windows driver object(s) diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 1fa47d7eb..423b48487 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -17,13 +17,15 @@ #include -#include FT_ERRORS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_FNT_TYPES_H + #include "winfnt.h" +#include "fnterrs.h" + /*************************************************************************/ /* */ @@ -139,14 +141,14 @@ header->version != 0x300 ) { FT_TRACE2(( "[not a valid FNT file]\n" )); - error = FT_Err_Unknown_File_Format; + error = FNT_Err_Unknown_File_Format; goto Exit; } if ( header->file_type & 1 ) { FT_TRACE2(( "[can't handle vector FNT fonts]\n" )); - error = FT_Err_Unknown_File_Format; + error = FNT_Err_Unknown_File_Format; goto Exit; } @@ -198,7 +200,7 @@ READ_Fields( winmz_header_fields, &mz_header ) ) goto Exit; - error = FT_Err_Unknown_File_Format; + error = FNT_Err_Unknown_File_Format; if ( mz_header.magic == WINFNT_MZ_MAGIC ) { /* yes, now look for a NE header in the file */ @@ -209,7 +211,7 @@ READ_Fields( winne_header_fields, &ne_header ) ) goto Exit; - error = FT_Err_Unknown_File_Format; + error = FNT_Err_Unknown_File_Format; if ( ne_header.magic == WINFNT_NE_MAGIC ) { /* good, now look in the resource table for each FNT resource */ @@ -254,7 +256,7 @@ if ( !font_count || !font_offset ) { FT_TRACE2(( "this file doesn't contain any FNT resources!\n" )); - error = FT_Err_Unknown_File_Format; + error = FNT_Err_Unknown_File_Format; goto Exit; } @@ -464,7 +466,7 @@ } } - return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Pixel_Size ); + return ( size->font ? FNT_Err_Ok : FNT_Err_Invalid_Pixel_Size ); } @@ -513,7 +515,7 @@ if ( !font ) { - error = FT_Err_Invalid_Argument; + error = FNT_Err_Invalid_Argument; goto Exit; }