From cc069beb2d2b6b1cb9f9b9f2af2a7ea12780f634 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 8 Dec 2000 16:17:16 +0000 Subject: [PATCH] cleanups --- ChangeLog | 29 +- include/freetype/config/ft2build.h | 6 +- include/freetype/internal/t2types.h | 24 +- src/autohint/ahglobal.h | 4 +- src/autohint/ahglyph.c | 12 +- src/autohint/ahglyph.h | 8 +- src/autohint/ahhint.c | 11 +- src/autohint/ahhint.h | 6 +- src/autohint/ahmodule.c | 7 +- src/autohint/ahoptim.c | 8 +- src/autohint/ahoptim.h | 6 +- src/autohint/ahtypes.h | 20 +- src/autohint/autohint.c | 13 +- src/base/ftbase.c | 16 +- src/base/ftbbox.c | 9 +- src/base/ftcalc.c | 9 +- src/base/ftdebug.c | 6 +- src/base/ftextend.c | 7 +- src/base/ftglyph.c | 9 +- src/base/ftinit.c | 11 +- src/base/ftlist.c | 8 +- src/base/ftmac.c | 11 +- src/base/ftmm.c | 7 +- src/base/ftnames.c | 7 +- src/base/ftobjs.c | 13 +- src/base/ftoutln.c | 7 +- src/base/ftstream.c | 7 +- src/base/ftsynth.c | 9 +- src/base/ftsystem.c | 13 +- src/cache/ftcache.c | 14 +- src/cache/ftcchunk.c | 13 +- src/cache/ftcglyph.c | 15 +- src/cache/ftcimage.c | 8 +- src/cache/ftcmanag.c | 13 +- src/cache/ftcsbits.c | 13 +- src/cache/ftlru.c | 11 +- src/cff/cff.c | 1 + src/cff/cffdrivr.c | 2 + src/cff/cffdrivr.h | 1 + src/cff/cffload.c | 309 +++++------ src/cff/cffload.h | 58 +-- src/cff/cffobjs.c | 130 ++--- src/cff/cffobjs.h | 27 +- src/cff/cffparse.c | 83 +-- src/cff/cffparse.h | 22 +- src/cff/cfftoken.h | 42 +- src/cff/t2driver.c | 378 -------------- src/cff/t2driver.h | 41 -- src/cff/t2gload.c | 1 + src/cff/t2gload.h | 40 +- src/cff/t2load.c | 762 ---------------------------- src/cff/t2load.h | 69 --- src/cff/t2objs.c | 604 ---------------------- src/cff/t2objs.h | 148 ------ src/cff/t2parse.c | 655 ------------------------ src/cff/t2parse.h | 70 --- src/cff/t2tokens.h | 96 ---- src/cid/cidafm.c | 18 +- src/cid/cidafm.h | 29 +- src/cid/cidgload.c | 13 +- src/cid/cidgload.h | 7 +- src/cid/cidload.c | 20 +- src/cid/cidload.h | 10 +- src/cid/cidobjs.c | 15 +- src/cid/cidobjs.h | 12 +- src/cid/cidparse.c | 18 +- src/cid/cidparse.h | 25 +- src/cid/cidriver.c | 16 +- src/cid/cidriver.h | 8 +- src/cid/type1cid.c | 13 +- src/psaux/psaux.c | 9 +- src/psaux/psauxmod.c | 10 +- src/psaux/psauxmod.h | 8 +- src/psaux/psobjs.c | 11 +- src/psaux/psobjs.h | 7 +- src/psaux/t1decode.c | 2 + src/psaux/t1decode.h | 3 + src/psnames/psmodule.c | 4 +- src/psnames/psmodule.h | 4 + src/psnames/psnames.c | 4 +- src/raster/ftraster.h | 10 +- src/raster/ftrend1.c | 1 + src/raster/ftrend1.h | 4 + src/sfnt/sfdriver.c | 1 + src/sfnt/sfdriver.h | 8 +- src/sfnt/sfnt.c | 1 + src/sfnt/sfobjs.c | 17 +- src/sfnt/sfobjs.h | 2 + src/sfnt/ttcmap.c | 1 + src/sfnt/ttcmap.h | 14 +- src/sfnt/ttload.c | 2 + src/sfnt/ttload.h | 2 + src/sfnt/ttpost.c | 1 + src/sfnt/ttpost.h | 3 + src/sfnt/ttsbit.c | 2 + src/sfnt/ttsbit.h | 2 + src/smooth/ftgrays.h | 4 + src/smooth/ftsmooth.c | 2 + src/smooth/ftsmooth.h | 3 + src/smooth/smooth.c | 1 + src/truetype/truetype.c | 1 + src/truetype/ttdriver.c | 1 + src/truetype/ttdriver.h | 3 + src/truetype/ttgload.c | 1 + src/truetype/ttgload.h | 4 + src/truetype/ttinterp.c | 7 +- src/truetype/ttinterp.h | 19 +- src/truetype/ttobjs.c | 1 + src/truetype/ttobjs.h | 2 + src/truetype/ttpload.c | 1 + src/truetype/ttpload.h | 4 + src/type1/t1afm.c | 1 + src/type1/t1afm.h | 3 + src/type1/t1driver.c | 10 +- src/type1/t1driver.h | 4 + src/type1/t1gload.c | 2 + src/type1/t1gload.h | 3 + src/type1/t1load.c | 2 + src/type1/t1load.h | 3 + src/type1/t1objs.c | 2 + src/type1/t1objs.h | 3 + src/type1/t1parse.c | 2 + src/type1/t1parse.h | 3 + src/type1/type1.c | 1 + 124 files changed, 876 insertions(+), 3483 deletions(-) delete mode 100644 src/cff/t2driver.c delete mode 100644 src/cff/t2driver.h delete mode 100644 src/cff/t2load.c delete mode 100644 src/cff/t2load.h delete mode 100644 src/cff/t2objs.c delete mode 100644 src/cff/t2objs.h delete mode 100644 src/cff/t2parse.c delete mode 100644 src/cff/t2parse.h delete mode 100644 src/cff/t2tokens.h diff --git a/ChangeLog b/ChangeLog index f3f1a3e81..75418521a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,31 @@ -2000-12-07 David Turnre +2000-12-07 David Turner - * many, many files: changed source files to adhere to the new - header inclusion scheme. Not completely tested but works for - now here.. + * many files: Changed source files to adhere to the new + header inclusion scheme. Not completely tested but works for now + here. + + * src/cff/t2driver.c: Renamed and updated to... + * src/cff/cffdrivr.c: New file. + * src/cff/t2driver.h: Renamed and updated to... + * src/cff/cffdrivr.h: New file. + * src/cff/t2load.c: Renamed and updated to... + * src/cff/cffload.c: New file. + * src/cff/t2load.h: Renamed and updated to... + * src/cff/cffload.h: New file. + * src/cff/t2objs.c: Renamed and updated to... + * src/cff/cffobjs.c: New file. + * src/cff/t2objs.h: Renamed and updated to... + * src/cff/cffobjs.h: New file. + * src/cff/t2parse.c: Renamed and updated to... + * src/cff/cffparse.c: New file. + * src/cff/t2parse.h: Renamed and updated to... + * src/cff/cffparse.h: New file. + * src/cff/t2tokens.h: Renamed and updated to... + * src/cff/cfftoken.h: New file. 2000-12-06 David Turner - * src/cache/ftlru.c (FT_Lru_Done): fixed a small memory leak + * src/cache/ftlru.c (FT_Lru_Done): Fixed memory leak. 2000-12-06 Werner Lemberg diff --git a/include/freetype/config/ft2build.h b/include/freetype/config/ft2build.h index 33129a644..d0ae604ef 100644 --- a/include/freetype/config/ft2build.h +++ b/include/freetype/config/ft2build.h @@ -113,10 +113,10 @@ /* directory and compile them normally by defining the macro */ /* FT_FLAT_COMPILATION. */ /* */ -#ifdef FT_FLAT_COMPILATION -# define FT_SOURCE_FILE( d, x ) #x +#ifdef FT_FLAT_COMPILATION +#define FT_SOURCE_FILE( d, x ) #x #else -# define FT_SOURCE_FILE( d, x ) +#define FT_SOURCE_FILE( d, x ) #endif diff --git a/include/freetype/internal/t2types.h b/include/freetype/internal/t2types.h index 485303a04..ab6940d8f 100644 --- a/include/freetype/internal/t2types.h +++ b/include/freetype/internal/t2types.h @@ -61,28 +61,28 @@ FT_BEGIN_HEADER } CFF_Index; - typedef struct CFF_Encoding_ + typedef struct CFF_Encoding_ { - FT_Stream stream; + FT_Stream stream; - FT_UInt format; - FT_ULong offset; - FT_UInt size; + FT_UInt format; + FT_ULong offset; + FT_UInt size; - FT_Byte* bytes; + FT_Byte* bytes; } CFF_Encoding; - typedef struct CFF_Charset_ + typedef struct CFF_Charset_ { - FT_Stream stream; + FT_Stream stream; - FT_UInt format; - FT_ULong offset; - FT_UInt size; + FT_UInt format; + FT_ULong offset; + FT_UInt size; - FT_Byte* bytes; + FT_Byte* bytes; } CFF_Charset; diff --git a/src/autohint/ahglobal.h b/src/autohint/ahglobal.h index 57457efec..42306b480 100644 --- a/src/autohint/ahglobal.h +++ b/src/autohint/ahglobal.h @@ -35,8 +35,8 @@ FT_BEGIN_HEADER /* compute global metrics automatically */ - FT_LOCAL FT_Error - ah_hinter_compute_globals( AH_Hinter* hinter ); + FT_LOCAL + FT_Error ah_hinter_compute_globals( AH_Hinter* hinter ); FT_END_HEADER diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 2027e5520..9c6ebfda0 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -19,11 +19,13 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(autohint,ahglyph.h) -#include FT_SOURCE_FILE(autohint,ahangles.h) -#include FT_SOURCE_FILE(autohint,ahglobal.h) -#include + +#include +#include FT_SOURCE_FILE(autohint,ahglyph.h) +#include FT_SOURCE_FILE(autohint,ahangles.h) +#include FT_SOURCE_FILE(autohint,ahglobal.h) + +#include #define xxxAH_DEBUG_GLYPH diff --git a/src/autohint/ahglyph.h b/src/autohint/ahglyph.h index e5bcb0157..cd3c34eff 100644 --- a/src/autohint/ahglyph.h +++ b/src/autohint/ahglyph.h @@ -23,11 +23,14 @@ #ifndef AHGLYPH_H #define AHGLYPH_H -#include -#include FT_SOURCE_FILE(autohint,ahtypes.h) + +#include +#include FT_SOURCE_FILE(autohint,ahtypes.h) + FT_BEGIN_HEADER + typedef enum AH_UV_ { ah_uv_fxy, @@ -80,6 +83,7 @@ FT_BEGIN_HEADER FT_LOCAL void ah_outline_done( AH_Outline* outline ); + FT_END_HEADER #endif /* AHGLYPH_H */ diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 90b47fe7d..187b72c5d 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -18,11 +18,12 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(autohint,ahhint.h) -#include FT_SOURCE_FILE(autohint,ahglyph.h) -#include FT_SOURCE_FILE(autohint,ahangles.h) -#include FT_OUTLINE_H + +#include +#include FT_SOURCE_FILE(autohint,ahhint.h) +#include FT_SOURCE_FILE(autohint,ahglyph.h) +#include FT_SOURCE_FILE(autohint,ahangles.h) +#include FT_OUTLINE_H #define FACE_GLOBALS( face ) ((AH_Face_Globals*)(face)->autohint.data) diff --git a/src/autohint/ahhint.h b/src/autohint/ahhint.h index 744c33604..2b9876ca0 100644 --- a/src/autohint/ahhint.h +++ b/src/autohint/ahhint.h @@ -22,8 +22,10 @@ #ifndef AHHINT_H #define AHHINT_H -#include -#include FT_SOURCE_FILE(autohint,ahglobal.h) + +#include +#include FT_SOURCE_FILE(autohint,ahglobal.h) + FT_BEGIN_HEADER diff --git a/src/autohint/ahmodule.c b/src/autohint/ahmodule.c index 3c9bd96a7..f1a2564a0 100644 --- a/src/autohint/ahmodule.c +++ b/src/autohint/ahmodule.c @@ -18,9 +18,10 @@ /* */ /***************************************************************************/ -#include -#include FT_MODULE_H -#include FT_SOURCE_FILE(autohint,ahhint.h) + +#include +#include FT_MODULE_H +#include FT_SOURCE_FILE(autohint,ahhint.h) typedef struct FT_AutoHinterRec_ diff --git a/src/autohint/ahoptim.c b/src/autohint/ahoptim.c index 4d0421cd5..f10d3a6a1 100644 --- a/src/autohint/ahoptim.c +++ b/src/autohint/ahoptim.c @@ -30,9 +30,11 @@ /* */ /*************************************************************************/ -#include -#include FT_INTERNAL_OBJECTS_H /* for ALLOC_ARRAY() and FREE() */ -#include FT_SOURCE_FILE(autohint,ahoptim.h) + +#include +#include FT_INTERNAL_OBJECTS_H /* for ALLOC_ARRAY() and FREE() */ +#include FT_SOURCE_FILE(autohint,ahoptim.h) + /* define this macro to use brute force optimisation -- this is slow, */ /* but a good way to perfect the distortion function `by hand' through */ diff --git a/src/autohint/ahoptim.h b/src/autohint/ahoptim.h index 01c7ee60d..9bdf01fb9 100644 --- a/src/autohint/ahoptim.h +++ b/src/autohint/ahoptim.h @@ -22,8 +22,10 @@ #ifndef AHOPTIM_H #define AHOPTIM_H -#include -#include FT_SOURCE_FILE(autohint,ahtypes.h) + +#include +#include FT_SOURCE_FILE(autohint,ahtypes.h) + FT_BEGIN_HEADER diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index 1477ee0b4..581259f2b 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -23,20 +23,26 @@ #ifndef AHTYPES_H #define AHTYPES_H -#include -#include FT_INTERNAL_OBJECTS_H -#include FT_SOURCE_FILE(autohint,ahloader.h) + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_SOURCE_FILE(autohint,ahloader.h) #define xxAH_DEBUG #ifdef AH_DEBUG -# include -# define AH_LOG( x ) printf##x + +#include +#define AH_LOG( x ) printf##x + #else -# define AH_LOG( x ) do ; while ( 0 ) /* nothing */ -#endif + +#define AH_LOG( x ) do ; while ( 0 ) /* nothing */ + +#endif /* AH_DEBUG */ + FT_BEGIN_HEADER diff --git a/src/autohint/autohint.c b/src/autohint/autohint.c index d2f4df693..a06eac535 100644 --- a/src/autohint/autohint.c +++ b/src/autohint/autohint.c @@ -21,11 +21,12 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include -#include FT_SOURCE_FILE(autohint,ahangles.c) -#include FT_SOURCE_FILE(autohint,ahglyph.c) -#include FT_SOURCE_FILE(autohint,ahglobal.c) -#include FT_SOURCE_FILE(autohint,ahhint.c) -#include FT_SOURCE_FILE(autohint,ahmodule.c) +#include +#include FT_SOURCE_FILE(autohint,ahangles.c) +#include FT_SOURCE_FILE(autohint,ahglyph.c) +#include FT_SOURCE_FILE(autohint,ahglobal.c) +#include FT_SOURCE_FILE(autohint,ahhint.c) +#include FT_SOURCE_FILE(autohint,ahmodule.c) + /* END */ diff --git a/src/base/ftbase.c b/src/base/ftbase.c index 82d0b1406..391870081 100644 --- a/src/base/ftbase.c +++ b/src/base/ftbase.c @@ -16,14 +16,14 @@ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(base,ftcalc.c) -#include FT_SOURCE_FILE(base,ftobjs.c) -#include FT_SOURCE_FILE(base,ftstream.c) -#include FT_SOURCE_FILE(base,ftlist.c) -#include FT_SOURCE_FILE(base,ftoutln.c) -#include FT_SOURCE_FILE(base,ftextend.c) -#include FT_SOURCE_FILE(base,ftnames.c) +#include +#include FT_SOURCE_FILE(base,ftcalc.c) +#include FT_SOURCE_FILE(base,ftobjs.c) +#include FT_SOURCE_FILE(base,ftstream.c) +#include FT_SOURCE_FILE(base,ftlist.c) +#include FT_SOURCE_FILE(base,ftoutln.c) +#include FT_SOURCE_FILE(base,ftextend.c) +#include FT_SOURCE_FILE(base,ftnames.c) /* END */ diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index f6ebb0793..657227b05 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -23,10 +23,11 @@ /* */ /*************************************************************************/ -#include -#include FT_BBOX_H -#include FT_IMAGE_H -#include FT_OUTLINE_H + +#include +#include FT_BBOX_H +#include FT_IMAGE_H +#include FT_OUTLINE_H typedef struct TBBox_Rec_ diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index e95577923..c1a3ffd9b 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -30,10 +30,11 @@ /* */ /*************************************************************************/ -#include -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_INTERNAL_CALC_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 3032b4fd9..d8489c641 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -40,8 +40,10 @@ /* */ /*************************************************************************/ -#include -#include FT_INTERNAL_DEBUG_H + +#include +#include FT_INTERNAL_DEBUG_H + #ifdef FT_DEBUG_LEVEL_TRACE char ft_trace_levels[trace_max]; diff --git a/src/base/ftextend.c b/src/base/ftextend.c index 18c39f7e0..eba24c33d 100644 --- a/src/base/ftextend.c +++ b/src/base/ftextend.c @@ -24,9 +24,10 @@ /* */ /*************************************************************************/ -#include -#include FT_INTERNAL_EXTEND_H -#include FT_INTERNAL_DEBUG_H + +#include +#include FT_INTERNAL_EXTEND_H +#include FT_INTERNAL_DEBUG_H /*************************************************************************/ diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index d1b52634e..510dcbe25 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -27,10 +27,11 @@ /* */ /*************************************************************************/ -#include -#include FT_GLYPH_H -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_GLYPH_H +#include FT_OUTLINE_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/base/ftinit.c b/src/base/ftinit.c index ed6150468..f0d1e8d7d 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -36,11 +36,12 @@ /* */ /*************************************************************************/ -#include -#include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_MODULE_H + +#include +#include FT_CONFIG_CONFIG_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H +#include FT_MODULE_H /*************************************************************************/ diff --git a/src/base/ftlist.c b/src/base/ftlist.c index f72db2445..94564e063 100644 --- a/src/base/ftlist.c +++ b/src/base/ftlist.c @@ -23,10 +23,10 @@ /*************************************************************************/ -#include -#include FT_LIST_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H +#include +#include FT_LIST_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/base/ftmac.c b/src/base/ftmac.c index 55ba30afb..08681b316 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -56,11 +56,12 @@ and delegate the rest of the work to it, by calling FT_Open_Face(). */ -#include -#include FT_FREETYPE_H -#include FT_INTERNAL_STREAM_H -#include FT_SOURCE_FILE(truetype/ttobjs.h) -#include FT_SOURCE_FILE(type1/t1objs.h) + +#include +#include FT_FREETYPE_H +#include FT_INTERNAL_STREAM_H +#include FT_SOURCE_FILE(truetype/ttobjs.h) +#include FT_SOURCE_FILE(type1/t1objs.h) #include #include diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 24479efd0..7e9dbe00f 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -15,9 +15,10 @@ /* */ /***************************************************************************/ -#include -#include FT_MULTIPLE_MASTERS_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_MULTIPLE_MASTERS_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/base/ftnames.c b/src/base/ftnames.c index de030db89..d6ae8b93e 100644 --- a/src/base/ftnames.c +++ b/src/base/ftnames.c @@ -18,9 +18,10 @@ /* */ /***************************************************************************/ -#include -#include FT_NAMES_H -#include FT_INTERNAL_TRUETYPE_TYPES_H + +#include +#include FT_NAMES_H +#include FT_INTERNAL_TRUETYPE_TYPES_H #ifdef TT_CONFIG_OPTION_SFNT_NAMES diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 58e796dcd..a0c6713d7 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -15,12 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_LIST_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TABLES_H + +#include +#include FT_LIST_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TABLES_H #include /* for strcmp() */ diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 1cf7e54be..f8294c68d 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -22,9 +22,10 @@ /* */ /*************************************************************************/ -#include -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_OUTLINE_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/base/ftstream.c b/src/base/ftstream.c index 999ae70cb..1ada68c09 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -15,9 +15,10 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_DEBUG_H + +#include +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_DEBUG_H /*************************************************************************/ diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index c9cb59bdb..604e1bf4c 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -15,10 +15,11 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_OBJECTS_H -#include FT_OUTLINE_H -#include FT_SYNTHESIS_H + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_OUTLINE_H +#include FT_SYNTHESIS_H #define FT_BOLD_THRESHOLD 0x0100 diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index e1eb9f2d2..5b97e80c7 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -24,12 +24,13 @@ /* */ /*************************************************************************/ -#include -#include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_DEBUG_H -#include FT_SYSTEM_H -#include FT_ERRORS_H -#include FT_TYPES_H + +#include +#include FT_CONFIG_CONFIG_H +#include FT_INTERNAL_DEBUG_H +#include FT_SYSTEM_H +#include FT_ERRORS_H +#include FT_TYPES_H #include #include diff --git a/src/cache/ftcache.c b/src/cache/ftcache.c index f3d49fe1b..b9ebbb7e5 100644 --- a/src/cache/ftcache.c +++ b/src/cache/ftcache.c @@ -18,13 +18,13 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include -#include FT_SOURCE_FILE(cache,ftlru.c) -#include FT_SOURCE_FILE(cache,ftcmanag.c) -#include FT_SOURCE_FILE(cache,ftcglyph.c) -#include FT_SOURCE_FILE(cache,ftcchunk.c) -#include FT_SOURCE_FILE(cache,ftcimage.c) -#include FT_SOURCE_FILE(cache,ftcsbits.c) +#include +#include FT_SOURCE_FILE(cache,ftlru.c) +#include FT_SOURCE_FILE(cache,ftcmanag.c) +#include FT_SOURCE_FILE(cache,ftcglyph.c) +#include FT_SOURCE_FILE(cache,ftcchunk.c) +#include FT_SOURCE_FILE(cache,ftcimage.c) +#include FT_SOURCE_FILE(cache,ftcsbits.c) /* END */ diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c index 183ee0de3..ec283b2f5 100644 --- a/src/cache/ftcchunk.c +++ b/src/cache/ftcchunk.c @@ -15,12 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_INTERNAL_CHUNK_H -#include FT_LIST_H -#include FT_ERRORS_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_CHUNK_H +#include FT_LIST_H +#include FT_ERRORS_H +#include FT_INTERNAL_OBJECTS_H /*************************************************************************/ diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 9c76e5ea7..cc9a6d8a9 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -15,13 +15,14 @@ /* */ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_INTERNAL_GLYPH_H -#include FT_ERRORS_H -#include FT_LIST_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_GLYPH_H +#include FT_ERRORS_H +#include FT_LIST_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H /*************************************************************************/ diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 98103fcfe..9d48bbec6 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -16,10 +16,10 @@ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_IMAGE_H -#include FT_INTERNAL_MEMORY_H +#include +#include FT_CACHE_H +#include FT_CACHE_IMAGE_H +#include FT_INTERNAL_MEMORY_H #include /* memcmp() */ #include /* labs() */ diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 0e9ecdd60..a39e7fab9 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -15,12 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_MANAGER_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_LIST_H + +#include +#include FT_CACHE_H +#include FT_CACHE_MANAGER_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H +#include FT_LIST_H #undef FT_COMPONENT diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 75347b42c..de73815df 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -15,12 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_SMALL_BITMAPS_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H -#include FT_ERRORS_H + +#include +#include FT_CACHE_H +#include FT_CACHE_SMALL_BITMAPS_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H +#include FT_ERRORS_H #include /* memcmp() */ diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c index 295348075..783ccbece 100644 --- a/src/cache/ftlru.c +++ b/src/cache/ftlru.c @@ -15,11 +15,12 @@ /* */ /***************************************************************************/ -#include -#include FT_CACHE_H -#include FT_CACHE_INTERNAL_LRU_H -#include FT_LIST_H -#include FT_INTERNAL_OBJECTS_H + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_LRU_H +#include FT_LIST_H +#include FT_INTERNAL_OBJECTS_H static diff --git a/src/cff/cff.c b/src/cff/cff.c index d99cb1c30..5af569855 100644 --- a/src/cff/cff.c +++ b/src/cff/cff.c @@ -25,4 +25,5 @@ #include FT_SOURCE_FILE(cff,cffobjs.c) #include FT_SOURCE_FILE(cff,t2gload.c) + /* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 6066e44f3..f8853d65d 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_FREETYPE_H #include FT_INTERNAL_DEBUG_H @@ -26,6 +27,7 @@ #include FT_SOURCE_FILE(cff,cffdrivr.h) #include FT_SOURCE_FILE(cff,t2gload.h) + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ diff --git a/src/cff/cffdrivr.h b/src/cff/cffdrivr.h index f2b934ca1..5d19ba0d4 100644 --- a/src/cff/cffdrivr.h +++ b/src/cff/cffdrivr.h @@ -24,6 +24,7 @@ FT_BEGIN_HEADER + FT_CALLBACK_TABLE const FT_Driver_Class cff_driver_class; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 5aa4cca51..db4d64aa0 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H @@ -26,6 +27,7 @@ #include FT_SOURCE_FILE(cff,cffload.h) #include FT_SOURCE_FILE(cff,cffparse.h) + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -37,9 +39,9 @@ /* read a CFF offset from memory */ - static FT_ULong - cff_get_offset( FT_Byte* p, - FT_Byte off_size ) + static + FT_ULong cff_get_offset( FT_Byte* p, + FT_Byte off_size ) { FT_ULong result; @@ -54,14 +56,14 @@ } - static FT_Error - cff_new_index( CFF_Index* index, - FT_Stream stream, - FT_Bool load ) + static + FT_Error cff_new_index( CFF_Index* index, + FT_Stream stream, + FT_Bool load ) { - FT_Error error; - FT_Memory memory = stream->memory; - FT_UShort count; + FT_Error error; + FT_Memory memory = stream->memory; + FT_UShort count; MEM_Set( index, 0, sizeof ( *index ) ); @@ -127,8 +129,8 @@ } - static void - cff_done_index( CFF_Index* index ) + static + void cff_done_index( CFF_Index* index ) { if ( index->stream ) { @@ -145,9 +147,9 @@ } - static FT_Error - cff_explicit_index( CFF_Index* index, - FT_Byte*** table ) + static + FT_Error cff_explicit_index( CFF_Index* index, + FT_Byte*** table ) { FT_Error error = 0; FT_Memory memory = index->stream->memory; @@ -177,11 +179,11 @@ } - FT_LOCAL_DEF FT_Error - CFF_Access_Element( CFF_Index* index, - FT_UInt element, - FT_Byte** pbytes, - FT_ULong* pbyte_len ) + FT_LOCAL_DEF + FT_Error CFF_Access_Element( CFF_Index* index, + FT_UInt element, + FT_Byte** pbytes, + FT_ULong* pbyte_len ) { FT_Error error = 0; @@ -242,9 +244,9 @@ } - FT_LOCAL_DEF void - CFF_Forget_Element( CFF_Index* index, - FT_Byte** pbytes ) + FT_LOCAL_DEF + void CFF_Forget_Element( CFF_Index* index, + FT_Byte** pbytes ) { if ( index->bytes == 0 ) { @@ -256,9 +258,9 @@ } - FT_LOCAL_DEF FT_String* - CFF_Get_Name( CFF_Index* index, - FT_UInt element ) + FT_LOCAL_DEF + FT_String* CFF_Get_Name( CFF_Index* index, + FT_UInt element ) { FT_Memory memory = index->stream->memory; FT_Byte* bytes; @@ -283,10 +285,10 @@ } - FT_LOCAL_DEF FT_String* - CFF_Get_String( CFF_Index* index, - FT_UInt sid, - PSNames_Interface* interface ) + FT_LOCAL_DEF + FT_String* CFF_Get_String( CFF_Index* index, + FT_UInt sid, + PSNames_Interface* interface ) { /* if it is not a standard string, return it */ if ( sid > 390 ) @@ -327,9 +329,9 @@ /*************************************************************************/ - static void - CFF_Done_FD_Select( CFF_FD_Select* select, - FT_Stream stream ) + static + void CFF_Done_FD_Select( CFF_FD_Select* select, + FT_Stream stream ) { if ( select->data ) RELEASE_Frame( select->data ); @@ -340,15 +342,15 @@ } - static FT_Error - CFF_Load_FD_Select( CFF_FD_Select* select, - FT_UInt num_glyphs, - FT_Stream stream, - FT_ULong offset ) + static + FT_Error CFF_Load_FD_Select( CFF_FD_Select* select, + FT_UInt num_glyphs, + FT_Stream stream, + FT_ULong offset ) { - FT_Error error; - FT_Byte format; - FT_UInt num_ranges; + FT_Error error; + FT_Byte format; + FT_UInt num_ranges; /* read format */ @@ -384,9 +386,9 @@ } - FT_LOCAL_DEF FT_Byte - CFF_Get_FD( CFF_FD_Select* select, - FT_UInt glyph_index ) + FT_LOCAL_DEF + FT_Byte CFF_Get_FD( CFF_FD_Select* select, + FT_UInt glyph_index ) { FT_Byte fd = 0; @@ -454,12 +456,13 @@ /*************************************************************************/ /*************************************************************************/ - static void - CFF_Done_Encoding( CFF_Encoding* encoding, - FT_Stream stream ) + static + void CFF_Done_Encoding( CFF_Encoding* encoding, + FT_Stream stream ) { FT_Memory memory = stream->memory; + FREE( encoding->bytes ); encoding->format = 0; encoding->size = 0; @@ -467,12 +470,13 @@ } - static void - CFF_Done_Charset( CFF_Charset* charset, - FT_Stream stream ) + static + void CFF_Done_Charset( CFF_Charset* charset, + FT_Stream stream ) { FT_Memory memory = stream->memory; + FREE( charset->bytes ); charset->format = 0; charset->offset = 0; @@ -480,20 +484,22 @@ } - static FT_Error - CFF_Load_Charset( CFF_Charset* charset, - FT_UInt num_glyphs, - FT_Stream stream, - FT_ULong base_offset, - FT_ULong offset ) + static + FT_Error CFF_Load_Charset( CFF_Charset* charset, + FT_UInt num_glyphs, + FT_Stream stream, + FT_ULong base_offset, + FT_ULong offset ) { - FT_Error error = 0; - FT_Memory memory = stream->memory; + FT_Error error = 0; + FT_Memory memory = stream->memory; + if ( offset > 2 ) { FT_ULong size = 1; + charset->offset = base_offset + offset; /* we need to parse the table to determine its size */ @@ -501,55 +507,55 @@ READ_Byte( charset->format ) ) goto Exit; - switch (charset->format) + switch ( charset->format ) { - case 0: + case 0: + size += 2 * ( num_glyphs - 1 ); + break; + + case 1: + { + FT_UInt glyph, nleft; + + + num_glyphs--; + while ( num_glyphs > 0 ) { - size += 2*(num_glyphs-1); - break; - } + if ( READ_UShort( glyph ) || + READ_Byte( nleft ) ) + goto Exit; - case 1: + size += 3; + num_glyphs -= 1 + nleft; + } + break; + } + + case 2: + { + FT_UInt glyph, nleft; + + + num_glyphs--; + while ( num_glyphs > 0 ) { - FT_UInt glyph, nleft; + if ( READ_UShort( glyph ) || + READ_UShort( nleft ) ) + goto Exit; - num_glyphs--; - while (num_glyphs > 0) - { - if ( READ_UShort(glyph) || - READ_Byte(nleft) ) - goto Exit; - - size += 3; - num_glyphs -= 1 + nleft; - } - break; + size += 4; + num_glyphs -= 1 + nleft; } + break; + } - case 2: - { - FT_UInt glyph, nleft; - - num_glyphs--; - while (num_glyphs > 0) - { - if ( READ_UShort(glyph) || - READ_UShort(nleft) ) - goto Exit; - - size += 4; - num_glyphs -= 1 + nleft; - } - break; - } - - default: - FT_ERROR(( "CFF.Load_Charset: invalid table format !!\n" )); - error = FT_Err_Invalid_File_Format; - goto Exit; + default: + FT_ERROR(( "CFF_Load_Charset: invalid table format!\n" )); + error = FT_Err_Invalid_File_Format; + goto Exit; } - charset->size = size; + charset->size = size; if ( ALLOC( charset->bytes, size ) || FILE_Seek( charset->offset ) || @@ -564,23 +570,25 @@ } - static FT_Error - CFF_Load_Encoding( CFF_Encoding* encoding, - FT_UInt num_glyphs, - FT_Stream stream, - FT_ULong base_offset, - FT_ULong offset ) + static + FT_Error CFF_Load_Encoding( CFF_Encoding* encoding, + FT_UInt num_glyphs, + FT_Stream stream, + FT_ULong base_offset, + FT_ULong offset ) { FT_Error error = 0; FT_Memory memory = stream->memory; FT_UInt count; - FT_UNUSED(num_glyphs); + FT_UNUSED( num_glyphs ); + if ( offset > 2 ) { FT_ULong size = 1; + encoding->offset = base_offset + offset; /* we need to parse the table to determine its size */ @@ -589,43 +597,37 @@ READ_Byte( count ) ) goto Exit; - switch (encoding->format & 0x7F) + switch ( encoding->format & 0x7F ) { - case 0: - { - size = 2+count; - break; - } + case 0: + size = 2 + count; + break; - case 1: - { - size = 2+count*2; - break; - } + case 1: + size = 2 + count * 2; + break; - case 2: - { - size = 2+count*3; - break; - } + case 2: + size = 2 + count * 3; + break; - default: - FT_ERROR(( "CFF.Load_Encoding: invalid table format !!\n" )); - error = FT_Err_Invalid_File_Format; - goto Exit; + default: + FT_ERROR(( "CFF.Load_Encoding: invalid table format!\n" )); + error = FT_Err_Invalid_File_Format; + goto Exit; } - if (encoding->format & 0x80) + if ( encoding->format & 0x80 ) { - /* count supplements.. */ + /* count supplements */ if ( FILE_Seek( encoding->offset + size ) || READ_Byte( count ) ) goto Exit; - size += 1+3*count; + size += 1 + 3 * count; } - encoding->size = size; + encoding->size = size; if ( ALLOC( encoding->bytes, size ) || FILE_Seek( encoding->offset ) || @@ -640,16 +642,15 @@ } - - static FT_Error - CFF_Load_SubFont( CFF_SubFont* font, - CFF_Index* index, - FT_UInt font_index, - FT_Stream stream, - FT_ULong base_offset ) + static + FT_Error CFF_Load_SubFont( CFF_SubFont* font, + CFF_Index* index, + FT_UInt font_index, + FT_Stream stream, + FT_ULong base_offset ) { FT_Error error; - CFF_Parser parser; + CFF_Parser parser; FT_Byte* dict; FT_ULong dict_len; CFF_Font_Dict* top = &font->font_dict; @@ -720,7 +721,7 @@ font->num_local_subrs = font->local_subrs_index.count; error = cff_explicit_index( &font->local_subrs_index, &font->local_subrs ); - if (error) + if ( error ) goto Exit; } @@ -729,9 +730,9 @@ } - static void - CFF_Done_SubFont( FT_Memory memory, - CFF_SubFont* subfont ) + static + void CFF_Done_SubFont( FT_Memory memory, + CFF_SubFont* subfont ) { if ( subfont ) { @@ -741,10 +742,10 @@ } - FT_LOCAL_DEF FT_Error - CFF_Load_Font( FT_Stream stream, - FT_Int face_index, - CFF_Font* font ) + FT_LOCAL_DEF + FT_Error CFF_Load_Font( FT_Stream stream, + FT_Int face_index, + CFF_Font* font ) { static const FT_Frame_Field cff_header_fields[] = { @@ -791,10 +792,10 @@ goto Exit; /* read the name, top dict, string and global subrs index */ - if ( FT_SET_ERROR(cff_new_index( &font->name_index, stream, 0 )) || - FT_SET_ERROR(cff_new_index( &font->font_dict_index, stream, 0 )) || - FT_SET_ERROR(cff_new_index( &font->string_index, stream, 0 )) || - FT_SET_ERROR(cff_new_index( &font->global_subrs_index, stream, 1 )) ) + if ( FT_SET_ERROR( cff_new_index( &font->name_index, stream, 0 )) || + FT_SET_ERROR( cff_new_index( &font->font_dict_index, stream, 0 )) || + FT_SET_ERROR( cff_new_index( &font->string_index, stream, 0 )) || + FT_SET_ERROR( cff_new_index( &font->global_subrs_index, stream, 1 )) ) goto Exit; /* well, we don't really forget the `disabled' fonts... */ @@ -867,7 +868,7 @@ stream, base_offset + dict->cid_fd_select_offset ); - Fail_CID: + Fail_CID: cff_done_index( &fd_index ); if ( error ) @@ -904,12 +905,12 @@ /* read the Charset and Encoding tables when available */ error = CFF_Load_Charset( &font->charset, font->num_glyphs, stream, base_offset, dict->charset_offset ); - if (error) + if ( error ) goto Exit; error = CFF_Load_Encoding( &font->encoding, font->num_glyphs, stream, base_offset, dict->encoding_offset ); - if (error) + if ( error ) goto Exit; /* get the font name */ @@ -920,8 +921,8 @@ } - FT_LOCAL_DEF void - CFF_Done_Font( CFF_Font* font ) + FT_LOCAL_DEF + void CFF_Done_Font( CFF_Font* font ) { FT_Memory memory = font->memory; FT_UInt index; diff --git a/src/cff/cffload.h b/src/cff/cffload.h index ce3bfe086..99b2d44f5 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -19,49 +19,49 @@ #ifndef CFFLOAD_H #define CFFLOAD_H + #include #include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H + FT_BEGIN_HEADER - FT_LOCAL FT_String* - CFF_Get_Name( CFF_Index* index, - FT_UInt element ); + FT_LOCAL + FT_String* CFF_Get_Name( CFF_Index* index, + FT_UInt element ); + + FT_LOCAL + FT_String* CFF_Get_String( CFF_Index* index, + FT_UInt sid, + PSNames_Interface* interface ); - FT_LOCAL FT_String* - CFF_Get_String( CFF_Index* index, - FT_UInt sid, - PSNames_Interface* interface ); + FT_LOCAL + FT_Error CFF_Access_Element( CFF_Index* index, + FT_UInt element, + FT_Byte** pbytes, + FT_ULong* pbyte_len ); + + FT_LOCAL + void CFF_Forget_Element( CFF_Index* index, + FT_Byte** pbytes ); - FT_LOCAL FT_Error - CFF_Access_Element( CFF_Index* index, - FT_UInt element, - FT_Byte** pbytes, - FT_ULong* pbyte_len ); + FT_LOCAL + FT_Error CFF_Load_Font( FT_Stream stream, + FT_Int face_index, + CFF_Font* font ); + + FT_LOCAL + void CFF_Done_Font( CFF_Font* font ); - FT_LOCAL void - CFF_Forget_Element( CFF_Index* index, - FT_Byte** pbytes ); + FT_LOCAL + FT_Byte CFF_Get_FD( CFF_FD_Select* select, + FT_UInt glyph_index ); - FT_LOCAL FT_Error - CFF_Load_Font( FT_Stream stream, - FT_Int face_index, - CFF_Font* font ); - - - FT_LOCAL void - CFF_Done_Font( CFF_Font* font ); - - - FT_LOCAL FT_Byte - CFF_Get_FD( CFF_FD_Select* select, - FT_UInt glyph_index ); - FT_END_HEADER #endif /* CFFLOAD_H */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 7d543f3fb..321f417a8 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H @@ -27,6 +28,7 @@ #include FT_SOURCE_FILE(cff,cffobjs.h) #include FT_SOURCE_FILE(cff,cffload.h) #include FT_INTERNAL_CFF_ERRORS_H + #include /* for strlen() */ @@ -87,7 +89,7 @@ charset_offset = dict->charset_offset; if ( !charset_offset ) { - FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" )); + FT_ERROR(( "CFF_Build_Unicode_Charmap: charset table is missing\n" )); error = T2_Err_Invalid_File_Format; goto Exit; } @@ -106,68 +108,71 @@ switch ( format ) { - case 0: /* format 0 - one SID per glyph */ - { - const char** gname = glyph_names; - const char** limit = gname + num_glyphs; + case 0: /* format 0 - one SID per glyph */ + { + const char** gname = glyph_names; + const char** limit = gname + num_glyphs; - if ( ACCESS_Frame( num_glyphs*2 ) ) + + if ( ACCESS_Frame( num_glyphs * 2 ) ) + goto Fail; + + for ( ; gname < limit; gname++ ) + gname[0] = T2_Get_String( &font->string_index, + GET_UShort(), + psnames ); + FORGET_Frame(); + break; + } + + case 1: /* format 1 - sequential ranges */ + case 2: /* format 2 - sequential ranges with 16-bit counts */ + { + const char** gname = glyph_names; + const char** limit = gname + num_glyphs; + FT_UInt len = 3; + + + if ( format == 2 ) + len++; + + while ( gname < limit ) + { + FT_UInt first; + FT_UInt count; + + + if ( ACCESS_Frame( len ) ) goto Fail; - for ( ; gname < limit; gname++ ) - gname[0] = T2_Get_String( &font->string_index, - GET_UShort(), - psnames ); + first = GET_UShort(); + if ( format == 3 ) + count = GET_UShort(); + else + count = GET_Byte(); + FORGET_Frame(); - break; - } - case 1: /* format 1 - sequential ranges */ - case 2: /* format 2 - sequential ranges with 16-bit counts */ - { - const char** gname = glyph_names; - const char** limit = gname + num_glyphs; - FT_UInt len = 3; - - if (format == 2) - len++; - - while (gname < limit) + for ( ; count > 0; count-- ) { - FT_UInt first; - FT_UInt count; - - if ( ACCESS_Frame( len ) ) - goto Fail; - - first = GET_UShort(); - if (format == 3) - count = GET_UShort(); - else - count = GET_Byte(); - - FORGET_Frame(); - - for ( ; count > 0; count-- ) - { - gname[0] = T2_Get_String( &font->string_index, - first, - psnames ); - gname++; - first++; - } + gname[0] = T2_Get_String( &font->string_index, + first, + psnames ); + gname++; + first++; } - break; } + break; + } - default: /* unknown charset format! */ - FT_ERROR(( "CFF: unknown charset format!\n" )); - error = T2_Err_Invalid_File_Format; - goto Fail; + default: /* unknown charset format! */ + FT_ERROR(( "CFF_Build_Unicode_Charmap: unknown charset format!\n" )); + error = T2_Err_Invalid_File_Format; + goto Fail; } - /* all right, the glyph names were loaded, we now need to create */ - /* the corresponding unicode charmap.. */ + /* all right, the glyph names were loaded; we now need to create */ + /* the corresponding unicode charmap */ Fail: for ( n = 0; n < num_glyphs; n++ ) @@ -290,20 +295,20 @@ goto Bad_Format; } - /* If we are performing a simple font format check, exit immediately */ + /* if we are performing a simple font format check, exit immediately */ if ( face_index < 0 ) return T2_Err_Ok; sfnt_format = 1; - /* now, the font can be either an OpenType/CFF font, or a SVG CEF */ - /* font in the later case; it doesn't have a `head' table */ + /* now, the font can be either an OpenType/CFF font, or an SVG CEF */ + /* font in the later case; it doesn't have a `head' table */ error = face->goto_table( face, TTAG_head, stream, 0 ); if ( !error ) { pure_cff = 0; - /* Load font directory */ + /* load font directory */ error = sfnt->load_face( stream, face, face_index, num_params, params ); if ( error ) @@ -316,8 +321,9 @@ if ( error ) goto Exit; - /* XXX: for now, we don't load the GPOS table, as OpenType Layout */ - /* support will be added later to FreeType 2 as a separate module */ + /* XXX: we don't load the GPOS table, as OpenType Layout */ + /* support will be added later to a layout library on top of */ + /* FreeType 2 */ } /* now, load the CFF part of the file */ @@ -353,7 +359,7 @@ goto Exit; /* Complement the root flags with some interesting information. */ - /* Note that this is only necessary for pure CFF and CEF fonts */ + /* Note that this is only necessary for pure CFF and CEF fonts. */ root = &face->root; if ( pure_cff ) @@ -390,15 +396,11 @@ /* retrieve font family & style name */ root->family_name = CFF_Get_Name( &cff->name_index, face_index ); if ( dict->cid_registry ) - { root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */ - } else - { root->style_name = CFF_Get_String( &cff->string_index, dict->weight, psnames ); - } /*******************************************************************/ /* */ @@ -414,7 +416,7 @@ if ( dict->is_fixed_pitch ) flags |= FT_FACE_FLAG_FIXED_WIDTH; -/* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ + /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ #if 0 /* kerning available? */ if ( face->kern_pairs ) diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 5838d11ab..9633cff22 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -19,14 +19,17 @@ #ifndef T2OBJS_H #define T2OBJS_H + #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_CFF_ERRORS_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H + FT_BEGIN_HEADER + /*************************************************************************/ /* */ /* */ @@ -111,26 +114,26 @@ FT_BEGIN_HEADER /* */ /* Face functions */ /* */ - FT_LOCAL FT_Error - T2_Init_Face( FT_Stream stream, - T2_Face face, - FT_Int face_index, - FT_Int num_params, - FT_Parameter* params ); + FT_LOCAL + FT_Error T2_Init_Face( FT_Stream stream, + T2_Face face, + FT_Int face_index, + FT_Int num_params, + FT_Parameter* params ); - FT_LOCAL void - T2_Done_Face( T2_Face face ); + FT_LOCAL + void T2_Done_Face( T2_Face face ); /*************************************************************************/ /* */ /* Driver functions */ /* */ - FT_LOCAL FT_Error - T2_Init_Driver( T2_Driver driver ); + FT_LOCAL + FT_Error T2_Init_Driver( T2_Driver driver ); - FT_LOCAL void - T2_Done_Driver( T2_Driver driver ); + FT_LOCAL + void T2_Done_Driver( T2_Driver driver ); FT_END_HEADER diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 64a9e55b1..06875c869 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -15,11 +15,13 @@ /* */ /***************************************************************************/ + #include #include FT_SOURCE_FILE(cff,cffparse.h) #include FT_INTERNAL_CFF_ERRORS_H #include FT_INTERNAL_STREAM_H + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -30,8 +32,8 @@ #define FT_COMPONENT trace_t2parse -#define T2_Err_Stack_Underflow FT_Err_Invalid_Argument -#define T2_Err_Syntax_Error FT_Err_Invalid_Argument +#define T2_Err_Stack_Underflow FT_Err_Invalid_Argument +#define T2_Err_Syntax_Error FT_Err_Invalid_Argument enum @@ -64,10 +66,10 @@ } CFF_Field_Handler; - FT_LOCAL_DEF void - CFF_Parser_Init( CFF_Parser* parser, - FT_UInt code, - void* object ) + FT_LOCAL_DEF + void CFF_Parser_Init( CFF_Parser* parser, + FT_UInt code, + void* object ) { MEM_Set( parser, 0, sizeof ( *parser ) ); @@ -77,10 +79,10 @@ } - /* reads an integer */ - static FT_Long - cff_parse_integer( FT_Byte* start, - FT_Byte* limit ) + /* read an integer */ + static + FT_Long cff_parse_integer( FT_Byte* start, + FT_Byte* limit ) { FT_Byte* p = start; FT_Int v = *p++; @@ -137,10 +139,10 @@ /* read a real */ - static FT_Fixed - cff_parse_real( FT_Byte* start, - FT_Byte* limit, - FT_Int power_ten ) + static + FT_Fixed cff_parse_real( FT_Byte* start, + FT_Byte* limit, + FT_Int power_ten ) { FT_Byte* p = start; FT_Long num, divider, result, exp; @@ -158,7 +160,6 @@ for (;;) { - /* If we entered this iteration with phase == 4, we need to */ /* read a new byte. This also skips past the intial 0x1E. */ if ( phase ) @@ -186,17 +187,16 @@ if ( nib == 0xa ) for (;;) { - /* If we entered this iteration with phase == 4, we need */ /* to read a new byte. */ if ( phase ) - { + { p++; /* Make sure we don't read past the end. */ if ( p >= limit ) goto Bad; - } + } /* Get the nibble. */ nib = ( p[0] >> phase ) & 0xF; @@ -204,7 +204,7 @@ if ( nib >= 10 ) break; - if (divider < 10000000L) + if ( divider < 10000000L ) { num = num * 10 + nib; divider *= 10; @@ -227,13 +227,13 @@ /* If we entered this iteration with phase == 4, we need */ /* to read a new byte. */ if ( phase ) - { + { p++; /* Make sure we don't read past the end. */ if ( p >= limit ) goto Bad; - } + } /* Get the nibble. */ nib = ( p[0] >> phase ) & 0xF; @@ -283,25 +283,25 @@ /* read a number, either integer or real */ - static FT_Long - cff_parse_num( FT_Byte** d ) + static + FT_Long cff_parse_num( FT_Byte** d ) { return ( **d == 30 ? ( cff_parse_real ( d[0], d[1], 0 ) >> 16 ) : cff_parse_integer( d[0], d[1] ) ); } - /* reads a floating point number, either integer or real */ - static FT_Fixed - cff_parse_fixed( FT_Byte** d ) + /* read a floating point number, either integer or real */ + static + FT_Fixed cff_parse_fixed( FT_Byte** d ) { return ( **d == 30 ? cff_parse_real ( d[0], d[1], 0 ) : cff_parse_integer( d[0], d[1] ) << 16 ); } - static FT_Error - cff_parse_font_matrix( CFF_Parser* parser ) + static + FT_Error cff_parse_font_matrix( CFF_Parser* parser ) { CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; FT_Matrix* matrix = &dict->font_matrix; @@ -327,8 +327,8 @@ } - static FT_Error - cff_parse_font_bbox( CFF_Parser* parser ) + static + FT_Error cff_parse_font_bbox( CFF_Parser* parser ) { CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; FT_BBox* bbox = &dict->font_bbox; @@ -351,8 +351,8 @@ } - static FT_Error - cff_parse_private_dict( CFF_Parser* parser ) + static + FT_Error cff_parse_private_dict( CFF_Parser* parser ) { CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; FT_Byte** data = parser->stack; @@ -372,8 +372,8 @@ } - static FT_Error - cff_parse_cid_ros( CFF_Parser* parser ) + static + FT_Error cff_parse_cid_ros( CFF_Parser* parser ) { CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; FT_Byte** data = parser->stack; @@ -448,10 +448,10 @@ }; - FT_LOCAL_DEF FT_Error - CFF_Parser_Run( CFF_Parser* parser, - FT_Byte* start, - FT_Byte* limit ) + FT_LOCAL_DEF + FT_Error CFF_Parser_Run( CFF_Parser* parser, + FT_Byte* start, + FT_Byte* limit ) { FT_Byte* p = start; FT_Error error = T2_Err_Ok; @@ -505,9 +505,9 @@ /* This is not a number, hence it's an operator. Compute its code */ /* and look for it in our current list. */ - FT_UInt code; - FT_UInt num_args = (FT_UInt) - ( parser->top - parser->stack ); + FT_UInt code; + FT_UInt num_args = (FT_UInt) + ( parser->top - parser->stack ); const CFF_Field_Handler* field; @@ -533,6 +533,7 @@ FT_Long val; FT_Byte* q = (FT_Byte*)parser->object + field->offset; + switch ( field->kind ) { case cff_kind_bool: diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index f0941654c..aa78a9d9f 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -19,20 +19,21 @@ #ifndef __CFF_PARSE_H__ #define __CFF_PARSE_H__ + #include #include FT_INTERNAL_CFF_TYPES_H #include FT_INTERNAL_OBJECTS_H + FT_BEGIN_HEADER + #define CFF_MAX_STACK_DEPTH 96 #define CFF_CODE_TOPDICT 0x1000 #define CFF_CODE_PRIVATE 0x2000 - - typedef struct CFF_Parser_ { FT_Byte* start; @@ -48,19 +49,20 @@ FT_BEGIN_HEADER } CFF_Parser; - FT_LOCAL void - CFF_Parser_Init( CFF_Parser* parser, - FT_UInt code, - void* object ); + FT_LOCAL + void CFF_Parser_Init( CFF_Parser* parser, + FT_UInt code, + void* object ); - FT_LOCAL FT_Error - CFF_Parser_Run( CFF_Parser* parser, - FT_Byte* start, - FT_Byte* limit ); + FT_LOCAL + FT_Error CFF_Parser_Run( CFF_Parser* parser, + FT_Byte* start, + FT_Byte* limit ); FT_END_HEADER + #endif /* __CFF_PARSE_H__ */ diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h index 151bae995..ab4fd8ee2 100644 --- a/src/cff/cfftoken.h +++ b/src/cff/cfftoken.h @@ -22,12 +22,12 @@ #undef CFFCODE #define CFFCODE CFFCODE_TOPDICT - CFF_FIELD_STRING ( 0, version ) - CFF_FIELD_STRING ( 1, notice ) + CFF_FIELD_STRING ( 0, version ) + CFF_FIELD_STRING ( 1, notice ) CFF_FIELD_STRING ( 0x100, copyright ) - CFF_FIELD_STRING ( 2, full_name ) - CFF_FIELD_STRING ( 3, family_name ) - CFF_FIELD_STRING ( 4, weight ) + CFF_FIELD_STRING ( 2, full_name ) + CFF_FIELD_STRING ( 3, family_name ) + CFF_FIELD_STRING ( 4, weight ) CFF_FIELD_BOOL ( 0x101, is_fixed_pitch ) CFF_FIELD_FIXED ( 0x102, italic_angle ) CFF_FIELD_NUM ( 0x103, underline_position ) @@ -35,13 +35,13 @@ CFF_FIELD_NUM ( 0x105, paint_type ) CFF_FIELD_NUM ( 0x106, charstring_type ) CFF_FIELD_CALLBACK( 0x107, font_matrix ) - CFF_FIELD_NUM ( 13, unique_id ) - CFF_FIELD_CALLBACK( 5, font_bbox ) + CFF_FIELD_NUM ( 13, unique_id ) + CFF_FIELD_CALLBACK( 5, font_bbox ) CFF_FIELD_NUM ( 0x108, stroke_width ) - CFF_FIELD_NUM ( 15, charset_offset ) - CFF_FIELD_NUM ( 16, encoding_offset ) - CFF_FIELD_NUM ( 17, charstrings_offset ) - CFF_FIELD_CALLBACK( 18, private_dict ) + CFF_FIELD_NUM ( 15, charset_offset ) + CFF_FIELD_NUM ( 16, encoding_offset ) + CFF_FIELD_NUM ( 17, charstrings_offset ) + CFF_FIELD_CALLBACK( 18, private_dict ) CFF_FIELD_NUM ( 0x114, synthetic_base ) CFF_FIELD_STRING ( 0x115, postscript ) CFF_FIELD_STRING ( 0x116, base_font_name ) @@ -70,17 +70,17 @@ #undef FT_STRUCTURE #define FT_STRUCTURE CFF_Private #undef CFFCODE -#define CFFCODE CFFCODE_PRIVATE +#define CFFCODE CFFCODE_PRIVATE - CFF_FIELD_DELTA( 6, blue_values, 14 ) - CFF_FIELD_DELTA( 7, other_blues, 10 ) - CFF_FIELD_DELTA( 8, family_blues, 14 ) - CFF_FIELD_DELTA( 9, family_other_blues, 10 ) + CFF_FIELD_DELTA( 6, blue_values, 14 ) + CFF_FIELD_DELTA( 7, other_blues, 10 ) + CFF_FIELD_DELTA( 8, family_blues, 14 ) + CFF_FIELD_DELTA( 9, family_other_blues, 10 ) CFF_FIELD_FIXED( 0x109, blue_scale ) CFF_FIELD_NUM ( 0x10A, blue_shift ) CFF_FIELD_NUM ( 0x10B, blue_fuzz ) - CFF_FIELD_NUM ( 10, standard_width ) - CFF_FIELD_NUM ( 11, standard_height ) + CFF_FIELD_NUM ( 10, standard_width ) + CFF_FIELD_NUM ( 11, standard_height ) CFF_FIELD_DELTA( 0x10C, snap_widths, 13 ) CFF_FIELD_DELTA( 0x10D, snap_heights, 13 ) CFF_FIELD_BOOL ( 0x10E, force_bold ) @@ -89,9 +89,9 @@ CFF_FIELD_NUM ( 0x111, language_group ) CFF_FIELD_FIXED( 0x112, expansion_factor ) CFF_FIELD_NUM ( 0x113, initial_random_seed ) - CFF_FIELD_NUM ( 19, local_subrs_offset ) - CFF_FIELD_NUM ( 20, default_width ) - CFF_FIELD_NUM ( 21, nominal_width ) + CFF_FIELD_NUM ( 19, local_subrs_offset ) + CFF_FIELD_NUM ( 20, default_width ) + CFF_FIELD_NUM ( 21, nominal_width ) /* END */ diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c deleted file mode 100644 index 374557dea..000000000 --- a/src/cff/t2driver.c +++ /dev/null @@ -1,378 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2driver.c */ -/* */ -/* OpenType font driver implementation (body). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#include -#include -#include -#include -#include - -#include - - -#ifdef FT_FLAT_COMPILE - -#include "t2driver.h" -#include "t2gload.h" - -#else - -#include -#include - -#endif - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_t2driver - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** F A C E S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - -#undef PAIR_TAG -#define PAIR_TAG( left, right ) ( ( (FT_ULong)left << 16 ) | \ - (FT_ULong)right ) - - - /*************************************************************************/ - /* */ - /* */ - /* Get_Kerning */ - /* */ - /* */ - /* A driver method used to return the kerning vector between two */ - /* glyphs of the same face. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this function. Other layouts, or more sophisticated */ - /* kernings, are out of scope of this method (the basic driver */ - /* interface is meant to be simple). */ - /* */ - /* They can be implemented by format-specific interfaces. */ - /* */ - static - FT_Error Get_Kerning( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ) - { - TT_Kern_0_Pair* pair; - - - if ( !face ) - return T2_Err_Invalid_Face_Handle; - - kerning->x = 0; - kerning->y = 0; - - if ( face->kern_pairs ) - { - /* there are some kerning pairs in this font file! */ - FT_ULong search_tag = PAIR_TAG( left_glyph, right_glyph ); - FT_Long left, right; - - - left = 0; - right = face->num_kern_pairs - 1; - - while ( left <= right ) - { - FT_Int middle = left + ( ( right - left ) >> 1 ); - FT_ULong cur_pair; - - - pair = face->kern_pairs + middle; - cur_pair = PAIR_TAG( pair->left, pair->right ); - - if ( cur_pair == search_tag ) - goto Found; - - if ( cur_pair < search_tag ) - left = middle + 1; - else - right = middle - 1; - } - } - - Exit: - return T2_Err_Ok; - - Found: - kerning->x = pair->value; - goto Exit; - } - - -#undef PAIR_TAG - - - /*************************************************************************/ - /* */ - /* */ - /* Load_Glyph */ - /* */ - /* */ - /* A driver method used to load a glyph within a given glyph slot. */ - /* */ - /* */ - /* slot :: A handle to the target slot object where the glyph */ - /* will be loaded. */ - /* */ - /* size :: A handle to the source face size at which the glyph */ - /* must be scaled, loaded, etc. */ - /* */ - /* glyph_index :: The index of the glyph in the font file. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FTLOAD_??? constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - static - FT_Error Load_Glyph( T2_GlyphSlot slot, - T2_Size size, - FT_UShort glyph_index, - FT_UInt load_flags ) - { - FT_Error error; - - - if ( !slot ) - return T2_Err_Invalid_Glyph_Handle; - - /* check whether we want a scaled outline or bitmap */ - if ( !size ) - load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - - if ( load_flags & FT_LOAD_NO_SCALE ) - size = NULL; - - /* reset the size object if necessary */ - if ( size ) - { - /* these two object must have the same parent */ - if ( size->face != slot->root.face ) - return T2_Err_Invalid_Face_Handle; - } - - /* now load the glyph outline if necessary */ - error = T2_Load_Glyph( slot, size, glyph_index, load_flags ); - - /* force drop-out mode to 2 - irrelevant now */ - /* slot->outline.dropout_mode = 2; */ - - return error; - } - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** C H A R A C T E R M A P P I N G S ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* */ - /* Get_Char_Index */ - /* */ - /* */ - /* Uses a charmap to return a given character code's glyph index. */ - /* */ - /* */ - /* charmap :: A handle to the source charmap object. */ - /* charcode :: The character code. */ - /* */ - /* */ - /* Glyph index. 0 means `undefined character code'. */ - /* */ - static - FT_UInt t2_get_char_index( TT_CharMap charmap, - FT_Long charcode ) - { - FT_Error error; - T2_Face face; - TT_CMapTable* cmap; - - - cmap = &charmap->cmap; - face = (T2_Face)charmap->root.face; - - /* Load table if needed */ - if ( !cmap->loaded ) - { - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; - - - error = sfnt->load_charmap( face, cmap, face->root.stream ); - if ( error ) - return 0; - - cmap->loaded = TRUE; - } - - return ( cmap->get_index ? cmap->get_index( cmap, charcode ) : 0 ); - } - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** D R I V E R I N T E R F A C E ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - static - FT_Module_Interface t2_get_interface( T2_Driver driver, - const char* interface ) - { - FT_Module sfnt; - - - /* we simply pass our request to the `sfnt' module */ - sfnt = FT_Get_Module( driver->root.root.library, "sfnt" ); - - return sfnt ? sfnt->clazz->get_interface( sfnt, interface ) : 0; - } - - - /* The FT_DriverInterface structure is defined in ftdriver.h. */ - - FT_CALLBACK_TABLE_DEF - const FT_Driver_Class cff_driver_class = - { - /* begin with the FT_Module_Class fields */ - { - ft_module_font_driver | ft_module_driver_scalable, - sizeof( T2_DriverRec ), - "cff", - 0x10000L, - 0x20000L, - - 0, /* module-specific interface */ - - (FT_Module_Constructor)T2_Init_Driver, - (FT_Module_Destructor) T2_Done_Driver, - (FT_Module_Requester) t2_get_interface, - }, - - /* now the specific driver fields */ - sizeof( TT_FaceRec ), - sizeof( FT_SizeRec ), - sizeof( T2_GlyphSlotRec ), - - (FTDriver_initFace) T2_Init_Face, - (FTDriver_doneFace) T2_Done_Face, - (FTDriver_initSize) 0, - (FTDriver_doneSize) 0, - (FTDriver_initGlyphSlot)0, - (FTDriver_doneGlyphSlot)0, - - (FTDriver_setCharSizes) 0, - (FTDriver_setPixelSizes)0, - - (FTDriver_loadGlyph) Load_Glyph, - (FTDriver_getCharIndex) t2_get_char_index, - - (FTDriver_getKerning) Get_Kerning, - (FTDriver_attachFile) 0, - (FTDriver_getAdvances) 0 - }; - - -#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS - - - /*************************************************************************/ - /* */ - /* */ - /* getDriverClass */ - /* */ - /* */ - /* This function is used when compiling the TrueType driver as a */ - /* shared library (`.DLL' or `.so'). It will be used by the */ - /* high-level library of FreeType to retrieve the address of the */ - /* driver's generic interface. */ - /* */ - /* It shouldn't be implemented in a static build, as each driver must */ - /* have the same function as an exported entry point. */ - /* */ - /* */ - /* The address of the TrueType's driver generic interface. The */ - /* format-specific interface can then be retrieved through the method */ - /* interface->get_format_interface. */ - /* */ - FT_EXPORT_DEF( const FT_Driver_Class* ) getDriverClass( void ) - { - return &cff_driver_class; - } - - -#endif /* CONFIG_OPTION_DYNAMIC_DRIVERS */ - - -/* END */ diff --git a/src/cff/t2driver.h b/src/cff/t2driver.h deleted file mode 100644 index 7b3bc4d91..000000000 --- a/src/cff/t2driver.h +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2driver.h */ -/* */ -/* High-level OpenType driver interface (specification). */ -/* */ -/* Copyright 1996-2000 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef T2DRIVER_H -#define T2DRIVER_H - -#include - -#ifdef __cplusplus - extern "C" { -#endif - - - FT_CALLBACK_TABLE - const FT_Driver_Class cff_driver_class; - - -#ifdef __cplusplus - } -#endif - - -#endif /* T2DRIVER_H */ - - -/* END */ diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c index 723a9dcf4..8cdff6ccf 100644 --- a/src/cff/t2gload.c +++ b/src/cff/t2gload.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H diff --git a/src/cff/t2gload.h b/src/cff/t2gload.h index d9f23cd25..0450dda87 100644 --- a/src/cff/t2gload.h +++ b/src/cff/t2gload.h @@ -161,35 +161,35 @@ FT_BEGIN_HEADER } T2_Decoder; - FT_LOCAL void - T2_Init_Decoder( T2_Decoder* decoder, - TT_Face face, - T2_Size size, - T2_GlyphSlot slot ); + FT_LOCAL + void T2_Init_Decoder( T2_Decoder* decoder, + TT_Face face, + T2_Size size, + T2_GlyphSlot slot ); - FT_LOCAL void - T2_Prepare_Decoder( T2_Decoder* decoder, - FT_UInt glyph_index ); + FT_LOCAL + void T2_Prepare_Decoder( T2_Decoder* decoder, + FT_UInt glyph_index ); #if 0 /* unused until we support pure CFF fonts */ /* Compute the maximum advance width of a font through quick parsing */ - FT_LOCAL FT_Error - T2_Compute_Max_Advance( TT_Face face, - FT_Int* max_advance ); + FT_LOCAL + FT_Error T2_Compute_Max_Advance( TT_Face face, + FT_Int* max_advance ); #endif /* 0 */ - FT_LOCAL FT_Error - T2_Parse_CharStrings( T2_Decoder* decoder, - FT_Byte* charstring_base, - FT_Int charstring_len ); + FT_LOCAL + FT_Error T2_Parse_CharStrings( T2_Decoder* decoder, + FT_Byte* charstring_base, + FT_Int charstring_len ); - FT_LOCAL FT_Error - T2_Load_Glyph( T2_GlyphSlot glyph, - T2_Size size, - FT_Int glyph_index, - FT_Int load_flags ); + FT_LOCAL + FT_Error T2_Load_Glyph( T2_GlyphSlot glyph, + T2_Size size, + FT_Int glyph_index, + FT_Int load_flags ); FT_END_HEADER diff --git a/src/cff/t2load.c b/src/cff/t2load.c deleted file mode 100644 index 2a79ab691..000000000 --- a/src/cff/t2load.c +++ /dev/null @@ -1,762 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2load.c */ -/* */ -/* TrueType glyph data/program tables loader (body). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#include -#include -#include -#include - -#include -#include - - -#ifdef FT_FLAT_COMPILE - -#include "t2load.h" -#include "t2parse.h" - -#else - -#include -#include - -#endif - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_t2load - - - /* read a CFF offset from memory */ - static - FT_ULong t2_get_offset( FT_Byte* p, - FT_Byte off_size ) - { - FT_ULong result; - - - for ( result = 0; off_size > 0; off_size-- ) - { - result <<= 8; - result |= *p++; - } - - return result; - } - - - static - FT_Error t2_new_cff_index( CFF_Index* index, - FT_Stream stream, - FT_Bool load ) - { - FT_Error error; - FT_Memory memory = stream->memory; - FT_UShort count; - - - MEM_Set( index, 0, sizeof ( *index ) ); - - index->stream = stream; - if ( !READ_UShort( count ) && - count > 0 ) - { - FT_Byte* p; - FT_Byte offsize; - FT_ULong data_size; - FT_ULong* poff; - - - /* there is at least one element; read the offset size, */ - /* then access the offset table to compute the index's total size */ - if ( READ_Byte( offsize ) ) - goto Exit; - - index->stream = stream; - index->count = count; - index->off_size = offsize; - data_size = (FT_ULong)( count + 1 ) * offsize; - - if ( ALLOC_ARRAY( index->offsets, count + 1, FT_ULong ) || - ACCESS_Frame( data_size ) ) - goto Exit; - - poff = index->offsets; - p = (FT_Byte*)stream->cursor; - - for ( ; (FT_Short)count >= 0; count-- ) - { - poff[0] = t2_get_offset( p, offsize ); - poff++; - p += offsize; - } - - FORGET_Frame(); - - index->data_offset = FILE_Pos(); - data_size = poff[-1] - 1; - - if ( load ) - { - /* load the data */ - if ( EXTRACT_Frame( data_size, index->bytes ) ) - goto Exit; - } - else - { - /* skip the data */ - if ( FILE_Skip( data_size ) ) - goto Exit; - } - } - - Exit: - if ( error ) - FREE( index->offsets ); - - return error; - } - - - static - void t2_done_cff_index( CFF_Index* index ) - { - if ( index->stream ) - { - FT_Stream stream = index->stream; - FT_Memory memory = stream->memory; - - - if ( index->bytes ) - RELEASE_Frame( index->bytes ); - - FREE( index->offsets ); - MEM_Set( index, 0, sizeof ( *index ) ); - } - } - - - static - FT_Error t2_explicit_cff_index( CFF_Index* index, - FT_Byte*** table ) - { - FT_Error error = 0; - FT_Memory memory = index->stream->memory; - FT_UInt n, offset, old_offset; - FT_Byte** t; - - - *table = 0; - - if ( index->count > 0 && !ALLOC_ARRAY( t, index->count + 1, FT_Byte* ) ) - { - old_offset = 1; - for ( n = 0; n <= index->count; n++ ) - { - offset = index->offsets[n]; - if ( !offset ) - offset = old_offset; - - t[n] = index->bytes + offset - 1; - - old_offset = offset; - } - *table = t; - } - - return error; - } - - - FT_LOCAL_DEF - FT_Error T2_Access_Element( CFF_Index* index, - FT_UInt element, - FT_Byte** pbytes, - FT_ULong* pbyte_len ) - { - FT_Error error = 0; - - - if ( index && index->count > element ) - { - /* compute start and end offsets */ - FT_ULong off1, off2 = 0; - - - off1 = index->offsets[element]; - if ( off1 ) - { - do - { - element++; - off2 = index->offsets[element]; - - } while ( off2 == 0 && element < index->count ); - - if ( !off2 ) - off1 = 0; - } - - /* access element */ - if ( off1 ) - { - *pbyte_len = off2 - off1; - - if ( index->bytes ) - { - /* this index was completely loaded in memory, that's easy */ - *pbytes = index->bytes + off1 - 1; - } - else - { - /* this index is still on disk/file, access it through a frame */ - FT_Stream stream = index->stream; - - - if ( FILE_Seek( index->data_offset + off1 - 1 ) || - EXTRACT_Frame( off2 - off1, *pbytes ) ) - goto Exit; - } - } - else - { - /* empty index element */ - *pbytes = 0; - *pbyte_len = 0; - } - } - else - error = T2_Err_Invalid_Argument; - - Exit: - return error; - } - - - FT_LOCAL_DEF - void T2_Forget_Element( CFF_Index* index, - FT_Byte** pbytes ) - { - if ( index->bytes == 0 ) - { - FT_Stream stream = index->stream; - - - RELEASE_Frame( *pbytes ); - } - } - - - FT_LOCAL_DEF - FT_String* T2_Get_Name( CFF_Index* index, - FT_UInt element ) - { - FT_Memory memory = index->stream->memory; - FT_Byte* bytes; - FT_ULong byte_len; - FT_Error error; - FT_String* name = 0; - - - error = T2_Access_Element( index, element, &bytes, &byte_len ); - if ( error ) - goto Exit; - - if ( !ALLOC( name, byte_len + 1 ) ) - { - MEM_Copy( name, bytes, byte_len ); - name[byte_len] = 0; - } - T2_Forget_Element( index, &bytes ); - - Exit: - return name; - } - - - FT_LOCAL_DEF - FT_String* T2_Get_String( CFF_Index* index, - FT_UInt sid, - PSNames_Interface* interface ) - { - /* if it is not a standard string, return it */ - if ( sid > 390 ) - return T2_Get_Name( index, sid - 391 ); - - /* that's a standard string, fetch a copy from the PSName module */ - { - FT_String* name = 0; - const char* adobe_name = interface->adobe_std_strings( sid ); - FT_UInt len; - - - if ( adobe_name ) - { - FT_Memory memory = index->stream->memory; - FT_Error error; - - - len = (FT_UInt)strlen( adobe_name ); - if ( !ALLOC( name, len + 1 ) ) - { - MEM_Copy( name, adobe_name, len ); - name[len] = 0; - } - } - - return name; - } - } - - - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** FD Select table support ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - - - static - void CFF_Done_FD_Select( CFF_FD_Select* select, - FT_Stream stream ) - { - if ( select->data ) - RELEASE_Frame( select->data ); - - select->data_size = 0; - select->format = 0; - select->range_count = 0; - } - - - static - FT_Error CFF_Load_FD_Select( CFF_FD_Select* select, - FT_UInt num_glyphs, - FT_Stream stream, - FT_ULong offset ) - { - FT_Error error; - FT_Byte format; - FT_UInt num_ranges; - - - /* read format */ - if ( FILE_Seek( offset ) || READ_Byte( format ) ) - goto Exit; - - select->format = format; - select->cache_count = 0; /* clear cache */ - - switch ( format ) - { - case 0: /* format 0, that's simple */ - select->data_size = num_glyphs; - goto Load_Data; - - case 3: /* format 3, a tad more complex */ - if ( READ_UShort( num_ranges ) ) - goto Exit; - - select->data_size = num_ranges * 3 + 2; - - Load_Data: - if ( EXTRACT_Frame( select->data_size, select->data ) ) - goto Exit; - break; - - default: /* hmm... that's wrong */ - error = T2_Err_Invalid_File_Format; - } - - Exit: - return error; - } - - - FT_LOCAL_DEF - FT_Byte CFF_Get_FD( CFF_FD_Select* select, - FT_UInt glyph_index ) - { - FT_Byte fd = 0; - - - switch ( select->format ) - { - case 0: - fd = select->data[glyph_index]; - break; - - case 3: - /* first, compare to cache */ - if ( (FT_UInt)(glyph_index-select->cache_first) < select->cache_count ) - { - fd = select->cache_fd; - break; - } - - /* then, lookup the ranges array */ - { - FT_Byte* p = select->data; - FT_Byte* p_limit = p + select->data_size; - FT_Byte fd2; - FT_UInt first, limit; - - - first = NEXT_UShort( p ); - do - { - if ( glyph_index < first ) - break; - - fd2 = *p++; - limit = NEXT_UShort( p ); - - if ( glyph_index < limit ) - { - fd = fd2; - - /* update cache */ - select->cache_first = first; - select->cache_count = limit-first; - select->cache_fd = fd2; - break; - } - first = limit; - - } while ( p < p_limit ); - } - break; - - default: - ; - } - - return fd; - } - - - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** CFF font support ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - - - static - FT_Error CFF_Load_SubFont( CFF_SubFont* font, - CFF_Index* index, - FT_UInt font_index, - FT_Stream stream, - FT_ULong base_offset ) - { - FT_Error error; - T2_Parser parser; - FT_Byte* dict; - FT_ULong dict_len; - CFF_Font_Dict* top = &font->font_dict; - CFF_Private* priv = &font->private_dict; - - - T2_Parser_Init( &parser, T2CODE_TOPDICT, &font->font_dict ); - - /* set defaults */ - MEM_Set( top, 0, sizeof ( *top ) ); - - top->underline_position = -100; - top->underline_thickness = 50; - top->charstring_type = 2; - top->font_matrix.xx = 0x10000L; - top->font_matrix.yy = 0x10000L; - top->cid_count = 8720; - - error = T2_Access_Element( index, font_index, &dict, &dict_len ) || - T2_Parser_Run( &parser, dict, dict + dict_len ); - - T2_Forget_Element( index, &dict ); - - if ( error ) - goto Exit; - - /* if it is a CID font, we stop there */ - if ( top->cid_registry ) - goto Exit; - - /* parse the private dictionary, if any */ - if ( top->private_offset && top->private_size ) - { - /* set defaults */ - MEM_Set( priv, 0, sizeof ( *priv ) ); - - priv->blue_shift = 7; - priv->blue_fuzz = 1; - priv->lenIV = -1; - priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L; - priv->blue_scale = (FT_Fixed)0.039625 * 0x10000L; - - T2_Parser_Init( &parser, T2CODE_PRIVATE, priv ); - - if ( FILE_Seek( base_offset + font->font_dict.private_offset ) || - ACCESS_Frame( font->font_dict.private_size ) ) - goto Exit; - - error = T2_Parser_Run( &parser, - (FT_Byte*)stream->cursor, - (FT_Byte*)stream->limit ); - FORGET_Frame(); - if ( error ) - goto Exit; - } - - /* read the local subrs, if any */ - if ( priv->local_subrs_offset ) - { - if ( FILE_Seek( base_offset + top->private_offset + - priv->local_subrs_offset ) ) - goto Exit; - - error = t2_new_cff_index( &font->local_subrs_index, stream, 1 ); - if ( error ) - goto Exit; - - font->num_local_subrs = font->local_subrs_index.count; - error = t2_explicit_cff_index( &font->local_subrs_index, - &font->local_subrs ); - } - - Exit: - return error; - } - - - static - void CFF_Done_SubFont( FT_Memory memory, - CFF_SubFont* subfont ) - { - if ( subfont ) - { - t2_done_cff_index( &subfont->local_subrs_index ); - FREE( subfont->local_subrs ); - } - } - - - FT_LOCAL_DEF - FT_Error T2_Load_CFF_Font( FT_Stream stream, - FT_Int face_index, - CFF_Font* font ) - { - static const FT_Frame_Field cff_header_fields[] = - { -#undef FT_STRUCTURE -#define FT_STRUCTURE CFF_Font - - FT_FRAME_START( 4 ), - FT_FRAME_BYTE( version_major ), - FT_FRAME_BYTE( version_minor ), - FT_FRAME_BYTE( header_size ), - FT_FRAME_BYTE( absolute_offsize ), - FT_FRAME_END - }; - - FT_Error error; - FT_Memory memory = stream->memory; - FT_ULong base_offset; - CFF_Font_Dict* dict; - - - MEM_Set( font, 0, sizeof ( *font ) ); - font->stream = stream; - font->memory = memory; - dict = &font->top_font.font_dict; - base_offset = FILE_Pos(); - - /* read CFF font header */ - if ( READ_Fields( cff_header_fields, font ) ) - goto Exit; - - /* check format */ - if ( font->version_major != 1 || - font->header_size < 4 || - font->absolute_offsize > 4 ) - { - FT_TRACE2(( "[not a CFF font header!]\n" )); - error = FT_Err_Unknown_File_Format; - goto Exit; - } - - /* skip the rest of the header */ - if ( FILE_Skip( font->header_size - 4 ) ) - goto Exit; - - /* read the name, top dict, string and global subrs index */ - error = t2_new_cff_index( &font->name_index, stream, 0 ) || - t2_new_cff_index( &font->font_dict_index, stream, 0 ) || - t2_new_cff_index( &font->string_index, stream, 0 ) || - t2_new_cff_index( &font->global_subrs_index, stream, 1 ); - if ( error ) - goto Exit; - - /* well, we don't really forget the `disabled' fonts... */ - font->num_faces = font->name_index.count; - if ( face_index >= (FT_Int)font->num_faces ) - { - FT_ERROR(( "T2_Load_CFF_Font: incorrect face index = %d\n", - face_index )); - error = T2_Err_Invalid_Argument; - } - - /* in case of a font format check, simply exit now */ - if ( face_index < 0 ) - goto Exit; - - /* now, parse the top-level font dictionary */ - error = CFF_Load_SubFont( &font->top_font, - &font->font_dict_index, - face_index, - stream, - base_offset ); - if ( error ) - goto Exit; - - /* now, check for a CID font */ - if ( dict->cid_registry ) - { - CFF_Index fd_index; - CFF_SubFont* sub; - FT_UInt index; - - - /* this is a CID-keyed font, we must now allocate a table of */ - /* sub-fonts, then load each of them separately */ - if ( FILE_Seek( base_offset + dict->cid_fd_array_offset ) ) - goto Exit; - - error = t2_new_cff_index( &fd_index, stream, 0 ); - if ( error ) - goto Exit; - - if ( fd_index.count > CFF_MAX_CID_FONTS ) - { - FT_ERROR(( "T2_Load_CFF_Font: FD array too large in CID font\n" )); - goto Fail_CID; - } - - /* allocate & read each font dict independently */ - font->num_subfonts = fd_index.count; - if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFont ) ) - goto Fail_CID; - - /* setup pointer table */ - for ( index = 0; index < fd_index.count; index++ ) - font->subfonts[index] = sub + index; - - /* now load each sub font independently */ - for ( index = 0; index < fd_index.count; index++ ) - { - sub = font->subfonts[index]; - error = CFF_Load_SubFont( sub, &fd_index, index, - stream, base_offset ); - if ( error ) - goto Fail_CID; - } - - /* now load the FD Select array */ - error = CFF_Load_FD_Select( &font->fd_select, - dict->cid_count, - stream, - base_offset + dict->cid_fd_select_offset ); - - Fail_CID: - t2_done_cff_index( &fd_index ); - - if ( error ) - goto Exit; - } - else - font->num_subfonts = 0; - - /* read the charstrings index now */ - if ( dict->charstrings_offset == 0 ) - { - FT_ERROR(( "T2_Load_CFF_Font: no charstrings offset!\n" )); - error = FT_Err_Unknown_File_Format; - goto Exit; - } - - if ( FILE_Seek( base_offset + dict->charstrings_offset ) ) - goto Exit; - - error = t2_new_cff_index( &font->charstrings_index, stream, 0 ); - if ( error ) - goto Exit; - - /* explicit the global subrs */ - font->num_global_subrs = font->global_subrs_index.count; - font->num_glyphs = font->charstrings_index.count; - - error = t2_explicit_cff_index( &font->global_subrs_index, - &font->global_subrs ) ; - - if ( error ) - goto Exit; - - /* get the font name */ - font->font_name = T2_Get_Name( &font->name_index, face_index ); - - Exit: - return error; - } - - - FT_LOCAL_DEF - void T2_Done_CFF_Font( CFF_Font* font ) - { - FT_Memory memory = font->memory; - FT_UInt index; - - - t2_done_cff_index( &font->global_subrs_index ); - t2_done_cff_index( &font->string_index ); - t2_done_cff_index( &font->font_dict_index ); - t2_done_cff_index( &font->name_index ); - t2_done_cff_index( &font->charstrings_index ); - - /* release font dictionaries */ - for ( index = 0; index < font->num_subfonts; index++ ) - CFF_Done_SubFont( memory, font->subfonts[index] ); - - CFF_Done_SubFont( memory, &font->top_font ); - - CFF_Done_FD_Select( &font->fd_select, font->stream ); - - FREE( font->global_subrs ); - FREE( font->font_name ); - } - - -/* END */ diff --git a/src/cff/t2load.h b/src/cff/t2load.h deleted file mode 100644 index f75fa3236..000000000 --- a/src/cff/t2load.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2load.h */ -/* */ -/* OpenType glyph data/program tables loader (specification). */ -/* */ -/* Copyright 1996-2000 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef T2LOAD_H -#define T2LOAD_H - -#include -#include - -#ifdef __cplusplus - extern "C" { -#endif - - FT_LOCAL - FT_String* T2_Get_Name( CFF_Index* index, - FT_UInt element ); - - FT_LOCAL - FT_String* T2_Get_String( CFF_Index* index, - FT_UInt sid, - PSNames_Interface* interface ); - - FT_LOCAL - FT_Error T2_Access_Element( CFF_Index* index, - FT_UInt element, - FT_Byte** pbytes, - FT_ULong* pbyte_len ); - - FT_LOCAL - void T2_Forget_Element( CFF_Index* index, - FT_Byte** pbytes ); - - FT_LOCAL - FT_Error T2_Load_CFF_Font( FT_Stream stream, - FT_Int face_index, - CFF_Font* font ); - - FT_LOCAL - void T2_Done_CFF_Font( CFF_Font* font ); - - FT_LOCAL - FT_Byte CFF_Get_FD( CFF_FD_Select* select, - FT_UInt glyph_index ); - - -#ifdef __cplusplus - } -#endif - - -#endif /* T2LOAD_H */ - - -/* END */ diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c deleted file mode 100644 index cc6af95b3..000000000 --- a/src/cff/t2objs.c +++ /dev/null @@ -1,604 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2objs.c */ -/* */ -/* OpenType objects manager (body). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#include -#include -#include -#include -#include -#include - -#include -#include - - -#ifdef FT_FLAT_COMPILE - -#include "t2objs.h" -#include "t2load.h" - -#else - -#include -#include - -#endif - - -#include - -#include /* for strlen() */ - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_t2objs - - - /*************************************************************************/ - /* */ - /* FACE FUNCTIONS */ - /* */ - /*************************************************************************/ - - static - FT_String* T2_StrCopy( FT_Memory memory, - const FT_String* source ) - { - FT_Error error; - FT_String* result = 0; - FT_Int len = (FT_Int)strlen( source ); - - - if ( !ALLOC( result, len + 1 ) ) - { - MEM_Copy( result, source, len ); - result[len] = 0; - } - return result; - } - - -#if 0 - - /* this function is used to build a Unicode charmap from the glyph names */ - /* in a file */ - static - FT_Error CFF_Build_Unicode_Charmap( T2_Face face, - FT_ULong base_offset, - PSNames_Interface* psnames ) - { - CFF_Font* font = (CFF_Font*)face->extra.data; - FT_Memory memory = FT_FACE_MEMORY(face); - FT_UInt n, num_glyphs = face->root.num_glyphs; - const char** glyph_names; - FT_Error error; - CFF_Font_Dict* dict = &font->top_font.font_dict; - FT_ULong charset_offset; - FT_Byte format; - FT_Stream stream = face->root.stream; - - - charset_offset = dict->charset_offset; - if ( !charset_offset ) - { - FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" )); - error = T2_Err_Invalid_File_Format; - goto Exit; - } - - /* allocate the charmap */ - if ( ALLOC( face->charmap, ... - - /* seek to charset table and allocate glyph names table */ - if ( FILE_Seek( base_offset + charset_offset ) || - ALLOC_ARRAY( glyph_names, num_glyphs, const char* ) ) - goto Exit; - - /* now, read each glyph name and store it in the glyph name table */ - if ( READ_Byte( format ) ) - goto Fail; - - switch ( format ) - { - case 0: /* format 0 - one SID per glyph */ - { - const char** gname = glyph_names; - const char** limit = gname + num_glyphs; - - if ( ACCESS_Frame( num_glyphs*2 ) ) - goto Fail; - - for ( ; gname < limit; gname++ ) - gname[0] = T2_Get_String( &font->string_index, - GET_UShort(), - psnames ); - FORGET_Frame(); - break; - } - - case 1: /* format 1 - sequential ranges */ - case 2: /* format 2 - sequential ranges with 16-bit counts */ - { - const char** gname = glyph_names; - const char** limit = gname + num_glyphs; - FT_UInt len = 3; - - if (format == 2) - len++; - - while (gname < limit) - { - FT_UInt first; - FT_UInt count; - - if ( ACCESS_Frame( len ) ) - goto Fail; - - first = GET_UShort(); - if (format == 3) - count = GET_UShort(); - else - count = GET_Byte(); - - FORGET_Frame(); - - for ( ; count > 0; count-- ) - { - gname[0] = T2_Get_String( &font->string_index, - first, - psnames ); - gname++; - first++; - } - } - break; - } - - default: /* unknown charset format! */ - FT_ERROR(( "CFF: unknown charset format!\n" )); - error = T2_Err_Invalid_File_Format; - goto Fail; - } - - /* all right, the glyph names were loaded, we now need to create */ - /* the corresponding unicode charmap.. */ - - Fail: - for ( n = 0; n < num_glyphs; n++ ) - FREE( glyph_names[n] ); - - FREE( glyph_names ); - - Exit: - return error; - } - -#endif /* 0 */ - - - static - FT_Encoding find_encoding( int platform_id, - int encoding_id ) - { - typedef struct TEncoding - { - int platform_id; - int encoding_id; - FT_Encoding encoding; - - } TEncoding; - - static - const TEncoding tt_encodings[] = - { - { TT_PLATFORM_ISO, -1, ft_encoding_unicode }, - - { TT_PLATFORM_APPLE_UNICODE, -1, ft_encoding_unicode }, - - { TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, ft_encoding_apple_roman }, - - { TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, ft_encoding_unicode }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, ft_encoding_sjis }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, ft_encoding_gb2312 }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, ft_encoding_big5 }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, ft_encoding_wansung }, - { TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, ft_encoding_johab } - }; - - const TEncoding *cur, *limit; - - - cur = tt_encodings; - limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] ); - - for ( ; cur < limit; cur++ ) - { - if ( cur->platform_id == platform_id ) - { - if ( cur->encoding_id == encoding_id || - cur->encoding_id == -1 ) - return cur->encoding; - } - } - - return ft_encoding_none; - } - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Init_Face */ - /* */ - /* */ - /* Initializes a given OpenType face object. */ - /* */ - /* */ - /* stream :: The source font stream. */ - /* */ - /* face_index :: The index of the font face in the resource. */ - /* */ - /* num_params :: Number of additional generic parameters. Ignored. */ - /* */ - /* params :: Additional generic parameters. Ignored. */ - /* */ - /* */ - /* face :: The newly built face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL - FT_Error T2_Init_Face( FT_Stream stream, - T2_Face face, - FT_Int face_index, - FT_Int num_params, - FT_Parameter* params ) - { - FT_Error error; - SFNT_Interface* sfnt; - PSNames_Interface* psnames; - FT_Bool pure_cff = 1; - FT_Bool sfnt_format = 0; - - - sfnt = (SFNT_Interface*)FT_Get_Module_Interface( - face->root.driver->root.library, "sfnt" ); - if ( !sfnt ) - goto Bad_Format; - - psnames = (PSNames_Interface*)FT_Get_Module_Interface( - face->root.driver->root.library, "psnames" ); - - /* create input stream from resource */ - if ( FILE_Seek( 0 ) ) - goto Exit; - - /* check that we have a valid OpenType file */ - error = sfnt->init_face( stream, face, face_index, num_params, params ); - if ( !error ) - { - if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */ - { - FT_TRACE2(( "[not a valid OpenType/CFF font]\n" )); - goto Bad_Format; - } - - /* If we are performing a simple font format check, exit immediately */ - if ( face_index < 0 ) - return T2_Err_Ok; - - sfnt_format = 1; - - /* now, the font can be either an OpenType/CFF font, or a SVG CEF */ - /* font in the later case; it doesn't have a `head' table */ - error = face->goto_table( face, TTAG_head, stream, 0 ); - if ( !error ) - { - pure_cff = 0; - - /* Load font directory */ - error = sfnt->load_face( stream, face, - face_index, num_params, params ); - if ( error ) - goto Exit; - } - else - { - /* load the `cmap' table by hand */ - error = sfnt->load_charmaps( face, stream ); - if ( error ) - goto Exit; - - /* XXX: for now, we don't load the GPOS table, as OpenType Layout */ - /* support will be added later to FreeType 2 as a separate module */ - } - - /* now, load the CFF part of the file */ - error = face->goto_table( face, TTAG_CFF, stream, 0 ); - if ( error ) - goto Exit; - } - else - { - /* rewind to start of file; we are going to load a pure-CFF font */ - if ( FILE_Seek( 0 ) ) - goto Exit; - error = FT_Err_Ok; - } - - /* now load and parse the CFF table in the file */ - { - CFF_Font* cff; - FT_Memory memory = face->root.memory; - FT_Face root; - FT_UInt flags; - FT_ULong base_offset; - - - if ( ALLOC( cff, sizeof ( *cff ) ) ) - goto Exit; - - base_offset = FILE_Pos(); - - face->extra.data = cff; - error = T2_Load_CFF_Font( stream, face_index, cff ); - if ( error ) - goto Exit; - - /* Complement the root flags with some interesting information. */ - /* Note that this is only necessary for pure CFF and CEF fonts */ - - root = &face->root; - if ( pure_cff ) - { - CFF_Font_Dict* dict = &cff->top_font.font_dict; - - - /* we need the `PSNames' module for pure-CFF and CEF formats */ - if ( !psnames ) - { - FT_ERROR(( "T2_Init_Face:" )); - FT_ERROR(( " cannot open CFF & CEF fonts\n" )); - FT_ERROR(( " " )); - FT_ERROR(( " without the `PSNames' module\n" )); - goto Bad_Format; - } - - /* Set up num_faces. */ - root->num_faces = cff->num_faces; - - /* compute number of glyphs */ - if ( dict->cid_registry ) - root->num_glyphs = dict->cid_count; - else - root->num_glyphs = cff->charstrings_index.count; - - /* set global bbox, as well as EM size */ - root->units_per_EM = 1000; - root->bbox = dict->font_bbox; - root->ascender = (FT_Short)root->bbox.yMax; - root->descender = (FT_Short)root->bbox.yMin; - root->height = ( ( root->ascender - root->descender ) * 12 ) / 10; - - /* retrieve font family & style name */ - root->family_name = T2_Get_Name( &cff->name_index, face_index ); - if ( dict->cid_registry ) - { - root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */ - } - else - { - root->style_name = T2_Get_String( &cff->string_index, - dict->weight, - psnames ); - } - - /*******************************************************************/ - /* */ - /* Compute face flags. */ - /* */ - flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */ - FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ - - if ( sfnt_format ) - flags |= FT_FACE_FLAG_SFNT; - - /* fixed width font? */ - if ( dict->is_fixed_pitch ) - flags |= FT_FACE_FLAG_FIXED_WIDTH; - -/* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ -#if 0 - /* kerning available? */ - if ( face->kern_pairs ) - flags |= FT_FACE_FLAG_KERNING; -#endif - - root->face_flags = flags; - - /*******************************************************************/ - /* */ - /* Compute style flags. */ - /* */ - flags = 0; - - if ( dict->italic_angle ) - flags |= FT_STYLE_FLAG_ITALIC; - - /* XXX: may not be correct */ - if ( cff->top_font.private_dict.force_bold ) - flags |= FT_STYLE_FLAG_BOLD; - - root->style_flags = flags; - - /* set the charmaps if any */ - if ( sfnt_format ) - { - /*****************************************************************/ - /* */ - /* Polish the charmaps. */ - /* */ - /* Try to set the charmap encoding according to the platform & */ - /* encoding ID of each charmap. */ - /* */ - TT_CharMap charmap; - FT_Int n; - - - charmap = face->charmaps; - root->num_charmaps = face->num_charmaps; - - /* allocate table of pointers */ - if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) ) - goto Exit; - - for ( n = 0; n < root->num_charmaps; n++, charmap++ ) - { - FT_Int platform = charmap->cmap.platformID; - FT_Int encoding = charmap->cmap.platformEncodingID; - - - charmap->root.face = (FT_Face)face; - charmap->root.platform_id = platform; - charmap->root.encoding_id = encoding; - charmap->root.encoding = find_encoding( platform, encoding ); - - /* now, set root->charmap with a unicode charmap */ - /* wherever available */ - if ( !root->charmap && - charmap->root.encoding == ft_encoding_unicode ) - root->charmap = (FT_CharMap)charmap; - - root->charmaps[n] = (FT_CharMap)charmap; - } - } - } - } - - Exit: - return error; - - Bad_Format: - error = FT_Err_Unknown_File_Format; - goto Exit; - } - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Done_Face */ - /* */ - /* */ - /* Finalizes a given face object. */ - /* */ - /* */ - /* face :: A pointer to the face object to destroy. */ - /* */ - FT_LOCAL - void T2_Done_Face( T2_Face face ) - { - FT_Memory memory = face->root.memory; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; - - - if ( sfnt ) - sfnt->done_face( face ); - - { - CFF_Font* cff = (CFF_Font*)face->extra.data; - - - if ( cff ) - { - T2_Done_CFF_Font( cff ); - FREE( face->extra.data ); - } - } - } - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Init_Driver */ - /* */ - /* */ - /* Initializes a given OpenType driver object. */ - /* */ - /* */ - /* driver :: A handle to the target driver object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF - FT_Error T2_Init_Driver( T2_Driver driver ) - { - /* init extension registry if needed */ - -#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE - - return TT_Init_Extensions( driver ); - -#else - - FT_UNUSED( driver ); - - return T2_Err_Ok; - -#endif - } - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Done_Driver */ - /* */ - /* */ - /* Finalizes a given OpenType driver. */ - /* */ - /* */ - /* driver :: A handle to the target OpenType driver. */ - /* */ - FT_LOCAL_DEF - void T2_Done_Driver( T2_Driver driver ) - { - /* destroy extensions registry if needed */ - -#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE - - TT_Done_Extensions( driver ); - -#else - - FT_UNUSED( driver ); - -#endif - } - - -/* END */ diff --git a/src/cff/t2objs.h b/src/cff/t2objs.h deleted file mode 100644 index c28cbe9d2..000000000 --- a/src/cff/t2objs.h +++ /dev/null @@ -1,148 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2objs.h */ -/* */ -/* OpenType objects manager (specification). */ -/* */ -/* Copyright 1996-2000 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef T2OBJS_H -#define T2OBJS_H - - -#include -#include -#include -#include - -#ifdef __cplusplus - extern "C" { -#endif - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Driver */ - /* */ - /* */ - /* A handle to an OpenType driver object. */ - /* */ - typedef struct T2_DriverRec_* T2_Driver; - - typedef TT_Face T2_Face; - - - /*************************************************************************/ - /* */ - /* */ - /* T2_Size */ - /* */ - /* */ - /* A handle to an OpenType size object. */ - /* */ - typedef FT_Size T2_Size; - - - /*************************************************************************/ - /* */ - /* */ - /* T2_GlyphSlot */ - /* */ - /* */ - /* A handle to an OpenType glyph slot object. */ - /* */ - typedef struct T2_GlyphSlotRec_ - { - FT_GlyphSlotRec root; - - FT_Bool hint; - FT_Bool scaled; - - FT_Fixed x_scale; - FT_Fixed y_scale; - - } T2_GlyphSlotRec, *T2_GlyphSlot; - - - - /*************************************************************************/ - /* */ - /* Subglyph transformation record. */ - /* */ - typedef struct T2_Transform_ - { - FT_Fixed xx, xy; /* transformation matrix coefficients */ - FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ - - } T2_Transform; - - - /* this is only used in the case of a pure CFF font with no charmap */ - typedef struct T2_CharMapRec_ - { - TT_CharMapRec root; - PS_Unicodes unicodes; - - } T2_CharMapRec, *T2_CharMap; - - - /***********************************************************************/ - /* */ - /* TrueType driver class. */ - /* */ - typedef struct T2_DriverRec_ - { - FT_DriverRec root; - - void* extension_component; - - } T2_DriverRec; - - - /*************************************************************************/ - /* */ - /* Face functions */ - /* */ - FT_LOCAL - FT_Error T2_Init_Face( FT_Stream stream, - T2_Face face, - FT_Int face_index, - FT_Int num_params, - FT_Parameter* params ); - - FT_LOCAL - void T2_Done_Face( T2_Face face ); - - - /*************************************************************************/ - /* */ - /* Driver functions */ - /* */ - FT_LOCAL - FT_Error T2_Init_Driver( T2_Driver driver ); - - FT_LOCAL - void T2_Done_Driver( T2_Driver driver ); - - -#ifdef __cplusplus - } -#endif - - -#endif /* T2OBJS_H */ - - -/* END */ diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c deleted file mode 100644 index 6d1d744b5..000000000 --- a/src/cff/t2parse.c +++ /dev/null @@ -1,655 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2parse.c */ -/* */ -/* OpenType parser (body). */ -/* */ -/* 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. */ -/* */ -/***************************************************************************/ - - -#ifdef FT_FLAT_COMPILE - -#include "t2parse.h" - -#else - -#include - -#endif - - -#include -#include - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_t2parse - - -#define T2_Err_Stack_Underflow FT_Err_Invalid_Argument -#define T2_Err_Syntax_Error FT_Err_Invalid_Argument - - - enum - { - t2_kind_none = 0, - t2_kind_num, - t2_kind_fixed, - t2_kind_string, - t2_kind_bool, - t2_kind_delta, - t2_kind_callback, - - t2_kind_max /* do not remove */ - }; - - - /* now generate handlers for the most simple fields */ - typedef FT_Error (*T2_Field_Reader)( T2_Parser* parser ); - - typedef struct T2_Field_Handler_ - { - int kind; - int code; - FT_UInt offset; - FT_Byte size; - T2_Field_Reader reader; - FT_UInt array_max; - FT_UInt count_offset; - - } T2_Field_Handler; - - - FT_LOCAL_DEF - void T2_Parser_Init( T2_Parser* parser, - FT_UInt code, - void* object ) - { - MEM_Set( parser, 0, sizeof ( *parser ) ); - - parser->top = parser->stack; - parser->object_code = code; - parser->object = object; - } - - - /* reads an integer */ - static - FT_Long parse_t2_integer( FT_Byte* start, - FT_Byte* limit ) - { - FT_Byte* p = start; - FT_Int v = *p++; - FT_Long val = 0; - - - if ( v == 28 ) - { - if ( p + 2 > limit ) - goto Bad; - - val = (FT_Short)( ( (FT_Int)p[0] << 8 ) | p[1] ); - p += 2; - } - else if ( v == 29 ) - { - if ( p + 4 > limit ) - goto Bad; - - val = ( (FT_Long)p[0] << 24 ) | - ( (FT_Long)p[1] << 16 ) | - ( (FT_Long)p[2] << 8 ) | - p[3]; - p += 4; - } - else if ( v < 247 ) - { - val = v - 139; - } - else if ( v < 251 ) - { - if ( p + 1 > limit ) - goto Bad; - - val = ( v - 247 ) * 256 + p[0] + 108; - p++; - } - else - { - if ( p + 1 > limit ) - goto Bad; - - val = -( v - 251 ) * 256 - p[0] - 108; - p++; - } - - Exit: - return val; - - Bad: - val = 0; - goto Exit; - } - - - /* read a real */ - static - FT_Fixed parse_t2_real( FT_Byte* start, - FT_Byte* limit, - FT_Int power_ten ) - { - FT_Byte* p = start; - FT_Long num, divider, result, exp; - FT_Int sign = 0, exp_sign = 0; - FT_Byte nib; - FT_Byte phase; - - - result = 0; - num = 0; - divider = 1; - - /* first of all, read the integer part */ - phase = 4; - - for (;;) - { - - /* If we entered this iteration with phase == 4, we need to */ - /* read a new byte. This also skips past the intial 0x1E. */ - if ( phase ) - p++; - - /* Make sure we don't read past the end. */ - if ( p >= limit ) - goto Bad; - - /* Get the nibble. */ - nib = ( p[0] >> phase ) & 0xF; - phase = 4 - phase; - - if ( nib == 0xE ) - sign = 1; - else if ( nib > 9 ) - break; - else - result = result * 10 + nib; - } - - /* read decimal part, if any */ - if ( nib == 0xa ) - for (;;) - { - - /* If we entered this iteration with phase == 4, we need */ - /* to read a new byte. */ - if ( phase ) - p++; - - /* Make sure we don't read past the end. */ - if ( p >= limit ) - goto Bad; - - /* Get the nibble. */ - nib = ( p[0] >> phase ) & 0xF; - phase = 4 - phase; - if ( nib >= 10 ) - break; - - if (divider < 10000000L) - { - num = num * 10 + nib; - divider *= 10; - } - } - - /* read exponent, if any */ - if ( nib == 12 ) - { - exp_sign = 1; - nib = 11; - } - - if ( nib == 11 ) - { - exp = 0; - - for (;;) - { - /* If we entered this iteration with phase == 4, we need */ - /* to read a new byte. */ - if ( phase ) - p++; - - /* Make sure we don't read past the end. */ - if ( p >= limit ) - goto Bad; - - /* Get the nibble. */ - nib = ( p[0] >> phase ) & 0xF; - phase = 4 - phase; - if ( nib >= 10 ) - break; - - exp = exp * 10 + nib; - } - - if ( exp_sign ) - exp = -exp; - - power_ten += exp; - } - - /* raise to power of ten if needed */ - while ( power_ten > 0 ) - { - result = result * 10; - num = num * 10; - - power_ten--; - } - - while ( power_ten < 0 ) - { - result = result / 10; - divider = divider * 10; - - power_ten++; - } - - if ( num ) - result += FT_DivFix( num, divider ); - - if ( sign ) - result = -result; - - Exit: - return result; - - Bad: - result = 0; - goto Exit; - } - - - /* read a number, either integer or real */ - static - FT_Long t2_parse_num( FT_Byte** d ) - { - return ( **d == 30 ? ( parse_t2_real( d[0], d[1], 0 ) >> 16 ) - : parse_t2_integer( d[0], d[1] ) ); - } - - - /* reads a floating point number, either integer or real */ - static - FT_Fixed t2_parse_fixed( FT_Byte** d ) - { - return ( **d == 30 ? parse_t2_real( d[0], d[1], 0 ) - : parse_t2_integer( d[0], d[1] ) << 16 ); - } - - - static - FT_Error parse_font_matrix( T2_Parser* parser ) - { - CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; - FT_Matrix* matrix = &dict->font_matrix; - FT_Byte** data = parser->stack; - FT_Error error; - - - error = T2_Err_Stack_Underflow; - - if ( parser->top >= parser->stack + 4 ) - { - matrix->xx = t2_parse_fixed( data++ ); - matrix->yx = t2_parse_fixed( data++ ); - matrix->xy = t2_parse_fixed( data++ ); - matrix->yy = t2_parse_fixed( data ); - error = T2_Err_Ok; - } - - return error; - } - - - static - FT_Error parse_font_bbox( T2_Parser* parser ) - { - CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; - FT_BBox* bbox = &dict->font_bbox; - FT_Byte** data = parser->stack; - FT_Error error; - - - error = T2_Err_Stack_Underflow; - - if ( parser->top >= parser->stack + 4 ) - { - bbox->xMin = t2_parse_num( data++ ); - bbox->yMin = t2_parse_num( data++ ); - bbox->xMax = t2_parse_num( data++ ); - bbox->yMax = t2_parse_num( data ); - error = T2_Err_Ok; - } - - return error; - } - - - static - FT_Error parse_private_dict( T2_Parser* parser ) - { - CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; - FT_Byte** data = parser->stack; - FT_Error error; - - - error = T2_Err_Stack_Underflow; - - if ( parser->top >= parser->stack + 2 ) - { - dict->private_size = t2_parse_num( data++ ); - dict->private_offset = t2_parse_num( data ); - error = T2_Err_Ok; - } - - return error; - } - - - static - FT_Error parse_cid_ros( T2_Parser* parser ) - { - CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; - FT_Byte** data = parser->stack; - FT_Error error; - - - error = T2_Err_Stack_Underflow; - - if ( parser->top >= parser->stack + 3 ) - { - dict->cid_registry = (FT_UInt)t2_parse_num( data++ ); - dict->cid_ordering = (FT_UInt)t2_parse_num( data++ ); - dict->cid_supplement = (FT_ULong)t2_parse_num( data ); - error = T2_Err_Ok; - } - - return error; - } - - -#define T2_FIELD_NUM( code, name ) \ - T2_FIELD( code, name, t2_kind_num ) -#define T2_FIELD_FIXED( code, name ) \ - T2_FIELD( code, name, t2_kind_fixed ) -#define T2_FIELD_STRING( code, name ) \ - T2_FIELD( code, name, t2_kind_string ) -#define T2_FIELD_BOOL( code, name ) \ - T2_FIELD( code, name, t2_kind_bool ) -#define T2_FIELD_DELTA( code, name, max ) \ - T2_FIELD( code, name, t2_kind_delta ) - -#define T2_FIELD_CALLBACK( code, name ) \ - { \ - t2_kind_callback, \ - code | T2CODE, \ - 0, 0, \ - parse_ ## name, \ - 0, 0 \ - }, - -#undef T2_FIELD -#define T2_FIELD( code, name, kind ) \ - { \ - kind, \ - code | T2CODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE( name ), \ - 0, 0, 0 \ - }, - -#undef T2_FIELD_DELTA -#define T2_FIELD_DELTA( code, name, max ) \ - { \ - t2_kind_delta, \ - code | T2CODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE_DELTA( name ), \ - 0, \ - max, \ - FT_FIELD_OFFSET( num_ ## name ) \ - }, - -#define T2CODE_TOPDICT 0x1000 -#define T2CODE_PRIVATE 0x2000 - - static const T2_Field_Handler t2_field_handlers[] = - { - -#ifdef FT_FLAT_COMPILE - -#include "t2tokens.h" - -#else - -#include - -#endif - - { 0, 0, 0, 0, 0, 0, 0 } - }; - - - FT_LOCAL_DEF - FT_Error T2_Parser_Run( T2_Parser* parser, - FT_Byte* start, - FT_Byte* limit ) - { - FT_Byte* p = start; - FT_Error error = T2_Err_Ok; - - - parser->top = parser->stack; - parser->start = start; - parser->limit = limit; - parser->cursor = start; - - while ( p < limit ) - { - FT_Byte v = *p; - - - if ( v >= 27 && v != 31 ) - { - /* it's a number; we will push its position on the stack */ - if ( parser->top - parser->stack >= T2_MAX_STACK_DEPTH ) - goto Stack_Overflow; - - *parser->top ++ = p; - - /* now, skip it */ - if ( v == 30 ) - { - /* skip real number */ - p++; - for (;;) - { - if ( p >= limit ) - goto Syntax_Error; - v = p[0] >> 4; - if ( v == 15 ) - break; - v = p[0] & 0xF; - if ( v == 15 ) - break; - p++; - } - } - else if ( v == 28 ) - p += 2; - else if ( v == 29 ) - p += 4; - else if ( v > 246 ) - p += 1; - } - else - { - /* This is not a number, hence it's an operator. Compute its code */ - /* and look for it in our current list. */ - - FT_UInt code; - FT_UInt num_args = (FT_UInt) - ( parser->top - parser->stack ); - const T2_Field_Handler* field; - - - /* first of all, a trivial check */ - if ( num_args < 1 ) - goto Stack_Underflow; - - *parser->top = p; - code = v; - if ( v == 12 ) - { - /* two byte operator */ - p++; - code = 0x100 | p[0]; - } - code = code | parser->object_code; - - for ( field = t2_field_handlers; field->kind; field++ ) - { - if ( field->code == (FT_Int)code ) - { - /* we found our field's handler; read it */ - FT_Long val; - FT_Byte* q = (FT_Byte*)parser->object + field->offset; - - switch ( field->kind ) - { - case t2_kind_bool: - case t2_kind_string: - case t2_kind_num: - val = t2_parse_num( parser->stack ); - goto Store_Number; - - case t2_kind_fixed: - val = t2_parse_fixed( parser->stack ); - - Store_Number: - switch ( field->size ) - { - case 1: - *(FT_Byte*)q = (FT_Byte)val; - break; - - case 2: - *(FT_Short*)q = (FT_Short)val; - break; - - case 4: - *(FT_Int32*)q = (FT_Int)val; - break; - - default: /* for 64-bit systems where long is 8 bytes */ - *(FT_Long*)q = val; - } - break; - - case t2_kind_delta: - { - FT_Byte* qcount = (FT_Byte*)parser->object + - field->count_offset; - - FT_Byte** data = parser->stack; - - - if ( num_args > field->array_max ) - num_args = field->array_max; - - /* store count */ - *qcount = (FT_Byte)num_args; - - val = 0; - while ( num_args > 0 ) - { - val += t2_parse_num( data++ ); - switch ( field->size ) - { - case 1: - *(FT_Byte*)q = (FT_Byte)val; - break; - - case 2: - *(FT_Short*)q = (FT_Short)val; - break; - - case 4: - *(FT_Int32*)q = (FT_Int)val; - break; - - default: /* for 64-bit systems */ - *(FT_Long*)q = val; - } - - q += field->size; - num_args--; - } - } - break; - - default: /* callback */ - error = field->reader( parser ); - if ( error ) - goto Exit; - } - goto Found; - } - } - - /* this is an unknown operator, or it is unsupported; */ - /* we will ignore it for now. */ - - Found: - /* clear stack */ - parser->top = parser->stack; - } - p++; - } - - Exit: - return error; - - Stack_Overflow: - error = T2_Err_Invalid_Argument; - goto Exit; - - Stack_Underflow: - error = T2_Err_Invalid_Argument; - goto Exit; - - Syntax_Error: - error = T2_Err_Invalid_Argument; - goto Exit; - } - - -/* END */ diff --git a/src/cff/t2parse.h b/src/cff/t2parse.h deleted file mode 100644 index 14fb1d57d..000000000 --- a/src/cff/t2parse.h +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2parse.h */ -/* */ -/* OpenType parser (specification). */ -/* */ -/* Copyright 1996-2000 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef T2PARSE_H -#define T2PARSE_H - -#include -#include - -#define T2_MAX_STACK_DEPTH 96 - -#define T2CODE_TOPDICT 0x1000 -#define T2CODE_PRIVATE 0x2000 - - -#ifdef __cplusplus - extern "C" { -#endif - - - typedef struct T2_Parser_ - { - FT_Byte* start; - FT_Byte* limit; - FT_Byte* cursor; - - FT_Byte* stack[T2_MAX_STACK_DEPTH + 1]; - FT_Byte** top; - - FT_UInt object_code; - void* object; - - } T2_Parser; - - - FT_LOCAL - void T2_Parser_Init( T2_Parser* parser, - FT_UInt code, - void* object ); - - FT_LOCAL - FT_Error T2_Parser_Run( T2_Parser* parser, - FT_Byte* start, - FT_Byte* limit ); - - -#ifdef __cplusplus - } -#endif - - -#endif /* T2PARSE_H */ - - -/* END */ diff --git a/src/cff/t2tokens.h b/src/cff/t2tokens.h deleted file mode 100644 index d69daa632..000000000 --- a/src/cff/t2tokens.h +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************/ -/* */ -/* t2tokens.h */ -/* */ -/* OpenType token 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. */ -/* */ -/***************************************************************************/ - - -#undef FT_STRUCTURE -#define FT_STRUCTURE CFF_Font_Dict -#undef T2CODE -#define T2CODE T2CODE_TOPDICT - - T2_FIELD_STRING ( 0, version ) - T2_FIELD_STRING ( 1, notice ) - T2_FIELD_STRING ( 0x100, copyright ) - T2_FIELD_STRING ( 2, full_name ) - T2_FIELD_STRING ( 3, family_name ) - T2_FIELD_STRING ( 4, weight ) - T2_FIELD_BOOL ( 0x101, is_fixed_pitch ) - T2_FIELD_FIXED ( 0x102, italic_angle ) - T2_FIELD_NUM ( 0x103, underline_position ) - T2_FIELD_NUM ( 0x104, underline_thickness ) - T2_FIELD_NUM ( 0x105, paint_type ) - T2_FIELD_NUM ( 0x106, charstring_type ) - T2_FIELD_CALLBACK( 0x107, font_matrix ) - T2_FIELD_NUM ( 13, unique_id ) - T2_FIELD_CALLBACK( 5, font_bbox ) - T2_FIELD_NUM ( 0x108, stroke_width ) - T2_FIELD_NUM ( 15, charset_offset ) - T2_FIELD_NUM ( 16, encoding_offset ) - T2_FIELD_NUM ( 17, charstrings_offset ) - T2_FIELD_CALLBACK( 18, private_dict ) - T2_FIELD_NUM ( 0x114, synthetic_base ) - T2_FIELD_STRING ( 0x115, postscript ) - T2_FIELD_STRING ( 0x116, base_font_name ) - -#if 0 - T2_FIELD_DELTA ( 0x117, base_font_blend, 16 ) - T2_FIELD_CALLBACK( 0x118, multiple_master ) - T2_FIELD_CALLBACK( 0x119, blend_axit_types ) -#endif - - T2_FIELD_CALLBACK( 0x11E, cid_ros ) - T2_FIELD_NUM ( 0x11F, cid_font_version ) - T2_FIELD_NUM ( 0x120, cid_font_revision ) - T2_FIELD_NUM ( 0x121, cid_font_type ) - T2_FIELD_NUM ( 0x122, cid_count ) - T2_FIELD_NUM ( 0x123, cid_uid_base ) - T2_FIELD_NUM ( 0x124, cid_fd_array_offset ) - T2_FIELD_NUM ( 0x125, cid_fd_select_offset ) - T2_FIELD_STRING ( 0x126, cid_font_name ) - -#if 0 - T2_FIELD_NUM ( 0x127, chameleon ) -#endif - - -#undef FT_STRUCTURE -#define FT_STRUCTURE CFF_Private -#undef T2CODE -#define T2CODE T2CODE_PRIVATE - - T2_FIELD_DELTA( 6, blue_values, 14 ) - T2_FIELD_DELTA( 7, other_blues, 10 ) - T2_FIELD_DELTA( 8, family_blues, 14 ) - T2_FIELD_DELTA( 9, family_other_blues, 10 ) - T2_FIELD_FIXED( 0x109, blue_scale ) - T2_FIELD_NUM ( 0x10A, blue_shift ) - T2_FIELD_NUM ( 0x10B, blue_fuzz ) - T2_FIELD_NUM ( 10, standard_width ) - T2_FIELD_NUM ( 11, standard_height ) - T2_FIELD_DELTA( 0x10C, snap_widths, 13 ) - T2_FIELD_DELTA( 0x10D, snap_heights, 13 ) - T2_FIELD_BOOL ( 0x10E, force_bold ) - T2_FIELD_FIXED( 0x10F, force_bold_threshold ) - T2_FIELD_NUM ( 0x110, lenIV ) - T2_FIELD_NUM ( 0x111, language_group ) - T2_FIELD_FIXED( 0x112, expansion_factor ) - T2_FIELD_NUM ( 0x113, initial_random_seed ) - T2_FIELD_NUM ( 19, local_subrs_offset ) - T2_FIELD_NUM ( 20, default_width ) - T2_FIELD_NUM ( 21, nominal_width ) - - -/* END */ diff --git a/src/cid/cidafm.c b/src/cid/cidafm.c index d28f4b237..6f4379fe6 100644 --- a/src/cid/cidafm.c +++ b/src/cid/cidafm.c @@ -15,14 +15,16 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(cid,cidafm.h) -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE1_ERRORS_H -#include /* for qsort() */ -#include /* for strcmp() */ -#include /* for isalnum() */ + +#include +#include FT_SOURCE_FILE(cid,cidafm.h) +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_TYPE1_TYPES_H +#include FT_INTERNAL_TYPE1_ERRORS_H + +#include /* for qsort() */ +#include /* for strcmp() */ +#include /* for isalnum() */ /*************************************************************************/ diff --git a/src/cid/cidafm.h b/src/cid/cidafm.h index b91039193..fd34fccc3 100644 --- a/src/cid/cidafm.h +++ b/src/cid/cidafm.h @@ -19,11 +19,13 @@ #ifndef CIDAFM_H #define CIDAFM_H -#include -#include FT_SOURCE_FILE(cid,cidobjs.h) +#include +#include FT_SOURCE_FILE(cid,cidobjs.h) + FT_BEGIN_HEADER + typedef struct CID_Kern_Pair_ { FT_UInt glyph1; @@ -41,19 +43,20 @@ FT_BEGIN_HEADER } CID_AFM; - FT_LOCAL FT_Error - CID_Read_AFM( FT_Face cid_face, - FT_Stream stream ); + FT_LOCAL + FT_Error CID_Read_AFM( FT_Face cid_face, + FT_Stream stream ); - FT_LOCAL void - CID_Done_AFM( FT_Memory memory, - CID_AFM* afm ); + FT_LOCAL + void CID_Done_AFM( FT_Memory memory, + CID_AFM* afm ); + + FT_LOCAL + void CID_Get_Kerning( CID_AFM* afm, + FT_UInt glyph1, + FT_UInt glyph2, + FT_Vector* kerning ); - FT_LOCAL void - CID_Get_Kerning( CID_AFM* afm, - FT_UInt glyph1, - FT_UInt glyph2, - FT_Vector* kerning ); FT_END_HEADER diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 62553a689..44ffa3b48 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -15,12 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(cid,cidload.h) -#include FT_SOURCE_FILE(cid,cidgload.h) -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_OUTLINE_H + +#include +#include FT_SOURCE_FILE(cid,cidload.h) +#include FT_SOURCE_FILE(cid,cidgload.h) +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_OUTLINE_H /*************************************************************************/ diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h index fee9c47e8..1483bc7ca 100644 --- a/src/cid/cidgload.h +++ b/src/cid/cidgload.h @@ -19,8 +19,10 @@ #ifndef CIDGLOAD_H #define CIDGLOAD_H -#include -#include FT_SOURCE_FILE(cid,cidobjs.h) + +#include +#include FT_SOURCE_FILE(cid,cidobjs.h) + FT_BEGIN_HEADER @@ -39,6 +41,7 @@ FT_BEGIN_HEADER FT_Int glyph_index, FT_Int load_flags ); + FT_END_HEADER #endif /* CIDGLOAD_H */ diff --git a/src/cid/cidload.c b/src/cid/cidload.c index e9acb216c..77abcee12 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -15,15 +15,17 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_DEBUG_H -#include FT_CONFIG_CONFIG_H -#include FT_MULTIPLE_MASTERS_H -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_TYPE1_ERRORS_H -#include FT_SOURCE_FILE(cid,cidload.h) -#include -#include /* for isspace(), isalnum() */ + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_CONFIG_CONFIG_H +#include FT_MULTIPLE_MASTERS_H +#include FT_INTERNAL_TYPE1_TYPES_H +#include FT_INTERNAL_TYPE1_ERRORS_H +#include FT_SOURCE_FILE(cid,cidload.h) + +#include +#include /* for isspace(), isalnum() */ /*************************************************************************/ diff --git a/src/cid/cidload.h b/src/cid/cidload.h index 52697fc77..a07c19033 100644 --- a/src/cid/cidload.h +++ b/src/cid/cidload.h @@ -19,12 +19,15 @@ #ifndef CIDLOAD_H #define CIDLOAD_H -#include -#include FT_INTERNAL_STREAM_H -#include FT_SOURCE_FILE(cid,cidparse.h) + +#include +#include FT_INTERNAL_STREAM_H +#include FT_SOURCE_FILE(cid,cidparse.h) + FT_BEGIN_HEADER + typedef struct CID_Loader_ { CID_Parser parser; /* parser used to read the stream */ @@ -45,6 +48,7 @@ FT_BEGIN_HEADER FT_LOCAL FT_Error CID_Open_Face( CID_Face face ); + FT_END_HEADER #endif /* CIDLOAD_H */ diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 62019af5f..7dceb0e7d 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -15,13 +15,14 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_SOURCE_FILE(cid,cidgload.h) -#include FT_SOURCE_FILE(cid,cidload.h) -#include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_SOURCE_FILE(cid,cidgload.h) +#include FT_SOURCE_FILE(cid,cidload.h) +#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H /*************************************************************************/ diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h index cd1f3429c..e68055d80 100644 --- a/src/cid/cidobjs.h +++ b/src/cid/cidobjs.h @@ -19,11 +19,13 @@ #ifndef CIDOBJS_H #define CIDOBJS_H -#include -#include FT_INTERNAL_OBJECTS_H -#include FT_CONFIG_CONFIG_H -#include FT_INTERNAL_TYPE1_ERRORS_H -#include FT_INTERNAL_TYPE1_TYPES_H + +#include +#include FT_INTERNAL_OBJECTS_H +#include FT_CONFIG_CONFIG_H +#include FT_INTERNAL_TYPE1_ERRORS_H +#include FT_INTERNAL_TYPE1_TYPES_H + FT_BEGIN_HEADER diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index 2c8749614..31aeb8705 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -15,14 +15,16 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_CALC_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_TYPE1_ERRORS_H -#include FT_SOURCE_FILE(cid,cidparse.h) -#include /* for strncmp() */ + +#include +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_TYPE1_ERRORS_H +#include FT_SOURCE_FILE(cid,cidparse.h) + +#include /* for strncmp() */ /*************************************************************************/ diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h index 9805634cb..2ec43efba 100644 --- a/src/cid/cidparse.h +++ b/src/cid/cidparse.h @@ -19,13 +19,16 @@ #ifndef CIDPARSE_H #define CIDPARSE_H -#include -#include FT_INTERNAL_TYPE1_TYPES_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_AUX_H + +#include +#include FT_INTERNAL_TYPE1_TYPES_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_POSTSCRIPT_AUX_H + FT_BEGIN_HEADER + /*************************************************************************/ /* */ /* */ @@ -68,14 +71,14 @@ FT_BEGIN_HEADER } CID_Parser; - FT_LOCAL FT_Error - CID_New_Parser( CID_Parser* parser, - FT_Stream stream, - FT_Memory memory, - PSAux_Interface* psaux ); + FT_LOCAL + FT_Error CID_New_Parser( CID_Parser* parser, + FT_Stream stream, + FT_Memory memory, + PSAux_Interface* psaux ); - FT_LOCAL void - CID_Done_Parser( CID_Parser* parser ); + FT_LOCAL + void CID_Done_Parser( CID_Parser* parser ); /*************************************************************************/ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 24640d1df..d916dab11 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -15,13 +15,15 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(cid,cidriver.h) -#include FT_SOURCE_FILE(cid,cidgload.h) -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include /* for strcmp() */ + +#include +#include FT_SOURCE_FILE(cid,cidriver.h) +#include FT_SOURCE_FILE(cid,cidgload.h) +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_POSTSCRIPT_NAMES_H + +#include /* for strcmp() */ /*************************************************************************/ diff --git a/src/cid/cidriver.h b/src/cid/cidriver.h index c80318c70..3e4263cd6 100644 --- a/src/cid/cidriver.h +++ b/src/cid/cidriver.h @@ -19,14 +19,18 @@ #ifndef CIDRIVER_H #define CIDRIVER_H -#include -#include FT_INTERNAL_DRIVER_H + +#include +#include FT_INTERNAL_DRIVER_H + FT_BEGIN_HEADER + FT_CALLBACK_TABLE const FT_Driver_Class t1cid_driver_class; + FT_END_HEADER #endif /* CIDRIVER_H */ diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index f2a91e523..d0a1728ed 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -18,11 +18,12 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include -#include FT_SOURCE_FILE(cid,cidparse.c) -#include FT_SOURCE_FILE(cid,cidload.c) -#include FT_SOURCE_FILE(cid,cidobjs.c) -#include FT_SOURCE_FILE(cid,cidriver.c) -#include FT_SOURCE_FILE(cid,cidgload.c) +#include +#include FT_SOURCE_FILE(cid,cidparse.c) +#include FT_SOURCE_FILE(cid,cidload.c) +#include FT_SOURCE_FILE(cid,cidobjs.c) +#include FT_SOURCE_FILE(cid,cidriver.c) +#include FT_SOURCE_FILE(cid,cidgload.c) + /* END */ diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c index c98be56fd..c0119a80c 100644 --- a/src/psaux/psaux.c +++ b/src/psaux/psaux.c @@ -18,9 +18,10 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include -#include FT_SOURCE_FILE(psaux,psobjs.c) -#include FT_SOURCE_FILE(psaux,psauxmod.c) -#include FT_SOURCE_FILE(psaux,t1decode.c) +#include +#include FT_SOURCE_FILE(psaux,psobjs.c) +#include FT_SOURCE_FILE(psaux,psauxmod.c) +#include FT_SOURCE_FILE(psaux,t1decode.c) + /* END */ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 722359af1..d8f436c14 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -15,10 +15,12 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(psaux,psauxmod.h) -#include FT_SOURCE_FILE(psaux,psobjs.h) -#include FT_SOURCE_FILE(psaux,t1decode.h) + +#include +#include FT_SOURCE_FILE(psaux,psauxmod.h) +#include FT_SOURCE_FILE(psaux,psobjs.h) +#include FT_SOURCE_FILE(psaux,t1decode.h) + FT_CALLBACK_TABLE_DEF const PS_Table_Funcs ps_table_funcs = diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h index f6c175251..3f23dc02d 100644 --- a/src/psaux/psauxmod.h +++ b/src/psaux/psauxmod.h @@ -19,13 +19,17 @@ #ifndef PSAUXMOD_H #define PSAUXMOD_H -#include -#include FT_MODULE_H + +#include +#include FT_MODULE_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; + FT_END_HEADER #endif /* PSAUXMOD_H */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index d5e9ac7ea..3f51e2b33 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -15,11 +15,12 @@ /* */ /***************************************************************************/ -#include -#include FT_INTERNAL_POSTSCRIPT_AUX_H -#include FT_INTERNAL_DEBUG_H -#include FT_ERRORS_H -#include FT_SOURCE_FILE(psaux,psobjs.h) + +#include +#include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_DEBUG_H +#include FT_ERRORS_H +#include FT_SOURCE_FILE(psaux,psobjs.h) /*************************************************************************/ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 10b550300..af586b4db 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -19,11 +19,14 @@ #ifndef PSOBJS_H #define PSOBJS_H -#include -#include FT_INTERNAL_POSTSCRIPT_AUX_H + +#include +#include FT_INTERNAL_POSTSCRIPT_AUX_H + FT_BEGIN_HEADER + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index e2497b12f..be53050d5 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_TYPE1_ERRORS_H @@ -22,6 +23,7 @@ #include FT_SOURCE_FILE(psaux,t1decode.h) #include FT_SOURCE_FILE(psaux,psobjs.h) + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 6d5c0ff60..b5f4c169b 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -19,13 +19,16 @@ #ifndef T1DECODE_H #define T1DECODE_H + #include #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_TYPE1_TYPES_H + FT_BEGIN_HEADER + FT_CALLBACK_TABLE const T1_Decoder_Funcs t1_decoder_funcs; diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 31d79d9a1..1de46c630 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -15,11 +15,13 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_POSTSCRIPT_NAMES_H #include FT_INTERNAL_OBJECTS_H #include FT_SOURCE_FILE(psnames,psmodule.h) #include FT_SOURCE_FILE(psnames,pstables.h) + #include /* for qsort() */ #include /* for strcmp(), strncpy() */ @@ -27,8 +29,6 @@ #ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES - - #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST diff --git a/src/psnames/psmodule.h b/src/psnames/psmodule.h index 3bfcf769e..12ec48de6 100644 --- a/src/psnames/psmodule.h +++ b/src/psnames/psmodule.h @@ -19,13 +19,17 @@ #ifndef PSDRIVER_H #define PSDRIVER_H + #include #include FT_MODULE_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Module_Class ) psnames_module_class; + FT_END_HEADER #endif /* PSDRIVER_H */ diff --git a/src/psnames/psnames.c b/src/psnames/psnames.c index 2cd9a793d..55824a069 100644 --- a/src/psnames/psnames.c +++ b/src/psnames/psnames.c @@ -18,8 +18,8 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT -#include -#include FT_SOURCE_FILE(psnames,psmodule.c) +#include +#include FT_SOURCE_FILE(psnames,psmodule.c) #endif diff --git a/src/raster/ftraster.h b/src/raster/ftraster.h index 36eaf55df..e48c708ce 100644 --- a/src/raster/ftraster.h +++ b/src/raster/ftraster.h @@ -19,12 +19,15 @@ #ifndef FTRASTER_H #define FTRASTER_H -#include -#include FT_CONFIG_CONFIG_H -#include FT_IMAGE_H + +#include +#include FT_CONFIG_CONFIG_H +#include FT_IMAGE_H + FT_BEGIN_HEADER + /*************************************************************************/ /* */ /* Uncomment the following line if you are using ftraster.c as a */ @@ -34,6 +37,7 @@ FT_BEGIN_HEADER FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster; + FT_END_HEADER #endif /* FTRASTER_H */ diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 5d68d9d86..81931f085 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -22,6 +22,7 @@ #include FT_SOURCE_FILE(raster,ftrend1.h) #include FT_SOURCE_FILE(raster,ftraster.h) + /* initialize renderer -- init its raster */ static FT_Error ft_raster1_init( FT_Renderer render ) diff --git a/src/raster/ftrend1.h b/src/raster/ftrend1.h index 20f0d211c..da4d0c51f 100644 --- a/src/raster/ftrend1.h +++ b/src/raster/ftrend1.h @@ -19,11 +19,14 @@ #ifndef FTREND1_H #define FTREND1_H + #include #include FT_RENDER_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster1_renderer_class; /* this renderer is _NOT_ part of the default modules, you'll need */ @@ -32,6 +35,7 @@ FT_BEGIN_HEADER /* */ FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class; + FT_END_HEADER #endif /* FTREND1_H */ diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index ec8c75d8a..203115de8 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_OBJECTS_H diff --git a/src/sfnt/sfdriver.h b/src/sfnt/sfdriver.h index 206df4772..f70b065f9 100644 --- a/src/sfnt/sfdriver.h +++ b/src/sfnt/sfdriver.h @@ -19,13 +19,17 @@ #ifndef SFDRIVER_H #define SFDRIVER_H -#include -#include FT_MODULE_H + +#include +#include FT_MODULE_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class; + FT_END_HEADER #endif /* SFDRIVER_H */ diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index a933338d9..d605ac83f 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -32,4 +32,5 @@ #include FT_SOURCE_FILE(sfnt,ttpost.c) #endif + /* END */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index cee509a15..e4284a4a6 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -15,14 +15,15 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(sfnt,sfobjs.h) -#include FT_SOURCE_FILE(sfnt,ttload.h) -#include FT_INTERNAL_SFNT_H -#include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include FT_TRUETYPE_NAMES_H -#include FT_TRUETYPE_TAGS_H -#include FT_INTERNAL_TRUETYPE_ERRORS_H + +#include +#include FT_SOURCE_FILE(sfnt,sfobjs.h) +#include FT_SOURCE_FILE(sfnt,ttload.h) +#include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_POSTSCRIPT_NAMES_H +#include FT_TRUETYPE_NAMES_H +#include FT_TRUETYPE_TAGS_H +#include FT_INTERNAL_TRUETYPE_ERRORS_H /*************************************************************************/ diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h index 7e32b1df5..f41504dde 100644 --- a/src/sfnt/sfobjs.h +++ b/src/sfnt/sfobjs.h @@ -19,10 +19,12 @@ #ifndef SFOBJS_H #define SFOBJS_H + #include #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_OBJECTS_H + FT_BEGIN_HEADER FT_LOCAL diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 6b02b0724..9698a80c9 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_TRUETYPE_ERRORS_H diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index aab2dcd35..6c8db11b2 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -19,11 +19,12 @@ #ifndef TTCMAP_H #define TTCMAP_H -#include -#ifdef __cplusplus - extern "C" { -#endif +#include +#include FT_INTERNAL_TRUETYPE_TYPES_H + + +FT_BEGIN_HEADER FT_LOCAL @@ -35,9 +36,8 @@ FT_Error TT_CharMap_Free( TT_Face face, TT_CMapTable* cmap ); -#ifdef __cplusplus - } -#endif + +FT_END_HEADER #endif /* TTCMAP_H */ diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index d2a19d676..572d65bc3 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -16,6 +16,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_TRUETYPE_ERRORS_H @@ -24,6 +25,7 @@ #include FT_SOURCE_FILE(sfnt,ttload.h) #include FT_SOURCE_FILE(sfnt,ttcmap.h) + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index de4d66f7b..16422831a 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -20,6 +20,7 @@ #ifndef TTLOAD_H #define TTLOAD_H + #include #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_TRUETYPE_TYPES_H @@ -27,6 +28,7 @@ FT_BEGIN_HEADER + FT_LOCAL TT_Table* TT_LookUp_Table( TT_Face face, FT_ULong tag ); diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index d9c529eb5..c2ee53eaa 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -24,6 +24,7 @@ /* */ /*************************************************************************/ + #include #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_TRUETYPE_ERRORS_H diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index fef0aa32c..7fca4b292 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -20,12 +20,15 @@ #ifndef TTPOST_H #define TTPOST_H + #include #include FT_CONFIG_CONFIG_H #include FT_INTERNAL_TRUETYPE_TYPES_H + FT_BEGIN_HEADER + #define TT_Err_Invalid_Post_Table_Format 0x0B00 #define TT_Err_Invalid_Post_Table 0x0B01 diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index b2063571c..2b637fc3d 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_TRUETYPE_ERRORS_H @@ -22,6 +23,7 @@ #include FT_TRUETYPE_TAGS_H #include FT_SOURCE_FILE(sfnt,ttsbit.h) + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index 6c00b0cb5..847532a58 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -19,9 +19,11 @@ #ifndef TTSBIT_H #define TTSBIT_H + #include #include FT_SOURCE_FILE(sfnt,ttload.h) + FT_BEGIN_HEADER diff --git a/src/smooth/ftgrays.h b/src/smooth/ftgrays.h index cfbd8bbd2..fd71c1015 100644 --- a/src/smooth/ftgrays.h +++ b/src/smooth/ftgrays.h @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #ifndef FTGRAYS_H #define FTGRAYS_H @@ -22,6 +23,7 @@ extern "C" { #endif + #ifdef _STANDALONE_ #include "ftimage.h" #else @@ -29,6 +31,7 @@ #include FT_IMAGE_H #endif + /*************************************************************************/ /* */ /* To make ftgrays.h independent from configuration files we check */ @@ -43,6 +46,7 @@ FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_grays_raster; + #ifdef __cplusplus } #endif diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 47f201b88..9e5682172 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -15,12 +15,14 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_OBJECTS_H #include FT_OUTLINE_H #include FT_SOURCE_FILE(smooth,ftsmooth.h) #include FT_SOURCE_FILE(smooth,ftgrays.h) + /* initialize renderer -- init its raster */ static FT_Error ft_smooth_init( FT_Renderer render ) diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h index 332e18e8f..dc35c8430 100644 --- a/src/smooth/ftsmooth.h +++ b/src/smooth/ftsmooth.h @@ -19,12 +19,14 @@ #ifndef FTSMOOTH_H #define FTSMOOTH_H + #include #include FT_RENDER_H FT_BEGIN_HEADER + #ifndef FT_CONFIG_OPTION_NO_STD_RASTER FT_EXPORT_VAR( const FT_Renderer_Class ) ft_std_renderer_class; #endif @@ -33,6 +35,7 @@ FT_BEGIN_HEADER FT_EXPORT_VAR( const FT_Renderer_Class ) ft_smooth_renderer_class; #endif + FT_END_HEADER #endif /* FTSMOOTH_H */ diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c index d9f186e15..aeeb254f0 100644 --- a/src/smooth/smooth.c +++ b/src/smooth/smooth.c @@ -22,4 +22,5 @@ #include FT_SOURCE_FILE(smooth,ftgrays.c) #include FT_SOURCE_FILE(smooth,ftsmooth.c) + /* END */ diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c index c6ca1fc59..a32c9b0e2 100644 --- a/src/truetype/truetype.c +++ b/src/truetype/truetype.c @@ -28,4 +28,5 @@ #include FT_SOURCE_FILE(truetype,ttinterp.c) #endif + /* END */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index bbdd67c07..44782325c 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h index 1c5f305d6..12d267db9 100644 --- a/src/truetype/ttdriver.h +++ b/src/truetype/ttdriver.h @@ -19,11 +19,14 @@ #ifndef TTDRIVER_H #define TTDRIVER_H + #include #include FT_INTERNAL_DRIVER_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Driver_Class ) tt_driver_class; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index ac610bb8a..8e560309c 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h index 0a47f2eb8..bbb304f42 100644 --- a/src/truetype/ttgload.h +++ b/src/truetype/ttgload.h @@ -19,6 +19,7 @@ #ifndef TTGLOAD_H #define TTGLOAD_H + #include #include FT_SOURCE_FILE(truetype,ttobjs.h) @@ -26,8 +27,10 @@ #include FT_SOURCE_FILE(truetype,ttinterp.h) #endif + FT_BEGIN_HEADER + FT_LOCAL void TT_Get_Metrics( TT_HoriHeader* header, FT_UInt index, @@ -43,6 +46,7 @@ FT_BEGIN_HEADER FT_UShort glyph_index, FT_UInt load_flags ); + FT_END_HEADER #endif /* TTGLOAD_H */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 685db5c23..22fe60366 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H @@ -26,10 +27,10 @@ #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER -#define TT_MULFIX FT_MulFix -#define TT_MULDIV FT_MulDiv +#define TT_MULFIX FT_MulFix +#define TT_MULDIV FT_MulDiv -#define TT_INT64 FT_Int64 +#define TT_INT64 FT_Int64 /*************************************************************************/ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index cd4d6983a..fd6a85812 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -19,24 +19,27 @@ #ifndef TTINTERP_H #define TTINTERP_H + #include #include FT_SOURCE_FILE(truetype,ttobjs.h) + FT_BEGIN_HEADER + #ifndef TT_CONFIG_OPTION_STATIC_INTEPRETER /* indirect implementation */ -# define EXEC_OP_ TT_ExecContext exc, -# define EXEC_OP TT_ExecContext exc -# define EXEC_ARG_ exc, -# define EXEC_ARG exc +#define EXEC_OP_ TT_ExecContext exc, +#define EXEC_OP TT_ExecContext exc +#define EXEC_ARG_ exc, +#define EXEC_ARG exc #else /* static implementation */ -# define EXEC_OP_ /* void */ -# define EXEC_OP /* void */ -# define EXEC_ARG_ /* void */ -# define EXEC_ARG /* void */ +#define EXEC_OP_ /* void */ +#define EXEC_OP /* void */ +#define EXEC_ARG_ /* void */ +#define EXEC_ARG /* void */ #endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */ diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 8801b2a34..d65524dc1 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index 08d4d5890..5c0b45947 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -19,11 +19,13 @@ #ifndef TTOBJS_H #define TTOBJS_H + #include #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TRUETYPE_TYPES_H #include FT_INTERNAL_TRUETYPE_ERRORS_H + FT_BEGIN_HEADER diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index e56e1af71..a14ad1f31 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h index 7ee4f8c9c..618794673 100644 --- a/src/truetype/ttpload.h +++ b/src/truetype/ttpload.h @@ -19,11 +19,14 @@ #ifndef TTPLOAD_H #define TTPLOAD_H + #include #include FT_INTERNAL_TRUETYPE_TYPES_H + FT_BEGIN_HEADER + FT_LOCAL FT_Error TT_Load_Locations( TT_Face face, FT_Stream stream ); @@ -36,6 +39,7 @@ FT_BEGIN_HEADER FT_Error TT_Load_Programs( TT_Face face, FT_Stream stream ); + FT_END_HEADER #endif /* TTPLOAD_H */ diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 7c4cc2d82..970bc644f 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -15,6 +15,7 @@ /* */ /***************************************************************************/ + #include #include FT_SOURCE_FILE(type1,t1afm.h) #include FT_INTERNAL_STREAM_H diff --git a/src/type1/t1afm.h b/src/type1/t1afm.h index a5cc08539..cc8adb9b7 100644 --- a/src/type1/t1afm.h +++ b/src/type1/t1afm.h @@ -22,8 +22,10 @@ #include #include FT_SOURCE_FILE(type1,t1objs.h) + FT_BEGIN_HEADER + typedef struct T1_Kern_Pair_ { FT_UInt glyph1; @@ -55,6 +57,7 @@ FT_BEGIN_HEADER FT_UInt glyph2, FT_Vector* kerning ); + FT_END_HEADER #endif /* T1AFM_H */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index dcda8e332..a00ab574c 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -15,13 +15,13 @@ /* */ /***************************************************************************/ -#include -#include FT_SOURCE_FILE(type1,t1driver.h) -#include FT_SOURCE_FILE(type1,t1gload.h) -#include FT_SOURCE_FILE(type1,t1load.h) +#include +#include FT_SOURCE_FILE(type1,t1driver.h) +#include FT_SOURCE_FILE(type1,t1gload.h) +#include FT_SOURCE_FILE(type1,t1load.h) #ifndef T1_CONFIG_OPTION_NO_AFM -#include FT_SOURCE_FILE(type1,t1afm.h) +#include FT_SOURCE_FILE(type1,t1afm.h) #endif #include FT_INTERNAL_DEBUG_H diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h index 8282d89e3..a03fc7b4f 100644 --- a/src/type1/t1driver.h +++ b/src/type1/t1driver.h @@ -19,13 +19,17 @@ #ifndef T1DRIVER_H #define T1DRIVER_H + #include #include FT_INTERNAL_DRIVER_H + FT_BEGIN_HEADER + FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class; + FT_END_HEADER #endif /* T1DRIVER_H */ diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index d21d7ccd2..3d0891d42 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -15,12 +15,14 @@ /* */ /***************************************************************************/ + #include #include FT_SOURCE_FILE(type1,t1gload.h) #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_OUTLINE_H #include FT_INTERNAL_POSTSCRIPT_AUX_H + #include /* for strcmp() */ diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h index cc47559cb..14c6a5892 100644 --- a/src/type1/t1gload.h +++ b/src/type1/t1gload.h @@ -19,11 +19,14 @@ #ifndef T1GLOAD_H #define T1GLOAD_H + #include #include FT_SOURCE_FILE(type1,t1objs.h) + FT_BEGIN_HEADER + FT_LOCAL FT_Error T1_Compute_Max_Advance( T1_Face face, FT_Int* max_advance ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 7606ef769..f7133d438 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -60,6 +60,7 @@ /* */ /*************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_CONFIG_CONFIG_H @@ -68,6 +69,7 @@ #include FT_INTERNAL_TYPE1_ERRORS_H #include FT_SOURCE_FILE(type1,t1load.h) + #include /* for strncmp(), strcmp() */ #include /* for isalnum() */ diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 6f1dcb86e..424f66c43 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -19,6 +19,7 @@ #ifndef T1LOAD_H #define T1LOAD_H + #include #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_AUX_H @@ -26,8 +27,10 @@ #include FT_SOURCE_FILE(type1,t1parse.h) + FT_BEGIN_HEADER + typedef struct T1_Loader_ { T1_ParserRec parser; /* parser used to read the stream */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 77ee296af..848e3e8a4 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -15,9 +15,11 @@ /* */ /***************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H + #include /* strcmp() */ #include FT_SOURCE_FILE(type1,t1gload.h) diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index 3bd1f8477..d3dc0c0ca 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -19,14 +19,17 @@ #ifndef T1OBJS_H #define T1OBJS_H + #include #include FT_INTERNAL_OBJECTS_H #include FT_CONFIG_CONFIG_H #include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_TYPE1_TYPES_H + FT_BEGIN_HEADER + /* The following structures must be defined by the hinter */ typedef struct T1_Size_Hints_ T1_Size_Hints; typedef struct T1_Glyph_Hints_ T1_Glyph_Hints; diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index b3d5c02b8..39d305c0b 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -32,6 +32,7 @@ /* */ /*************************************************************************/ + #include #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H @@ -39,6 +40,7 @@ #include FT_INTERNAL_TYPE1_ERRORS_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_SOURCE_FILE(type1,t1parse.h) + #include /* for strncmp() */ diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h index 2bb47e26e..012410773 100644 --- a/src/type1/t1parse.h +++ b/src/type1/t1parse.h @@ -19,12 +19,15 @@ #ifndef T1PARSE_H #define T1PARSE_H + #include #include FT_INTERNAL_TYPE1_TYPES_H #include FT_INTERNAL_STREAM_H + FT_BEGIN_HEADER + /*************************************************************************/ /* */ /* */ diff --git a/src/type1/type1.c b/src/type1/type1.c index abcf5abcc..03080f704 100644 --- a/src/type1/type1.c +++ b/src/type1/type1.c @@ -29,4 +29,5 @@ #include FT_SOURCE_FILE(type1,t1afm.c) #endif + /* END */