From a37745bad4e46c5ad0e690150b0ec8081ff81c90 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 23 Mar 2005 16:45:24 +0000 Subject: [PATCH] * docs/CHANGES, docs/INSTALL.ANY: Updated. * include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'. Add `OTvalid'. * src/autofit/aferrors.h: New file. * src/autofit/afglobal.c, src/autofit/afhints.c, src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/. Include aferrors.h. * src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h. * src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/. --- ChangeLog | 21 +++++++++++++++++-- docs/CHANGES | 29 +++++++++++++++------------ docs/INSTALL.ANY | 2 +- include/freetype/ftmoderr.h | 33 +++++++++++++++--------------- src/autofit/aferrors.h | 40 +++++++++++++++++++++++++++++++++++++ src/autofit/afglobal.c | 9 +++++---- src/autofit/afhints.c | 11 +++++----- src/autofit/aflatin.c | 9 +++++---- src/autofit/afloader.c | 9 +++++---- src/autofit/rules.mk | 5 +++-- src/otvalid/otverror.h | 4 ++-- 11 files changed, 119 insertions(+), 53 deletions(-) create mode 100644 src/autofit/aferrors.h diff --git a/ChangeLog b/ChangeLog index dd13b98e1..3545eb109 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,24 @@ +2005-03-23 Werner Lemberg + + * docs/CHANGES, docs/INSTALL.ANY: Updated. + + * include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'. + Add `OTvalid'. + + * src/autofit/aferrors.h: New file. + + * src/autofit/afglobal.c, src/autofit/afhints.c, + src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/. + Include aferrors.h. + + * src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h. + + * src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/. + 2005-03-22 David Turner - * src/autohint/*, Jamfile: removing the 'autohint' module - from the build. + * src/autohint/*: Removed. + * Jamfile: Updated. 2005-03-15 David Turner diff --git a/docs/CHANGES b/docs/CHANGES index cc19787be..0dd370f6f 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -38,9 +38,10 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9 memory-mapped font files (which is the default on Unix systems which support them). - - The auto-hinter has been completely rewritten as a new module, - called the `auto-fitter', which is now the default auto-hinting - module. It consumes a lot less memory than its predecessor. + - The auto-hinter has been replaced with a new module, called the + `auto-fitter'. It consumes less memory than its predecessor, + and it is prepared to support non-latin scripts better in next + releases. - George Williams contributed code to read kerning data from PFM files. @@ -74,19 +75,21 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9 - A new option `--ftversion' has been added to freetype-config to return the FreeType version. - - The memory debugger has been updated to dump allocation statistics - on all allocation sources in the library. This is useful to spot - greedy allocations when loading and processing fonts. + - The memory debugger has been updated to dump allocation + statistics on all allocation sources in the library. This is + useful to spot greedy allocations when loading and processing + fonts. - - we removed a huge array of constant pointers to constant strings - in the 'psnames' module. The problem was that when compiled in PIC - mode (i.e. when generating a Unix shared object / dll), the array - could only be placed in the non-shared writable section of the library* + - We removed a huge array of constant pointers to constant strings + in the `psnames' module. The problem was that compilations in + PIC mode (i.e., when generating a Unix shared object/dll) put + the array into the non-shared writable section of the library since absolute pointers are not relocatable by nature. - This saves about 16Kb per process linked to FreeType. We also store - the array in a novel compressed way that saves about 20 Kb of code - as well. + This reduces the memory consumption by approximately 16KByte per + process linked to FreeType. We now also store the array in a + compressed form (as a trie) which saves about 20KByte of code as + well. ====================================================================== diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY index af3f6e7a3..084961979 100644 --- a/docs/INSTALL.ANY +++ b/docs/INSTALL.ANY @@ -42,7 +42,7 @@ I. Standard procedure -- other components (optional) - src/autohint/autohint.c -- auto hinting module + src/autofit/autofit.c -- auto hinting module src/cache/ftcache.c -- cache sub-system (in beta) src/sfnt/sfnt.c -- SFNT files support (TrueType & OpenType) diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h index d190167fa..b0115dd0d 100644 --- a/include/freetype/ftmoderr.h +++ b/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2004 by */ +/* Copyright 2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,8 +23,8 @@ /* 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 0x1003, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1103, etc. */ + /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ /* */ /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ /* to make the higher byte always zero (disabling the module error */ @@ -103,25 +103,26 @@ FT_MODERRDEF( Base, 0x000, "base module" ) - FT_MODERRDEF( Autohint, 0x100, "autohinter module" ) + FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) FT_MODERRDEF( BDF, 0x200, "BDF module" ) FT_MODERRDEF( Cache, 0x300, "cache module" ) FT_MODERRDEF( CFF, 0x400, "CFF module" ) FT_MODERRDEF( CID, 0x500, "CID module" ) FT_MODERRDEF( Gzip, 0x600, "Gzip module" ) FT_MODERRDEF( LZW, 0x700, "LZW module" ) - FT_MODERRDEF( PCF, 0x800, "PCF module" ) - FT_MODERRDEF( PFR, 0x900, "PFR module" ) - FT_MODERRDEF( PSaux, 0xA00, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xB00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xC00, "PS names module" ) - FT_MODERRDEF( Raster, 0xD00, "raster module" ) - FT_MODERRDEF( SFNT, 0xE00, "SFNT module" ) - FT_MODERRDEF( Smooth, 0xF00, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0x1000, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1100, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1200, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" ) + FT_MODERRDEF( OTvalid, 0x800, "OpenType validation module" ) + FT_MODERRDEF( PCF, 0x900, "PCF module" ) + FT_MODERRDEF( PFR, 0xA00, "PFR module" ) + FT_MODERRDEF( PSaux, 0xB00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xC00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xD00, "PS names module" ) + FT_MODERRDEF( Raster, 0xE00, "raster module" ) + FT_MODERRDEF( SFNT, 0xF00, "SFNT module" ) + FT_MODERRDEF( Smooth, 0x1000, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1100, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1200, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1300, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" ) #ifdef FT_MODERR_END_LIST diff --git a/src/autofit/aferrors.h b/src/autofit/aferrors.h new file mode 100644 index 000000000..c2ed5fe2a --- /dev/null +++ b/src/autofit/aferrors.h @@ -0,0 +1,40 @@ +/***************************************************************************/ +/* */ +/* aferrors.h */ +/* */ +/* Autofitter error codes (specification only). */ +/* */ +/* Copyright 2005 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 Autofitter error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __AFERRORS_H__ +#define __AFERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERR_PREFIX AF_Err_ +#define FT_ERR_BASE FT_Mod_Err_Autofit + +#include FT_ERRORS_H + +#endif /* __AFERRORS_H__ */ + +/* END */ diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index 05be73d46..640cf7929 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -19,6 +19,7 @@ #include "afglobal.h" #include "afdummy.h" #include "aflatin.h" +#include "aferrors.h" /* populate this list when you add new scripts */ @@ -57,7 +58,7 @@ static FT_Error af_face_globals_compute_script_coverage( AF_FaceGlobals globals ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; FT_Byte* gscripts = globals->glyph_scripts; @@ -76,7 +77,7 @@ * Ignore this error; we simply use Latin as the standard * script. XXX: Shouldn't we rather disable hinting? */ - error = FT_Err_Ok; + error = AF_Err_Ok; goto Exit; } @@ -219,12 +220,12 @@ AF_ScriptMetrics metrics = NULL; FT_UInt index; AF_ScriptClass clazz; - FT_Error error = 0; + FT_Error error = AF_Err_Ok; if ( gindex >= globals->glyph_count ) { - error = FT_Err_Invalid_Argument; + error = AF_Err_Invalid_Argument; goto Exit; } diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index afc8462f1..ade4fd3b9 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -17,6 +17,7 @@ #include "afhints.h" +#include "aferrors.h" FT_LOCAL_DEF( FT_Error ) @@ -24,7 +25,7 @@ FT_Memory memory, AF_Segment *asegment ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; AF_Segment segment = NULL; @@ -37,7 +38,7 @@ if ( old_max >= big_max ) { - error = FT_Err_Out_Of_Memory; + error = AF_Err_Out_Of_Memory; goto Exit; } @@ -66,7 +67,7 @@ FT_Memory memory, AF_Edge *aedge ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; AF_Edge edge = NULL; AF_Edge edges; @@ -80,7 +81,7 @@ if ( old_max >= big_max ) { - error = FT_Err_Out_Of_Memory; + error = AF_Err_Out_Of_Memory; goto Exit; } @@ -462,7 +463,7 @@ af_glyph_hints_reload( AF_GlyphHints hints, FT_Outline* outline ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; AF_Point points; FT_UInt old_max, new_max; AF_Scaler scaler = &hints->metrics->scaler; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index c6fc17fe5..d6cfaa653 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -17,6 +17,7 @@ #include "aflatin.h" +#include "aferrors.h" /*************************************************************************/ @@ -377,7 +378,7 @@ af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; FT_CharMap oldmap = face->charmap; FT_UInt ee; @@ -408,7 +409,7 @@ } FT_Set_Charmap( face, oldmap ); - return FT_Err_Ok; + return AF_Err_Ok; } @@ -577,7 +578,7 @@ { AF_AxisHints axis = &hints->axis[dim]; FT_Memory memory = hints->memory; - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; AF_Segment segment = NULL; AF_Point* contour = hints->contours; AF_Point* contour_limit = contour + hints->num_contours; @@ -921,7 +922,7 @@ AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; - FT_Error error = 0; + FT_Error error = AF_Err_Ok; FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index c02df648f..c3f3b2c37 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -20,6 +20,7 @@ #include "afhints.h" #include "afglobal.h" #include "aflatin.h" +#include "aferrors.h" FT_LOCAL_DEF( FT_Error ) @@ -51,7 +52,7 @@ af_loader_reset( AF_Loader loader, FT_Face face ) { - FT_Error error = FT_Err_Ok; + FT_Error error = AF_Err_Ok; loader->face = face; @@ -331,7 +332,7 @@ if ( start_point + k >= num_base_points || l >= (FT_UInt)num_new_points ) { - error = FT_Err_Invalid_Composite; + error = AF_Err_Invalid_Composite; goto Exit; } @@ -369,7 +370,7 @@ default: /* we don't support other formats (yet?) */ - error = FT_Err_Unimplemented_Feature; + error = AF_Err_Unimplemented_Feature; } Hint_Metrics: @@ -448,7 +449,7 @@ if ( !size ) - return FT_Err_Invalid_Argument; + return AF_Err_Invalid_Argument; FT_ZERO( &scaler ); diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk index 5ace990e1..7f7ff9975 100644 --- a/src/autofit/rules.mk +++ b/src/autofit/rules.mk @@ -35,8 +35,9 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ # AUTOF driver headers # -AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ - $(AUTOF_DIR)/aftypes.h +AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ + $(AUTOF_DIR)/aftypes.h \ + $(AUTOF_DIR)/aferrors.h # AUTOF driver object(s) diff --git a/src/otvalid/otverror.h b/src/otvalid/otverror.h index dc34a5aef..041b53836 100644 --- a/src/otvalid/otverror.h +++ b/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004 by */ +/* Copyright 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ #undef __FTERRORS_H__ #define FT_ERR_PREFIX OTV_Err_ -#define FT_ERR_BASE FT_Mod_Err_OTV +#define FT_ERR_BASE FT_Mod_Err_OTvalid #define FT_KEEP_ERR_PREFIX