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.
This commit is contained in:
Werner Lemberg 2001-06-06 17:30:41 +00:00
parent b3d9f882d0
commit 1f7f0e87e5
84 changed files with 1190 additions and 624 deletions

View File

@ -1,5 +1,49 @@
2001-06-06 Werner Lemberg <wl@gnu.org> 2001-06-06 Werner Lemberg <wl@gnu.org>
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 <wl@gnu.org>
* 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_): * src/include/freetype/tttables.h (TT_HoriHeader_, TT_VertHeader_):
Fix length of `Reserved' array. Note that this isn't the real fix Fix length of `Reserved' array. Note that this isn't the real fix
since recent OpenType specs have introduced a `CaretOffset' field since recent OpenType specs have introduced a `CaretOffset' field

View File

@ -164,6 +164,18 @@
#define FT_ERRORS_H <freetype/fterrors.h> #define FT_ERRORS_H <freetype/fterrors.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 <freetype/ftmoderr.h>
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* @macro: */ /* @macro: */

View File

@ -73,6 +73,22 @@ FT_BEGIN_HEADER
#undef FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS #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 */ /* Alternate Glyph Image Format support */

View File

@ -19,14 +19,25 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* This file is used to define the FreeType error enumeration constants. */ /* 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 */ /* It can also be used to create an error message table easily with */
/* something like */ /* something like */
/* */ /* */
/* { */ /* { */
/* #undef __FTERRORS_H__ */ /* #undef __FTERRORS_H__ */
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */ /* #define FT_ERRORDEF( e, v, s ) { FT_Err_ ## e, s }, */
/* #define FT_ERROR_START_LIST { */ /* #define FT_NOERRORDEF( e, v, s ) { FT_Err_ ## e, s }, */
/* #define FT_ERROR_END_LIST { 0, 0 } }; */ /* #define FT_ERROR_START_LIST { */
/* #define FT_ERROR_END_LIST { 0, 0 } }; */
/* */ /* */
/* const struct */ /* const struct */
/* { */ /* { */
@ -37,8 +48,8 @@
/* #include FT_ERRORS_H */ /* #include FT_ERRORS_H */
/* } */ /* } */
/* */ /* */
/* For C++ it might be necessary to use `extern "C" {' and to define */ /* To use such a table, all errors must be ANDed with 0x00FF to remove */
/* FT_NEED_EXTERN_C also. */ /* the module error offset. */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
@ -46,15 +57,18 @@
#ifndef __FTERRORS_H__ #ifndef __FTERRORS_H__
#define __FTERRORS_H__ #define __FTERRORS_H__
#include FT_MODULE_ERRORS_H
#undef FT_NEED_EXTERN_C #undef FT_NEED_EXTERN_C
#ifndef FT_ERRORDEF #ifndef FT_ERRORDEF
#define FT_ERRORDEF( e, v, s ) e = v, #define FT_ERRORDEF( e, v, s ) FT_Err_ ## e = v + FT_Mod_Err_Base,
#define FT_ERROR_START_LIST enum { #define FT_NOERRORDEF( e, v, s ) FT_Err_ ## e = v,
#define FT_ERROR_END_LIST FT_Err_Max };
#define FT_ERROR_START_LIST enum {
#define FT_ERROR_END_LIST FT_Err_Max };
#ifdef __cplusplus #ifdef __cplusplus
#define FT_NEED_EXTERN_C #define FT_NEED_EXTERN_C
@ -68,119 +82,182 @@
FT_ERROR_START_LIST FT_ERROR_START_LIST
#endif #endif
/* generic errors */ /* generic errors */
FT_ERRORDEF( FT_Err_Ok, 0x0000, \ FT_NOERRORDEF( Ok, 0x00, \
"no error" ) "no error" )
FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, \
FT_ERRORDEF( Cannot_Open_Resource, 0x01, \
"cannot open resource" ) "cannot open resource" )
FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, \ FT_ERRORDEF( Unknown_File_Format, 0x02, \
"unknown file format" ) "unknown file format" )
FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, \ FT_ERRORDEF( Invalid_File_Format, 0x03, \
"broken file" ) "broken file" )
FT_ERRORDEF( FT_Err_Invalid_Version, 0x0004, \ FT_ERRORDEF( Invalid_Version, 0x04, \
"invalid FreeType version" ) "invalid FreeType version" )
FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0005, \ FT_ERRORDEF( Lower_Module_Version, 0x05, \
"module version is too low" ) "module version is too low" )
FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0006, \ FT_ERRORDEF( Invalid_Argument, 0x06, \
"invalid argument" ) "invalid argument" )
FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0007, \ FT_ERRORDEF( Unimplemented_Feature, 0x07, \
"unimplemented feature" ) "unimplemented feature" )
/* glyph/character errors */ /* glyph/character errors */
FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0010, \ FT_ERRORDEF( Invalid_Glyph_Index, 0x10, \
"invalid glyph index" ) "invalid glyph index" )
FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0011, \ FT_ERRORDEF( Invalid_Character_Code, 0x11, \
"invalid character code" ) "invalid character code" )
FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0012, \ FT_ERRORDEF( Invalid_Glyph_Format, 0x12, \
"unsupported glyph image format" ) "unsupported glyph image format" )
FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0013, \ FT_ERRORDEF( Cannot_Render_Glyph, 0x13, \
"cannot render this glyph format" ) "cannot render this glyph format" )
FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0014, \ FT_ERRORDEF( Invalid_Outline, 0x14, \
"invalid outline" ) "invalid outline" )
FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0015, \ FT_ERRORDEF( Invalid_Composite, 0x15, \
"invalid composite glyph" ) "invalid composite glyph" )
FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0016, \ FT_ERRORDEF( Too_Many_Hints, 0x16, \
"too many hints" ) "too many hints" )
FT_ERRORDEF( FT_Err_Invalid_Pixel_Size, 0x0017, \ FT_ERRORDEF( Invalid_Pixel_Size, 0x17, \
"invalid pixel size" ) "invalid pixel size" )
/* handle errors */ /* handle errors */
FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0020, \ FT_ERRORDEF( Invalid_Handle, 0x20, \
"invalid object handle" ) "invalid object handle" )
FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0021, \ FT_ERRORDEF( Invalid_Library_Handle, 0x21, \
"invalid library handle" ) "invalid library handle" )
FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0022, \ FT_ERRORDEF( Invalid_Driver_Handle, 0x22, \
"invalid module handle" ) "invalid module handle" )
FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0023, \ FT_ERRORDEF( Invalid_Face_Handle, 0x23, \
"invalid face handle" ) "invalid face handle" )
FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0024, \ FT_ERRORDEF( Invalid_Size_Handle, 0x24, \
"invalid size handle" ) "invalid size handle" )
FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0025, \ FT_ERRORDEF( Invalid_Slot_Handle, 0x25, \
"invalid glyph slot handle" ) "invalid glyph slot handle" )
FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0026, \ FT_ERRORDEF( Invalid_CharMap_Handle, 0x26, \
"invalid charmap handle" ) "invalid charmap handle" )
FT_ERRORDEF( FT_Err_Invalid_Cache_Handle, 0x0027, \ FT_ERRORDEF( Invalid_Cache_Handle, 0x27, \
"invalid cache manager handle" ) "invalid cache manager handle" )
FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0028, \ FT_ERRORDEF( Invalid_Stream_Handle, 0x28, \
"invalid stream handle" ) "invalid stream handle" )
/* driver errors */ /* driver errors */
FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0030, \ FT_ERRORDEF( Too_Many_Drivers, 0x30, \
"too many modules" ) "too many modules" )
FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0031, \ FT_ERRORDEF( Too_Many_Extensions, 0x31, \
"too many extensions" ) "too many extensions" )
/* memory errors */ /* memory errors */
FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0040, \ FT_ERRORDEF( Out_Of_Memory, 0x40, \
"out of memory" ) "out of memory" )
FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0041, \ FT_ERRORDEF( Unlisted_Object, 0x41, \
"unlisted object" ) "unlisted object" )
/* stream errors */ /* stream errors */
FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0051, \ FT_ERRORDEF( Cannot_Open_Stream, 0x51, \
"cannot open stream" ) "cannot open stream" )
FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0052, \ FT_ERRORDEF( Invalid_Stream_Seek, 0x52, \
"invalid stream seek" ) "invalid stream seek" )
FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0053, \ FT_ERRORDEF( Invalid_Stream_Skip, 0x53, \
"invalid stream skip" ) "invalid stream skip" )
FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0054, \ FT_ERRORDEF( Invalid_Stream_Read, 0x54, \
"invalid stream read" ) "invalid stream read" )
FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0055, \ FT_ERRORDEF( Invalid_Stream_Operation, 0x55, \
"invalid stream operation" ) "invalid stream operation" )
FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0056, \ FT_ERRORDEF( Invalid_Frame_Operation, 0x56, \
"invalid frame operation" ) "invalid frame operation" )
FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0057, \ FT_ERRORDEF( Nested_Frame_Access, 0x57, \
"nested frame access" ) "nested frame access" )
FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0058, \ FT_ERRORDEF( Invalid_Frame_Read, 0x58, \
"invalid frame read" ) "invalid frame read" )
/* raster errors */ /* raster errors */
FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0060, \ FT_ERRORDEF( Raster_Uninitialized, 0x60, \
"raster uninitialized" ) "raster uninitialized" )
FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0061, \ FT_ERRORDEF( Raster_Corrupted, 0x61, \
"raster corrupted" ) "raster corrupted" )
FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0062, \ FT_ERRORDEF( Raster_Overflow, 0x62, \
"raster overflow" ) "raster overflow" )
FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0063, \ FT_ERRORDEF( Raster_Negative_Height, 0x63, \
"negative height while rastering" ) "negative height while rastering" )
/* cache errors */ /* cache errors */
FT_ERRORDEF( FT_Err_Too_Many_Caches, 0x0070, \ FT_ERRORDEF( Too_Many_Caches, 0x70, \
"too many registered caches" ) "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 #ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST FT_ERROR_END_LIST
@ -190,6 +267,7 @@
#undef FT_ERROR_START_LIST #undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST #undef FT_ERROR_END_LIST
#undef FT_ERRORDEF #undef FT_ERRORDEF
#undef FT_NOERRORDEF
#ifdef FT_NEED_EXTERN_C #ifdef FT_NEED_EXTERN_C

123
include/freetype/ftmoderr.h Normal file
View File

@ -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 */

View File

@ -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 <ft2build.h>
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 */

View File

@ -36,19 +36,14 @@
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h> #define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h> #define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
#define FT_INTERNAL_TRUETYPE_ERRORS_H <freetype/internal/tterrors.h>
#define FT_INTERNAL_TYPE1_ERRORS_H <freetype/internal/t1errors.h>
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h> #define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
#define FT_INTERNAL_CFF_ERRORS_H <freetype/internal/cfferrs.h>
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h> #define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h> #define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h> #define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> #define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
/* END */ /* END */

View File

@ -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 <ft2build.h>
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 */

View File

@ -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 <ft2build.h>
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 */

43
src/autohint/aherrors.h Normal file
View File

@ -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 */

View File

@ -24,6 +24,7 @@
#include "ahglyph.h" #include "ahglyph.h"
#include "ahangles.h" #include "ahangles.h"
#include "ahglobal.h" #include "ahglobal.h"
#include "aherrors.h"
#include <stdio.h> #include <stdio.h>
@ -388,7 +389,7 @@
FT_Face face ) FT_Face face )
{ {
FT_Memory memory = outline->memory; FT_Memory memory = outline->memory;
FT_Error error = FT_Err_Ok; FT_Error error = AH_Err_Ok;
FT_Outline* source = &face->glyph->outline; FT_Outline* source = &face->glyph->outline;
FT_Int num_points = source->n_points; FT_Int num_points = source->n_points;
FT_Int num_contours = source->n_contours; FT_Int num_contours = source->n_contours;
@ -399,7 +400,7 @@
if ( !face || if ( !face ||
!face->size || !face->size ||
face->glyph->format != ft_glyph_format_outline ) 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 */ /* first of all, reallocate the contours array if necessary */
if ( num_contours > outline->max_contours ) if ( num_contours > outline->max_contours )
@ -1316,7 +1317,7 @@
AH_Globals* globals = &face_globals->design; AH_Globals* globals = &face_globals->design;
FT_Fixed y_scale = outline->y_scale; 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 */ /* compute which blue zones are active, i.e. have their scaled */
@ -1325,14 +1326,16 @@
AH_Blue blue; AH_Blue blue;
FT_Bool check = 0; FT_Bool check = 0;
for ( blue = ah_blue_capital_top; blue < ah_blue_max; blue++ ) for ( blue = ah_blue_capital_top; blue < ah_blue_max; blue++ )
{ {
FT_Pos ref, shoot, dist; FT_Pos ref, shoot, dist;
ref = globals->blue_refs[blue]; ref = globals->blue_refs[blue];
shoot = globals->blue_shoots[blue]; shoot = globals->blue_shoots[blue];
dist = ref-shoot; dist = ref-shoot;
if (dist < 0) if ( dist < 0 )
dist = -dist; dist = -dist;
blue_active[blue] = 0; blue_active[blue] = 0;
@ -1345,7 +1348,7 @@
} }
/* return immediately if no blue zone is active */ /* return immediately if no blue zone is active */
if (!check) if ( !check )
return; return;
} }

View File

@ -23,6 +23,7 @@
#include "ahhint.h" #include "ahhint.h"
#include "ahglyph.h" #include "ahglyph.h"
#include "ahangles.h" #include "ahangles.h"
#include "aherrors.h"
#include FT_OUTLINE_H #include FT_OUTLINE_H
@ -1241,7 +1242,7 @@
if ( start_point + k >= num_base_points || if ( start_point + k >= num_base_points ||
l >= (FT_UInt)num_new_points ) l >= (FT_UInt)num_new_points )
{ {
error = FT_Err_Invalid_Composite; error = AH_Err_Invalid_Composite;
goto Exit; goto Exit;
} }
@ -1279,7 +1280,7 @@
default: default:
/* we don't support other formats (yet?) */ /* we don't support other formats (yet?) */
error = FT_Err_Unimplemented_Feature; error = AH_Err_Unimplemented_Feature;
} }
Hint_Metrics: Hint_Metrics:

View File

@ -39,7 +39,8 @@ AUTO_DRV_SRC := $(AUTO_DIR_)ahangles.c \
# #
AUTO_DRV_H := $(AUTO_DRV_SRC:%c=%h) \ AUTO_DRV_H := $(AUTO_DRV_SRC:%c=%h) \
$(AUTO_DIR_)ahloader.h \ $(AUTO_DIR_)ahloader.h \
$(AUTO_DIR_)ahtypes.h $(AUTO_DIR_)ahtypes.h \
$(AUTO_DIR_)aherrors.h
# AUTO driver object(s) # AUTO driver object(s)

View File

@ -23,6 +23,8 @@
#include FT_ERRORS_H #include FT_ERRORS_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include "ftcerror.h"
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -223,7 +225,7 @@
*anode = 0; *anode = 0;
if ( glyph_index >= cset->element_max ) if ( glyph_index >= cset->element_max )
error = FT_Err_Invalid_Argument; error = FTC_Err_Invalid_Argument;
else else
{ {
FT_UInt chunk_size = cset->element_count; FT_UInt chunk_size = cset->element_count;
@ -401,7 +403,7 @@
/* check for valid `desc' delayed to FT_Lru_Lookup() */ /* check for valid `desc' delayed to FT_Lru_Lookup() */
if ( !cache || !anode || !aindex ) if ( !cache || !anode || !aindex )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*anode = 0; *anode = 0;
*aindex = 0; *aindex = 0;

43
src/cache/ftcerror.h vendored Normal file
View File

@ -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 */

View File

@ -24,6 +24,8 @@
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include "ftcerror.h"
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -433,7 +435,7 @@
/* check for valid `desc' delayed to FT_Lru_Lookup() */ /* check for valid `desc' delayed to FT_Lru_Lookup() */
if ( !cache || !anode ) if ( !cache || !anode )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*anode = 0; *anode = 0;
gset = cache->last_gset; gset = cache->last_gset;

View File

@ -21,6 +21,8 @@
#include FT_CACHE_IMAGE_H #include FT_CACHE_IMAGE_H
#include FT_INTERNAL_MEMORY_H #include FT_INTERNAL_MEMORY_H
#include "ftcerror.h"
#include <string.h> /* memcmp() */ #include <string.h> /* memcmp() */
#include <stdlib.h> /* labs() */ #include <stdlib.h> /* labs() */
@ -143,7 +145,7 @@
node->ft_glyph = glyph; node->ft_glyph = glyph;
} }
else 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 */ /* some argument checks are delayed to FTC_Glyph_Cache_Lookup */
if (!aglyph) if (!aglyph)
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
error = FTC_Glyph_Cache_Lookup( (FTC_Glyph_Cache)cache, error = FTC_Glyph_Cache_Lookup( (FTC_Glyph_Cache)cache,
desc, gindex, &node ); desc, gindex, &node );

10
src/cache/ftcmanag.c vendored
View File

@ -23,6 +23,8 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_LIST_H #include FT_LIST_H
#include "ftcerror.h"
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_cache #define FT_COMPONENT trace_cache
@ -224,7 +226,7 @@
if ( !library ) if ( !library )
return FT_Err_Invalid_Library_Handle; return FTC_Err_Invalid_Library_Handle;
memory = library->memory; memory = library->memory;
@ -328,7 +330,7 @@
FT_Face *aface ) FT_Face *aface )
{ {
if ( !manager ) if ( !manager )
return FT_Err_Invalid_Cache_Handle; return FTC_Err_Invalid_Cache_Handle;
return FT_Lru_Lookup( manager->faces_lru, return FT_Lru_Lookup( manager->faces_lru,
(FT_LruKey)face_id, (FT_LruKey)face_id,
@ -436,7 +438,7 @@
FTC_Cache_Class* clazz, FTC_Cache_Class* clazz,
FTC_Cache *acache ) FTC_Cache *acache )
{ {
FT_Error error = FT_Err_Invalid_Argument; FT_Error error = FTC_Err_Invalid_Argument;
if ( manager && clazz && acache ) if ( manager && clazz && acache )
@ -459,7 +461,7 @@
/* return an error if there are too many registered caches */ /* return an error if there are too many registered caches */
if ( index >= FTC_MAX_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(( "FTC_Manager_Register_Cache:" ));
FT_ERROR(( " too many registered caches\n" )); FT_ERROR(( " too many registered caches\n" ));
goto Exit; goto Exit;

View File

@ -23,6 +23,8 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_ERRORS_H #include FT_ERRORS_H
#include "ftcerror.h"
#include <string.h> /* memcmp() */ #include <string.h> /* memcmp() */
@ -144,7 +146,7 @@
{ {
FT_ERROR(( "FTC_SBit_Cache: cannot load scalable glyphs in an" FT_ERROR(( "FTC_SBit_Cache: cannot load scalable glyphs in an"
" sbit cache, please check your arguments!\n" )); " sbit cache, please check your arguments!\n" ));
error = FT_Err_Invalid_Argument; error = FTC_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -378,7 +380,7 @@
/* argument checks delayed to FTC_Chunk_Cache_Lookup */ /* argument checks delayed to FTC_Chunk_Cache_Lookup */
if ( !ansbit ) if ( !ansbit )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*ansbit = 0; *ansbit = 0;
error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex, error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex,

8
src/cache/ftlru.c vendored
View File

@ -22,6 +22,8 @@
#include FT_LIST_H #include FT_LIST_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include "ftcerror.h"
static static
void lru_build_free_list( FT_LruNode nodes, void lru_build_free_list( FT_LruNode nodes,
@ -50,7 +52,7 @@
if ( !anlru ) if ( !anlru )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*anlru = 0; *anlru = 0;
if ( !ALLOC( lru, sizeof ( *lru ) ) ) if ( !ALLOC( lru, sizeof ( *lru ) ) )
@ -146,7 +148,7 @@
if ( !lru || !key || !anode ) if ( !lru || !key || !anode )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
node = lru->elements.head; node = lru->elements.head;
clazz = lru->clazz; clazz = lru->clazz;
@ -271,7 +273,7 @@
/* check for valid `lru' and `key' delayed to FT_Lru_Lookup_Node() */ /* check for valid `lru' and `key' delayed to FT_Lru_Lookup_Node() */
if ( !anobject ) if ( !anobject )
return FT_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*anobject = 0; *anobject = 0;
error = FT_Lru_Lookup_Node( lru, key, &node ); error = FT_Lru_Lookup_Node( lru, key, &node );

3
src/cache/rules.mk vendored
View File

@ -40,7 +40,8 @@ Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c \
Cache_DRV_H := $(CACHE_H_DIR_)ftlru.h \ Cache_DRV_H := $(CACHE_H_DIR_)ftlru.h \
$(CACHE_H_DIR_)ftcmanag.h \ $(CACHE_H_DIR_)ftcmanag.h \
$(CACHE_H_DIR_)ftcglyph.h \ $(CACHE_H_DIR_)ftcglyph.h \
$(CACHE_H_DIR_)ftcimage.h $(CACHE_H_DIR_)ftcimage.h \
$(CACHE_DIR_)ftcerror.h
# Cache driver object(s) # Cache driver object(s)

View File

@ -22,12 +22,14 @@
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H #include FT_INTERNAL_SFNT_H
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include FT_INTERNAL_CFF_ERRORS_H
#include "cffdrivr.h" #include "cffdrivr.h"
#include "cffgload.h" #include "cffgload.h"
#include "cffload.h" #include "cffload.h"
#include "cfferrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -180,7 +182,7 @@
if ( !slot ) if ( !slot )
return CFF_Err_Invalid_Glyph_Handle; return CFF_Err_Invalid_Slot_Handle;
/* check whether we want a scaled outline or bitmap */ /* check whether we want a scaled outline or bitmap */
if ( !size ) if ( !size )

43
src/cff/cfferrs.h Normal file
View File

@ -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 */

View File

@ -27,7 +27,7 @@
#include "cffload.h" #include "cffload.h"
#include "cffgload.h" #include "cffgload.h"
#include FT_INTERNAL_CFF_ERRORS_H #include "cfferrs.h"
/*************************************************************************/ /*************************************************************************/

View File

@ -21,12 +21,13 @@
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_CFF_ERRORS_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "cffload.h" #include "cffload.h"
#include "cffparse.h" #include "cffparse.h"
#include "cfferrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -27,7 +27,8 @@
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include "cffobjs.h" #include "cffobjs.h"
#include "cffload.h" #include "cffload.h"
#include FT_INTERNAL_CFF_ERRORS_H
#include "cfferrs.h"
#include <string.h> /* for strlen() */ #include <string.h> /* for strlen() */

View File

@ -23,7 +23,6 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_CFF_TYPES_H
#include FT_INTERNAL_CFF_ERRORS_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H

View File

@ -18,9 +18,10 @@
#include <ft2build.h> #include <ft2build.h>
#include "cffparse.h" #include "cffparse.h"
#include FT_INTERNAL_CFF_ERRORS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include "cfferrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -33,7 +33,8 @@ CFF_DRV_SRC := $(CFF_DIR_)cffobjs.c \
# CFF driver headers # CFF driver headers
# #
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
$(CFF_DIR_)cfftoken.h $(CFF_DIR_)cfftoken.h \
$(CFF_DIR_)cfferrs.h
# CFF driver object(s) # CFF driver object(s)

43
src/cid/ciderrs.h Normal file
View File

@ -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 */

View File

@ -23,6 +23,8 @@
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include "ciderrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -175,7 +177,7 @@
*max_advance = decoder.builder.advance.x; *max_advance = decoder.builder.advance.x;
return T1_Err_Ok; return CID_Err_Ok;
} }

View File

@ -21,9 +21,11 @@
#include FT_CONFIG_CONFIG_H #include FT_CONFIG_CONFIG_H
#include FT_MULTIPLE_MASTERS_H #include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_TYPE1_TYPES_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include "cidload.h" #include "cidload.h"
#include "ciderrs.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> /* for isspace(), isalnum() */ #include <ctype.h> /* for isspace(), isalnum() */
@ -125,7 +127,7 @@
{ {
FT_ERROR(( "cid_load_keyword: invalid use of `%s'!\n", FT_ERROR(( "cid_load_keyword: invalid use of `%s'!\n",
keyword->ident )); keyword->ident ));
error = T1_Err_Syntax_Error; error = CID_Err_Syntax_Error;
goto Exit; goto Exit;
} }
@ -170,7 +172,7 @@
bbox->xMax = FT_RoundFix( temp[2] ); bbox->xMax = FT_RoundFix( temp[2] );
bbox->yMax = FT_RoundFix( temp[3] ); 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 */ /* we must return an error code */
} }
@ -224,7 +226,7 @@
offset->y = temp[5] >> 16; 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 */ /* we must return an error code */
} }
@ -235,7 +237,7 @@
{ {
CID_Info* cid = &face->cid; CID_Info* cid = &face->cid;
FT_Memory memory = face->root.memory; FT_Memory memory = face->root.memory;
FT_Error error = T1_Err_Ok; FT_Error error = CID_Err_Ok;
FT_Long num_dicts; FT_Long num_dicts;
@ -271,7 +273,7 @@
const T1_Field cid_field_records[] = const T1_Field cid_field_records[] =
{ {
#include "cidtokens.h" #include "cidtoken.h"
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox ) T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
T1_FIELD_CALLBACK( "FDArray", parse_fd_array ) T1_FIELD_CALLBACK( "FDArray", parse_fd_array )

View File

@ -24,6 +24,8 @@
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_AUX_H
#include "ciderrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -165,7 +167,7 @@
if ( face_index != 0 ) if ( face_index != 0 )
{ {
FT_ERROR(( "CID_Init_Face: invalid face index\n" )); FT_ERROR(( "CID_Init_Face: invalid face index\n" ));
error = T1_Err_Invalid_Argument; error = CID_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -356,7 +358,7 @@
{ {
FT_UNUSED( driver ); FT_UNUSED( driver );
return T1_Err_Ok; return CID_Err_Ok;
} }

View File

@ -23,7 +23,6 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_CONFIG_CONFIG_H #include FT_CONFIG_CONFIG_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_TYPE1_TYPES_H

View File

@ -21,9 +21,11 @@
#include FT_INTERNAL_CALC_H #include FT_INTERNAL_CALC_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include "cidparse.h" #include "cidparse.h"
#include "ciderrs.h"
#include <string.h> /* for strncmp() */ #include <string.h> /* for strncmp() */
@ -75,7 +77,7 @@
"%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
{ {
FT_TRACE2(( "[not a valid CID-keyed font]\n" )); FT_TRACE2(( "[not a valid CID-keyed font]\n" ));
error = T1_Err_Unknown_File_Format; error = CID_Err_Unknown_File_Format;
} }
FORGET_Frame(); FORGET_Frame();

View File

@ -23,6 +23,8 @@
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include "ciderrs.h"
#include <string.h> /* for strcmp() */ #include <string.h> /* for strcmp() */
@ -65,7 +67,7 @@
if ( afm ) if ( afm )
CID_Get_Kerning( afm, left_glyph, right_glyph, kerning ); CID_Get_Kerning( afm, left_glyph, right_glyph, kerning );
return T1_Err_Ok; return CID_Err_Ok;
} }

View File

@ -1,6 +1,6 @@
/***************************************************************************/ /***************************************************************************/
/* */ /* */
/* cidtokens.h */ /* cidtoken.h */
/* */ /* */
/* CID token definitions (specification only). */ /* CID token definitions (specification only). */
/* */ /* */

View File

@ -33,7 +33,8 @@ CID_DRV_SRC := $(CID_DIR_)cidparse.c \
# CID driver headers # CID driver headers
# #
CID_DRV_H := $(CID_DRV_SRC:%.c=%.h) \ CID_DRV_H := $(CID_DRV_SRC:%.c=%.h) \
$(CID_DIR_)cidtokens.h $(CID_DIR_)cidtoken.h \
$(CID_DIR_)ciderrs.h
# CID driver object(s) # CID driver object(s)

View File

@ -27,7 +27,6 @@ THE SOFTWARE.
#include <ft2build.h> #include <ft2build.h>
#include FT_ERRORS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
@ -36,6 +35,8 @@ THE SOFTWARE.
#include "pcfdriver.h" #include "pcfdriver.h"
#include "pcfutil.h" #include "pcfutil.h"
#include "pcferror.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -68,7 +69,7 @@ THE SOFTWARE.
FT_TRACE4(( "DONE_FACE!!!\n" )); FT_TRACE4(( "DONE_FACE!!!\n" ));
return FT_Err_Ok; return PCF_Err_Ok;
} }
@ -79,7 +80,7 @@ THE SOFTWARE.
FT_Int num_params, FT_Int num_params,
FT_Parameter* params ) FT_Parameter* params )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_UNUSED( num_params ); FT_UNUSED( num_params );
FT_UNUSED( params ); FT_UNUSED( params );
@ -90,13 +91,13 @@ THE SOFTWARE.
if ( error ) if ( error )
goto Fail; goto Fail;
return FT_Err_Ok; return PCF_Err_Ok;
Fail: Fail:
FT_TRACE2(( "[not a valid PCF file]\n" )); FT_TRACE2(( "[not a valid PCF file]\n" ));
PCF_Done_Face( face ); 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.height = size->metrics.ascender -
size->metrics.descender; size->metrics.descender;
return FT_Err_Ok; return PCF_Err_Ok;
} }
else else
{ {
FT_TRACE4(( "size WRONG\n" )); 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 ) FT_Int load_flags )
{ {
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); 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_Memory memory = FT_FACE(face)->memory;
FT_Bitmap* bitmap = &slot->bitmap; FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric; PCF_Metric metric;
@ -151,7 +152,7 @@ THE SOFTWARE.
if ( !face ) if ( !face )
{ {
error = FT_Err_Invalid_Argument; error = PCF_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -186,7 +187,7 @@ THE SOFTWARE.
break; break;
default: default:
return FT_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
} }
/* XXX: to do: are there cases that need repadding the bitmap? */ /* XXX: to do: are there cases that need repadding the bitmap? */

43
src/pcf/pcferror.h Normal file
View File

@ -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 */

View File

@ -27,7 +27,6 @@ THE SOFTWARE.
#include <ft2build.h> #include <ft2build.h>
#include FT_ERRORS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
@ -35,6 +34,8 @@ THE SOFTWARE.
#include "pcf.h" #include "pcf.h"
#include "pcfdriver.h" #include "pcfdriver.h"
#include "pcferror.h"
#include <string.h> /* strlen(), strcpy() */ #include <string.h> /* strlen(), strcpy() */
/*************************************************************************/ /*************************************************************************/
@ -98,13 +99,13 @@ THE SOFTWARE.
if ( FILE_Seek ( 0 ) || if ( FILE_Seek ( 0 ) ||
READ_Fields ( pcf_toc_header, toc ) ) READ_Fields ( pcf_toc_header, toc ) )
return FT_Err_Cannot_Open_Resource; return PCF_Err_Cannot_Open_Resource;
if ( toc->version != PCF_FILE_VERSION ) 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 ) ) ) 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; tables = face->toc.tables;
for ( i = 0; i < toc->count; i++ ) for ( i = 0; i < toc->count; i++ )
@ -139,7 +140,7 @@ THE SOFTWARE.
#endif #endif
return FT_Err_Ok; return PCF_Err_Ok;
Exit: Exit:
FREE( face->toc.tables ); FREE( face->toc.tables );
@ -202,13 +203,13 @@ THE SOFTWARE.
const FT_Frame_Field* header, const FT_Frame_Field* header,
PCF_Metric metric ) PCF_Metric metric )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
if ( READ_Fields( header, metric ) ) if ( READ_Fields( header, metric ) )
return error; return error;
return FT_Err_Ok; return PCF_Err_Ok;
} }
@ -217,7 +218,7 @@ THE SOFTWARE.
PCF_Metric metric ) PCF_Metric metric )
{ {
PCF_Compressed_MetricRec compr_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 ) ) if ( READ_Fields( pcf_compressed_metric_header, &compr_metric ) )
@ -230,7 +231,7 @@ THE SOFTWARE.
metric->descent = (FT_Short)compr_metric.descent - 0x80; metric->descent = (FT_Short)compr_metric.descent - 0x80;
metric->attributes = 0; metric->attributes = 0;
return FT_Err_Ok; return PCF_Err_Ok;
} }
@ -239,7 +240,7 @@ THE SOFTWARE.
FT_ULong format, FT_ULong format,
PCF_Metric metric ) PCF_Metric metric )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
@ -272,15 +273,15 @@ THE SOFTWARE.
if ( tables[i].type == type ) if ( tables[i].type == type )
{ {
if ( stream->pos > tables[i].offset ) 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 ) ) 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 */ *sizep = tables[i].size; /* unused - to be removed */
*formatp = tables[i].format; *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( props );
FREE( strings ); FREE( strings );
return FT_Err_Ok; return PCF_Err_Ok;
Bail: Bail:
FREE( props ); FREE( props );
@ -480,7 +481,7 @@ THE SOFTWARE.
FT_Error pcf_get_metrics( FT_Stream stream, FT_Error pcf_get_metrics( FT_Stream stream,
PCF_Face face ) PCF_Face face )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory; FT_Memory memory = FT_FACE(face)->memory;
FT_ULong format = 0; FT_ULong format = 0;
FT_ULong size = 0; FT_ULong size = 0;
@ -502,7 +503,7 @@ THE SOFTWARE.
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) !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 ) ) if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
{ {
@ -519,12 +520,12 @@ THE SOFTWARE.
(void)READ_UShortLE( nmetrics ); (void)READ_UShortLE( nmetrics );
} }
if ( error || nmetrics == -1 ) if ( error || nmetrics == -1 )
return FT_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
face->nmetrics = nmetrics; face->nmetrics = nmetrics;
if ( ALLOC( face->metrics, nmetrics * sizeof ( PCF_MetricRec ) ) ) if ( ALLOC( face->metrics, nmetrics * sizeof ( PCF_MetricRec ) ) )
return FT_Err_Out_Of_Memory; return PCF_Err_Out_Of_Memory;
metrics = face->metrics; metrics = face->metrics;
for ( i = 0; i < nmetrics; i++ ) for ( i = 0; i < nmetrics; i++ )
@ -557,7 +558,7 @@ THE SOFTWARE.
FT_Error pcf_get_bitmaps( FT_Stream stream, FT_Error pcf_get_bitmaps( FT_Stream stream,
PCF_Face face ) PCF_Face face )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory; FT_Memory memory = FT_FACE(face)->memory;
FT_Long* offsets; FT_Long* offsets;
FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_Long bitmapSizes[GLYPHPADOPTIONS];
@ -580,7 +581,7 @@ THE SOFTWARE.
return error; return error;
format = GET_ULongLE(); format = GET_ULongLE();
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) 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 ) if ( PCF_BYTE_ORDER( format ) == MSBFirst )
nbitmaps = GET_ULong(); nbitmaps = GET_ULong();
@ -588,7 +589,7 @@ THE SOFTWARE.
nbitmaps = GET_ULongLE(); nbitmaps = GET_ULongLE();
FT_Forget_Frame( stream ); FT_Forget_Frame( stream );
if ( nbitmaps != face->nmetrics ) if ( nbitmaps != face->nmetrics )
return FT_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
if ( ALLOC( offsets, nbitmaps * sizeof ( FT_ULong ) ) ) if ( ALLOC( offsets, nbitmaps * sizeof ( FT_ULong ) ) )
return error; return error;
@ -647,7 +648,7 @@ THE SOFTWARE.
FT_Error pcf_get_encodings( FT_Stream stream, FT_Error pcf_get_encodings( FT_Stream stream,
PCF_Face face ) PCF_Face face )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory; FT_Memory memory = FT_FACE(face)->memory;
FT_ULong format, size; FT_ULong format, size;
int firstCol, lastCol; int firstCol, lastCol;
@ -671,7 +672,7 @@ THE SOFTWARE.
return error; return error;
format = GET_ULongLE(); format = GET_ULongLE();
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) 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 ) if ( PCF_BYTE_ORDER( format ) == MSBFirst )
{ {
@ -698,7 +699,7 @@ THE SOFTWARE.
nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );
if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) ) 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 ); error = FT_Access_Frame( stream, 2 * nencoding );
if ( error ) if ( error )
@ -799,7 +800,7 @@ THE SOFTWARE.
FT_ULong type ) FT_ULong type )
{ {
FT_ULong format, size; FT_ULong format, size;
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
PCF_Accel accel = &face->accel; PCF_Accel accel = &face->accel;
@ -860,7 +861,7 @@ THE SOFTWARE.
FT_Error pcf_load_font( FT_Stream stream, FT_Error pcf_load_font( FT_Stream stream,
PCF_Face face ) PCF_Face face )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory; FT_Memory memory = FT_FACE(face)->memory;
FT_Bool hasBDFAccelerators; FT_Bool hasBDFAccelerators;
@ -1033,7 +1034,7 @@ THE SOFTWARE.
face->charmap.face = root; face->charmap.face = root;
face->charmap_handle face->charmap_handle
return FT_Err_Ok; return PCF_Err_Ok;
} }
#endif #endif
} }
@ -1047,11 +1048,11 @@ THE SOFTWARE.
face->charmap_handle = &face->charmap; face->charmap_handle = &face->charmap;
root->charmap = face->charmap_handle; root->charmap = face->charmap_handle;
} }
return FT_Err_Ok; return PCF_Err_Ok;
Bail: Bail:
PCF_Done_Face( face ); PCF_Done_Face( face );
return FT_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
} }

View File

@ -44,7 +44,8 @@ PCF_DRV_SRC := $(PCF_DIR_)pcfread.c \
# #
PCF_DRV_H := $(PCF_DIR_)pcf.h \ PCF_DRV_H := $(PCF_DIR_)pcf.h \
$(PCF_DIR_)pcfdriver.h \ $(PCF_DIR_)pcfdriver.h \
$(PCF_DIR_)pcfutil.h $(PCF_DIR_)pcfutil.h \
$(PCF_DIR_)pcferror.h
# pcf driver object(s) # pcf driver object(s)
# #

44
src/psaux/psauxerr.h Normal file
View File

@ -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 */

View File

@ -18,11 +18,12 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_ERRORS_H
#include "psobjs.h" #include "psobjs.h"
#include "psauxerr.h"
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -121,7 +122,7 @@
table->capacity = new_size; table->capacity = new_size;
return T1_Err_Ok; return PSaux_Err_Ok;
} }
@ -156,7 +157,7 @@
if ( index < 0 || index > table->max_elems ) if ( index < 0 || index > table->max_elems )
{ {
FT_ERROR(( "PS_Table_Add: invalid index\n" )); FT_ERROR(( "PS_Table_Add: invalid index\n" ));
return T1_Err_Invalid_Argument; return PSaux_Err_Invalid_Argument;
} }
/* grow the base block if needed */ /* grow the base block if needed */
@ -180,7 +181,7 @@
MEM_Copy( table->block + table->cursor, object, length ); MEM_Copy( table->block + table->cursor, object, length );
table->cursor += length; table->cursor += length;
return T1_Err_Ok; return PSaux_Err_Ok;
} }
@ -878,13 +879,13 @@
FT_UNUSED( pflags ); FT_UNUSED( pflags );
#endif #endif
error = T1_Err_Ok; error = PSaux_Err_Ok;
Exit: Exit:
return error; return error;
Fail: Fail:
error = T1_Err_Invalid_File_Format; error = PSaux_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -950,7 +951,7 @@
return error; return error;
Fail: Fail:
error = T1_Err_Invalid_File_Format; error = PSaux_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -1191,7 +1192,7 @@
if ( !builder->load_points ) if ( !builder->load_points )
{ {
outline->n_contours++; outline->n_contours++;
return T1_Err_Ok; return PSaux_Err_Ok;
} }
error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 ); error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 );

View File

@ -32,7 +32,8 @@ PSAUX_DRV_SRC := $(PSAUX_DIR_)psobjs.c \
# PSAUX driver headers # 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) # PSAUX driver object(s)

View File

@ -18,11 +18,13 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include "t1decode.h" #include "t1decode.h"
#include "psobjs.h" #include "psobjs.h"
#include "psauxerr.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -193,7 +195,7 @@
{ {
FT_ERROR(( "t1operator_seac:" )); FT_ERROR(( "t1operator_seac:" ));
FT_ERROR(( " glyph names table not available in this font!\n" )); 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 ); bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
@ -203,7 +205,7 @@
{ {
FT_ERROR(( "t1operator_seac:" )); FT_ERROR(( "t1operator_seac:" ));
FT_ERROR(( " invalid seac character code arguments\n" )); 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 */ /* if we are trying to load a composite glyph, do not load the */
@ -344,7 +346,7 @@
limit = zone->limit = charstring_base + charstring_len; limit = zone->limit = charstring_base + charstring_len;
ip = zone->cursor = zone->base; ip = zone->cursor = zone->base;
error = T1_Err_Ok; error = PSaux_Err_Ok;
outline = builder->current; outline = builder->current;
x = builder->pos_x; x = builder->pos_x;
@ -713,7 +715,7 @@
/* return now! */ /* return now! */
FT_TRACE4(( "\n\n" )); FT_TRACE4(( "\n\n" ));
return T1_Err_Ok; return PSaux_Err_Ok;
case op_hsbw: case op_hsbw:
FT_TRACE4(( " hsbw" )); FT_TRACE4(( " hsbw" ));
@ -729,7 +731,7 @@
/* the glyph's metrics (lsb + advance width), not load the */ /* the glyph's metrics (lsb + advance width), not load the */
/* rest of it; so exit immediately */ /* rest of it; so exit immediately */
if ( builder->metrics_only ) if ( builder->metrics_only )
return T1_Err_Ok; return PSaux_Err_Ok;
break; break;
@ -753,7 +755,7 @@
/* the glyph's metrics (lsb + advance width), not load the */ /* the glyph's metrics (lsb + advance width), not load the */
/* rest of it; so exit immediately */ /* rest of it; so exit immediately */
if ( builder->metrics_only ) if ( builder->metrics_only )
return T1_Err_Ok; return PSaux_Err_Ok;
break; break;
@ -1014,10 +1016,10 @@
return error; return error;
Syntax_Error: Syntax_Error:
return T1_Err_Syntax_Error; return PSaux_Err_Syntax_Error;
Stack_Underflow: Stack_Underflow:
return T1_Err_Stack_Underflow; return PSaux_Err_Stack_Underflow;
Memory_Error: Memory_Error:
return builder->error; return builder->error;
@ -1054,7 +1056,7 @@
{ {
FT_ERROR(( "T1_Decoder_Init: " )); FT_ERROR(( "T1_Decoder_Init: " ));
FT_ERROR(( "the `psnames' module is not available\n" )); FT_ERROR(( "the `psnames' module is not available\n" ));
return T1_Err_Unimplemented_Feature; return PSaux_Err_Unimplemented_Feature;
} }
decoder->psnames = psnames; decoder->psnames = psnames;

View File

@ -19,9 +19,12 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include "psmodule.h" #include "psmodule.h"
#include "pstables.h" #include "pstables.h"
#include "psnamerr.h"
#include <stdlib.h> /* for qsort() */ #include <stdlib.h> /* for qsort() */
#include <string.h> /* for strcmp(), strncpy() */ #include <string.h> /* for strcmp(), strncpy() */
@ -192,7 +195,7 @@
{ {
FREE( table->maps ); FREE( table->maps );
if ( !error ) if ( !error )
error = FT_Err_Invalid_Argument; /* no unicode chars here! */ error = PSnames_Err_Invalid_Argument; /* no unicode chars here! */
} }
else else
/* sort the table in increasing order of unicode values */ /* sort the table in increasing order of unicode values */

44
src/psnames/psnamerr.h Normal file
View File

@ -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 */

View File

@ -32,7 +32,8 @@ PSNAMES_DRV_SRC := $(PSNAMES_DIR_)psmodule.c
# PSNames driver headers # PSNames driver headers
# #
PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \ PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \
$(PSNAMES_DIR_)pstables.h $(PSNAMES_DIR_)pstables.h \
$(PSNAMES_DIR_)psnamerr.h
# PSNames driver object(s) # PSNames driver object(s)

View File

@ -170,15 +170,17 @@
#else /* _STANDALONE_ */ #else /* _STANDALONE_ */
#include <freetype/internal/ftobjs.h> #include FT_INTERNAL_OBJECTS_H
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */ #include FT_INTERNAL_DEBUG_H /* for FT_TRACE() and FT_ERROR() */
#define Raster_Err_None FT_Err_Ok #include "rasterrs.h"
#define Raster_Err_Not_Ini FT_Err_Raster_Uninitialized
#define Raster_Err_Overflow FT_Err_Raster_Overflow #define Raster_Err_None Raster_Err_Ok
#define Raster_Err_Neg_Height FT_Err_Raster_Negative_Height #define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized
#define Raster_Err_Invalid FT_Err_Invalid_Outline #define Raster_Err_Overflow Raster_Err_Raster_Overflow
#define Raster_Err_Unsupported FT_Err_Cannot_Render_Glyph #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_ */ #endif /* _STANDALONE_ */
@ -3012,7 +3014,7 @@
return error; return error;
} }
return FT_Err_Ok; return Raster_Err_Ok;
} }
@ -3085,7 +3087,7 @@
return error; return error;
} }
return FT_Err_Ok; return Raster_Err_Ok;
} }
#else /* FT_RASTER_OPTION_ANTI_ALIASING */ #else /* FT_RASTER_OPTION_ANTI_ALIASING */
@ -3095,7 +3097,7 @@
{ {
FT_UNUSED_RASTER; FT_UNUSED_RASTER;
return FT_Err_Cannot_Render_Glyph; return Raster_Err_Cannot_Render_Glyph;
} }
#endif /* FT_RASTER_OPTION_ANTI_ALIASING */ #endif /* FT_RASTER_OPTION_ANTI_ALIASING */

View File

@ -22,6 +22,8 @@
#include "ftrend1.h" #include "ftrend1.h"
#include "ftraster.h" #include "ftraster.h"
#include "rasterrs.h"
/* initialize renderer -- init its raster */ /* initialize renderer -- init its raster */
static static
@ -34,7 +36,7 @@
library->raster_pool, library->raster_pool,
library->raster_pool_size ); library->raster_pool_size );
return FT_Err_Ok; return Raster_Err_Ok;
} }
@ -58,12 +60,12 @@
FT_Matrix* matrix, FT_Matrix* matrix,
FT_Vector* delta ) FT_Vector* delta )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = Raster_Err_Ok;
if ( slot->format != render->glyph_format ) if ( slot->format != render->glyph_format )
{ {
error = FT_Err_Invalid_Argument; error = Raster_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -111,7 +113,7 @@
/* check glyph image format */ /* check glyph image format */
if ( slot->format != render->glyph_format ) if ( slot->format != render->glyph_format )
{ {
error = FT_Err_Invalid_Argument; error = Raster_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -120,13 +122,13 @@
{ {
/* raster1 is only capable of producing monochrome bitmaps */ /* raster1 is only capable of producing monochrome bitmaps */
if ( render->clazz == &ft_raster1_renderer_class ) if ( render->clazz == &ft_raster1_renderer_class )
return FT_Err_Cannot_Render_Glyph; return Raster_Err_Cannot_Render_Glyph;
} }
else else
{ {
/* raster5 is only capable of producing 5-gray-levels bitmaps */ /* raster5 is only capable of producing 5-gray-levels bitmaps */
if ( render->clazz == &ft_raster5_renderer_class ) if ( render->clazz == &ft_raster5_renderer_class )
return FT_Err_Cannot_Render_Glyph; return Raster_Err_Cannot_Render_Glyph;
} }
outline = &slot->outline; outline = &slot->outline;

44
src/raster/rasterrs.h Normal file
View File

@ -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 */

View File

@ -31,7 +31,8 @@ RAS1_DRV_SRC := $(RAS1_DIR_)ftraster.c \
# raster1 driver headers # 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) # raster1 driver object(s)

View File

@ -35,7 +35,8 @@ SFNT_DRV_SRC := $(SFNT_DIR_)ttload.c \
# SFNT driver headers # 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) # SFNT driver object(s)

42
src/sfnt/sferrors.h Normal file
View File

@ -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 */

View File

@ -23,7 +23,8 @@
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_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" ); sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt ) if ( !sfnt )
{ {
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -237,7 +238,7 @@
#undef LOAD_ #undef LOAD_
#define LOAD_( x ) ( ( error = sfnt->load_##x( face, stream ) ) \ #define LOAD_( x ) ( ( error = sfnt->load_##x( face, stream ) ) \
!= TT_Err_Ok ) != SFNT_Err_Ok )
FT_LOCAL_DEF FT_LOCAL_DEF
@ -327,8 +328,8 @@
if ( sfnt->load_sbits && LOAD_( sbits ) ) if ( sfnt->load_sbits && LOAD_( sbits ) )
{ {
/* return an error if this font file has no outlines */ /* return an error if this font file has no outlines */
if ( error == TT_Err_Table_Missing && has_outline ) if ( error == SFNT_Err_Table_Missing && has_outline )
error = TT_Err_Ok; error = SFNT_Err_Ok;
else else
goto Exit; goto Exit;
} }
@ -341,7 +342,7 @@
goto Exit; goto Exit;
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE #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; goto Exit;
#endif #endif

View File

@ -18,10 +18,11 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include "ttload.h" #include "ttload.h"
#include "ttcmap.h" #include "ttcmap.h"
#include "sferrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -91,7 +92,7 @@
if ( cmap->loaded ) if ( cmap->loaded )
return TT_Err_Ok; return SFNT_Err_Ok;
memory = stream->memory; memory = stream->memory;
@ -260,11 +261,11 @@
break; break;
default: /* corrupt character mapping table */ 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: Fail:
TT_CharMap_Free( face, cmap ); TT_CharMap_Free( face, cmap );
@ -295,7 +296,7 @@
if ( !cmap ) if ( !cmap )
return TT_Err_Ok; return SFNT_Err_Ok;
memory = face->root.driver->root.memory; memory = face->root.driver->root.memory;
@ -328,7 +329,7 @@
} }
cmap->loaded = FALSE; cmap->loaded = FALSE;
return TT_Err_Ok; return SFNT_Err_Ok;
} }

View File

@ -19,12 +19,13 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "ttload.h" #include "ttload.h"
#include "ttcmap.h" #include "ttcmap.h"
#include "sferrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -122,7 +123,7 @@
goto Exit; goto Exit;
} }
else else
error = TT_Err_Table_Missing; error = SFNT_Err_Table_Missing;
Exit: Exit:
return error; return error;
@ -233,7 +234,7 @@
/* check face index */ /* check face index */
if ( face_index >= face->ttc_header.count ) if ( face_index >= face->ttc_header.count )
{ {
error = TT_Err_Bad_Argument; error = SFNT_Err_Bad_Argument;
goto Exit; goto Exit;
} }
@ -262,7 +263,7 @@
entry_selector * 2 <= num_tables ) entry_selector * 2 <= num_tables )
{ {
FT_TRACE2(( "TT_Load_SFNT_Header: file is not SFNT!\n" )); 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 ); table = TT_LookUp_Table( face, tag );
if ( !table ) if ( !table )
{ {
error = TT_Err_Table_Missing; error = SFNT_Err_Table_Missing;
goto Exit; goto Exit;
} }
@ -420,7 +421,7 @@
{ {
*length = size; *length = size;
return TT_Err_Ok; return SFNT_Err_Ok;
} }
if ( length ) if ( length )
@ -679,7 +680,7 @@
/* Set number_Of_VMetrics to 0! */ /* Set number_Of_VMetrics to 0! */
FT_TRACE2(( " no vertical header in file.\n" )); FT_TRACE2(( " no vertical header in file.\n" ));
face->vertical.number_Of_VMetrics = 0; face->vertical.number_Of_VMetrics = 0;
error = TT_Err_Ok; error = SFNT_Err_Ok;
goto Exit; goto Exit;
} }
@ -693,7 +694,7 @@
if ( error ) if ( error )
{ {
FT_ERROR(( " no horizontal metrics in file!\n" )); FT_ERROR(( " no horizontal metrics in file!\n" ));
error = TT_Err_Hmtx_Table_Missing; error = SFNT_Err_Hmtx_Table_Missing;
goto Exit; goto Exit;
} }
@ -713,8 +714,8 @@
vertical ? "Vertical" vertical ? "Vertical"
: "Horizontal" )); : "Horizontal" ));
error = vertical ? TT_Err_Invalid_Vert_Metrics error = vertical ? SFNT_Err_Invalid_Vert_Metrics
: TT_Err_Invalid_Horiz_Metrics; : SFNT_Err_Invalid_Horiz_Metrics;
goto Exit; goto Exit;
} }
@ -831,7 +832,7 @@
error = face->goto_table( face, TTAG_vhea, stream, 0 ); error = face->goto_table( face, TTAG_vhea, stream, 0 );
if ( error ) if ( error )
{ {
error = TT_Err_Ok; error = SFNT_Err_Ok;
goto Exit; goto Exit;
} }
@ -845,7 +846,7 @@
error = face->goto_table( face, TTAG_hhea, stream, 0 ); error = face->goto_table( face, TTAG_hhea, stream, 0 );
if ( error ) if ( error )
{ {
error = TT_Err_Horiz_Header_Missing; error = SFNT_Err_Horiz_Header_Missing;
goto Exit; goto Exit;
} }
@ -931,7 +932,7 @@
{ {
/* The name table is required so indicate failure. */ /* The name table is required so indicate failure. */
FT_TRACE2(( "is missing!\n" )); FT_TRACE2(( "is missing!\n" ));
error = TT_Err_Name_Table_Missing; error = SFNT_Err_Name_Table_Missing;
goto Exit; goto Exit;
} }
@ -1123,7 +1124,7 @@
error = face->goto_table( face, TTAG_cmap, stream, 0 ); error = face->goto_table( face, TTAG_cmap, stream, 0 );
if ( error ) if ( error )
{ {
error = TT_Err_CMap_Table_Missing; error = SFNT_Err_CMap_Table_Missing;
goto Exit; goto Exit;
} }
@ -1289,7 +1290,7 @@
{ {
FT_TRACE2(( "is missing!\n" )); FT_TRACE2(( "is missing!\n" ));
face->os2.version = 0xFFFF; face->os2.version = 0xFFFF;
error = TT_Err_Ok; error = SFNT_Err_Ok;
goto Exit; goto Exit;
} }
@ -1367,7 +1368,7 @@
error = face->goto_table( face, TTAG_post, stream, 0 ); error = face->goto_table( face, TTAG_post, stream, 0 );
if ( error ) if ( error )
return TT_Err_Post_Table_Missing; return SFNT_Err_Post_Table_Missing;
if ( READ_Fields( post_fields, post ) ) if ( READ_Fields( post_fields, post ) )
return error; return error;
@ -1376,7 +1377,7 @@
/* module (ttpost). */ /* module (ttpost). */
FT_TRACE2(( "loaded\n" )); FT_TRACE2(( "loaded\n" ));
return TT_Err_Ok; return SFNT_Err_Ok;
} }
@ -1434,7 +1435,7 @@
{ {
FT_TRACE2(( "missing (optional)\n" )); FT_TRACE2(( "missing (optional)\n" ));
pclt->Version = 0; pclt->Version = 0;
return TT_Err_Ok; return SFNT_Err_Ok;
} }
if ( READ_Fields( pclt_fields, pclt ) ) if ( READ_Fields( pclt_fields, pclt ) )
@ -1478,7 +1479,7 @@
/* the gasp table is optional */ /* the gasp table is optional */
error = face->goto_table( face, TTAG_gasp, stream, 0 ); error = face->goto_table( face, TTAG_gasp, stream, 0 );
if ( error ) if ( error )
return TT_Err_Ok; return SFNT_Err_Ok;
if ( ACCESS_Frame( 4L ) ) if ( ACCESS_Frame( 4L ) )
goto Exit; goto Exit;
@ -1547,7 +1548,7 @@
/* the kern table is optional; exit silently if it is missing */ /* the kern table is optional; exit silently if it is missing */
error = face->goto_table( face, TTAG_kern, stream, 0 ); error = face->goto_table( face, TTAG_kern, stream, 0 );
if ( error ) if ( error )
return TT_Err_Ok; return SFNT_Err_Ok;
if ( ACCESS_Frame( 4L ) ) if ( ACCESS_Frame( 4L ) )
goto Exit; goto Exit;
@ -1658,7 +1659,7 @@
/* this table is optional */ /* this table is optional */
error = face->goto_table( face, TTAG_hdmx, stream, 0 ); error = face->goto_table( face, TTAG_hdmx, stream, 0 );
if ( error ) if ( error )
return TT_Err_Ok; return SFNT_Err_Ok;
if ( ACCESS_Frame( 8L ) ) if ( ACCESS_Frame( 8L ) )
goto Exit; goto Exit;

View File

@ -27,11 +27,11 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "ttpost.h" #include "ttpost.h"
#include "ttload.h" #include "ttload.h"
#include "sferrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -176,7 +176,7 @@
if ( num_glyphs > face->root.num_glyphs ) if ( num_glyphs > face->root.num_glyphs )
{ {
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -249,7 +249,7 @@
table->glyph_indices = glyph_indices; table->glyph_indices = glyph_indices;
table->glyph_names = name_strings; table->glyph_names = name_strings;
} }
return TT_Err_Ok; return SFNT_Err_Ok;
Fail1: Fail1:
@ -288,7 +288,7 @@
/* check the number of glyphs */ /* check the number of glyphs */
if ( num_glyphs > face->root.num_glyphs || num_glyphs > 258 ) if ( num_glyphs > face->root.num_glyphs || num_glyphs > 258 )
{ {
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -308,7 +308,7 @@
if ( index < 0 || index > num_glyphs ) if ( index < 0 || index > num_glyphs )
{ {
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
goto Fail; goto Fail;
} }
} }
@ -323,7 +323,7 @@
table->offsets = offset_table; table->offsets = offset_table;
} }
return TT_Err_Ok; return SFNT_Err_Ok;
Fail: Fail:
FREE( offset_table ); FREE( offset_table );
@ -367,7 +367,7 @@
break; break;
default: default:
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
} }
face->postscript_names.loaded = 1; face->postscript_names.loaded = 1;
@ -455,15 +455,15 @@
if ( !face ) if ( !face )
return TT_Err_Invalid_Face_Handle; return SFNT_Err_Invalid_Face_Handle;
if ( index >= (FT_UInt)face->root.num_glyphs ) 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 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames = (PSNames_Interface*)face->psnames; psnames = (PSNames_Interface*)face->psnames;
if ( !psnames ) if ( !psnames )
return TT_Err_Unimplemented_Feature; return SFNT_Err_Unimplemented_Feature;
#endif #endif
names = &face->postscript_names; names = &face->postscript_names;
@ -527,7 +527,7 @@
break; /* nothing to do */ break; /* nothing to do */
} }
return TT_Err_Ok; return SFNT_Err_Ok;
} }

View File

@ -29,10 +29,6 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#define TT_Err_Invalid_Post_Table_Format 0x0B00
#define TT_Err_Invalid_Post_Table 0x0B01
FT_LOCAL FT_LOCAL
FT_Error TT_Get_PS_Name( TT_Face face, FT_Error TT_Get_PS_Name( TT_Face face,
FT_UInt index, FT_UInt index,

View File

@ -18,11 +18,12 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "ttsbit.h" #include "ttsbit.h"
#include "sferrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -363,7 +364,7 @@
break; break;
default: default:
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
} }
Exit: Exit:
@ -469,7 +470,7 @@
num_strikes >= 0x10000L ) num_strikes >= 0x10000L )
{ {
FT_ERROR(( "TT_Load_SBit_Strikes: invalid table version!\n" )); FT_ERROR(( "TT_Load_SBit_Strikes: invalid table version!\n" ));
error = TT_Err_Invalid_File_Format; error = SFNT_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -630,7 +631,7 @@
if ( x_ppem < 0 || x_ppem > 255 || if ( x_ppem < 0 || x_ppem > 255 ||
y_ppem < 1 || y_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++ ) for ( i = 0; i < face->num_sbit_strikes; i++ )
{ {
@ -639,11 +640,11 @@
( face->sbit_strikes[i].x_ppem == x_ppem ) ) ) ( face->sbit_strikes[i].x_ppem == x_ppem ) ) )
{ {
*astrike_index = i; *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; *arange = 0;
*aglyph_offset = 0; *aglyph_offset = 0;
return TT_Err_Invalid_Argument; return SFNT_Err_Invalid_Argument;
} }
@ -775,7 +776,7 @@
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. Returns */ /* 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 static
FT_Error Find_SBit_Image( TT_Face face, FT_Error Find_SBit_Image( TT_Face face,
@ -802,7 +803,7 @@
*astrike = strike; *astrike = strike;
return TT_Err_Ok; return SFNT_Err_Ok;
Fail: Fail:
/* no embedded bitmap for this glyph in face */ /* no embedded bitmap for this glyph in face */
@ -810,7 +811,7 @@
*astrike = 0; *astrike = 0;
*aglyph_offset = 0; *aglyph_offset = 0;
return TT_Err_Invalid_Argument; return SFNT_Err_Invalid_Argument;
} }
@ -846,7 +847,7 @@
TT_SBit_Range* range, TT_SBit_Range* range,
TT_SBit_Metrics* metrics ) TT_SBit_Metrics* metrics )
{ {
FT_Error error = TT_Err_Ok; FT_Error error = SFNT_Err_Ok;
switch ( range->image_format ) switch ( range->image_format )
@ -905,7 +906,7 @@
if ( range->index_format == 2 || range->index_format == 5 ) if ( range->index_format == 2 || range->index_format == 5 )
*metrics = range->metrics; *metrics = range->metrics;
else else
return TT_Err_Invalid_File_Format; return SFNT_Err_Invalid_File_Format;
} }
Exit: Exit:
@ -1134,7 +1135,7 @@
if ( x_offset < 0 || x_offset + metrics->width > map->width || if ( x_offset < 0 || x_offset + metrics->width > map->width ||
y_offset < 0 || y_offset + metrics->height > map->rows ) y_offset < 0 || y_offset + metrics->height > map->rows )
{ {
error = TT_Err_Invalid_Argument; error = SFNT_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -1177,7 +1178,7 @@
break; break;
default: /* invalid format */ default: /* invalid format */
return TT_Err_Invalid_File_Format; return SFNT_Err_Invalid_File_Format;
} }
/* Now read data and draw glyph into target pixmap */ /* Now read data and draw glyph into target pixmap */
@ -1256,7 +1257,7 @@
break; break;
default: default:
return TT_Err_Invalid_File_Format; return SFNT_Err_Invalid_File_Format;
} }
size = map->rows * map->pitch; size = map->rows * map->pitch;
@ -1287,7 +1288,7 @@
break; break;
default: /* invalid image format */ 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 */ /* All right, we have a compound format. First of all, read */

View File

@ -122,14 +122,17 @@
#else /* _STANDALONE_ */ #else /* _STANDALONE_ */
#include <ft2build.h> #include <ft2build.h>
#include "ftgrays.h" #include "ftgrays.h"
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_OUTLINE_H #include FT_OUTLINE_H
#define ErrRaster_Invalid_Mode FT_Err_Cannot_Render_Glyph #include "ftsmerrs.h"
#define ErrRaster_Invalid_Outline FT_Err_Invalid_Outline
#define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
#define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline
#endif /* _STANDALONE_ */ #endif /* _STANDALONE_ */

44
src/smooth/ftsmerrs.h Normal file
View File

@ -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 */

View File

@ -22,6 +22,8 @@
#include "ftsmooth.h" #include "ftsmooth.h"
#include "ftgrays.h" #include "ftgrays.h"
#include "ftsmerrs.h"
/* initialize renderer -- init its raster */ /* initialize renderer -- init its raster */
static static
@ -57,12 +59,12 @@
FT_Matrix* matrix, FT_Matrix* matrix,
FT_Vector* delta ) FT_Vector* delta )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = Smooth_Err_Ok;
if ( slot->format != render->glyph_format ) if ( slot->format != render->glyph_format )
{ {
error = FT_Err_Invalid_Argument; error = Smooth_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -110,13 +112,13 @@
/* check glyph image format */ /* check glyph image format */
if ( slot->format != render->glyph_format ) if ( slot->format != render->glyph_format )
{ {
error = FT_Err_Invalid_Argument; error = Smooth_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
/* check mode */ /* check mode */
if ( mode != ft_render_mode_normal ) if ( mode != ft_render_mode_normal )
return FT_Err_Cannot_Render_Glyph; return Smooth_Err_Cannot_Render_Glyph;
outline = &slot->outline; outline = &slot->outline;

View File

@ -31,7 +31,8 @@ SMOOTH_DRV_SRC := $(SMOOTH_DIR_)ftgrays.c \
# smooth driver headers # 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) # smooth driver object(s)

View File

@ -34,7 +34,8 @@ TT_DRV_SRC := $(TT_DIR_)ttobjs.c \
# TrueType driver headers # 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) # TrueType driver object(s)

View File

@ -21,9 +21,12 @@
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H #include FT_INTERNAL_SFNT_H
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include "ttdriver.h" #include "ttdriver.h"
#include "ttgload.h" #include "ttgload.h"
#include "tterrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -298,7 +301,7 @@
if ( !slot ) if ( !slot )
return TT_Err_Invalid_Glyph_Handle; return TT_Err_Invalid_Slot_Handle;
/* check whether we want a scaled outline or bitmap */ /* check whether we want a scaled outline or bitmap */
if ( !size ) if ( !size )

43
src/truetype/tterrors.h Normal file
View File

@ -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 */

View File

@ -26,6 +26,8 @@
#include "ttgload.h" #include "ttgload.h"
#include "tterrors.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -300,14 +302,14 @@
if ( n_ins > face->max_profile.maxSizeOfInstructions ) if ( n_ins > face->max_profile.maxSizeOfInstructions )
{ {
FT_TRACE0(( "ERROR: Too many instructions!\n" )); FT_TRACE0(( "ERROR: Too many instructions!\n" ));
error = TT_Err_Too_Many_Ins; error = TT_Err_Too_Many_Hints;
goto Fail; goto Fail;
} }
if ( stream->cursor + n_ins > stream->limit ) if ( stream->cursor + n_ins > stream->limit )
{ {
FT_TRACE0(( "ERROR: Instruction count mismatch!\n" )); FT_TRACE0(( "ERROR: Instruction count mismatch!\n" ));
error = TT_Err_Too_Many_Ins; error = TT_Err_Too_Many_Hints;
goto Fail; goto Fail;
} }
@ -1019,7 +1021,7 @@
{ {
FT_TRACE0(( "Too many instructions (%d) in composite glyph %ld\n", FT_TRACE0(( "Too many instructions (%d) in composite glyph %ld\n",
n_ins, subglyph->index )); n_ins, subglyph->index ));
return TT_Err_Too_Many_Ins; return TT_Err_Too_Many_Hints;
} }
/* read the instructions */ /* read the instructions */

View File

@ -20,8 +20,10 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H #include FT_INTERNAL_CALC_H
#include FT_SYSTEM_H #include FT_SYSTEM_H
#include "ttinterp.h" #include "ttinterp.h"
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include "tterrors.h"
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER

View File

@ -24,11 +24,12 @@
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_SFNT_H #include FT_INTERNAL_SFNT_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include "ttgload.h" #include "ttgload.h"
#include "ttpload.h" #include "ttpload.h"
#include "tterrors.h"
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include "ttinterp.h" #include "ttinterp.h"
#endif #endif

View File

@ -23,7 +23,6 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
FT_BEGIN_HEADER FT_BEGIN_HEADER

View File

@ -21,8 +21,10 @@
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "ttpload.h" #include "ttpload.h"
#include FT_INTERNAL_TRUETYPE_ERRORS_H
#include "tterrors.h"
/*************************************************************************/ /*************************************************************************/

View File

@ -36,7 +36,8 @@ T1_DRV_SRC := $(T1_DIR_)t1parse.c \
# Type1 driver headers # Type1 driver headers
# #
T1_DRV_H := $(T1_DRV_SRC:%.c=%.h) \ T1_DRV_H := $(T1_DRV_SRC:%.c=%.h) \
$(T1_DIR_)t1tokens.h $(T1_DIR_)t1tokens.h \
$(T1_DIR_)t1errors.h
# Type1 driver object(s) # Type1 driver object(s)

View File

@ -21,6 +21,8 @@
#include "t1gload.h" #include "t1gload.h"
#include "t1load.h" #include "t1load.h"
#include "t1errors.h"
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
#include "t1afm.h" #include "t1afm.h"
#endif #endif

43
src/type1/t1errors.h Normal file
View File

@ -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 */

View File

@ -23,6 +23,8 @@
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_AUX_H
#include "t1errors.h"
#include <string.h> /* for strcmp() */ #include <string.h> /* for strcmp() */

View File

@ -66,10 +66,11 @@
#include FT_CONFIG_CONFIG_H #include FT_CONFIG_CONFIG_H
#include FT_MULTIPLE_MASTERS_H #include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_TYPE1_TYPES_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include "t1load.h" #include "t1load.h"
#include "t1errors.h"
#include <string.h> /* for strncmp(), strcmp() */ #include <string.h> /* for strncmp(), strcmp() */
#include <ctype.h> /* for isalnum() */ #include <ctype.h> /* for isalnum() */

View File

@ -25,6 +25,8 @@
#include "t1gload.h" #include "t1gload.h"
#include "t1load.h" #include "t1load.h"
#include "t1errors.h"
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
#include "t1afm.h" #include "t1afm.h"
#endif #endif

View File

@ -23,7 +23,6 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_CONFIG_CONFIG_H #include FT_CONFIG_CONFIG_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_TYPE1_TYPES_H

View File

@ -37,10 +37,12 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H #include FT_INTERNAL_CALC_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_TYPE1_ERRORS_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_AUX_H
#include "t1parse.h" #include "t1parse.h"
#include "t1errors.h"
#include <string.h> /* for strncmp() */ #include <string.h> /* for strncmp() */

44
src/winfonts/fnterrs.h Normal file
View File

@ -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 */

View File

@ -28,7 +28,8 @@ FNT_DRV_SRC := $(FNT_DIR_)winfnt.c
# Windows driver headers # 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) # Windows driver object(s)

View File

@ -17,13 +17,15 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_ERRORS_H
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_FNT_TYPES_H #include FT_INTERNAL_FNT_TYPES_H
#include "winfnt.h" #include "winfnt.h"
#include "fnterrs.h"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -139,14 +141,14 @@
header->version != 0x300 ) header->version != 0x300 )
{ {
FT_TRACE2(( "[not a valid FNT file]\n" )); FT_TRACE2(( "[not a valid FNT file]\n" ));
error = FT_Err_Unknown_File_Format; error = FNT_Err_Unknown_File_Format;
goto Exit; goto Exit;
} }
if ( header->file_type & 1 ) if ( header->file_type & 1 )
{ {
FT_TRACE2(( "[can't handle vector FNT fonts]\n" )); FT_TRACE2(( "[can't handle vector FNT fonts]\n" ));
error = FT_Err_Unknown_File_Format; error = FNT_Err_Unknown_File_Format;
goto Exit; goto Exit;
} }
@ -198,7 +200,7 @@
READ_Fields( winmz_header_fields, &mz_header ) ) READ_Fields( winmz_header_fields, &mz_header ) )
goto Exit; goto Exit;
error = FT_Err_Unknown_File_Format; error = FNT_Err_Unknown_File_Format;
if ( mz_header.magic == WINFNT_MZ_MAGIC ) if ( mz_header.magic == WINFNT_MZ_MAGIC )
{ {
/* yes, now look for a NE header in the file */ /* yes, now look for a NE header in the file */
@ -209,7 +211,7 @@
READ_Fields( winne_header_fields, &ne_header ) ) READ_Fields( winne_header_fields, &ne_header ) )
goto Exit; goto Exit;
error = FT_Err_Unknown_File_Format; error = FNT_Err_Unknown_File_Format;
if ( ne_header.magic == WINFNT_NE_MAGIC ) if ( ne_header.magic == WINFNT_NE_MAGIC )
{ {
/* good, now look in the resource table for each FNT resource */ /* good, now look in the resource table for each FNT resource */
@ -254,7 +256,7 @@
if ( !font_count || !font_offset ) if ( !font_count || !font_offset )
{ {
FT_TRACE2(( "this file doesn't contain any FNT resources!\n" )); 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; 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 ) if ( !font )
{ {
error = FT_Err_Invalid_Argument; error = FNT_Err_Invalid_Argument;
goto Exit; goto Exit;
} }