A lot of formatting.

Added more tracing levels.

More Makefile fixes.

Minor other changes.
This commit is contained in:
Werner Lemberg 2000-06-12 19:36:41 +00:00
parent e35cac66c6
commit 78575dc0d1
25 changed files with 1353 additions and 1369 deletions

View File

@ -43,7 +43,7 @@
FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64 l ); FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64 l );
#endif /* OLD_CALCS */ #endif /* FT_CONFIG_OPTION_OLD_CALCS */
#else /* LONG64 */ #else /* LONG64 */

View File

@ -48,37 +48,49 @@
/* the first level must always be `trace_any' */ /* the first level must always be `trace_any' */
trace_any = 0, trace_any = 0,
/* we start with an enum for each base component */ /* base components */
trace_aaraster, /* anti-aliasing raster (ftgrays.c) */ trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
trace_calc, /* calculations (ftcalc.c) */ trace_calc, /* calculations (ftcalc.c) */
trace_extend, /* extension manager (ftextend.c) */ trace_extend, /* extension manager (ftextend.c) */
trace_glyph, /* glyph manager (ftglyph.c) */ trace_glyph, /* glyph manager (ftglyph.c) */
trace_io, /* i/o monitoring (ftsystem.c) */ trace_io, /* i/o monitoring (ftsystem.c) */
trace_init, /* initialization (ftinit.c) */ trace_init, /* initialization (ftinit.c) */
trace_list, /* list manager (ftlist.c) */ trace_list, /* list manager (ftlist.c) */
trace_memory, /* memory manager (ftobjs.c) */ trace_memory, /* memory manager (ftobjs.c) */
trace_mm, /* MM interface (ftmm.c) */ trace_mm, /* MM interface (ftmm.c) */
trace_objs, /* base objects (ftobjs.c) */ trace_objs, /* base objects (ftobjs.c) */
trace_outline, /* outline management (ftoutln.c) */ trace_outline, /* outline management (ftoutln.c) */
trace_raster, /* raster (ftraster.c) */ trace_raster, /* rasterizer (ftraster.c) */
trace_stream, /* stream manager (ftstream.c) */ trace_stream, /* stream manager (ftstream.c) */
/* then define an enum for each TrueType driver component */ /* SFNT driver components */
trace_ttobjs, trace_sfobjs, /* SFNT object handler (sfobjs.c) */
trace_ttload, trace_ttcmap, /* charmap handler (ttcmap.c) */
trace_ttgload, trace_ttload, /* basic TrueType tables (ttload.c) */
trace_ttinterp, trace_ttpost, /* PS table processing (ttpost.c) */
trace_ttcmap, trace_ttsbit, /* TrueType sbit handling (ttsbit.c) */
trace_ttextend,
trace_ttdriver,
/* define an enum for each Type 1 driver component */ /* TrueType driver components */
trace_ttdriver, /* TT font driver (ttdriver.c) */
trace_ttgload, /* TT glyph loader (ttgload.c) */
trace_ttinterp, /* bytecode interpreter (ttinterp.c) */
trace_ttobjs, /* TT objects manager (ttobjs.c) */
trace_ttpload, /* TT data/program loader (ttpload.c) */
/* Type 1 driver components */
trace_t1objs, trace_t1objs,
trace_t1load, trace_t1load,
trace_t1gload, trace_t1gload,
trace_t1hint, trace_t1hint,
trace_t1driver, trace_t1driver,
/* Type 2 driver components */
trace_t2driver,
trace_t2gload,
trace_t2load,
trace_t2objs,
trace_t2parse,
/* other trace levels */ /* other trace levels */
/* the last level must always be `trace_max' */ /* the last level must always be `trace_max' */

View File

@ -108,7 +108,7 @@
return root; return root;
} }
#endif /* OLD_CALCS */ #endif /* FT_CONFIG_OPTION_OLD_CALCS */
#ifdef LONG64 #ifdef LONG64

View File

@ -4,11 +4,11 @@
/* */ /* */
/* FreeType OpenType driver component (body only). */ /* FreeType OpenType driver component (body only). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -16,29 +16,6 @@
/***************************************************************************/ /***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to compile the FreeType TrueType font driver. It */
/* relies on all components included in the `base' layer (see the file */
/* `ftbase.c'). The source code is located in `freetype/ttlib' and */
/* contains: */
/* */
/* - a driver interface */
/* - an object manager */
/* - a table loader */
/* - a glyph loader */
/* - a glyph hinter/bytecode interpreter */
/* - a charmap processor */
/* - an extension manager (only used for some tools) */
/* */
/* Note that the engine extensions found in `freetype/ttlib/extend' are */
/* reserved to specific tools and/or font servers; they're not part of */
/* the `core' TrueType driver, even though they are separately linkable */
/* to it. */
/* */
/*************************************************************************/
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#include <t2driver.c> /* driver interface */ #include <t2driver.c> /* driver interface */
@ -47,4 +24,5 @@
#include <t2objs.c> /* object management */ #include <t2objs.c> /* object management */
#include <t2gload.c> /* glyph loader */ #include <t2gload.c> /* glyph loader */
/* END */ /* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType font driver implementation (body). */ /* OpenType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -25,9 +25,14 @@
#include <t2gload.h> #include <t2gload.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 #undef FT_COMPONENT
#define FT_COMPONENT trace_ttdriver #define FT_COMPONENT trace_t2driver
/*************************************************************************/ /*************************************************************************/
@ -43,7 +48,9 @@
/*************************************************************************/ /*************************************************************************/
#undef PAIR_TAG #undef PAIR_TAG
#define PAIR_TAG( left, right ) ( ((TT_ULong)left << 16) | (TT_ULong)right ) #define PAIR_TAG( left, right ) ( ( (TT_ULong)left << 16 ) | \
(TT_ULong)right )
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -4,11 +4,11 @@
/* */ /* */
/* OpenType Glyph Loader (body). */ /* OpenType Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -22,13 +22,21 @@
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1gload
#include <t2load.h> #include <t2load.h>
#include <t2gload.h> #include <t2gload.h>
typedef enum T2_Operator_
/*************************************************************************/
/* */
/* 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_t2gload
typedef enum T2_Operator_
{ {
t2_op_unknown = 0, t2_op_unknown = 0,
t2_op_rmoveto, t2_op_rmoveto,

View File

@ -4,11 +4,11 @@
/* */ /* */
/* TrueType glyph data/program tables loader (body). */ /* TrueType glyph data/program tables loader (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -26,8 +26,16 @@
#include <t2load.h> #include <t2load.h>
#include <t2parse.h> #include <t2parse.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 #undef FT_COMPONENT
#define FT_COMPONENT trace_ttload #define FT_COMPONENT trace_t2load
/* read a CFF offset from memory */ /* read a CFF offset from memory */
static static

View File

@ -1,14 +1,14 @@
/***************************************************************************/ /***************************************************************************/
/* */ /* */
/* ttobjs.c */ /* t2objs.c */
/* */ /* */
/* Objects manager (body). */ /* OpenType objects manager (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -29,9 +29,15 @@
#include <t2load.h> #include <t2load.h>
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
/* required by tracing mode */
#undef FT_COMPONENT /*************************************************************************/
#define FT_COMPONENT trace_ttobjs /* */
/* 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
/*************************************************************************/ /*************************************************************************/

View File

@ -1,6 +1,35 @@
/***************************************************************************/
/* */
/* 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. */
/* */
/***************************************************************************/
#include <t2parse.h> #include <t2parse.h>
#include <freetype/fterrors.h> #include <freetype/fterrors.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_Stack_Underflow FT_Err_Invalid_Argument
#define T2_Err_Syntax_Error FT_Err_Invalid_Argument #define T2_Err_Syntax_Error FT_Err_Invalid_Argument

View File

@ -22,6 +22,16 @@
#include <freetype/ttnameid.h> #include <freetype/ttnameid.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_sfobjs
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */

View File

@ -32,6 +32,17 @@
#include <ttpost.h> #include <ttpost.h>
#include <ttload.h> #include <ttload.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_ttpost
/* If this configuration macro is defined, we rely on the `psnames' */ /* If this configuration macro is defined, we rely on the `psnames' */
/* module to grab the glyph names. */ /* module to grab the glyph names. */

View File

@ -23,6 +23,16 @@
#include <ttsbit.h> #include <ttsbit.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_ttsbit
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */

View File

@ -4,11 +4,11 @@
/* */ /* */
/* FreeType TrueType driver component (body only). */ /* FreeType TrueType driver component (body only). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -16,29 +16,6 @@
/***************************************************************************/ /***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to compile the FreeType TrueType font driver. It */
/* relies on all components included in the `base' layer (see the file */
/* `ftbase.c'). The source code is located in `freetype/ttlib' and */
/* contains: */
/* */
/* - a driver interface */
/* - an object manager */
/* - a table loader */
/* - a glyph loader */
/* - a glyph hinter/bytecode interpreter */
/* - a charmap processor */
/* - an extension manager (only used for some tools) */
/* */
/* Note that the engine extensions found in `freetype/ttlib/extend' are */
/* reserved to specific tools and/or font servers; they're not part of */
/* the `core' TrueType driver, even though they are separately linkable */
/* to it. */
/* */
/*************************************************************************/
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ttdriver.c> /* driver interface */ #include <ttdriver.c> /* driver interface */
@ -49,4 +26,6 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <ttinterp.c> /* bytecode interpreter */ #include <ttinterp.c> /* bytecode interpreter */
#endif #endif
/* END */ /* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* TrueType font driver implementation (body). */ /* TrueType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -25,11 +25,16 @@
#include <ttgload.h> #include <ttgload.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 #undef FT_COMPONENT
#define FT_COMPONENT trace_ttdriver #define FT_COMPONENT trace_ttdriver
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -45,7 +50,8 @@
#undef PAIR_TAG #undef PAIR_TAG
#define PAIR_TAG( left, right ) ( ((TT_ULong)left << 16) | (TT_ULong)right ) #define PAIR_TAG( left, right ) ( ( (TT_ULong)left << 16 ) | \
(TT_ULong)right )
/*************************************************************************/ /*************************************************************************/
@ -70,12 +76,12 @@
/* formats. */ /* formats. */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. */ /* TrueType error code. 0 means success. */
/* */ /* */
/* <Note> */ /* <Note> */
/* Only horizontal layouts (left-to-right & right-to-left) are */ /* Only horizontal layouts (left-to-right & right-to-left) are */
/* supported by this function. Other layouts, or more sophisticated */ /* supported by this function. Other layouts, or more sophisticated */
/* kernings are out of scope of this method (the basic driver */ /* kernings, are out of scope of this method (the basic driver */
/* interface is meant to be simple). */ /* interface is meant to be simple). */
/* */ /* */
/* They can be implemented by format-specific interfaces. */ /* They can be implemented by format-specific interfaces. */
@ -107,7 +113,7 @@
while ( left <= right ) while ( left <= right )
{ {
TT_Int middle = left + ((right-left) >> 1); TT_Int middle = left + ( ( right - left ) >> 1 );
TT_ULong cur_pair; TT_ULong cur_pair;
@ -118,9 +124,9 @@
goto Found; goto Found;
if ( cur_pair < search_tag ) if ( cur_pair < search_tag )
left = middle+1; left = middle + 1;
else else
right = middle-1; right = middle - 1;
} }
} }
@ -159,16 +165,21 @@
/* and vertical) expressed in fractional points. */ /* and vertical) expressed in fractional points. */
/* */ /* */
/* <Input> */ /* <Input> */
/* char_width :: The character width expressed in 26.6 fractional */ /* char_width :: The character width expressed in 26.6 */
/* points. */ /* fractional points. */
/* char_height :: The character height expressed in 26.6 fractional */ /* */
/* points. */ /* char_height :: The character height expressed in 26.6 */
/* fractional points. */
/* */
/* horz_resolution :: The horizontal resolution of the output device. */
/* */
/* vert_resolution :: The vertical resolution of the output device. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* size :: A handle to the target size object. */ /* size :: A handle to the target size object. */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. */ /* TrueType error code. 0 means success. */
/* */ /* */
static static
TT_Error Set_Char_Sizes( TT_Size size, TT_Error Set_Char_Sizes( TT_Size size,
@ -181,25 +192,27 @@
TT_Face face = (TT_Face)size->root.face; TT_Face face = (TT_Face)size->root.face;
TT_Long dim_x, dim_y; TT_Long dim_x, dim_y;
/* This bit flag, when set, indicates that the pixel size must be */ /* This bit flag, when set, indicates that the pixel size must be */
/* truncated to an integer. Nearly all TrueType fonts have this */ /* truncated to an integer. Nearly all TrueType fonts have this */
/* bit set, as hinting won't work really well otherwise. */ /* bit set, as hinting won't work really well otherwise. */
/* */ /* */
/* However, for those rare fonts who do not set it, we override */ /* However, for those rare fonts who do not set it, we override */
/* the default computations performed by the base layer. I really */ /* the default computations performed by the base layer. I */
/* don't know if this is useful, but hey, that's the spec :-) */ /* really don't know whether this is useful, but hey, that's the */
/* spec :-) */
/* */ /* */
if ( (face->header.Flags & 8) == 0 ) if ( ( face->header.Flags & 8 ) == 0 )
{ {
/* Compute pixel sizes in 26.6 units */ /* Compute pixel sizes in 26.6 units */
dim_x = (char_width * horz_resolution) / 72; dim_x = ( char_width * horz_resolution ) / 72;
dim_y = (char_height * vert_resolution) / 72; dim_y = ( char_height * vert_resolution ) / 72;
metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM );
metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM );
metrics->x_ppem = (TT_UShort)(dim_x >> 6); metrics->x_ppem = (TT_UShort)( dim_x >> 6 );
metrics->y_ppem = (TT_UShort)(dim_y >> 6); metrics->y_ppem = (TT_UShort)( dim_y >> 6 );
} }
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
@ -226,17 +239,17 @@
/* size :: A handle to the target size object. */ /* size :: A handle to the target size object. */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success */ /* TrueType error code. 0 means success. */
/* */ /* */
static static
TT_Error Set_Pixel_Sizes( TT_Size size, TT_Error Set_Pixel_Sizes( TT_Size size,
TT_UInt pixel_width, TT_UInt pixel_width,
TT_UInt pixel_height ) TT_UInt pixel_height )
{ {
UNUSED(pixel_width); UNUSED( pixel_width );
UNUSED(pixel_height); UNUSED( pixel_height );
/* many things were pre-computed by the base layer */ /* many things have been pre-computed by the base layer */
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
@ -257,7 +270,7 @@
/* will be loaded. */ /* will be loaded. */
/* */ /* */
/* size :: A handle to the source face size at which the glyph */ /* size :: A handle to the source face size at which the glyph */
/* must be scaled/loaded/etc. */ /* must be scaled, loaded, etc. */
/* */ /* */
/* glyph_index :: The index of the glyph in the font file. */ /* glyph_index :: The index of the glyph in the font file. */
/* */ /* */
@ -266,13 +279,9 @@
/* glyph loading process (e.g., whether the outline */ /* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */ /* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */ /* whether to hint the outline, etc). */
/* <Output> */
/* result :: A set of bit flags indicating the type of data that */
/* was loaded in the glyph slot (outline, bitmap, */
/* pixmap, etc). */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0 means success. */ /* TrueType error code. 0 means success. */
/* */ /* */
static static
TT_Error Load_Glyph( TT_GlyphSlot slot, TT_Error Load_Glyph( TT_GlyphSlot slot,
@ -286,7 +295,7 @@
if ( !slot ) if ( !slot )
return TT_Err_Invalid_Glyph_Handle; return TT_Err_Invalid_Glyph_Handle;
/* check that we want a scaled outline or bitmap */ /* check whether we want a scaled outline or bitmap */
if ( !size ) if ( !size )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
@ -345,13 +354,14 @@
/* Glyph index. 0 means `undefined character code'. */ /* Glyph index. 0 means `undefined character code'. */
/* */ /* */
static static
FT_UInt Get_Char_Index( TT_CharMap charmap, TT_UInt Get_Char_Index( TT_CharMap charmap,
TT_Long charcode ) TT_Long charcode )
{ {
TT_Error error; TT_Error error;
TT_Face face; TT_Face face;
TT_CMapTable* cmap; TT_CMapTable* cmap;
cmap = &charmap->cmap; cmap = &charmap->cmap;
face = (TT_Face)charmap->root.face; face = (TT_Face)charmap->root.face;
@ -360,9 +370,10 @@
{ {
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
error = sfnt->load_charmap( face, cmap, face->root.stream ); error = sfnt->load_charmap( face, cmap, face->root.stream );
if (error) if ( error )
return error; return 0;
cmap->loaded = TRUE; cmap->loaded = TRUE;
} }
@ -374,19 +385,34 @@
} }
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** D R I V E R I N T E R F A C E ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
static static
FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface ) FTDriver_Interface tt_get_interface( TT_Driver driver,
const char* interface )
{ {
FT_Driver sfntd = FT_Get_Driver( driver->root.library, "sfnt" ); FT_Driver sfntd = FT_Get_Driver( driver->root.library, "sfnt" );
SFNT_Interface* sfnt; SFNT_Interface* sfnt;
/* only return the default interface from the SFNT module */ /* only return the default interface from the SFNT module */
if (sfntd) if ( sfntd )
{ {
sfnt = (SFNT_Interface*)(sfntd->interface.format_interface); sfnt = (SFNT_Interface*)(sfntd->interface.format_interface);
if (sfnt) if ( sfnt )
return sfnt->get_interface( (FT_Driver)driver, interface ); return sfnt->get_interface( (FT_Driver)driver, interface );
} }
return 0; return 0;
} }
@ -406,27 +432,29 @@
(void*)0, (void*)0,
(FTDriver_initDriver) TT_Init_Driver, (FTDriver_initDriver) TT_Init_Driver,
(FTDriver_doneDriver) TT_Done_Driver, (FTDriver_doneDriver) TT_Done_Driver,
(FTDriver_getInterface) tt_get_interface, (FTDriver_getInterface) tt_get_interface,
(FTDriver_initFace) TT_Init_Face, (FTDriver_initFace) TT_Init_Face,
(FTDriver_doneFace) TT_Done_Face, (FTDriver_doneFace) TT_Done_Face,
(FTDriver_getKerning) Get_Kerning, (FTDriver_getKerning) Get_Kerning,
(FTDriver_initSize) TT_Init_Size, (FTDriver_initSize) TT_Init_Size,
(FTDriver_doneSize) TT_Done_Size, (FTDriver_doneSize) TT_Done_Size,
(FTDriver_setCharSizes) Set_Char_Sizes, (FTDriver_setCharSizes) Set_Char_Sizes,
(FTDriver_setPixelSizes) Set_Pixel_Sizes, (FTDriver_setPixelSizes) Set_Pixel_Sizes,
(FTDriver_initGlyphSlot) TT_Init_GlyphSlot, (FTDriver_initGlyphSlot) TT_Init_GlyphSlot,
(FTDriver_doneGlyphSlot) TT_Done_GlyphSlot, (FTDriver_doneGlyphSlot) TT_Done_GlyphSlot,
(FTDriver_loadGlyph) Load_Glyph, (FTDriver_loadGlyph) Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index, (FTDriver_getCharIndex) Get_Char_Index,
}; };
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -447,13 +475,12 @@
/* format-specific interface can then be retrieved through the method */ /* format-specific interface can then be retrieved through the method */
/* interface->get_format_interface. */ /* interface->get_format_interface. */
/* */ /* */
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS EXPORT_FUNC( FT_DriverInterface* ) getDriverInterface( void )
EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
{ {
return &tt_driver_interface; return &tt_driver_interface;
} }
#endif /* CONFIG_OPTION_DYNAMIC_DRIVERS */ #endif /* CONFIG_OPTION_DYNAMIC_DRIVERS */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* High-level TrueType driver interface (specification). */ /* High-level TrueType driver interface (specification). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -25,7 +25,7 @@
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>
FT_EXPORT_VAR(const FT_DriverInterface) tt_driver_interface; FT_EXPORT_VAR( const FT_DriverInterface ) tt_driver_interface;
#endif /* TTDRIVER_H */ #endif /* TTDRIVER_H */

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,11 @@
/* */ /* */
/* TrueType Glyph Loader (specification). */ /* TrueType Glyph Loader (specification). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -29,7 +29,7 @@
extern "C" { extern "C" {
#endif #endif
typedef struct TT_Loader_ typedef struct TT_Loader_
{ {
TT_Face face; TT_Face face;
TT_Size size; TT_Size size;
@ -64,72 +64,12 @@
} TT_Loader; } TT_Loader;
/*************************************************************************/
/* */
/* <Function> */
/* TT_Get_Metrics */
/* */
/* <Description> */
/* Returns the horizontal or vertical metrics in font units for a */
/* given glyph. The metrics are the left side bearing (resp. top */
/* side bearing) and advance width (resp. advance height). */
/* */
/* <Input> */
/* header :: A pointer to either the horizontal or vertical metrics */
/* structure. */
/* */
/* index :: The glyph index. */
/* */
/* <Output> */
/* bearing :: The bearing, either left side or top side. */
/* */
/* advance :: The advance width resp. advance height. */
/* */
/* <Note> */
/* This function will much probably move to another component in the */
/* near future, but I haven't decided which yet. */
/* */
LOCAL_DEF LOCAL_DEF
void TT_Get_Metrics( TT_HoriHeader* header, void TT_Get_Metrics( TT_HoriHeader* header,
TT_UInt index, TT_UInt index,
TT_Short* bearing, TT_Short* bearing,
TT_UShort* advance ); TT_UShort* advance );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_Glyph */
/* */
/* <Description> */
/* A function used to load a single glyph within a given glyph slot, */
/* for a given size. */
/* */
/* <Input> */
/* glyph :: A handle to a 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. */
/* */
/* glyph_index :: The index of the glyph in the font file. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
/* FT_LOAD_XXX 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). */
/* <Output> */
/* result :: A set of bit flags indicating the type of data that */
/* was loaded in the glyph slot (outline or bitmap, */
/* etc). */
/* */
/* You can set this field to 0 if you don't want this */
/* information. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Load_Glyph( TT_Size size, TT_Error TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph, TT_GlyphSlot glyph,
@ -140,7 +80,6 @@
} }
#endif #endif
#endif /* TTGLOAD_H */ #endif /* TTGLOAD_H */

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,13 @@
/* */ /* */
/* ttinterp.h */ /* ttinterp.h */
/* */ /* */
/* TrueType bytecode intepreter (specification). */ /* TrueType bytecode interpreter (specification). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -27,21 +27,21 @@
#endif #endif
#ifndef TT_STATIC_INTEPRETER /* indirect implementation */ #ifndef TT_CONFIG_OPTION_STATIC_INTEPRETER /* indirect implementation */
#define EXEC_OP_ TT_ExecContext exc, #define EXEC_OP_ TT_ExecContext exc,
#define EXEC_OP TT_ExecContext exc #define EXEC_OP TT_ExecContext exc
#define EXEC_ARG_ exc, #define EXEC_ARG_ exc,
#define EXEC_ARG exc #define EXEC_ARG exc
#else /* static implementation */ #else /* static implementation */
#define EXEC_OP_ /* void */ #define EXEC_OP_ /* void */
#define EXEC_OP /* void */ #define EXEC_OP /* void */
#define EXEC_ARG_ /* void */ #define EXEC_ARG_ /* void */
#define EXEC_ARG /* void */ #define EXEC_ARG /* void */
#endif /* TT_STATIC_INTERPRETER */ #endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
/*************************************************************************/ /*************************************************************************/
@ -215,253 +215,48 @@
} TT_ExecContextRec; } TT_ExecContextRec;
LOCAL_DEF LOCAL_DEF
const TT_GraphicsState tt_default_graphics_state; const TT_GraphicsState tt_default_graphics_state;
/*************************************************************************/
/* */
/* <Function> */
/* TT_Goto_CodeRange */
/* */
/* <Description> */
/* Switches to a new code range (updates the code related elements in */
/* `exec', and `IP'). */
/* */
/* <Input> */
/* range :: The new execution code range. */
/* IP :: The new IP in the new code range. */
/* */
/* <InOut> */
/* exec :: The target execution context. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Goto_CodeRange( TT_ExecContext exec, TT_Error TT_Goto_CodeRange( TT_ExecContext exec,
TT_Int range, TT_Int range,
TT_Long IP ); TT_Long IP );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Set_CodeRange */
/* */
/* <Description> */
/* Sets a code range. */
/* */
/* <Input> */
/* range :: The code range index. */
/* base :: The new code base. */
/* length :: The range size in bytes. */
/* */
/* <InOut> */
/* exec :: The target execution context. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Set_CodeRange( TT_ExecContext exec, TT_Error TT_Set_CodeRange( TT_ExecContext exec,
TT_Int range, TT_Int range,
void* base, void* base,
TT_Long length ); TT_Long length );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Clear_CodeRange */
/* */
/* <Description> */
/* Clears a code range. */
/* */
/* <Input> */
/* range :: The code range index. */
/* */
/* <InOut> */
/* exec :: The target execution context. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Does not set the Error variable. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Clear_CodeRange( TT_ExecContext exec, TT_Error TT_Clear_CodeRange( TT_ExecContext exec,
TT_Int range ); TT_Int range );
FT_EXPORT_DEF( TT_ExecContext ) TT_New_Context( TT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* TT_New_Context */
/* */
/* <Description> */
/* Queries the face context for a given font. Note that there is */
/* now a _single_ execution context in the TrueType driver which is */
/* shared among faces. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* <Return> */
/* A handle to the execution context. Initialized for `face'. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
/* This function is publicly exported because it is directly */
/* invoked by the TrueType debugger.. */
/* */
FT_EXPORT_DEF(TT_ExecContext) TT_New_Context( TT_Face face );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Done_Context */
/* */
/* <Description> */
/* Discards an execution context. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Done_Context( TT_ExecContext exec ); TT_Error TT_Done_Context( TT_ExecContext exec );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Destroy_Context */
/* */
/* <Description> */
/* Destroys a given context. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* memory :: A handle to the parent memory object. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Destroy_Context( TT_ExecContext exec, TT_Error TT_Destroy_Context( TT_ExecContext exec,
FT_Memory memory ); FT_Memory memory );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_Context */
/* */
/* <Description> */
/* Prepare an execution context for glyph hinting. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* face :: A handle to the source face object. */
/* size :: A handle to the source size object. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Load_Context( TT_ExecContext exec, TT_Error TT_Load_Context( TT_ExecContext exec,
TT_Face face, TT_Face face,
TT_Size size ); TT_Size size );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Save_Context */
/* */
/* <Description> */
/* Saves the code ranges in a `size' object. */
/* */
/* <Input> */
/* exec :: A handle to the source execution context. */
/* */
/* <Output> */
/* ins :: A handle to the target size object. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Save_Context( TT_ExecContext exec, TT_Error TT_Save_Context( TT_ExecContext exec,
TT_Size ins ); TT_Size ins );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Run_Context */
/* */
/* <Description> */
/* Executes one or more instructions in the execution context. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* */
/* debug :: A Boolean flag. If set, the function sets some internal */
/* variables and returns immediately, otherwise TT_RunIns() */
/* is called. */
/* */
/* <Return> */
/* TrueTyoe error code. 0 means success. */
/* */
/* <Note> */
/* Only the glyph loader and debugger should call this function. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Run_Context( TT_ExecContext exec, TT_Error TT_Run_Context( TT_ExecContext exec,
TT_Bool debug ); TT_Bool debug );
FT_EXPORT_DEF( TT_Error ) TT_RunIns( TT_ExecContext exec );
/*************************************************************************/
/* */
/* <Function> */
/* TT_RunIns */
/* */
/* <Description> */
/* Executes one or more instruction in the execution context. This */
/* is the main function of the TrueType opcode interpreter. */
/* */
/* <Input> */
/* exec :: A handle to the target execution context. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
/* <Note> */
/* Only object manager and debugger should call this function. */
/* */
/* This function is publicly exported because it is directly */
/* invoked by the TrueType debugger.. */
/* */
FT_EXPORT_DEF(TT_Error) TT_RunIns( TT_ExecContext exec );
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -4,11 +4,11 @@
/* */ /* */
/* Objects manager (body). */ /* Objects manager (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -33,7 +33,13 @@
#include <ttinterp.h> #include <ttinterp.h>
#endif #endif
/* required by tracing mode */
/*************************************************************************/
/* */
/* 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 #undef FT_COMPONENT
#define FT_COMPONENT trace_ttobjs #define FT_COMPONENT trace_ttobjs
@ -45,8 +51,6 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -56,8 +60,15 @@
/* Initializes a given TrueType face object. */ /* Initializes a given TrueType face object. */
/* */ /* */
/* <Input> */ /* <Input> */
/* resource :: The source font resource. */ /* stream :: The source font stream. */
/* */
/* face_index :: The index of the font face in the resource. */ /* 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. */ /* face :: The newly built face object. */
/* */ /* */
/* <Return> */ /* <Return> */
@ -70,43 +81,49 @@
TT_Int num_params, TT_Int num_params,
FT_Parameter* params ) FT_Parameter* params )
{ {
TT_Error error; TT_Error error;
FT_Driver sfnt_driver; FT_Driver sfnt_driver;
SFNT_Interface* sfnt; SFNT_Interface* sfnt;
sfnt_driver = FT_Get_Driver( face->root.driver->library, "sfnt" ); sfnt_driver = FT_Get_Driver( face->root.driver->library, "sfnt" );
if (!sfnt_driver) goto Bad_Format; if ( !sfnt_driver )
goto Bad_Format;
sfnt = (SFNT_Interface*)(sfnt_driver->interface.format_interface); sfnt = (SFNT_Interface*)(sfnt_driver->interface.format_interface);
if (!sfnt) goto Bad_Format; if ( !sfnt )
goto Bad_Format;
/* create input stream from resource */ /* create input stream from resource */
if ( FILE_Seek(0) ) if ( FILE_Seek( 0 ) )
goto Exit; goto Exit;
/* check that we have a valid TrueType file */ /* check that we have a valid TrueType file */
error = sfnt->init_face( stream, face, face_index, num_params, params ); error = sfnt->init_face( stream, face, face_index, num_params, params );
if (error) goto Exit; if ( error )
goto Exit;
/* We must also be able to accept Mac/GX fonts, as well as OT ones */ /* We must also be able to accept Mac/GX fonts, as well as OT ones */
if ( face->format_tag != 0x00010000 && /* MS fonts */ if ( face->format_tag != 0x00010000L && /* MS fonts */
face->format_tag != TTAG_true ) /* Mac fonts */ face->format_tag != TTAG_true ) /* Mac fonts */
{ {
FT_TRACE2(( "[not a valid TTF font]" )); FT_TRACE2(( "[not a valid TTF font]\n" ));
goto Bad_Format; goto Bad_Format;
} }
/* If we're performing a simple font format check, exit immediately */ /* If we are performing a simple font format check, exit immediately */
if ( face_index < 0 ) if ( face_index < 0 )
return TT_Err_Ok; return TT_Err_Ok;
/* Load font directory */ /* Load font directory */
error = sfnt->load_face( stream, face, face_index, num_params, params ); error = sfnt->load_face( stream, face, face_index, num_params, params );
if ( error ) goto Exit; if ( error )
goto Exit;
error = TT_Load_Locations( face, stream ) || error = TT_Load_Locations( face, stream ) ||
TT_Load_CVT ( face, stream ) || TT_Load_CVT ( face, stream ) ||
TT_Load_Programs ( face, stream ); TT_Load_Programs ( face, stream );
Exit: Exit:
return error; return error;
@ -136,8 +153,9 @@
SFNT_Interface* sfnt = face->sfnt; SFNT_Interface* sfnt = face->sfnt;
if (sfnt)
sfnt->done_face(face); if ( sfnt )
sfnt->done_face( face );
/* freeing the locations table */ /* freeing the locations table */
FREE( face->glyph_locations ); FREE( face->glyph_locations );
@ -182,6 +200,7 @@
TT_Error error = 0; TT_Error error = 0;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_Face face = (TT_Face)size->root.face; TT_Face face = (TT_Face)size->root.face;
FT_Memory memory = face->root.memory; FT_Memory memory = face->root.memory;
TT_Int i; TT_Int i;
@ -190,6 +209,7 @@
TT_UShort n_twilight; TT_UShort n_twilight;
TT_MaxProfile* maxp = &face->max_profile; TT_MaxProfile* maxp = &face->max_profile;
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
size->max_function_defs = maxp->maxFunctionDefs; size->max_function_defs = maxp->maxFunctionDefs;
@ -209,6 +229,7 @@
FT_Size_Metrics* metrics = &size->root.metrics; FT_Size_Metrics* metrics = &size->root.metrics;
TT_Size_Metrics* metrics2 = &size->ttmetrics; TT_Size_Metrics* metrics2 = &size->ttmetrics;
metrics->x_ppem = 0; metrics->x_ppem = 0;
metrics->y_ppem = 0; metrics->y_ppem = 0;
@ -220,7 +241,7 @@
metrics2->compensations[i] = 0; metrics2->compensations[i] = 0;
} }
/* allocate function defs, instruction defs, cvt and storage area */ /* allocate function defs, instruction defs, cvt, and storage area */
if ( ALLOC_ARRAY( size->function_defs, if ( ALLOC_ARRAY( size->function_defs,
size->max_function_defs, size->max_function_defs,
TT_DefRecord ) || TT_DefRecord ) ||
@ -249,17 +270,18 @@
{ {
FT_Library library = face->root.driver->library; FT_Library library = face->root.driver->library;
face->interpreter = (TT_Interpreter) face->interpreter = (TT_Interpreter)
library->debug_hooks[ FT_DEBUG_HOOK_TRUETYPE ]; library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
if (!face->interpreter) if ( !face->interpreter )
face->interpreter = (TT_Interpreter)TT_RunIns; face->interpreter = (TT_Interpreter)TT_RunIns;
} }
/* Fine, now execute the font program! */ /* Fine, now execute the font program! */
exec = size->context; exec = size->context;
if (!size->debug)
exec = TT_New_Context( face );
/* size objects used during debugging have their own context */ /* size objects used during debugging have their own context */
if ( !size->debug )
exec = TT_New_Context( face );
if ( !exec ) if ( !exec )
{ {
@ -282,14 +304,14 @@
TT_Size_Metrics* tt_metrics = &exec->tt_metrics; TT_Size_Metrics* tt_metrics = &exec->tt_metrics;
metrics->x_ppem = 0; metrics->x_ppem = 0;
metrics->y_ppem = 0; metrics->y_ppem = 0;
metrics->x_scale = 0; metrics->x_scale = 0;
metrics->y_scale = 0; metrics->y_scale = 0;
tt_metrics->ppem = 0; tt_metrics->ppem = 0;
tt_metrics->scale = 0; tt_metrics->scale = 0;
tt_metrics->ratio = 0x10000; tt_metrics->ratio = 0x10000L;
} }
exec->instruction_trap = FALSE; exec->instruction_trap = FALSE;
@ -332,11 +354,13 @@
return error; return error;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
Fail_Exec: Fail_Exec:
if ( !size->debug ) if ( !size->debug )
TT_Done_Context( exec ); TT_Done_Context( exec );
Fail_Memory: Fail_Memory:
#endif #endif
TT_Done_Size( size ); TT_Done_Size( size );
@ -358,9 +382,12 @@
LOCAL_FUNC LOCAL_FUNC
void TT_Done_Size( TT_Size size ) void TT_Done_Size( TT_Size size )
{ {
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
FT_Memory memory = size->root.face->memory; FT_Memory memory = size->root.face->memory;
if ( size->debug ) if ( size->debug )
{ {
/* the debug context must be deleted by the debugger itself */ /* the debug context must be deleted by the debugger itself */
@ -380,6 +407,7 @@
FREE( size->function_defs ); FREE( size->function_defs );
FREE( size->instruction_defs ); FREE( size->instruction_defs );
size->num_function_defs = 0; size->num_function_defs = 0;
size->max_function_defs = 0; size->max_function_defs = 0;
size->num_instruction_defs = 0; size->num_instruction_defs = 0;
@ -387,6 +415,7 @@
size->max_func = 0; size->max_func = 0;
size->max_ins = 0; size->max_ins = 0;
#endif #endif
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
@ -413,6 +442,7 @@
FT_Size_Metrics* metrics; FT_Size_Metrics* metrics;
if ( size->ttmetrics.valid ) if ( size->ttmetrics.valid )
return TT_Err_Ok; return TT_Err_Ok;
@ -428,7 +458,7 @@
{ {
size->ttmetrics.scale = metrics->x_scale; size->ttmetrics.scale = metrics->x_scale;
size->ttmetrics.ppem = metrics->x_ppem; size->ttmetrics.ppem = metrics->x_ppem;
size->ttmetrics.x_ratio = 0x10000; size->ttmetrics.x_ratio = 0x10000L;
size->ttmetrics.y_ratio = FT_MulDiv( metrics->y_ppem, size->ttmetrics.y_ratio = FT_MulDiv( metrics->y_ppem,
0x10000L, 0x10000L,
metrics->x_ppem ); metrics->x_ppem );
@ -440,7 +470,7 @@
size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem, size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem,
0x10000L, 0x10000L,
metrics->y_ppem ); metrics->y_ppem );
size->ttmetrics.y_ratio = 0x10000; size->ttmetrics.y_ratio = 0x10000L;
} }
/* Compute root ascender, descender, test height, and max_advance */ /* Compute root ascender, descender, test height, and max_advance */
@ -457,13 +487,14 @@
metrics->x_scale ) + 32 ) & -64; metrics->x_scale ) + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{ {
TT_ExecContext exec; TT_ExecContext exec;
TT_UInt i, j; TT_UInt i, j;
/* Scale the cvt values to the new ppem. */ /* Scale the cvt values to the new ppem. */
/* We use by default the y ppem to scale the CVT. */ /* We use by default the y ppem to scale the CVT. */
for ( i = 0; i < size->cvt_size; i++ ) for ( i = 0; i < size->cvt_size; i++ )
size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
@ -528,6 +559,7 @@
TT_Done_Context( exec ); TT_Done_Context( exec );
/* debugging instances keep their context */ /* debugging instances keep their context */
} }
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
if ( !error ) if ( !error )
@ -559,7 +591,7 @@
FT_Library library = face->driver->library; FT_Library library = face->driver->library;
FT_TRACE4(( "TT.Init_GlyphSlot: Creating outline maxp = %d, maxc = %d\n", FT_TRACE4(( "TT_Init_GlyphSlot: Creating outline maxp = %d, maxc = %d\n",
face->max_points, face->max_contours )); face->max_points, face->max_contours ));
return FT_Outline_New( library, return FT_Outline_New( library,
@ -586,7 +618,8 @@
FT_Library library = slot->face->driver->library; FT_Library library = slot->face->driver->library;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
if (slot->flags & ft_glyph_own_bitmap)
if ( slot->flags & ft_glyph_own_bitmap )
FREE( slot->bitmap.buffer ); FREE( slot->bitmap.buffer );
FT_Outline_Done( library, &slot->outline ); FT_Outline_Done( library, &slot->outline );
@ -614,10 +647,13 @@
FT_Memory memory = driver->root.memory; FT_Memory memory = driver->root.memory;
FT_Error error; FT_Error error;
error = FT_New_GlyphZone( memory, 0, 0, &driver->zone ); error = FT_New_GlyphZone( memory, 0, 0, &driver->zone );
if (error) return error; if ( error )
return error;
/* init extension registry if needed */ /* init extension registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
return TT_Init_Extensions( driver ); return TT_Init_Extensions( driver );
#else #else
@ -641,6 +677,7 @@
void TT_Done_Driver( TT_Driver driver ) void TT_Done_Driver( TT_Driver driver )
{ {
/* destroy extensions registry if needed */ /* destroy extensions registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
TT_Done_Extensions( driver ); TT_Done_Extensions( driver );
#endif #endif
@ -649,12 +686,14 @@
FT_Done_GlyphZone( &driver->zone ); FT_Done_GlyphZone( &driver->zone );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* destroy the execution context */ /* destroy the execution context */
if ( driver->context ) if ( driver->context )
{ {
TT_Destroy_Context( driver->context, driver->root.memory ); TT_Destroy_Context( driver->context, driver->root.memory );
driver->context = NULL; driver->context = NULL;
} }
#endif #endif
} }

View File

@ -4,11 +4,11 @@
/* */ /* */
/* Objects manager (specification). */ /* Objects manager (specification). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -209,7 +209,7 @@
/* */ /* */
/* A note regarding non-squared pixels: */ /* A note regarding non-squared pixels: */
/* */ /* */
/* (This text will probably go into some docs at some time, for now, it */ /* (This text will probably go into some docs at some time; for now, it */
/* is kept here to explain some definitions in the TIns_Metrics */ /* is kept here to explain some definitions in the TIns_Metrics */
/* record). */ /* record). */
/* */ /* */
@ -312,6 +312,7 @@
TT_Size_Metrics ttmetrics; TT_Size_Metrics ttmetrics;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_UInt num_function_defs; /* number of function definitions */ TT_UInt num_function_defs; /* number of function definitions */
TT_UInt max_function_defs; TT_UInt max_function_defs;
TT_DefArray function_defs; /* table of function definitions */ TT_DefArray function_defs; /* table of function definitions */
@ -364,45 +365,60 @@
} TT_DriverRec; } TT_DriverRec;
/*************************************************************************/ /*************************************************************************/
/* Face Funcs */ /* */
/* Face functions */
/* */
LOCAL_DEF
TT_Error TT_Init_Face( FT_Stream stream,
TT_Face face,
TT_Int face_index,
TT_Int num_params,
FT_Parameter* params );
LOCAL_DEF TT_Error TT_Init_Face( FT_Stream stream, LOCAL_DEF
TT_Face face, void TT_Done_Face( TT_Face face );
TT_Int face_index,
TT_Int num_params,
FT_Parameter* params );
LOCAL_DEF void TT_Done_Face( TT_Face face );
/*************************************************************************/ /*************************************************************************/
/* Size funcs */ /* */
/* Size functions */
/* */
LOCAL_DEF
TT_Error TT_Init_Size( TT_Size size );
LOCAL_DEF TT_Error TT_Init_Size ( TT_Size size ); LOCAL_DEF
LOCAL_DEF void TT_Done_Size ( TT_Size size ); void TT_Done_Size( TT_Size size );
LOCAL_DEF TT_Error TT_Reset_Size( TT_Size size );
LOCAL_DEF
TT_Error TT_Reset_Size( TT_Size size );
/*************************************************************************/ /*************************************************************************/
/* GlyphSlot funcs */ /* */
/* GlyphSlot functions */
/* */
LOCAL_DEF
TT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot );
LOCAL_DEF TT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot ); LOCAL_DEF
LOCAL_DEF void TT_Done_GlyphSlot( TT_GlyphSlot slot ); void TT_Done_GlyphSlot( TT_GlyphSlot slot );
/*************************************************************************/ /*************************************************************************/
/* Driver funcs */ /* */
/* Driver functions */
LOCAL_DEF TT_Error TT_Init_Driver( TT_Driver driver ); /* */
LOCAL_DEF void TT_Done_Driver( TT_Driver driver ); LOCAL_DEF
TT_Error TT_Init_Driver( TT_Driver driver );
LOCAL_DEF
void TT_Done_Driver( TT_Driver driver );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* TTOBJS_H */ #endif /* TTOBJS_H */

View File

@ -4,11 +4,11 @@
/* */ /* */
/* TrueType glyph data/program tables loader (body). */ /* TrueType glyph data/program tables loader (body). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -24,8 +24,16 @@
#include <ttpload.h> #include <ttpload.h>
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.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 #undef FT_COMPONENT
#define FT_COMPONENT trace_ttload #define FT_COMPONENT trace_ttpload
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -35,8 +43,10 @@
/* <Description> */ /* <Description> */
/* Loads the locations table. */ /* Loads the locations table. */
/* */ /* */
/* <Input> */ /* <InOut> */
/* face :: A handle to the target face object. */ /* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: The input stream. */ /* stream :: The input stream. */
/* */ /* */
/* <Return> */ /* <Return> */
@ -51,11 +61,12 @@
TT_Short LongOffsets; TT_Short LongOffsets;
TT_ULong table_len; TT_ULong table_len;
FT_TRACE2(( "Locations " )); FT_TRACE2(( "Locations " ));
LongOffsets = face->header.Index_To_Loc_Format; LongOffsets = face->header.Index_To_Loc_Format;
error = face->goto_table( face, TTAG_loca, stream, &table_len ); error = face->goto_table( face, TTAG_loca, stream, &table_len );
if (error) if ( error )
{ {
error = TT_Err_Locations_Missing; error = TT_Err_Locations_Missing;
goto Exit; goto Exit;
@ -63,9 +74,9 @@
if ( LongOffsets != 0 ) if ( LongOffsets != 0 )
{ {
face->num_locations = (TT_UShort)(table_len >> 2); face->num_locations = (TT_UShort)( table_len >> 2 );
FT_TRACE2(( "(32 bits offsets): %12d ", face->num_locations )); FT_TRACE2(( "(32bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations, if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations, face->num_locations,
@ -79,6 +90,7 @@
TT_Long* loc = face->glyph_locations; TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations; TT_Long* limit = loc + face->num_locations;
for ( ; loc < limit; loc++ ) for ( ; loc < limit; loc++ )
*loc = GET_Long(); *loc = GET_Long();
} }
@ -87,10 +99,9 @@
} }
else else
{ {
face->num_locations = (TT_UShort)(table_len >> 1); face->num_locations = (TT_UShort)( table_len >> 1 );
FT_TRACE2(( "(16 bits offsets): %12d ", FT_TRACE2(( "(16bit offsets): %12d ", face->num_locations ));
face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations, if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations, face->num_locations,
@ -103,8 +114,9 @@
TT_Long* loc = face->glyph_locations; TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations; TT_Long* limit = loc + face->num_locations;
for ( ; loc < limit; loc++ ) for ( ; loc < limit; loc++ )
*loc = (TT_Long)((TT_ULong)GET_UShort() * 2); *loc = (TT_Long)( (TT_ULong)GET_UShort() * 2 );
} }
FORGET_Frame(); FORGET_Frame();
} }
@ -124,8 +136,10 @@
/* <Description> */ /* <Description> */
/* Loads the control value table into a face object. */ /* Loads the control value table into a face object. */
/* */ /* */
/* <Input> */ /* <InOut> */
/* face :: A handle to the target face object. */ /* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: A handle to the input stream. */ /* stream :: A handle to the input stream. */
/* */ /* */
/* <Return> */ /* <Return> */
@ -139,10 +153,11 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
TT_ULong table_len; TT_ULong table_len;
FT_TRACE2(( "CVT " )); FT_TRACE2(( "CVT " ));
error = face->goto_table( face, TTAG_cvt, stream, &table_len ); error = face->goto_table( face, TTAG_cvt, stream, &table_len );
if (error) if ( error )
{ {
FT_TRACE2(( "is missing!\n" )); FT_TRACE2(( "is missing!\n" ));
@ -167,6 +182,7 @@
TT_Short* cur = face->cvt; TT_Short* cur = face->cvt;
TT_Short* limit = cur + face->cvt_size; TT_Short* limit = cur + face->cvt_size;
for ( ; cur < limit; cur++ ) for ( ; cur < limit; cur++ )
*cur = GET_Short(); *cur = GET_Short();
} }
@ -187,8 +203,10 @@
/* <Description> */ /* <Description> */
/* Loads the font program and the cvt program. */ /* Loads the font program and the cvt program. */
/* */ /* */
/* <Input> */ /* <InOut> */
/* face :: A handle to the target face object. */ /* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: A handle to the input stream. */ /* stream :: A handle to the input stream. */
/* */ /* */
/* <Return> */ /* <Return> */
@ -201,6 +219,7 @@
TT_Error error; TT_Error error;
TT_ULong table_len; TT_ULong table_len;
FT_TRACE2(( "Font program " )); FT_TRACE2(( "Font program " ));
/* The font program is optional */ /* The font program is optional */
@ -209,6 +228,7 @@
{ {
face->font_program = NULL; face->font_program = NULL;
face->font_program_size = 0; face->font_program_size = 0;
FT_TRACE2(( "is missing!\n" )); FT_TRACE2(( "is missing!\n" ));
} }
else else
@ -236,6 +256,7 @@
face->cvt_program_size = table_len; face->cvt_program_size = table_len;
if ( EXTRACT_Frame( table_len, face->cvt_program ) ) if ( EXTRACT_Frame( table_len, face->cvt_program ) )
goto Exit; goto Exit;
FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size )); FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
} }

View File

@ -4,11 +4,11 @@
/* */ /* */
/* TrueType glyph data/program tables loader (specification). */ /* TrueType glyph data/program tables loader (specification). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -27,61 +27,14 @@
#endif #endif
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_Locations */
/* */
/* <Description> */
/* Loads the locations table. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* stream :: The input stream. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Load_Locations( TT_Face face, TT_Error TT_Load_Locations( TT_Face face,
FT_Stream stream ); FT_Stream stream );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_CVT */
/* */
/* <Description> */
/* Loads the control value table into a face object. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Load_CVT( TT_Face face, TT_Error TT_Load_CVT( TT_Face face,
FT_Stream stream ); FT_Stream stream );
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_Progams */
/* */
/* <Description> */
/* Loads the font program and the cvt program. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_DEF LOCAL_DEF
TT_Error TT_Load_Programs( TT_Face face, TT_Error TT_Load_Programs( TT_Face face,
FT_Stream stream ); FT_Stream stream );

View File

@ -1,85 +1,16 @@
#**************************************************************************** #
#* * # FreeType 2 Type 1 driver configuration rules
#* Type1 driver Makefile * #
#* *
#* Copyright 1996-1999 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. *
#* *
#****************************************************************************
#**************************************************************************** # Copyright 1996-2000 by
#* * # David Turner, Robert Wilhelm, and Werner Lemberg.
#* IMPORTANT NOTE: This Makefile is intended for GNU Make! * #
#* If you provide Makefiles for other make utilities, * # This file is part of the FreeType project, and may only be used, modified,
#* please place them in `freetype/lib/arch/<system>'. * # 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
#* This file is to be included by the FreeType Makefile.lib, located in * # fully.
#* the `freetype/lib' directory. Here is the list of the variables that *
#* must be defined to use it: *
#* *
#* *
#* BASE_DIR: The location of the base layer's directory. This is *
#* usually `freetype/lib/base'. *
#* *
#* ARCH_DIR: The location of the architecture-dependent directory. *
#* This is usually `freetype/lib/arch/<system>'. *
#* *
#* DRIVERS_DIR: The location of the font driver sub-dirs, usually *
#* `freetype/lib/drivers'. *
#* *
#* OBJ_DIR: The location where the compiled object(s) file will be *
#* placed. *
#* *
#* BASE_H: A list of pathnames to the base layer's header files on *
#* which the driver depends. *
#* *
#* FT_CFLAGS: A set of flags used for compilation of object files. *
#* This contains at least the include paths of the arch *
#* and base directories + optimization + warnings + ANSI *
#* compliance. *
#* *
#* FT_IFLAG: The flag used to specify an include path on the *
#* compiler command line. For example, with GCC, this is *
#* `-I', while some other compilers use `/i=' or `-J', *
#* etc. *
#* *
#* FT_OBJ: The suffix of an object file for the platform; can be *
#* `o', `obj', `coff', `tco', etc. depending on the *
#* platform. *
#* *
#* *
#* It also updates the following variables defined and used in the main *
#* Makefile: *
#* *
#* DRV_OBJ_S: The list of driver object files in *
#* single-object mode. *
#* *
#* DRV_OBJ_M: The list of driver object files in *
#* multiple-objects mode. *
#* *
#* FTINIT_DRIVER_PATHS: The list of include paths used to compile the *
#* `ftinit' component which registers all font *
#* drivers in the FT_Init_FreeType() function. *
#* *
#* FTINIT_DRIVER_H: The list of header dependencies used to *
#* compile the `ftinit' component. *
#* *
#* FTINIT_DRIVER_MACROS: The list of macros to be defined when *
#* compiling the `ftinit' component. *
#* *
#* `Single-object compilation' means that each font driver is compiled *
#* into a single object file. This is useful to get rid of all *
#* driver-specific entries. *
#* *
#****************************************************************************
# Type1 driver directory # Type1 driver directory
@ -90,62 +21,52 @@ T1_DIR_ := $(T1_DIR)$(SEP)
# additional include flags used when compiling the driver # additional include flags used when compiling the driver
# #
T1_INCLUDE := $(SHARED) $(T1_DIR) T1_INCLUDE := $(T1_DIR)
T1_COMPILE := $(FT_COMPILE) $(T1_INCLUDE:%=$I%)
# compilation flags for the driver
#
T1_CFLAGS := $(T1_INCLUDE:%=$I%)
T1_COMPILE := $(FT_COMPILE) $(T1_CFLAGS)
# Type1 driver sources (i.e., C files) # Type1 driver sources (i.e., C files)
# #
T1_DRV_SRC := $(T1_DIR_)t1objs.c \ T1_DRV_SRC := $(T1_DIR_)t1objs.c \
$(T1_DIR_)t1load.c \ $(T1_DIR_)t1load.c \
$(T1_DIR_)t1parse.c \ $(T1_DIR_)t1parse.c \
$(T1_DIR_)t1tokens.c \ $(T1_DIR_)t1tokens.c \
$(T1_DIR_)t1driver.c \ $(T1_DIR_)t1driver.c \
$(T1_DIR_)t1hinter.c \ $(T1_DIR_)t1hinter.c \
$(T1_DIR_)t1afm.c \ $(T1_DIR_)t1afm.c \
$(T1_DIR_)t1gload.c $(T1_DIR_)t1gload.c
# Type1 driver headers # Type1 driver headers
# #
T1_DRV_H := $(T1SHARED_H) \ T1_DRV_H := $(T1_DRV_SRC:%.c=%.h)
$(T1_DRV_SRC:%.c=%.h)
# driver object(s) # Type1 driver object(s)
# #
# T1_DRV_OBJ_M is used during `debug' builds # T1_DRV_OBJ_M is used during `multi' builds
# T1_DRV_OBJ_S is used during `release' builds # T1_DRV_OBJ_S is used during `single' builds
# #
T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O) \ T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O)
$(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_S := $(OBJ_)type1.$O T1_DRV_OBJ_S := $(OBJ_)type1.$O
# Type1 driver source file for single build
# driver root source file(s)
# #
T1_DRV_SRC_M := $(T1_DRV_SRC) $(T1SHARED_SRC)
T1_DRV_SRC_S := $(T1_DIR_)type1.c T1_DRV_SRC_S := $(T1_DIR_)type1.c
# driver - single object # Type1 driver - single object
# #
# the driver is recompiled if any of the header or source files is changed $(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)
#
$(T1_DRV_OBJ_S): $(BASE_H) $(T1_DRV_H) $(T1_DRV_SRC) $(T1_DRV_SRC_S)
$(T1_COMPILE) $T$@ $(T1_DRV_SRC_S) $(T1_COMPILE) $T$@ $(T1_DRV_SRC_S)
# Type1 driver - multiple objects
# driver - multiple objects
# #
# All objects are recompiled if any of the header files is changed $(OBJ_)%.$O: $(T1_DIR_)%.c $(FREETYPE_H) $(T1_DRV_H)
#
$(OBJ_)t1%.$O: $(T1_DIR_)t1%.c $(BASE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $<
$(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
$(T1_COMPILE) $T$@ $< $(T1_COMPILE) $T$@ $<
@ -154,4 +75,4 @@ $(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
DRV_OBJS_S += $(T1_DRV_OBJ_S) DRV_OBJS_S += $(T1_DRV_OBJ_S)
DRV_OBJS_M += $(T1_DRV_OBJ_M) DRV_OBJS_M += $(T1_DRV_OBJ_M)
# END # EOF

View File

@ -1,31 +1,18 @@
# #
# FreeType 2 driver configuration rules # FreeType 2 Type1z driver configuration rules
# #
# Copyright 1996-2000 by # Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used modified # This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license, # and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you # LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it # indicate that you have read the license and understand and accept it
# fully. # fully.
#****************************************************************************
#* *
#* The "Type1z" driver is an experimental replacement for the current *
#* Type 1 driver. It features a very different loading mechanism that *
#* is much faster than the one used by the `normal' driver, and also *
#* deals nicely with nearly broken Type 1 font files. It is also *
#* much smaller... *
#* *
#* Note that it may become a permanent replacement of the current *
#* "src/type1" driver in the future.. *
#* *
#****************************************************************************
# Type1z driver directory # Type1z driver directory
# #
T1Z_DIR := $(SRC_)type1z T1Z_DIR := $(SRC_)type1z
@ -35,7 +22,11 @@ T1Z_DIR_ := $(T1Z_DIR)$(SEP)
# additional include flags used when compiling the driver # additional include flags used when compiling the driver
# #
T1Z_INCLUDE := $(SHARED) $(T1Z_DIR) T1Z_INCLUDE := $(SHARED) $(T1Z_DIR)
T1Z_COMPILE := $(FT_COMPILE) $(T1Z_INCLUDE:%=$I%)
# compilation flags for the driver
#
T1Z_CFLAGS := $(T1Z_INCLUDE:%=$I%)
T1Z_COMPILE := $(FT_COMPILE) $(T1Z_CFLAGS)
# Type1 driver sources (i.e., C files) # Type1 driver sources (i.e., C files)
@ -44,46 +35,37 @@ T1Z_DRV_SRC := $(T1Z_DIR_)t1parse.c \
$(T1Z_DIR_)t1load.c \ $(T1Z_DIR_)t1load.c \
$(T1Z_DIR_)t1driver.c \ $(T1Z_DIR_)t1driver.c \
$(T1Z_DIR_)t1afm.c \ $(T1Z_DIR_)t1afm.c \
$(T1Z_DIR_)t1gload.c $(T1Z_DIR_)t1gload.c \
$(T1Z_DIR_)t1objs.c
# Type1 driver headers # Type1 driver headers
# #
T1Z_DRV_H := $(T1SHARED_H) \ T1Z_DRV_H := $(T1Z_DRV_SRC:%.c=%.h) \
$(T1Z_DRV_SRC:%.c=%.h) $(T1Z_DIR_)t1tokens.h
# driver object(s) # Type1z driver object(s)
# #
# T1Z_DRV_OBJ_M is used during `debug' builds # T1Z_DRV_OBJ_M is used during `multi' builds
# T1Z_DRV_OBJ_S is used during `release' builds # T1Z_DRV_OBJ_S is used during `single' builds
# #
T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O) \ T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O)
$(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
T1Z_DRV_OBJ_S := $(OBJ_)type1z.$O T1Z_DRV_OBJ_S := $(OBJ_)type1z.$O
# Type1z driver source file for single build
# driver source file(s)
# #
T1Z_DRV_SRC_M := $(T1Z_DRV_SRC) $(T1SHARED_SRC)
T1Z_DRV_SRC_S := $(T1Z_DIR_)type1z.c T1Z_DRV_SRC_S := $(T1Z_DIR_)type1z.c
# driver - single object # Type1z driver - single object
# #
# the driver is recompiled if any of the header or source files is changed $(T1Z_DRV_OBJ_S): $(T1Z_DRV_SRC_S) $(T1Z_DRV_SRC) $(FREETYPE_H) $(T1Z_DRV_H)
#
$(T1Z_DRV_OBJ_S): $(BASE_H) $(T1Z_DRV_H) $(T1Z_DRV_SRC) $(T1Z_DRV_SRC_S)
$(T1Z_COMPILE) $T$@ $(T1Z_DRV_SRC_S) $(T1Z_COMPILE) $T$@ $(T1Z_DRV_SRC_S)
# driver - multiple objects # Type1z driver - multiple objects
# #
# All objects are recompiled if any of the header files is changed $(OBJ_)%.$O: $(T1Z_DIR_)%.c $(FREETYPE_H) $(T1Z_DRV_H)
#
$(OBJ_)t1%.$O: $(T1Z_DIR_)t1%.c $(BASE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $<
$(OBJ_)t1%.$O: $(T1SHARED_DIR_)t1%.c $(BASE_H) $(T1SHARED_H)
$(T1Z_COMPILE) $T$@ $< $(T1Z_COMPILE) $T$@ $<