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 );
#endif /* OLD_CALCS */
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
#else /* LONG64 */

View File

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

View File

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

View File

@ -4,11 +4,11 @@
/* */
/* FreeType OpenType driver component (body only). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -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
#include <t2driver.c> /* driver interface */
@ -47,4 +24,5 @@
#include <t2objs.c> /* object management */
#include <t2gload.c> /* glyph loader */
/* END */

View File

@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
/* Copyright 1996-1999 by */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -25,9 +25,14 @@
#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
#define FT_COMPONENT trace_ttdriver
#define FT_COMPONENT trace_t2driver
/*************************************************************************/
@ -43,7 +48,9 @@
/*************************************************************************/
#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). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -22,13 +22,21 @@
#include <freetype/internal/sfnt.h>
#include <freetype/tttags.h>
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1gload
#include <t2load.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_rmoveto,

View File

@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (body). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -26,8 +26,16 @@
#include <t2load.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
#define FT_COMPONENT trace_ttload
#define FT_COMPONENT trace_t2load
/* read a CFF offset from memory */
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. */
/* */
/* This file is part of the FreeType project, and may only be used */
/* modified and distributed under the terms of the FreeType project */
/* 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. */
@ -29,9 +29,15 @@
#include <t2load.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 <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_Syntax_Error FT_Err_Invalid_Argument

View File

@ -22,6 +22,16 @@
#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> */

View File

@ -32,6 +32,17 @@
#include <ttpost.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' */
/* module to grab the glyph names. */

View File

@ -23,6 +23,16 @@
#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> */

View File

@ -4,11 +4,11 @@
/* */
/* FreeType TrueType driver component (body only). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -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
#include <ttdriver.c> /* driver interface */
@ -49,4 +26,6 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <ttinterp.c> /* bytecode interpreter */
#endif
/* END */

View File

@ -4,7 +4,7 @@
/* */
/* TrueType font driver implementation (body). */
/* */
/* Copyright 1996-1999 by */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -25,11 +25,16 @@
#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
#define FT_COMPONENT trace_ttdriver
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -45,7 +50,8 @@
#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. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* TrueType 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 */
/* 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. */
@ -107,7 +113,7 @@
while ( left <= right )
{
TT_Int middle = left + ((right-left) >> 1);
TT_Int middle = left + ( ( right - left ) >> 1 );
TT_ULong cur_pair;
@ -118,9 +124,9 @@
goto Found;
if ( cur_pair < search_tag )
left = middle+1;
left = middle + 1;
else
right = middle-1;
right = middle - 1;
}
}
@ -159,16 +165,21 @@
/* and vertical) expressed in fractional points. */
/* */
/* <Input> */
/* char_width :: The character width expressed in 26.6 fractional */
/* points. */
/* char_height :: The character height expressed in 26.6 fractional */
/* points. */
/* char_width :: The character width 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> */
/* size :: A handle to the target size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* TrueType error code. 0 means success. */
/* */
static
TT_Error Set_Char_Sizes( TT_Size size,
@ -181,25 +192,27 @@
TT_Face face = (TT_Face)size->root.face;
TT_Long dim_x, dim_y;
/* 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. */
/* */
/* However, for those rare fonts who do not set it, we override */
/* the default computations performed by the base layer. I really */
/* don't know if this is useful, but hey, that's the spec :-) */
/* the default computations performed by the base layer. I */
/* 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 */
dim_x = (char_width * horz_resolution) / 72;
dim_y = (char_height * vert_resolution) / 72;
dim_x = ( char_width * horz_resolution ) / 72;
dim_y = ( char_height * vert_resolution ) / 72;
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->x_ppem = (TT_UShort)(dim_x >> 6);
metrics->y_ppem = (TT_UShort)(dim_y >> 6);
metrics->x_ppem = (TT_UShort)( dim_x >> 6 );
metrics->y_ppem = (TT_UShort)( dim_y >> 6 );
}
size->ttmetrics.valid = FALSE;
@ -226,17 +239,17 @@
/* size :: A handle to the target size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success */
/* TrueType error code. 0 means success. */
/* */
static
TT_Error Set_Pixel_Sizes( TT_Size size,
TT_UInt pixel_width,
TT_UInt pixel_height )
{
UNUSED(pixel_width);
UNUSED(pixel_height);
UNUSED( pixel_width );
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;
@ -257,7 +270,7 @@
/* will be loaded. */
/* */
/* 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. */
/* */
@ -266,13 +279,9 @@
/* 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, bitmap, */
/* pixmap, etc). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* TrueType error code. 0 means success. */
/* */
static
TT_Error Load_Glyph( TT_GlyphSlot slot,
@ -286,7 +295,7 @@
if ( !slot )
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 )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
@ -345,13 +354,14 @@
/* Glyph index. 0 means `undefined character code'. */
/* */
static
FT_UInt Get_Char_Index( TT_CharMap charmap,
TT_UInt Get_Char_Index( TT_CharMap charmap,
TT_Long charcode )
{
TT_Error error;
TT_Face face;
TT_CMapTable* cmap;
cmap = &charmap->cmap;
face = (TT_Face)charmap->root.face;
@ -360,9 +370,10 @@
{
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
error = sfnt->load_charmap( face, cmap, face->root.stream );
if (error)
return error;
if ( error )
return 0;
cmap->loaded = TRUE;
}
@ -374,19 +385,34 @@
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** D R I V E R I N T E R F A C E ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
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" );
SFNT_Interface* sfnt;
/* only return the default interface from the SFNT module */
if (sfntd)
if ( sfntd )
{
sfnt = (SFNT_Interface*)(sfntd->interface.format_interface);
if (sfnt)
if ( sfnt )
return sfnt->get_interface( (FT_Driver)driver, interface );
}
return 0;
}
@ -406,27 +432,29 @@
(void*)0,
(FTDriver_initDriver) TT_Init_Driver,
(FTDriver_doneDriver) TT_Done_Driver,
(FTDriver_getInterface) tt_get_interface,
(FTDriver_initDriver) TT_Init_Driver,
(FTDriver_doneDriver) TT_Done_Driver,
(FTDriver_getInterface) tt_get_interface,
(FTDriver_initFace) TT_Init_Face,
(FTDriver_doneFace) TT_Done_Face,
(FTDriver_getKerning) Get_Kerning,
(FTDriver_initFace) TT_Init_Face,
(FTDriver_doneFace) TT_Done_Face,
(FTDriver_getKerning) Get_Kerning,
(FTDriver_initSize) TT_Init_Size,
(FTDriver_doneSize) TT_Done_Size,
(FTDriver_setCharSizes) Set_Char_Sizes,
(FTDriver_setPixelSizes) Set_Pixel_Sizes,
(FTDriver_initSize) TT_Init_Size,
(FTDriver_doneSize) TT_Done_Size,
(FTDriver_setCharSizes) Set_Char_Sizes,
(FTDriver_setPixelSizes) Set_Pixel_Sizes,
(FTDriver_initGlyphSlot) TT_Init_GlyphSlot,
(FTDriver_doneGlyphSlot) TT_Done_GlyphSlot,
(FTDriver_loadGlyph) Load_Glyph,
(FTDriver_initGlyphSlot) TT_Init_GlyphSlot,
(FTDriver_doneGlyphSlot) TT_Done_GlyphSlot,
(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 */
/* 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;
}
#endif /* CONFIG_OPTION_DYNAMIC_DRIVERS */

View File

@ -4,7 +4,7 @@
/* */
/* High-level TrueType driver interface (specification). */
/* */
/* Copyright 1996-1999 by */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -25,7 +25,7 @@
#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 */

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,11 @@
/* */
/* TrueType Glyph Loader (specification). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -29,7 +29,7 @@
extern "C" {
#endif
typedef struct TT_Loader_
typedef struct TT_Loader_
{
TT_Face face;
TT_Size size;
@ -64,72 +64,12 @@
} 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
void TT_Get_Metrics( TT_HoriHeader* header,
TT_UInt index,
TT_Short* bearing,
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
TT_Error TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph,
@ -140,7 +80,6 @@
}
#endif
#endif /* TTGLOAD_H */

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,13 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used */
/* modified and distributed under the terms of the FreeType project */
/* 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. */
@ -27,21 +27,21 @@
#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_ARG_ exc,
#define EXEC_ARG exc
#else /* static implementation */
#else /* static implementation */
#define EXEC_OP_ /* void */
#define EXEC_OP /* 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;
LOCAL_DEF
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
TT_Error TT_Goto_CodeRange( TT_ExecContext exec,
TT_Int range,
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
TT_Error TT_Set_CodeRange( TT_ExecContext exec,
TT_Int range,
void* base,
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
TT_Error TT_Clear_CodeRange( TT_ExecContext exec,
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
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
TT_Error TT_Destroy_Context( TT_ExecContext exec,
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
TT_Error TT_Load_Context( TT_ExecContext exec,
TT_Face face,
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
TT_Error TT_Save_Context( TT_ExecContext exec,
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
TT_Error TT_Run_Context( TT_ExecContext exec,
TT_Bool debug );
/*************************************************************************/
/* */
/* <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 );
FT_EXPORT_DEF( TT_Error ) TT_RunIns( TT_ExecContext exec );
#ifdef __cplusplus

View File

@ -4,11 +4,11 @@
/* */
/* Objects manager (body). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -33,7 +33,13 @@
#include <ttinterp.h>
#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
#define FT_COMPONENT trace_ttobjs
@ -45,8 +51,6 @@
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
@ -56,8 +60,15 @@
/* Initializes a given TrueType face object. */
/* */
/* <Input> */
/* resource :: The source font resource. */
/* 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> */
@ -70,43 +81,49 @@
TT_Int num_params,
FT_Parameter* params )
{
TT_Error error;
FT_Driver sfnt_driver;
SFNT_Interface* sfnt;
TT_Error error;
FT_Driver sfnt_driver;
SFNT_Interface* 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);
if (!sfnt) goto Bad_Format;
if ( !sfnt )
goto Bad_Format;
/* create input stream from resource */
if ( FILE_Seek(0) )
if ( FILE_Seek( 0 ) )
goto Exit;
/* check that we have a valid TrueType file */
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 */
if ( face->format_tag != 0x00010000 && /* MS fonts */
face->format_tag != TTAG_true ) /* Mac fonts */
if ( face->format_tag != 0x00010000L && /* MS 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;
}
/* 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 )
return TT_Err_Ok;
/* Load font directory */
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 ) ||
TT_Load_CVT ( face, stream ) ||
TT_Load_Programs ( face, stream );
Exit:
return error;
@ -136,8 +153,9 @@
SFNT_Interface* sfnt = face->sfnt;
if (sfnt)
sfnt->done_face(face);
if ( sfnt )
sfnt->done_face( face );
/* freeing the locations table */
FREE( face->glyph_locations );
@ -182,6 +200,7 @@
TT_Error error = 0;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_Face face = (TT_Face)size->root.face;
FT_Memory memory = face->root.memory;
TT_Int i;
@ -190,6 +209,7 @@
TT_UShort n_twilight;
TT_MaxProfile* maxp = &face->max_profile;
size->ttmetrics.valid = FALSE;
size->max_function_defs = maxp->maxFunctionDefs;
@ -209,6 +229,7 @@
FT_Size_Metrics* metrics = &size->root.metrics;
TT_Size_Metrics* metrics2 = &size->ttmetrics;
metrics->x_ppem = 0;
metrics->y_ppem = 0;
@ -220,7 +241,7 @@
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,
size->max_function_defs,
TT_DefRecord ) ||
@ -249,17 +270,18 @@
{
FT_Library library = face->root.driver->library;
face->interpreter = (TT_Interpreter)
library->debug_hooks[ FT_DEBUG_HOOK_TRUETYPE ];
if (!face->interpreter)
library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
if ( !face->interpreter )
face->interpreter = (TT_Interpreter)TT_RunIns;
}
/* Fine, now execute the font program! */
exec = size->context;
if (!size->debug)
exec = TT_New_Context( face );
/* size objects used during debugging have their own context */
if ( !size->debug )
exec = TT_New_Context( face );
if ( !exec )
{
@ -282,14 +304,14 @@
TT_Size_Metrics* tt_metrics = &exec->tt_metrics;
metrics->x_ppem = 0;
metrics->y_ppem = 0;
metrics->x_scale = 0;
metrics->y_scale = 0;
metrics->x_ppem = 0;
metrics->y_ppem = 0;
metrics->x_scale = 0;
metrics->y_scale = 0;
tt_metrics->ppem = 0;
tt_metrics->scale = 0;
tt_metrics->ratio = 0x10000;
tt_metrics->ppem = 0;
tt_metrics->scale = 0;
tt_metrics->ratio = 0x10000L;
}
exec->instruction_trap = FALSE;
@ -332,11 +354,13 @@
return error;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
Fail_Exec:
if ( !size->debug )
TT_Done_Context( exec );
Fail_Memory:
#endif
TT_Done_Size( size );
@ -358,9 +382,12 @@
LOCAL_FUNC
void TT_Done_Size( TT_Size size )
{
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
FT_Memory memory = size->root.face->memory;
if ( size->debug )
{
/* the debug context must be deleted by the debugger itself */
@ -380,6 +407,7 @@
FREE( size->function_defs );
FREE( size->instruction_defs );
size->num_function_defs = 0;
size->max_function_defs = 0;
size->num_instruction_defs = 0;
@ -387,6 +415,7 @@
size->max_func = 0;
size->max_ins = 0;
#endif
size->ttmetrics.valid = FALSE;
@ -413,6 +442,7 @@
FT_Size_Metrics* metrics;
if ( size->ttmetrics.valid )
return TT_Err_Ok;
@ -428,7 +458,7 @@
{
size->ttmetrics.scale = metrics->x_scale;
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,
0x10000L,
metrics->x_ppem );
@ -440,7 +470,7 @@
size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem,
0x10000L,
metrics->y_ppem );
size->ttmetrics.y_ratio = 0x10000;
size->ttmetrics.y_ratio = 0x10000L;
}
/* Compute root ascender, descender, test height, and max_advance */
@ -457,13 +487,14 @@
metrics->x_scale ) + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
TT_ExecContext exec;
TT_UInt i, j;
/* Scale the cvt values to the new ppem. */
/* We use by default the y ppem to scale the CVT. */
for ( i = 0; i < size->cvt_size; i++ )
size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
@ -528,6 +559,7 @@
TT_Done_Context( exec );
/* debugging instances keep their context */
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
if ( !error )
@ -559,7 +591,7 @@
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 ));
return FT_Outline_New( library,
@ -586,7 +618,8 @@
FT_Library library = slot->face->driver->library;
FT_Memory memory = library->memory;
if (slot->flags & ft_glyph_own_bitmap)
if ( slot->flags & ft_glyph_own_bitmap )
FREE( slot->bitmap.buffer );
FT_Outline_Done( library, &slot->outline );
@ -614,10 +647,13 @@
FT_Memory memory = driver->root.memory;
FT_Error error;
error = FT_New_GlyphZone( memory, 0, 0, &driver->zone );
if (error) return error;
if ( error )
return error;
/* init extension registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
return TT_Init_Extensions( driver );
#else
@ -641,6 +677,7 @@
void TT_Done_Driver( TT_Driver driver )
{
/* destroy extensions registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
TT_Done_Extensions( driver );
#endif
@ -649,12 +686,14 @@
FT_Done_GlyphZone( &driver->zone );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* destroy the execution context */
if ( driver->context )
{
TT_Destroy_Context( driver->context, driver->root.memory );
driver->context = NULL;
}
#endif
}

View File

@ -4,11 +4,11 @@
/* */
/* Objects manager (specification). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -209,7 +209,7 @@
/* */
/* 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 */
/* record). */
/* */
@ -312,6 +312,7 @@
TT_Size_Metrics ttmetrics;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
TT_UInt num_function_defs; /* number of function definitions */
TT_UInt max_function_defs;
TT_DefArray function_defs; /* table of function definitions */
@ -364,45 +365,60 @@
} 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,
TT_Face face,
TT_Int face_index,
TT_Int num_params,
FT_Parameter* params );
LOCAL_DEF void TT_Done_Face( TT_Face face );
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 void TT_Done_Size ( TT_Size size );
LOCAL_DEF TT_Error TT_Reset_Size( TT_Size size );
LOCAL_DEF
void TT_Done_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 void TT_Done_GlyphSlot( TT_GlyphSlot slot );
LOCAL_DEF
void TT_Done_GlyphSlot( TT_GlyphSlot slot );
/*************************************************************************/
/* Driver funcs */
LOCAL_DEF TT_Error TT_Init_Driver( TT_Driver driver );
LOCAL_DEF void TT_Done_Driver( TT_Driver driver );
/*************************************************************************/
/* */
/* Driver functions */
/* */
LOCAL_DEF
TT_Error TT_Init_Driver( TT_Driver driver );
LOCAL_DEF
void TT_Done_Driver( TT_Driver driver );
#ifdef __cplusplus
}
#endif
#endif /* TTOBJS_H */

View File

@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (body). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -24,8 +24,16 @@
#include <ttpload.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
#define FT_COMPONENT trace_ttload
#define FT_COMPONENT trace_ttpload
/*************************************************************************/
/* */
@ -35,8 +43,10 @@
/* <Description> */
/* Loads the locations table. */
/* */
/* <Input> */
/* <InOut> */
/* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: The input stream. */
/* */
/* <Return> */
@ -51,11 +61,12 @@
TT_Short LongOffsets;
TT_ULong table_len;
FT_TRACE2(( "Locations " ));
LongOffsets = face->header.Index_To_Loc_Format;
error = face->goto_table( face, TTAG_loca, stream, &table_len );
if (error)
if ( error )
{
error = TT_Err_Locations_Missing;
goto Exit;
@ -63,9 +74,9 @@
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,
face->num_locations,
@ -79,6 +90,7 @@
TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations;
for ( ; loc < limit; loc++ )
*loc = GET_Long();
}
@ -87,10 +99,9 @@
}
else
{
face->num_locations = (TT_UShort)(table_len >> 1);
face->num_locations = (TT_UShort)( table_len >> 1 );
FT_TRACE2(( "(16 bits offsets): %12d ",
face->num_locations ));
FT_TRACE2(( "(16bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations,
@ -103,8 +114,9 @@
TT_Long* loc = face->glyph_locations;
TT_Long* limit = loc + face->num_locations;
for ( ; loc < limit; loc++ )
*loc = (TT_Long)((TT_ULong)GET_UShort() * 2);
*loc = (TT_Long)( (TT_ULong)GET_UShort() * 2 );
}
FORGET_Frame();
}
@ -124,8 +136,10 @@
/* <Description> */
/* Loads the control value table into a face object. */
/* */
/* <Input> */
/* <InOut> */
/* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
@ -139,10 +153,11 @@
FT_Memory memory = stream->memory;
TT_ULong table_len;
FT_TRACE2(( "CVT " ));
error = face->goto_table( face, TTAG_cvt, stream, &table_len );
if (error)
if ( error )
{
FT_TRACE2(( "is missing!\n" ));
@ -167,6 +182,7 @@
TT_Short* cur = face->cvt;
TT_Short* limit = cur + face->cvt_size;
for ( ; cur < limit; cur++ )
*cur = GET_Short();
}
@ -187,8 +203,10 @@
/* <Description> */
/* Loads the font program and the cvt program. */
/* */
/* <Input> */
/* <InOut> */
/* face :: A handle to the target face object. */
/* */
/* <Input> */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
@ -201,6 +219,7 @@
TT_Error error;
TT_ULong table_len;
FT_TRACE2(( "Font program " ));
/* The font program is optional */
@ -209,6 +228,7 @@
{
face->font_program = NULL;
face->font_program_size = 0;
FT_TRACE2(( "is missing!\n" ));
}
else
@ -236,6 +256,7 @@
face->cvt_program_size = table_len;
if ( EXTRACT_Frame( table_len, face->cvt_program ) )
goto Exit;
FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
}

View File

@ -4,11 +4,11 @@
/* */
/* TrueType glyph data/program tables loader (specification). */
/* */
/* Copyright 1996-1999 by */
/* 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 */
/* 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. */
@ -27,61 +27,14 @@
#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
TT_Error TT_Load_Locations( TT_Face face,
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
TT_Error TT_Load_CVT( TT_Face face,
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
TT_Error TT_Load_Programs( TT_Face face,
FT_Stream stream );

View File

@ -1,85 +1,16 @@
#****************************************************************************
#* *
#* 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. *
#* *
#****************************************************************************
#
# FreeType 2 Type 1 driver configuration rules
#
#****************************************************************************
#* *
#* IMPORTANT NOTE: This Makefile is intended for GNU Make! *
#* If you provide Makefiles for other make utilities, *
#* please place them in `freetype/lib/arch/<system>'. *
#* *
#* *
#* This file is to be included by the FreeType Makefile.lib, located in *
#* 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. *
#* *
#****************************************************************************
# 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.
# Type1 driver directory
@ -90,62 +21,52 @@ T1_DIR_ := $(T1_DIR)$(SEP)
# additional include flags used when compiling the driver
#
T1_INCLUDE := $(SHARED) $(T1_DIR)
T1_COMPILE := $(FT_COMPILE) $(T1_INCLUDE:%=$I%)
T1_INCLUDE := $(T1_DIR)
# compilation flags for the driver
#
T1_CFLAGS := $(T1_INCLUDE:%=$I%)
T1_COMPILE := $(FT_COMPILE) $(T1_CFLAGS)
# Type1 driver sources (i.e., C files)
#
T1_DRV_SRC := $(T1_DIR_)t1objs.c \
$(T1_DIR_)t1load.c \
$(T1_DIR_)t1parse.c \
$(T1_DIR_)t1tokens.c \
$(T1_DIR_)t1driver.c \
$(T1_DIR_)t1hinter.c \
$(T1_DIR_)t1afm.c \
T1_DRV_SRC := $(T1_DIR_)t1objs.c \
$(T1_DIR_)t1load.c \
$(T1_DIR_)t1parse.c \
$(T1_DIR_)t1tokens.c \
$(T1_DIR_)t1driver.c \
$(T1_DIR_)t1hinter.c \
$(T1_DIR_)t1afm.c \
$(T1_DIR_)t1gload.c
# Type1 driver headers
#
T1_DRV_H := $(T1SHARED_H) \
$(T1_DRV_SRC:%.c=%.h)
T1_DRV_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_S is used during `release' builds
# T1_DRV_OBJ_M is used during `multi' builds
# T1_DRV_OBJ_S is used during `single' builds
#
T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O) \
$(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_S := $(OBJ_)type1.$O
# driver root source file(s)
# Type1 driver source file for single build
#
T1_DRV_SRC_M := $(T1_DRV_SRC) $(T1SHARED_SRC)
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): $(BASE_H) $(T1_DRV_H) $(T1_DRV_SRC) $(T1_DRV_SRC_S)
$(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $(T1_DRV_SRC_S)
# driver - multiple objects
# Type1 driver - multiple objects
#
# All objects are recompiled if any of the header files is changed
#
$(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)
$(OBJ_)%.$O: $(T1_DIR_)%.c $(FREETYPE_H) $(T1_DRV_H)
$(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_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
# 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,
# 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.
#****************************************************************************
#* *
#* 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
#
T1Z_DIR := $(SRC_)type1z
@ -35,7 +22,11 @@ T1Z_DIR_ := $(T1Z_DIR)$(SEP)
# additional include flags used when compiling the driver
#
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)
@ -44,46 +35,37 @@ T1Z_DRV_SRC := $(T1Z_DIR_)t1parse.c \
$(T1Z_DIR_)t1load.c \
$(T1Z_DIR_)t1driver.c \
$(T1Z_DIR_)t1afm.c \
$(T1Z_DIR_)t1gload.c
$(T1Z_DIR_)t1gload.c \
$(T1Z_DIR_)t1objs.c
# Type1 driver headers
#
T1Z_DRV_H := $(T1SHARED_H) \
$(T1Z_DRV_SRC:%.c=%.h)
T1Z_DRV_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_S is used during `release' builds
# T1Z_DRV_OBJ_M is used during `multi' builds
# T1Z_DRV_OBJ_S is used during `single' builds
#
T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O) \
$(T1SHARED:$(T1SHARED_DIR_)%.c=$(OBJ_)%.$O)
T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O)
T1Z_DRV_OBJ_S := $(OBJ_)type1z.$O
# driver source file(s)
# Type1z driver source file for single build
#
T1Z_DRV_SRC_M := $(T1Z_DRV_SRC) $(T1SHARED_SRC)
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): $(BASE_H) $(T1Z_DRV_H) $(T1Z_DRV_SRC) $(T1Z_DRV_SRC_S)
$(T1Z_DRV_OBJ_S): $(T1Z_DRV_SRC_S) $(T1Z_DRV_SRC) $(FREETYPE_H) $(T1Z_DRV_H)
$(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_)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)
$(OBJ_)%.$O: $(T1Z_DIR_)%.c $(FREETYPE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $<