ref: cc069beb2d2b6b1cb9f9b9f2af2a7ea12780f634
parent: 19ed8afe60bbc5becf0fbbe3987a91b35a36aad4
author: Werner Lemberg <[email protected]>
date: Fri Dec 8 11:17:16 EST 2000
cleanups
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,31 @@
-2000-12-07 David Turnre <[email protected]>
+2000-12-07 David Turner <[email protected]>
- * 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 <[email protected]>
- * 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 <[email protected]>
--- 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 ) <d/x>
+#define FT_SOURCE_FILE( d, x ) <d/x>
#endif
--- a/include/freetype/internal/t2types.h
+++ b/include/freetype/internal/t2types.h
@@ -61,28 +61,28 @@
} 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;
--- a/src/autohint/ahglobal.h
+++ b/src/autohint/ahglobal.h
@@ -35,8 +35,8 @@
/* 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
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -19,11 +19,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_SOURCE_FILE(autohint,ahglyph.h)
-#include FT_SOURCE_FILE(autohint,ahangles.h)
-#include FT_SOURCE_FILE(autohint,ahglobal.h)
-#include <stdio.h>
+
+#include <ft2build.h>
+#include FT_SOURCE_FILE(autohint,ahglyph.h)
+#include FT_SOURCE_FILE(autohint,ahangles.h)
+#include FT_SOURCE_FILE(autohint,ahglobal.h)
+
+#include <stdio.h>
#define xxxAH_DEBUG_GLYPH
--- a/src/autohint/ahglyph.h
+++ b/src/autohint/ahglyph.h
@@ -23,11 +23,14 @@
#ifndef AHGLYPH_H
#define AHGLYPH_H
-#include <ft2build.h>
-#include FT_SOURCE_FILE(autohint,ahtypes.h)
+#include <ft2build.h>
+#include FT_SOURCE_FILE(autohint,ahtypes.h)
+
+
FT_BEGIN_HEADER
+
typedef enum AH_UV_
{
ah_uv_fxy,
@@ -79,6 +82,7 @@
FT_LOCAL
void ah_outline_done( AH_Outline* outline );
+
FT_END_HEADER
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -18,11 +18,12 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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)
--- a/src/autohint/ahhint.h
+++ b/src/autohint/ahhint.h
@@ -22,8 +22,10 @@
#ifndef AHHINT_H
#define AHHINT_H
-#include <ft2build.h>
-#include FT_SOURCE_FILE(autohint,ahglobal.h)
+
+#include <ft2build.h>
+#include FT_SOURCE_FILE(autohint,ahglobal.h)
+
FT_BEGIN_HEADER
--- a/src/autohint/ahmodule.c
+++ b/src/autohint/ahmodule.c
@@ -18,9 +18,10 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_MODULE_H
-#include FT_SOURCE_FILE(autohint,ahhint.h)
+
+#include <ft2build.h>
+#include FT_MODULE_H
+#include FT_SOURCE_FILE(autohint,ahhint.h)
typedef struct FT_AutoHinterRec_
--- a/src/autohint/ahoptim.c
+++ b/src/autohint/ahoptim.c
@@ -30,9 +30,11 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H /* for ALLOC_ARRAY() and FREE() */
-#include FT_SOURCE_FILE(autohint,ahoptim.h)
+
+#include <ft2build.h>
+#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 */
--- a/src/autohint/ahoptim.h
+++ b/src/autohint/ahoptim.h
@@ -22,8 +22,10 @@
#ifndef AHOPTIM_H
#define AHOPTIM_H
-#include <ft2build.h>
-#include FT_SOURCE_FILE(autohint,ahtypes.h)
+
+#include <ft2build.h>
+#include FT_SOURCE_FILE(autohint,ahtypes.h)
+
FT_BEGIN_HEADER
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -23,20 +23,26 @@
#ifndef AHTYPES_H
#define AHTYPES_H
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SOURCE_FILE(autohint,ahloader.h)
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+#include FT_SOURCE_FILE(autohint,ahloader.h)
+
#define xxAH_DEBUG
#ifdef AH_DEBUG
-# include <stdio.h>
-# define AH_LOG( x ) printf##x
+
+#include <stdio.h>
+#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
--- a/src/autohint/autohint.c
+++ b/src/autohint/autohint.c
@@ -21,11 +21,12 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 */
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -16,14 +16,14 @@
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 */
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -23,10 +23,11 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_BBOX_H
-#include FT_IMAGE_H
-#include FT_OUTLINE_H
+
+#include <ft2build.h>
+#include FT_BBOX_H
+#include FT_IMAGE_H
+#include FT_OUTLINE_H
typedef struct TBBox_Rec_
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -30,10 +30,11 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -40,8 +40,10 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+
+#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+
#ifdef FT_DEBUG_LEVEL_TRACE
char ft_trace_levels[trace_max];
--- a/src/base/ftextend.c
+++ b/src/base/ftextend.c
@@ -24,9 +24,10 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_EXTEND_H
-#include FT_INTERNAL_DEBUG_H
+
+#include <ft2build.h>
+#include FT_INTERNAL_EXTEND_H
+#include FT_INTERNAL_DEBUG_H
/*************************************************************************/
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -27,10 +27,11 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_GLYPH_H
+#include FT_OUTLINE_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -36,11 +36,12 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_MODULE_H
+
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_MODULE_H
/*************************************************************************/
--- a/src/base/ftlist.c
+++ b/src/base/ftlist.c
@@ -23,10 +23,10 @@
/*************************************************************************/
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+#include <ft2build.h>
+#include FT_LIST_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- 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 <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SOURCE_FILE(truetype/ttobjs.h)
-#include FT_SOURCE_FILE(type1/t1objs.h)
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_STREAM_H
+#include FT_SOURCE_FILE(truetype/ttobjs.h)
+#include FT_SOURCE_FILE(type1/t1objs.h)
#include <Resources.h>
#include <Fonts.h>
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -15,9 +15,10 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_MULTIPLE_MASTERS_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- a/src/base/ftnames.c
+++ b/src/base/ftnames.c
@@ -18,9 +18,10 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_NAMES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+
+#include <ft2build.h>
+#include FT_NAMES_H
+#include FT_INTERNAL_TRUETYPE_TYPES_H
#ifdef TT_CONFIG_OPTION_SFNT_NAMES
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -15,12 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 <string.h> /* for strcmp() */
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -22,9 +22,10 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_OUTLINE_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -15,9 +15,10 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
+
+#include <ft2build.h>
+#include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_DEBUG_H
/*************************************************************************/
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -15,10 +15,11 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include FT_SYNTHESIS_H
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+#include FT_OUTLINE_H
+#include FT_SYNTHESIS_H
#define FT_BOLD_THRESHOLD 0x0100
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -24,12 +24,13 @@
/* */
/*************************************************************************/
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_SYSTEM_H
+#include FT_ERRORS_H
+#include FT_TYPES_H
#include <stdio.h>
#include <stdlib.h>
--- a/src/cache/ftcache.c
+++ b/src/cache/ftcache.c
@@ -18,13 +18,13 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 */
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -15,12 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_INTERNAL_CHUNK_H
-#include FT_LIST_H
-#include FT_ERRORS_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_INTERNAL_CHUNK_H
+#include FT_LIST_H
+#include FT_ERRORS_H
+#include FT_INTERNAL_OBJECTS_H
/*************************************************************************/
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -15,13 +15,14 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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
/*************************************************************************/
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -16,10 +16,10 @@
/***************************************************************************/
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_IMAGE_H
-#include FT_INTERNAL_MEMORY_H
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_IMAGE_H
+#include FT_INTERNAL_MEMORY_H
#include <string.h> /* memcmp() */
#include <stdlib.h> /* labs() */
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -15,12 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_MANAGER_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_LIST_H
+
+#include <ft2build.h>
+#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
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -15,12 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 <string.h> /* memcmp() */
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -15,11 +15,12 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_CACHE_H
-#include FT_CACHE_INTERNAL_LRU_H
-#include FT_LIST_H
-#include FT_INTERNAL_OBJECTS_H
+
+#include <ft2build.h>
+#include FT_CACHE_H
+#include FT_CACHE_INTERNAL_LRU_H
+#include FT_LIST_H
+#include FT_INTERNAL_OBJECTS_H
static
--- 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 */
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_DEBUG_H
@@ -25,6 +26,7 @@
#include FT_SOURCE_FILE(cff,cffdrivr.h)
#include FT_SOURCE_FILE(cff,t2gload.h)
+
/*************************************************************************/
/* */
--- 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;
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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:
- {
- size += 2*(num_glyphs-1);
- break;
- }
+ case 0:
+ size += 2 * ( num_glyphs - 1 );
+ break;
- case 1:
- {
- FT_UInt glyph, nleft;
+ case 1:
+ {
+ FT_UInt glyph, nleft;
- num_glyphs--;
- while (num_glyphs > 0)
- {
- if ( READ_UShort(glyph) ||
- READ_Byte(nleft) )
- goto Exit;
- size += 3;
- num_glyphs -= 1 + nleft;
- }
- break;
+ num_glyphs--;
+ while ( num_glyphs > 0 )
+ {
+ if ( READ_UShort( glyph ) ||
+ READ_Byte( nleft ) )
+ goto Exit;
+
+ size += 3;
+ num_glyphs -= 1 + nleft;
}
+ break;
+ }
- case 2:
- {
- FT_UInt glyph, nleft;
+ 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;
+ 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;
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -19,48 +19,48 @@
#ifndef CFFLOAD_H
#define CFFLOAD_H
+
#include <ft2build.h>
#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 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 void
- CFF_Forget_Element( CFF_Index* index,
- FT_Byte** pbytes );
+ 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_Error
- CFF_Load_Font( FT_Stream stream,
- FT_Int face_index,
- CFF_Font* font );
+ FT_LOCAL
+ FT_Byte CFF_Get_FD( CFF_FD_Select* select,
+ FT_UInt glyph_index );
- 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
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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 <string.h> /* 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 ) )
- goto Fail;
- for ( ; gname < limit; gname++ )
- gname[0] = T2_Get_String( &font->string_index,
- GET_UShort(),
- psnames );
- FORGET_Frame();
- break;
- }
+ if ( ACCESS_Frame( num_glyphs * 2 ) )
+ goto Fail;
- 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;
+ for ( ; gname < limit; gname++ )
+ gname[0] = T2_Get_String( &font->string_index,
+ GET_UShort(),
+ psnames );
+ FORGET_Frame();
+ break;
+ }
- if (format == 2)
- len++;
+ 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;
- while (gname < limit)
- {
- FT_UInt first;
- FT_UInt count;
- if ( ACCESS_Frame( len ) )
- goto Fail;
+ if ( format == 2 )
+ len++;
- first = GET_UShort();
- if (format == 3)
- count = GET_UShort();
- else
- count = GET_Byte();
+ while ( gname < limit )
+ {
+ FT_UInt first;
+ FT_UInt count;
- FORGET_Frame();
- for ( ; count > 0; count-- )
- {
- gname[0] = T2_Get_String( &font->string_index,
- first,
- psnames );
- gname++;
- first++;
- }
+ 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;
}
+ 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 )
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -19,6 +19,7 @@
#ifndef T2OBJS_H
#define T2OBJS_H
+
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_CFF_TYPES_H
@@ -25,8 +26,10 @@
#include FT_INTERNAL_CFF_ERRORS_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/* */
/* <Type> */
@@ -111,15 +114,15 @@
/* */
/* 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 );
/*************************************************************************/
@@ -126,11 +129,11 @@
/* */
/* 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
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -15,11 +15,13 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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,8 +283,8 @@
/* 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] ) );
@@ -291,9 +291,9 @@
}
- /* 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 );
@@ -300,8 +300,8 @@
}
- 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;
@@ -532,6 +532,7 @@
/* we found our field's handler; read it */
FT_Long val;
FT_Byte* q = (FT_Byte*)parser->object + field->offset;
+
switch ( field->kind )
{
--- a/src/cff/cffparse.h
+++ b/src/cff/cffparse.h
@@ -19,12 +19,15 @@
#ifndef __CFF_PARSE_H__
#define __CFF_PARSE_H__
+
#include <ft2build.h>
#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
@@ -31,8 +34,6 @@
#define CFF_CODE_PRIVATE 0x2000
-
-
typedef struct CFF_Parser_
{
FT_Byte* start;
@@ -48,18 +49,19 @@
} 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__ */
--- 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 */
--- a/src/cff/t2driver.c
+++ /dev/null
@@ -1,378 +1,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 <freetype/freetype.h>
-#include <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftstream.h>
-#include <freetype/internal/sfnt.h>
-#include <freetype/ttnameid.h>
-
-#include <freetype/internal/t2errors.h>
-
-
-#ifdef FT_FLAT_COMPILE
-
-#include "t2driver.h"
-#include "t2gload.h"
-
-#else
-
-#include <cff/t2driver.h>
-#include <cff/t2gload.h>
-
-#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 )
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Get_Kerning */
- /* */
- /* <Description> */
- /* A driver method used to return the kerning vector between two */
- /* glyphs of the same face. */
- /* */
- /* <Input> */
- /* 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. */
- /* */
- /* <Output> */
- /* kerning :: The kerning vector. This is in font units for */
- /* scalable formats, and in pixels for fixed-sizes */
- /* formats. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- /* <Note> */
- /* 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
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Load_Glyph */
- /* */
- /* <Description> */
- /* A driver method used to load a glyph within a given glyph slot. */
- /* */
- /* <Input> */
- /* 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). */
- /* */
- /* <Return> */
- /* 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 ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Get_Char_Index */
- /* */
- /* <Description> */
- /* Uses a charmap to return a given character code's glyph index. */
- /* */
- /* <Input> */
- /* charmap :: A handle to the source charmap object. */
- /* charcode :: The character code. */
- /* */
- /* <Return> */
- /* 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
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* getDriverClass */
- /* */
- /* <Description> */
- /* 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. */
- /* */
- /* <Return> */
- /* 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 */
--- a/src/cff/t2driver.h
+++ /dev/null
@@ -1,41 +1,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 <freetype/internal/ftdriver.h>
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
- FT_CALLBACK_TABLE
- const FT_Driver_Class cff_driver_class;
-
-
-#ifdef __cplusplus
- }
-#endif
-
-
-#endif /* T2DRIVER_H */
-
-
-/* END */
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H
--- a/src/cff/t2gload.h
+++ b/src/cff/t2gload.h
@@ -161,35 +161,35 @@
} 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
--- a/src/cff/t2load.c
+++ /dev/null
@@ -1,762 +1,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 <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftstream.h>
-#include <freetype/internal/psnames.h>
-
-#include <freetype/internal/t2errors.h>
-#include <freetype/tttags.h>
-
-
-#ifdef FT_FLAT_COMPILE
-
-#include "t2load.h"
-#include "t2parse.h"
-
-#else
-
-#include <cff/t2load.h>
-#include <cff/t2parse.h>
-
-#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 */
--- a/src/cff/t2load.h
+++ /dev/null
@@ -1,69 +1,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 <freetype/internal/t2types.h>
-#include <freetype/internal/psnames.h>
-
-#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 */
--- a/src/cff/t2objs.c
+++ /dev/null
@@ -1,604 +1,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 <freetype/internal/ftdebug.h>
-#include <freetype/internal/ftcalc.h>
-#include <freetype/internal/ftstream.h>
-#include <freetype/fterrors.h>
-#include <freetype/ttnameid.h>
-#include <freetype/tttags.h>
-
-#include <freetype/internal/sfnt.h>
-#include <freetype/internal/psnames.h>
-
-
-#ifdef FT_FLAT_COMPILE
-
-#include "t2objs.h"
-#include "t2load.h"
-
-#else
-
-#include <cff/t2objs.h>
-#include <cff/t2load.h>
-
-#endif
-
-
-#include <freetype/internal/t2errors.h>
-
-#include <string.h> /* 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;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T2_Init_Face */
- /* */
- /* <Description> */
- /* Initializes a given OpenType face object. */
- /* */
- /* <Input> */
- /* 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. */
- /* */
- /* <InOut> */
- /* face :: The newly built face object. */
- /* */
- /* <Return> */
- /* 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;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T2_Done_Face */
- /* */
- /* <Description> */
- /* Finalizes a given face object. */
- /* */
- /* <Input> */
- /* 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 );
- }
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T2_Init_Driver */
- /* */
- /* <Description> */
- /* Initializes a given OpenType driver object. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target driver object. */
- /* */
- /* <Return> */
- /* 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
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* T2_Done_Driver */
- /* */
- /* <Description> */
- /* Finalizes a given OpenType driver. */
- /* */
- /* <Input> */
- /* 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 */
--- a/src/cff/t2objs.h
+++ /dev/null
@@ -1,148 +1,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 <freetype/internal/ftobjs.h>
-#include <freetype/internal/t2types.h>
-#include <freetype/internal/t2errors.h>
-#include <freetype/internal/psnames.h>
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T2_Driver */
- /* */
- /* <Description> */
- /* A handle to an OpenType driver object. */
- /* */
- typedef struct T2_DriverRec_* T2_Driver;
-
- typedef TT_Face T2_Face;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T2_Size */
- /* */
- /* <Description> */
- /* A handle to an OpenType size object. */
- /* */
- typedef FT_Size T2_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* T2_GlyphSlot */
- /* */
- /* <Description> */
- /* 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 */
--- a/src/cff/t2parse.c
+++ /dev/null
@@ -1,655 +1,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 <cff/t2parse.h>
-
-#endif
-
-
-#include <freetype/internal/t2errors.h>
-#include <freetype/internal/ftstream.h>
-
-
- /*************************************************************************/
- /* */
- /* 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 <cff/t2tokens.h>
-
-#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 */
--- a/src/cff/t2parse.h
+++ /dev/null
@@ -1,70 +1,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 <freetype/internal/t2types.h>
-#include <freetype/internal/ftobjs.h>
-
-#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 */
--- a/src/cff/t2tokens.h
+++ /dev/null
@@ -1,96 +1,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 */
--- a/src/cid/cidafm.c
+++ b/src/cid/cidafm.c
@@ -15,14 +15,16 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <stdlib.h> /* for qsort() */
-#include <string.h> /* for strcmp() */
-#include <ctype.h> /* for isalnum() */
+
+#include <ft2build.h>
+#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 <stdlib.h> /* for qsort() */
+#include <string.h> /* for strcmp() */
+#include <ctype.h> /* for isalnum() */
/*************************************************************************/
--- a/src/cid/cidafm.h
+++ b/src/cid/cidafm.h
@@ -19,11 +19,13 @@
#ifndef CIDAFM_H
#define CIDAFM_H
-#include <ft2build.h>
-#include FT_SOURCE_FILE(cid,cidobjs.h)
+#include <ft2build.h>
+#include FT_SOURCE_FILE(cid,cidobjs.h)
+
FT_BEGIN_HEADER
+
typedef struct CID_Kern_Pair_
{
FT_UInt glyph1;
@@ -41,19 +43,20 @@
} 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
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -15,12 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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
/*************************************************************************/
--- a/src/cid/cidgload.h
+++ b/src/cid/cidgload.h
@@ -19,9 +19,11 @@
#ifndef CIDGLOAD_H
#define CIDGLOAD_H
-#include <ft2build.h>
-#include FT_SOURCE_FILE(cid,cidobjs.h)
+#include <ft2build.h>
+#include FT_SOURCE_FILE(cid,cidobjs.h)
+
+
FT_BEGIN_HEADER
#if 0
@@ -38,6 +40,7 @@
CID_Size size,
FT_Int glyph_index,
FT_Int load_flags );
+
FT_END_HEADER
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -15,15 +15,17 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <stdio.h>
-#include <ctype.h> /* for isspace(), isalnum() */
+
+#include <ft2build.h>
+#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 <stdio.h>
+#include <ctype.h> /* for isspace(), isalnum() */
/*************************************************************************/
--- a/src/cid/cidload.h
+++ b/src/cid/cidload.h
@@ -19,12 +19,15 @@
#ifndef CIDLOAD_H
#define CIDLOAD_H
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_SOURCE_FILE(cid,cidparse.h)
+#include <ft2build.h>
+#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 */
@@ -44,6 +47,7 @@
FT_LOCAL
FT_Error CID_Open_Face( CID_Face face );
+
FT_END_HEADER
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -15,13 +15,14 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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
/*************************************************************************/
--- a/src/cid/cidobjs.h
+++ b/src/cid/cidobjs.h
@@ -19,11 +19,13 @@
#ifndef CIDOBJS_H
#define CIDOBJS_H
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_ERRORS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+
+#include <ft2build.h>
+#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
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -15,14 +15,16 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <string.h> /* for strncmp() */
+
+#include <ft2build.h>
+#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 <string.h> /* for strncmp() */
/*************************************************************************/
--- a/src/cid/cidparse.h
+++ b/src/cid/cidparse.h
@@ -19,13 +19,16 @@
#ifndef CIDPARSE_H
#define CIDPARSE_H
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <ft2build.h>
+#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/* */
/* <Struct> */
@@ -68,14 +71,14 @@
} 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 );
/*************************************************************************/
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -15,13 +15,15 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <string.h> /* for strcmp() */
+
+#include <ft2build.h>
+#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 <string.h> /* for strcmp() */
/*************************************************************************/
--- a/src/cid/cidriver.h
+++ b/src/cid/cidriver.h
@@ -19,13 +19,17 @@
#ifndef CIDRIVER_H
#define CIDRIVER_H
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <ft2build.h>
+#include FT_INTERNAL_DRIVER_H
+
+
FT_BEGIN_HEADER
+
FT_CALLBACK_TABLE
const FT_Driver_Class t1cid_driver_class;
+
FT_END_HEADER
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -18,11 +18,12 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
-#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 <ft2build.h>
+#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 */
--- a/src/psaux/psaux.c
+++ b/src/psaux/psaux.c
@@ -18,9 +18,10 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
-#include FT_SOURCE_FILE(psaux,psobjs.c)
-#include FT_SOURCE_FILE(psaux,psauxmod.c)
-#include FT_SOURCE_FILE(psaux,t1decode.c)
+#include <ft2build.h>
+#include FT_SOURCE_FILE(psaux,psobjs.c)
+#include FT_SOURCE_FILE(psaux,psauxmod.c)
+#include FT_SOURCE_FILE(psaux,t1decode.c)
+
/* END */
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -15,10 +15,12 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_SOURCE_FILE(psaux,psauxmod.h)
-#include FT_SOURCE_FILE(psaux,psobjs.h)
-#include FT_SOURCE_FILE(psaux,t1decode.h)
+
+#include <ft2build.h>
+#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 =
--- a/src/psaux/psauxmod.h
+++ b/src/psaux/psauxmod.h
@@ -19,12 +19,16 @@
#ifndef PSAUXMOD_H
#define PSAUXMOD_H
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
FT_BEGIN_HEADER
+
FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
+
FT_END_HEADER
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -15,11 +15,12 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_ERRORS_H
-#include FT_SOURCE_FILE(psaux,psobjs.h)
+
+#include <ft2build.h>
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_ERRORS_H
+#include FT_SOURCE_FILE(psaux,psobjs.h)
/*************************************************************************/
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -19,10 +19,13 @@
#ifndef PSOBJS_H
#define PSOBJS_H
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <ft2build.h>
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/*************************************************************************/
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TYPE1_ERRORS_H
@@ -21,6 +22,7 @@
#include FT_OUTLINE_H
#include FT_SOURCE_FILE(psaux,t1decode.h)
#include FT_SOURCE_FILE(psaux,psobjs.h)
+
/*************************************************************************/
/* */
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -19,12 +19,15 @@
#ifndef T1DECODE_H
#define T1DECODE_H
+
#include <ft2build.h>
#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;
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -15,18 +15,18 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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 <stdlib.h> /* for qsort() */
#include <string.h> /* for strcmp(), strncpy() */
#ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
-
-
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
--- a/src/psnames/psmodule.h
+++ b/src/psnames/psmodule.h
@@ -19,12 +19,16 @@
#ifndef PSDRIVER_H
#define PSDRIVER_H
+
#include <ft2build.h>
#include FT_MODULE_H
+
FT_BEGIN_HEADER
+
FT_EXPORT_VAR( const FT_Module_Class ) psnames_module_class;
+
FT_END_HEADER
--- a/src/psnames/psnames.c
+++ b/src/psnames/psnames.c
@@ -18,8 +18,8 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
-#include FT_SOURCE_FILE(psnames,psmodule.c)
+#include <ft2build.h>
+#include FT_SOURCE_FILE(psnames,psmodule.c)
#endif
--- a/src/raster/ftraster.h
+++ b/src/raster/ftraster.h
@@ -19,12 +19,15 @@
#ifndef FTRASTER_H
#define FTRASTER_H
-#include <ft2build.h>
-#include FT_CONFIG_CONFIG_H
-#include FT_IMAGE_H
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include FT_IMAGE_H
+
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/* */
/* Uncomment the following line if you are using ftraster.c as a */
@@ -33,6 +36,7 @@
/* #define _STANDALONE_ */
FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster;
+
FT_END_HEADER
--- 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 )
--- a/src/raster/ftrend1.h
+++ b/src/raster/ftrend1.h
@@ -19,11 +19,14 @@
#ifndef FTREND1_H
#define FTREND1_H
+
#include <ft2build.h>
#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 */
@@ -31,6 +34,7 @@
/* used for backwards-compatibility with FT 1.x anyway. */
/* */
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class;
+
FT_END_HEADER
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_SFNT_H
#include FT_INTERNAL_OBJECTS_H
--- a/src/sfnt/sfdriver.h
+++ b/src/sfnt/sfdriver.h
@@ -19,12 +19,16 @@
#ifndef SFDRIVER_H
#define SFDRIVER_H
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
FT_BEGIN_HEADER
+
FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class;
+
FT_END_HEADER
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -32,4 +32,5 @@
#include FT_SOURCE_FILE(sfnt,ttpost.c)
#endif
+
/* END */
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -15,14 +15,15 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#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 <ft2build.h>
+#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
/*************************************************************************/
--- a/src/sfnt/sfobjs.h
+++ b/src/sfnt/sfobjs.h
@@ -19,9 +19,11 @@
#ifndef SFOBJS_H
#define SFOBJS_H
+
#include <ft2build.h>
#include FT_INTERNAL_SFNT_H
#include FT_INTERNAL_OBJECTS_H
+
FT_BEGIN_HEADER
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
--- a/src/sfnt/ttcmap.h
+++ b/src/sfnt/ttcmap.h
@@ -19,13 +19,14 @@
#ifndef TTCMAP_H
#define TTCMAP_H
-#include <freetype/internal/tttypes.h>
-#ifdef __cplusplus
- extern "C" {
-#endif
+#include <ft2build.h>
+#include FT_INTERNAL_TRUETYPE_TYPES_H
+FT_BEGIN_HEADER
+
+
FT_LOCAL
FT_Error TT_CharMap_Load( TT_Face face,
TT_CMapTable* cmap,
@@ -35,9 +36,8 @@
FT_Error TT_CharMap_Free( TT_Face face,
TT_CMapTable* cmap );
-#ifdef __cplusplus
- }
-#endif
+
+FT_END_HEADER
#endif /* TTCMAP_H */
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -16,6 +16,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
@@ -23,6 +24,7 @@
#include FT_TRUETYPE_TAGS_H
#include FT_SOURCE_FILE(sfnt,ttload.h)
#include FT_SOURCE_FILE(sfnt,ttcmap.h)
+
/*************************************************************************/
/* */
--- a/src/sfnt/ttload.h
+++ b/src/sfnt/ttload.h
@@ -20,6 +20,7 @@
#ifndef TTLOAD_H
#define TTLOAD_H
+
#include <ft2build.h>
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_TRUETYPE_TYPES_H
@@ -26,6 +27,7 @@
FT_BEGIN_HEADER
+
FT_LOCAL
TT_Table* TT_LookUp_Table( TT_Face face,
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -24,6 +24,7 @@
/* */
/*************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
--- a/src/sfnt/ttpost.h
+++ b/src/sfnt/ttpost.h
@@ -20,11 +20,14 @@
#ifndef TTPOST_H
#define TTPOST_H
+
#include <ft2build.h>
#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
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
@@ -21,6 +22,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include FT_SOURCE_FILE(sfnt,ttsbit.h)
+
/*************************************************************************/
/* */
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -19,8 +19,10 @@
#ifndef TTSBIT_H
#define TTSBIT_H
+
#include <ft2build.h>
#include FT_SOURCE_FILE(sfnt,ttload.h)
+
FT_BEGIN_HEADER
--- 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 */
@@ -42,6 +45,7 @@
#endif
FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_grays_raster;
+
#ifdef __cplusplus
}
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -15,11 +15,13 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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
--- a/src/smooth/ftsmooth.h
+++ b/src/smooth/ftsmooth.h
@@ -19,6 +19,7 @@
#ifndef FTSMOOTH_H
#define FTSMOOTH_H
+
#include <ft2build.h>
#include FT_RENDER_H
@@ -25,6 +26,7 @@
FT_BEGIN_HEADER
+
#ifndef FT_CONFIG_OPTION_NO_STD_RASTER
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_std_renderer_class;
#endif
@@ -32,6 +34,7 @@
#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_smooth_renderer_class;
#endif
+
FT_END_HEADER
--- 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 */
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -28,4 +28,5 @@
#include FT_SOURCE_FILE(truetype,ttinterp.c)
#endif
+
/* END */
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
--- a/src/truetype/ttdriver.h
+++ b/src/truetype/ttdriver.h
@@ -19,10 +19,13 @@
#ifndef TTDRIVER_H
#define TTDRIVER_H
+
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
+
FT_BEGIN_HEADER
+
FT_EXPORT_VAR( const FT_Driver_Class ) tt_driver_class;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -19,6 +19,7 @@
#ifndef TTGLOAD_H
#define TTGLOAD_H
+
#include <ft2build.h>
#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,
@@ -42,6 +45,7 @@
TT_GlyphSlot glyph,
FT_UShort glyph_index,
FT_UInt load_flags );
+
FT_END_HEADER
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#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
/*************************************************************************/
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -19,24 +19,27 @@
#ifndef TTINTERP_H
#define TTINTERP_H
+
#include <ft2build.h>
#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 */
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -19,10 +19,12 @@
#ifndef TTOBJS_H
#define TTOBJS_H
+
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_TRUETYPE_ERRORS_H
+
FT_BEGIN_HEADER
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H
--- a/src/truetype/ttpload.h
+++ b/src/truetype/ttpload.h
@@ -19,11 +19,14 @@
#ifndef TTPLOAD_H
#define TTPLOAD_H
+
#include <ft2build.h>
#include FT_INTERNAL_TRUETYPE_TYPES_H
+
FT_BEGIN_HEADER
+
FT_LOCAL
FT_Error TT_Load_Locations( TT_Face face,
FT_Stream stream );
@@ -35,6 +38,7 @@
FT_LOCAL
FT_Error TT_Load_Programs( TT_Face face,
FT_Stream stream );
+
FT_END_HEADER
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_SOURCE_FILE(type1,t1afm.h)
#include FT_INTERNAL_STREAM_H
--- a/src/type1/t1afm.h
+++ b/src/type1/t1afm.h
@@ -22,8 +22,10 @@
#include <ft2build.h>
#include FT_SOURCE_FILE(type1,t1objs.h)
+
FT_BEGIN_HEADER
+
typedef struct T1_Kern_Pair_
{
FT_UInt glyph1;
@@ -54,6 +56,7 @@
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning );
+
FT_END_HEADER
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -15,13 +15,13 @@
/* */
/***************************************************************************/
-#include <ft2build.h>
-#include FT_SOURCE_FILE(type1,t1driver.h)
-#include FT_SOURCE_FILE(type1,t1gload.h)
-#include FT_SOURCE_FILE(type1,t1load.h)
+#include <ft2build.h>
+#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
--- a/src/type1/t1driver.h
+++ b/src/type1/t1driver.h
@@ -19,12 +19,16 @@
#ifndef T1DRIVER_H
#define T1DRIVER_H
+
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
+
FT_BEGIN_HEADER
+
FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class;
+
FT_END_HEADER
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -15,6 +15,7 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_SOURCE_FILE(type1,t1gload.h)
#include FT_INTERNAL_DEBUG_H
@@ -21,6 +22,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_OUTLINE_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
+
#include <string.h> /* for strcmp() */
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -19,10 +19,13 @@
#ifndef T1GLOAD_H
#define T1GLOAD_H
+
#include <ft2build.h>
#include FT_SOURCE_FILE(type1,t1objs.h)
+
FT_BEGIN_HEADER
+
FT_LOCAL
FT_Error T1_Compute_Max_Advance( T1_Face face,
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -60,6 +60,7 @@
/* */
/*************************************************************************/
+
#include <ft2build.h>
#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 <string.h> /* for strncmp(), strcmp() */
#include <ctype.h> /* for isalnum() */
--- a/src/type1/t1load.h
+++ b/src/type1/t1load.h
@@ -19,6 +19,7 @@
#ifndef T1LOAD_H
#define T1LOAD_H
+
#include <ft2build.h>
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
@@ -26,7 +27,9 @@
#include FT_SOURCE_FILE(type1,t1parse.h)
+
FT_BEGIN_HEADER
+
typedef struct T1_Loader_
{
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -15,9 +15,11 @@
/* */
/***************************************************************************/
+
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
+
#include <string.h> /* strcmp() */
#include FT_SOURCE_FILE(type1,t1gload.h)
--- a/src/type1/t1objs.h
+++ b/src/type1/t1objs.h
@@ -19,6 +19,7 @@
#ifndef T1OBJS_H
#define T1OBJS_H
+
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_CONFIG_CONFIG_H
@@ -25,7 +26,9 @@
#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;
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -32,6 +32,7 @@
/* */
/*************************************************************************/
+
#include <ft2build.h>
#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 <string.h> /* for strncmp() */
--- a/src/type1/t1parse.h
+++ b/src/type1/t1parse.h
@@ -19,11 +19,14 @@
#ifndef T1PARSE_H
#define T1PARSE_H
+
#include <ft2build.h>
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_INTERNAL_STREAM_H
+
FT_BEGIN_HEADER
+
/*************************************************************************/
/* */
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -29,4 +29,5 @@
#include FT_SOURCE_FILE(type1,t1afm.c)
#endif
+
/* END */