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,7 +48,7 @@
/* the first level must always be `trace_any' */
trace_any = 0,
/* we start with an enum for each base component */
/* base components */
trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
trace_calc, /* calculations (ftcalc.c) */
trace_extend, /* extension manager (ftextend.c) */
@ -60,25 +60,37 @@
trace_mm, /* MM interface (ftmm.c) */
trace_objs, /* base objects (ftobjs.c) */
trace_outline, /* outline management (ftoutln.c) */
trace_raster, /* raster (ftraster.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,12 +22,20 @@
#include <freetype/internal/sfnt.h>
#include <freetype/tttags.h>
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1gload
#include <t2load.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
#define FT_COMPONENT trace_t2gload
typedef enum T2_Operator_
{
t2_op_unknown = 0,

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 */
/*************************************************************************/
/* */
/* 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
#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. */
@ -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,13 +192,15 @@
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 */
/* 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 )
{
@ -226,7 +239,7 @@
/* 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,
@ -236,7 +249,7 @@
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;
return 0;
cmap->loaded = TRUE;
}
@ -374,12 +385,26 @@
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** 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 )
{
@ -387,6 +412,7 @@
if ( sfnt )
return sfnt->get_interface( (FT_Driver)driver, interface );
}
return 0;
}
@ -427,6 +453,8 @@
};
#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 )
{
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, */

View File

@ -4,11 +4,11 @@
/* */
/* TrueType 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. */
@ -29,7 +29,13 @@
#include <ttinterp.h>
#endif
/* required for the 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_ttgload
@ -50,12 +56,31 @@
#define USE_MY_METRICS 0x200
/*************************************************************************/
/* */
/* <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_FUNC
void TT_Get_Metrics( TT_HoriHeader* header,
TT_UInt index,
@ -81,6 +106,7 @@
/*************************************************************************/
/* */
/* Returns the horizontal metrics in font units for a given glyph. */
/* If `check' is true, take care of monospaced fonts by returning the */
/* advance width maximum. */
@ -100,6 +126,7 @@
/*************************************************************************/
/* */
/* Returns the advance width table for a given pixel size if it is */
/* found in the font's `hdmx' table (if any). */
/* */
@ -126,6 +153,7 @@
/*************************************************************************/
/* */
/* Translates an array of coordinates. */
/* */
static
@ -136,6 +164,7 @@
{
TT_UInt k;
if ( delta_x )
for ( k = 0; k < n; k++ )
coords[k].x += delta_x;
@ -146,8 +175,8 @@
}
/*************************************************************************/
/* */
/* Mounts one glyph zone on top of another. This is needed to */
/* assemble composite glyphs. */
/* */
@ -158,6 +187,7 @@
TT_UInt np;
TT_Int nc;
np = source->n_points;
nc = source->n_contours;
@ -175,6 +205,7 @@
#undef IS_HINTED
#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
/*************************************************************************/
/* */
/* <Function> */
@ -183,7 +214,7 @@
/* <Description> */
/* Loads a simple (i.e, non-composite) glyph. This function is used */
/* for the `Load_Simple' state of TT_Load_Glyph(). All composite */
/* glyphs elements will be loaded with routine. */
/* glyphs elements will be loaded with this routine. */
/* */
static
TT_Error Load_Simple( TT_Loader* load,
@ -199,7 +230,7 @@
TT_UShort n_ins;
TT_Int n, n_points;
/*********************************************************************/
/* simple check */
if ( n_contours > load->left_contours )
@ -214,7 +245,6 @@
/* preparing the execution context */
mount_zone( &load->base, zone );
/*********************************************************************/
/* reading the contours endpoints */
if ( ACCESS_Frame( byte_count ) )
@ -227,8 +257,6 @@
if ( n_contours > 0 )
n_points = zone->contours[n_contours - 1] + 1;
/*********************************************************************/
/* reading the bytecode instructions */
n_ins = GET_UShort();
@ -236,7 +264,8 @@
if ( n_points > load->left_points )
{
FT_TRACE0(( "ERROR: Too many points in glyph %ld\n", load->glyph_index ));
FT_TRACE0(( "ERROR: Too many points in glyph %ld\n",
load->glyph_index ));
error = TT_Err_Too_Many_Points;
goto Fail;
}
@ -258,19 +287,20 @@
}
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if ( (load->load_flags & (FT_LOAD_NO_SCALE|FT_LOAD_NO_HINTING))==0 )
if ( ( load->load_flags &
( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) == 0 )
{
MEM_Copy( load->exec->glyphIns, stream->cursor, n_ins );
error = TT_Set_CodeRange( load->exec, tt_coderange_glyph,
load->exec->glyphIns, n_ins );
if (error) goto Fail;
if ( error )
goto Fail;
}
#endif
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
stream->cursor += n_ins;
/*********************************************************************/
/* reading the point tags */
{
@ -278,6 +308,7 @@
TT_Byte* limit = flag + n_points;
TT_Byte c, count;
for ( ; flag < limit; flag++ )
{
*flag = c = GET_Byte();
@ -289,7 +320,6 @@
}
}
/*********************************************************************/
/* reading the X coordinates */
{
@ -298,14 +328,17 @@
TT_Byte* flag = zone->tags;
TT_Pos x = 0;
for ( ; vec < limit; vec++, flag++ )
{
TT_Pos y = 0;
if ( *flag & 2 )
{
y = GET_Byte();
if ((*flag & 16) == 0) y = -y;
if ( ( *flag & 16 ) == 0 )
y = -y;
}
else if ( ( *flag & 16 ) == 0 )
y = GET_Short();
@ -315,7 +348,6 @@
}
}
/*********************************************************************/
/* reading the Y coordinates */
{
@ -324,14 +356,17 @@
TT_Byte* flag = zone->tags;
TT_Pos x = 0;
for ( ; vec < limit; vec++, flag++ )
{
TT_Pos y = 0;
if ( *flag & 4 )
{
y = GET_Byte();
if ((*flag & 32) == 0) y = -y;
if ( ( *flag & 32 ) == 0 )
y = -y;
}
else if ( ( *flag & 32 ) == 0 )
y = GET_Short();
@ -343,8 +378,7 @@
FORGET_Frame();
/*********************************************************************/
/* Add shadow points */
/* add shadow points */
/* Now add the two shadow points at n and n + 1. */
/* We need the left side bearing and advance width. */
@ -353,6 +387,7 @@
TT_Vector* pp1;
TT_Vector* pp2;
/* pp1 = xMin - lsb */
pp1 = zone->org + n_points;
pp1->x = load->bbox.xMin - load->left_bearing;
@ -370,6 +405,7 @@
zone->tags[n_points ] = 0;
zone->tags[n_points + 1] = 0;
}
/* Note that we return two more points that are not */
/* part of the glyph outline. */
@ -377,7 +413,6 @@
zone->n_contours = n_contours;
n_points += 2;
/*******************************************/
/* now eventually scale and hint the glyph */
if ( load->load_flags & FT_LOAD_NO_SCALE )
@ -392,6 +427,7 @@
TT_Fixed x_scale = load->size->root.metrics.x_scale;
TT_Fixed y_scale = load->size->root.metrics.y_scale;
/* first scale the glyph points */
for ( ; vec < limit; vec++ )
{
@ -407,6 +443,8 @@
else
{
TT_Pos x = zone->org[n_points-2].x;
x = ( ( x + 32 ) & -64 ) - x;
translate_array( n_points, zone->org, x, 0 );
@ -419,7 +457,8 @@
if ( n_ins > 0 )
{
load->exec->is_composite = FALSE;
load->exec->pedantic_hinting = (TT_Bool)(load->load_flags & FT_LOAD_PEDANTIC);
load->exec->pedantic_hinting = (TT_Bool)(load->load_flags &
FT_LOAD_PEDANTIC);
load->exec->pts = *zone;
load->exec->pts.n_points += 2;
@ -427,7 +466,7 @@
if ( error && load->exec->pedantic_hinting )
return error;
}
#endif
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
}
}
@ -446,10 +485,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
@ -457,7 +492,7 @@
/* */
/* <Description> */
/* Loads a given truetype glyph. Handles composites and uses a */
/* TT_Loader object.. */
/* TT_Loader object. */
/* */
static
TT_Error load_truetype_glyph( TT_Loader* loader,
@ -472,6 +507,7 @@
TT_Fixed x_scale, y_scale;
TT_ULong ins_offset;
/* check glyph index */
index = glyph_index;
if ( index >= (TT_UInt)face->root.num_glyphs )
@ -485,8 +521,8 @@
num_points = 0;
ins_offset = 0;
x_scale = 0x10000;
y_scale = 0x10000;
x_scale = 0x10000L;
y_scale = 0x10000L;
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
x_scale = loader->size->root.metrics.x_scale;
@ -498,6 +534,7 @@
TT_Short left_bearing;
TT_UShort advance_width;
Get_HMetrics( face, index,
(TT_Bool)!(loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH),
@ -511,10 +548,10 @@
/* load glyph header */
offset = face->glyph_locations[index];
count = 0;
if ( index < (TT_UInt)face->num_locations - 1 )
count = face->glyph_locations[index + 1] - offset;
if ( count == 0 )
{
/* as described by Frederic Loyer, these are spaces, and */
@ -579,16 +616,17 @@
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/**********************************************************************/
/* if it is a simple glyph, load it */
if ( contours_count >= 0 )
{
TT_UInt num_base_points;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
error = Load_Simple( loader,
count,
@ -609,6 +647,8 @@
num_base_points = loader->base.n_points;
{
TT_UInt k;
for ( k = 0; k < num_contours; k++ )
loader->zone.contours[k] += num_base_points;
}
@ -622,18 +662,20 @@
loader->left_points -= num_points;
loader->left_contours -= num_contours;
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/************************************************************************/
else /* otherwise, load a composite !! */
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/* otherwise, load a composite! */
else
{
/* for each subglyph, read composite header */
TT_GlyphSlot glyph = loader->glyph;
FT_SubGlyph* subglyph = glyph->subglyphs + glyph->num_subglyphs;
if (ACCESS_Frame(count)) goto Fail;
if ( ACCESS_Frame( count ) )
goto Fail;
num_subglyphs = 0;
do
@ -641,13 +683,16 @@
TT_Fixed xx, xy, yy, yx;
FT_UInt total_subglyphs;
/* grow the 'glyph->subglyphs' table if necessary */
/* grow the `glyph->subglyphs' table if necessary */
total_subglyphs = glyph->num_subglyphs + num_subglyphs;
if ( total_subglyphs >= glyph->max_subglyphs )
{
FT_UInt new_max = glyph->max_subglyphs;
FT_Memory memory = loader->face->root.memory;
while ( new_max <= total_subglyphs )
new_max += 4;
@ -677,7 +722,7 @@
}
/* read transform */
xx = yy = 0x10000;
xx = yy = 0x10000L;
xy = yx = 0;
if ( subglyph->flags & WE_HAVE_A_SCALE )
@ -711,16 +756,18 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
/* we must undo the ACCESS_Frame in order to point to the */
/* composite instructions, if we find some .. */
/* we will process them later.. */
/* composite instructions, if we find some. */
/* we will process them later... */
/* */
ins_offset = FILE_Pos() + stream->cursor - stream->limit;
}
#endif
FORGET_Frame();
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
/* "as is" in the glyph slot (the client application will be */
/* responsible for interpreting this data..) */
/* `as is' in the glyph slot (the client application will be */
/* responsible for interpreting this data)... */
/* */
if ( loader->load_flags & FT_LOAD_NO_RECURSE )
{
/* set up remaining glyph fields */
@ -730,9 +777,9 @@
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/*********************************************************************/
/* Now, read each subglyph independently.. */
@ -742,18 +789,21 @@
subglyph = glyph->subglyphs + glyph->num_subglyphs;
glyph->num_subglyphs += num_subglyphs;
for ( n = 0; n < num_subglyphs; n++, subglyph++ )
{
TT_Vector pp1, pp2;
TT_Pos x, y;
pp1 = loader->pp1;
pp2 = loader->pp2;
num_base_points = loader->base.n_points;
error = load_truetype_glyph( loader, subglyph->index );
if (error) goto Fail;
if ( error )
goto Fail;
if ( subglyph->flags & USE_MY_METRICS )
{
@ -771,7 +821,6 @@
num_new_points = num_points - num_base_points;
/********************************************************/
/* now perform the transform required for this subglyph */
if ( subglyph->flags & ( WE_HAVE_A_SCALE |
@ -782,10 +831,12 @@
TT_Vector* org = loader->zone.org;
TT_Vector* limit = cur + num_new_points;
for ( ; cur < limit; cur++, org++ )
{
TT_Pos nx, ny;
nx = FT_MulFix( cur->x, subglyph->transform.xx ) +
FT_MulFix( cur->y, subglyph->transform.yx );
@ -813,6 +864,7 @@
TT_Int k = subglyph->arg1;
TT_UInt l = subglyph->arg2;
if ( k >= num_base_points ||
l >= (TT_UInt)num_new_points )
{
@ -847,16 +899,19 @@
cur_to_org( num_new_points, &loader->zone );
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/* we have finished loading all sub-glyphs, now, look for */
/* instructions for this composite !! */
/* instructions for this composite! */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
subglyph--;
if (num_subglyphs > 0 && loader->exec && subglyph->flags & WE_HAVE_INSTR)
if ( num_subglyphs > 0 &&
loader->exec &&
subglyph->flags & WE_HAVE_INSTR )
{
TT_UShort n_ins;
TT_ExecContext exec = loader->exec;
@ -864,9 +919,11 @@
FT_GlyphZone* pts;
TT_Vector* pp1;
/* read size of instructions */
if ( FILE_Seek( ins_offset ) ||
READ_UShort(n_ins) ) goto Fail;
READ_UShort(n_ins) )
goto Fail;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
/* check it */
@ -879,7 +936,9 @@
if ( exec )
{
/* XXX */
}
/* read the instructions */
if ( FILE_Read( exec->glyphIns, n_ins ) )
goto Fail;
@ -888,7 +947,8 @@
tt_coderange_glyph,
exec->glyphIns,
n_ins );
if ( error ) goto Fail;
if ( error )
goto Fail;
/* prepare the execution context */
exec->pts = loader->base;
@ -914,6 +974,8 @@
{
TT_UInt k;
for ( k = 0; k < n_points; k++ )
pts->tags[k] &= FT_Curve_Tag_On;
}
@ -936,15 +998,15 @@
loader->pp1 = pp1[0];
loader->pp2 = pp1[1];
}
#endif
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
}
/* end of composite loading */
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
Load_End:
error = TT_Err_Ok;
@ -954,9 +1016,6 @@
}
static
void compute_glyph_metrics( TT_Loader* loader,
TT_UInt glyph_index )
@ -969,17 +1028,18 @@
TT_GlyphSlot glyph = loader->glyph;
TT_Size size = loader->size;
/* when a simple glyph was loaded, the value of */
/* "base.n_points" and "base.n_contours" is 0, we must */
/* take those in the "zone" instead.. */
/* `base.n_points' and `base.n_contours' is 0, we will */
/* take those in the `zone' instead. */
if ( num_points == 0 && num_contours == 0 )
{
num_points = loader->zone.n_points;
num_contours = loader->zone.n_contours;
}
x_scale = 0x10000;
y_scale = 0x10000;
x_scale = 0x10000L;
y_scale = 0x10000L;
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
x_scale = size->root.metrics.x_scale;
@ -989,6 +1049,8 @@
if ( glyph->format != ft_glyph_format_composite )
{
TT_UInt u;
for ( u = 0; u < num_points + 2; u++ )
{
glyph->outline.points[u] = loader->base.cur[u];
@ -1022,7 +1084,7 @@
else
bbox = loader->bbox;
/* get the device-independent scaled horizontal metrics */
/* get the device-independent scaled horizontal metrics; */
/* take care of fixed-pitch fonts... */
{
TT_Pos left_bearing;
@ -1030,13 +1092,14 @@
TT_Pos lsb2, adv2;
left_bearing = loader->left_bearing;
advance = loader->advance;
/* the flag FT_LOAD_NO_ADVANCE_CHECK was introduced to */
/* correctly support DynaLab fonts, who have an incorrect */
/* "advance_Width_Max" field !! It is used, to my knowledge */
/* exclusively in the X-TrueType font server.. */
/* correctly support DynaLab fonts, which have an incorrect */
/* `advance_Width_Max' field! It is used, to my knowledge, */
/* exclusively in the X-TrueType font server. */
/* */
if ( face->postscript.isFixedPitch &&
( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
@ -1092,12 +1155,12 @@
}
else
{
/* Make up the distances from the horizontal header.. */
/* Make up the distances from the horizontal header. */
/* NOTE: The OS/2 values are the only `portable' ones, */
/* which is why we use them, when there is an */
/* OS/2 table in the font. Otherwise, we use the */
/* values defined in the horizontal header.. */
/* which is why we use them, if there is an OS/2 */
/* table in the font. Otherwise, we use the */
/* values defined in the horizontal header. */
/* */
/* NOTE2: The sTypoDescender is negative, which is why */
/* we compute the baseline-to-baseline distance */
@ -1120,9 +1183,9 @@
}
}
/* We must adjust the top_bearing value from the bounding box given
in the glyph header to te bounding box calculated with
TT_Get_Outline_BBox() */
/* We must adjust the top_bearing value from the bounding box given */
/* in the glyph header to te bounding box calculated with */
/* TT_Get_Outline_BBox(). */
/* scale the metrics */
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
@ -1141,15 +1204,17 @@
/* compute metrics2 fields */
{
FT_Pos vtb2 = top_bearing;
FT_Pos adv2 = advance_height;
TT_Pos vtb2 = top_bearing;
TT_Pos adv2 = advance_height;
/* scale to 16.16 format if required */
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) &&
loader->load_flags & FT_LOAD_LINEAR )
{
FT_Pos em_size = face->root.units_per_EM;
FT_Pos pixel_size = face->root.size->metrics.y_ppem;
TT_Pos em_size = face->root.units_per_EM;
TT_Pos pixel_size = face->root.size->metrics.y_ppem;
vtb2 = FT_MulDiv( vtb2, pixel_size, em_size );
adv2 = FT_MulDiv( adv2, pixel_size, em_size );
@ -1204,16 +1269,33 @@
}
/*************************************************************************/
/* */
/* <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). */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_FUNC
TT_Error TT_Load_Glyph( TT_Size size,
TT_GlyphSlot glyph,
@ -1228,6 +1310,7 @@
TT_Loader loader;
FT_GlyphZone* zone;
face = (TT_Face)glyph->face;
sfnt = (SFNT_Interface*)face->sfnt;
stream = face->root.stream;
@ -1246,12 +1329,15 @@
glyph->num_subglyphs = 0;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/*********************************************************************/
/* Try to load embedded bitmap if any */
if ( size && (load_flags & FT_LOAD_NO_BITMAP) == 0 && sfnt->load_sbits )
/* try to load embedded bitmap if any */
if ( size &&
( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
sfnt->load_sbits )
{
TT_SBit_Metrics metrics;
error = sfnt->load_sbit_image( face,
size->root.metrics.x_ppem,
size->root.metrics.y_ppem,
@ -1280,6 +1366,7 @@
return error;
}
}
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
if ( load_flags & FT_LOAD_NO_OUTLINE )
@ -1288,10 +1375,11 @@
/* seek to the beginning of the glyph table. For Type 43 fonts */
/* the table might be accessed from a Postscript stream or something */
/* else... */
error = face->goto_table( face, TTAG_glyf, stream, 0 );
if ( error )
{
FT_ERROR(( "TT.GLoad: could not access glyph table\n" ));
FT_ERROR(( "TT_Load_Glyph: Could not access glyph table\n" ));
goto Exit;
}
@ -1304,7 +1392,7 @@
face->root.max_contours );
if ( error )
{
FT_ERROR(( "TT.GLoad: could not update loader glyph zone\n" ));
FT_ERROR(( "TT_Load_Glyph: Could not update loader glyph zone\n" ));
goto Exit;
}
loader.base = *zone;
@ -1313,6 +1401,7 @@
loader.zone.n_contours = 0;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if ( size )
{
/* query new execution context */
@ -1326,16 +1415,17 @@
if ( size->GS.instruct_control & 2 )
loader.exec->GS = tt_default_graphics_state;
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/* clear all outline flags, except the "owner" one */
/* clear all outline flags, except the `owner' one */
glyph->outline.flags &= ft_outline_owner;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->outline.flags |= ft_outline_high_precision;
/************************************************************************/
/* let's initialise the rest of our loader now */
/* let's initialize the rest of our loader now */
loader.left_points = face->root.max_points;
loader.left_contours = face->root.max_contours;
loader.load_flags = load_flags;
@ -1348,11 +1438,13 @@
loader.glyf_offset = FILE_Pos();
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/* when the cvt program has disabled hinting, the argument */
/* if the cvt program has disabled hinting, the argument */
/* is ignored. */
if ( size && ( size->GS.instruct_control & 1 ) )
loader.load_flags |= FT_LOAD_NO_HINTING;
#endif
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/* Main loading loop */
glyph->format = ft_glyph_format_outline;
@ -1371,5 +1463,4 @@
}
/* END */

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. */
@ -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,7 +27,7 @@
#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
@ -41,7 +41,7 @@
#define EXEC_ARG_ /* void */
#define EXEC_ARG /* void */
#endif /* TT_STATIC_INTERPRETER */
#endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
/*************************************************************************/
@ -215,252 +215,47 @@
} 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 );
/*************************************************************************/
/* */
/* <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 );

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> */
@ -74,11 +85,14 @@
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 ) )
@ -86,27 +100,30 @@
/* 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 */
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,6 +153,7 @@
SFNT_Interface* sfnt = face->sfnt;
if ( sfnt )
sfnt->done_face( face );
@ -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,6 +270,7 @@
{
FT_Library library = face->root.driver->library;
face->interpreter = (TT_Interpreter)
library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
if ( !face->interpreter )
@ -257,9 +279,9 @@
/* Fine, now execute the font program! */
exec = size->context;
/* size objects used during debugging have their own context */
if ( !size->debug )
exec = TT_New_Context( face );
/* size objects used during debugging have their own context */
if ( !exec )
{
@ -289,7 +311,7 @@
tt_metrics->ppem = 0;
tt_metrics->scale = 0;
tt_metrics->ratio = 0x10000;
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,6 +618,7 @@
FT_Library library = slot->face->driver->library;
FT_Memory memory = library->memory;
if ( slot->flags & ft_glyph_own_bitmap )
FREE( slot->bitmap.buffer );
@ -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 */
@ -365,44 +366,59 @@
/*************************************************************************/
/* Face Funcs */
LOCAL_DEF TT_Error TT_Init_Face( FT_Stream stream,
/* */
/* 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 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,6 +61,7 @@
TT_Short LongOffsets;
TT_ULong table_len;
FT_TRACE2(( "Locations " ));
LongOffsets = face->header.Index_To_Loc_Format;
@ -65,7 +76,7 @@
{
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();
}
@ -89,8 +101,7 @@
{
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,6 +114,7 @@
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 );
}
@ -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,6 +153,7 @@
FT_Memory memory = stream->memory;
TT_ULong table_len;
FT_TRACE2(( "CVT " ));
error = face->goto_table( face, TTAG_cvt, stream, &table_len );
@ -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,8 +21,12 @@ 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)
@ -105,47 +40,33 @@ T1_DRV_SRC := $(T1_DIR_)t1objs.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$@ $<