Formatting.

Adding some trivial error checking.

Adding/Fixing tracing levels.
This commit is contained in:
Werner Lemberg 2000-07-08 19:51:42 +00:00
parent e1075ceabb
commit 7fa51b5535
72 changed files with 2884 additions and 2408 deletions

View File

@ -78,11 +78,19 @@
trace_ttpload, /* TT data/program loader (ttpload.c) */ trace_ttpload, /* TT data/program loader (ttpload.c) */
/* Type 1 driver components */ /* Type 1 driver components */
trace_t1objs, trace_t1driver,
trace_t1load,
trace_t1gload, trace_t1gload,
trace_t1hint, trace_t1hint,
trace_t1driver, trace_t1load,
trace_t1objs,
/* experimental Type 1 driver components */
trace_z1driver,
trace_z1gload,
trace_z1hint,
trace_z1load,
trace_z1objs,
trace_z1parse,
/* Type 2 driver components */ /* Type 2 driver components */
trace_t2driver, trace_t2driver,

View File

@ -17,19 +17,24 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftcalc.c" #include "ftcalc.c"
#include "ftobjs.c" #include "ftobjs.c"
#include "ftstream.c" #include "ftstream.c"
#include "ftlist.c" #include "ftlist.c"
#include "ftoutln.c" #include "ftoutln.c"
#include "ftextend.c" #include "ftextend.c"
#else #else
#include <ftcalc.c> #include <ftcalc.c>
#include <ftobjs.c> #include <ftobjs.c>
#include <ftstream.c> #include <ftstream.c>
#include <ftlist.c> #include <ftlist.c>
#include <ftoutln.c> #include <ftoutln.c>
#include <ftextend.c> #include <ftextend.c>
#endif #endif
/* END */ /* END */

View File

@ -2014,7 +2014,7 @@
metrics->y_scale = FT_DivFix( metrics->y_ppem << 6, metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,
face->units_per_EM ); face->units_per_EM );
ft_recompute_scaled_metrics( face, metrics ); ft_recompute_scaled_metrics( face, metrics );
} }

View File

@ -270,15 +270,16 @@
} }
FT_EXPORT_FUNC( FT_Error ) FT_Outline_New_Internal( FT_Memory memory, FT_EXPORT_FUNC( FT_Error ) FT_Outline_New_Internal(
FT_UInt numPoints, FT_Memory memory,
FT_Int numContours, FT_UInt numPoints,
FT_Outline* outline ) FT_Int numContours,
FT_Outline* outline )
{ {
FT_Error error; FT_Error error;
if ( !outline ) if ( !outline || !memory )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
*outline = null_outline; *outline = null_outline;
@ -302,7 +303,6 @@
} }
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -340,11 +340,13 @@
FT_Int numContours, FT_Int numContours,
FT_Outline* outline ) FT_Outline* outline )
{ {
if ( !library )
return FT_Err_Invalid_Library_Handle;
return FT_Outline_New_Internal( library->memory, numPoints, return FT_Outline_New_Internal( library->memory, numPoints,
numContours, outline ); numContours, outline );
} }
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -396,6 +398,25 @@
} }
FT_EXPORT_FUNC( FT_Error ) FT_Outline_Done_Internal( FT_Memory memory,
FT_Outline* outline )
{
if ( outline )
{
if ( outline->flags & ft_outline_owner )
{
FREE( outline->points );
FREE( outline->tags );
FREE( outline->contours );
}
*outline = null_outline;
return FT_Err_Ok;
}
else
return FT_Err_Invalid_Argument;
}
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -424,34 +445,18 @@
/* The reason why this function takes an `outline' parameter is */ /* The reason why this function takes an `outline' parameter is */
/* simply to use FT_Free(). */ /* simply to use FT_Free(). */
/* */ /* */
FT_EXPORT_FUNC( FT_Error ) FT_Outline_Done_Internal( FT_Memory memory,
FT_Outline* outline )
{
if ( outline )
{
if ( outline->flags & ft_outline_owner )
{
FREE( outline->points );
FREE( outline->tags );
FREE( outline->contours );
}
*outline = null_outline;
return FT_Err_Ok;
}
else
return FT_Err_Invalid_Argument;
}
FT_EXPORT_FUNC( FT_Error ) FT_Outline_Done( FT_Library library, FT_EXPORT_FUNC( FT_Error ) FT_Outline_Done( FT_Library library,
FT_Outline* outline ) FT_Outline* outline )
{ {
/* check for valid `outline' in FT_Outline_Done_Internal() */
if ( !library )
return FT_Err_Invalid_Library_Handle;
return FT_Outline_Done_Internal( library->memory, outline ); return FT_Outline_Done_Internal( library->memory, outline );
} }
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */

View File

@ -636,8 +636,6 @@
} }
BASE_FUNC( FT_Error ) FT_Read_Fields( FT_Stream stream, BASE_FUNC( FT_Error ) FT_Read_Fields( FT_Stream stream,
const FT_Frame_Field* fields, const FT_Frame_Field* fields,
void* structure ) void* structure )

View File

@ -19,19 +19,22 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2driver.c" /* driver interface */ #include "t2driver.c" /* driver interface */
#include "t2parse.c" /* token parser */ #include "t2parse.c" /* token parser */
#include "t2load.c" /* tables loader */ #include "t2load.c" /* tables loader */
#include "t2objs.c" /* object management */ #include "t2objs.c" /* object management */
#include "t2gload.c" /* glyph loader */ #include "t2gload.c" /* glyph loader */
#else #else
#include <cff/t2driver.c> /* driver interface */ #include <cff/t2driver.c> /* driver interface */
#include <cff/t2parse.c> /* token parser */ #include <cff/t2parse.c> /* token parser */
#include <cff/t2load.c> /* tables loader */ #include <cff/t2load.c> /* tables loader */
#include <cff/t2objs.c> /* object management */ #include <cff/t2objs.c> /* object management */
#include <cff/t2gload.c> /* glyph loader */ #include <cff/t2gload.c> /* glyph loader */
#endif #endif
/* END */ /* END */

View File

@ -24,14 +24,18 @@
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2driver.h" #include "t2driver.h"
#include "t2gload.h" #include "t2gload.h"
#else #else
#include <cff/t2driver.h> #include <cff/t2driver.h>
#include <cff/t2gload.h> #include <cff/t2gload.h>
#endif
#endif
/*************************************************************************/ /*************************************************************************/

View File

@ -23,14 +23,20 @@
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2load.h" #include "t2load.h"
#include "t2gload.h" #include "t2gload.h"
#else #else
#include <cff/t2load.h> #include <cff/t2load.h>
#include <cff/t2gload.h> #include <cff/t2gload.h>
#endif #endif
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
@ -470,7 +476,8 @@
FT_Pos y ) FT_Pos y )
{ {
FT_Error error = 0; FT_Error error = 0;
/* test whether we are building a new contour */ /* test whether we are building a new contour */
if ( !builder->path_begun ) if ( !builder->path_begun )
{ {
@ -1155,7 +1162,6 @@
} }
break; break;
case t2_op_rcurveline: case t2_op_rcurveline:
{ {
FT_Int num_curves = ( num_args - 2 ) / 6; FT_Int num_curves = ( num_args - 2 ) / 6;
@ -1196,128 +1202,131 @@
} }
break; break;
case t2_op_hflex1: case t2_op_hflex1:
{ {
FT_Pos start_y; FT_Pos start_y;
FT_TRACE4(( " hflex1" )); FT_TRACE4(( " hflex1" ));
args = stack; args = stack;
/* Adding five more points; 4 control points, 1 on curve point. */ /* adding five more points; 4 control points, 1 on-curve point */
if (start_point ( builder, x, y ) || check_points ( builder, 5 ) ) if ( start_point( builder, x, y ) ||
check_points( builder, 5 ) )
goto Memory_Error; goto Memory_Error;
/* Record the starting point's y postion for later use */ /* Record the starting point's y postion for later use */
start_y = y; start_y = y;
/* first control point */ /* first control point */
x += args[0]; x += args[0];
y += args[1]; y += args[1];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* second control point */ /* second control point */
x += args[2]; x += args[2];
y += args[3]; y += args[3];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */ /* join point; on curve, with y-value the same as the last */
/* control point's y-value */ /* control point's y-value */
x += args[4]; x += args[4];
add_point( builder, x, y, 1 ); add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */ /* third control point, with y-value the same as the join */
/* point's y-value */ /* point's y-value */
x += args[5]; x += args[5];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* fourth control point */ /* fourth control point */
x += args[6]; x += args[6];
y += args[7]; y += args[7];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start */ /* ending point, with y-value the same as the start */
/* point's y-value. we don't add this point, though. */ /* point's y-value -- we don't add this point, though */
x += args[8]; x += args[8];
y = start_y; y = start_y;
args = stack; args = stack;
break; break;
} }
case t2_op_hflex: case t2_op_hflex:
{ {
FT_Pos start_y; FT_Pos start_y;
FT_TRACE4(( " hflex" )); FT_TRACE4(( " hflex" ));
args = stack; args = stack;
/* Adding five more points; 4 control points, 1 on curve point. */ /* adding five more points; 4 control points, 1 on-curve point */
if (start_point ( builder, x, y ) || check_points ( builder, 5 ) ) if ( start_point( builder, x, y ) ||
check_points ( builder, 5 ) )
goto Memory_Error; goto Memory_Error;
/* Record the starting point's y postion for later use */ /* record the starting point's y-position for later use */
start_y = y; start_y = y;
/* first control point */ /* first control point */
x += args[0]; x += args[0];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* second control point */ /* second control point */
x += args[1]; x += args[1];
y += args[2]; y += args[2];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */ /* join point; on curve, with y-value the same as the last */
/* control point's y-value */ /* control point's y-value */
x += args[3]; x += args[3];
add_point( builder, x, y, 1 ); add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */ /* third control point, with y-value the same as the join */
/* point's y-value */ /* point's y-value */
x += args[4]; x += args[4];
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* fourth control point */ /* fourth control point */
x += args[5]; x += args[5];
y = start_y; y = start_y;
add_point( builder, x, y, 0 ); add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start point's */ /* ending point, with y-value the same as the start point's */
/* y-value we don't add this point, though. */ /* y-value -- we don't add this point, though */
x += args[6]; x += args[6];
args = stack; args = stack;
break; break;
} }
case t2_op_flex1: case t2_op_flex1:
{ {
FT_Pos start_x, start_y; /* record start x,y values for alter use */ FT_Pos start_x, start_y; /* record start x, y values for alter */
FT_Int dx = 0, dy = 0; /* used in hort./vert. algorithm below */ /* use */
FT_Int horizontal, count; FT_Int dx = 0, dy = 0; /* used in horizontal/vertical */
/* algorithm below */
FT_Int horizontal, count;
FT_TRACE4(( " flex1" )); FT_TRACE4(( " flex1" ));
/* Adding five more points; 4 control points, 1 on curve point. */ /* adding five more points; 4 control points, 1 on-curve point */
if (start_point ( builder, x, y ) || check_points ( builder, 5 ) ) if ( start_point( builder, x, y ) ||
check_points( builder, 5 ) )
goto Memory_Error; goto Memory_Error;
/* Record the starting point's x,y postion for later use */ /* record the starting point's x, y postion for later use */
start_x = x; start_x = x;
start_y = y; start_y = y;
/* XXXX: figure out if this is supposed to be a horizontal or */ /* XXX: figure out whether this is supposed to be a horizontal */
/* vertical flex. The Type 2 specification is vague... */ /* or vertical flex; the Type 2 specification is vague... */
args = stack; args = stack;
/* grab up to the last argument */ /* grab up to the last argument */
for ( count = 5; count > 0; count-- ) for ( count = 5; count > 0; count-- )
{ {
@ -1325,25 +1334,25 @@
dy += args[1]; dy += args[1];
args += 2; args += 2;
} }
/* rewind */ /* rewind */
args = stack; args = stack;
if ( dx < 0 ) dx = -dx; if ( dx < 0 ) dx = -dx;
if ( dy < 0 ) dy = -dy; if ( dy < 0 ) dy = -dy;
/* strange test, but here it is... */ /* strange test, but here it is... */
horizontal = (dx > dy); horizontal = ( dx > dy );
for ( count = 5; count > 0; count-- ) for ( count = 5; count > 0; count-- )
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
add_point( builder, x, y, (FT_Bool)(count == 3) ); add_point( builder, x, y, (FT_Bool)( count == 3 ) );
args += 2; args += 2;
} }
if (horizontal) if ( horizontal )
{ {
x += args[0]; x += args[0];
y = start_y; y = start_y;
@ -1353,41 +1362,38 @@
x = start_x; x = start_x;
y += args[0]; y += args[0];
} }
args = stack; args = stack;
break; break;
} }
case t2_op_flex: case t2_op_flex:
{ {
FT_UInt count; FT_UInt count;
FT_TRACE4(( " flex" )); FT_TRACE4(( " flex" ));
if (start_point ( builder, x, y ) || check_points ( builder, 5 ) ) if ( start_point( builder, x, y ) ||
goto Memory_Error; check_points( builder, 5 ) )
goto Memory_Error;
args = stack; args = stack;
for ( count = 5; count > 0; count-- ) for ( count = 5; count > 0; count-- )
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
add_point( builder, x, y, (FT_Bool)(count == 3) ); add_point( builder, x, y, (FT_Bool)( count == 3 ) );
args += 2; args += 2;
} }
x += args[0]; x += args[0];
y += args[1]; y += args[1];
args = stack; args = stack;
} }
break; break;
case t2_op_endchar: case t2_op_endchar:
FT_TRACE4(( " endchar" )); FT_TRACE4(( " endchar" ));

View File

@ -21,12 +21,18 @@
#include <freetype/freetype.h> #include <freetype/freetype.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2objs.h" #include "t2objs.h"
#else #else
#include <cff/t2objs.h> #include <cff/t2objs.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -24,12 +24,17 @@
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2load.h" #include "t2load.h"
#include "t2parse.h" #include "t2parse.h"
#else #else
#include <cff/t2load.h> #include <cff/t2load.h>
#include <cff/t2parse.h> #include <cff/t2parse.h>
#endif #endif
@ -324,7 +329,6 @@
} }
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*** ***/ /*** ***/

View File

@ -34,7 +34,6 @@
FT_UInt sid, FT_UInt sid,
PSNames_Interface* interface ); PSNames_Interface* interface );
LOCAL_DEF LOCAL_DEF
FT_Error T2_Access_Element( CFF_Index* index, FT_Error T2_Access_Element( CFF_Index* index,
FT_UInt element, FT_UInt element,

View File

@ -26,16 +26,24 @@
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2objs.h" #include "t2objs.h"
#include "t2load.h" #include "t2load.h"
#else #else
#include <cff/t2objs.h> #include <cff/t2objs.h>
#include <cff/t2load.h> #include <cff/t2load.h>
#endif #endif
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
#include <string.h> /* for strlen() */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -54,13 +62,15 @@
/*************************************************************************/ /*************************************************************************/
static static
FT_String* T2_StrCopy( FT_Memory memory, const FT_String* source ) FT_String* T2_StrCopy( FT_Memory memory,
const FT_String* source )
{ {
FT_Error error; FT_Error error;
FT_String* result = 0; FT_String* result = 0;
FT_Int len = (FT_Int)strlen(source); FT_Int len = (FT_Int)strlen( source );
if ( !ALLOC( result, len+1 ) )
if ( !ALLOC( result, len + 1 ) )
{ {
MEM_Copy( result, source, len ); MEM_Copy( result, source, len );
result[len] = 0; result[len] = 0;
@ -70,12 +80,13 @@
#if 0 #if 0
/* this function is used to build a Unicode charmap from the glyph names */ /* this function is used to build a Unicode charmap from the glyph names */
/* in a file.. */ /* in a file */
static static
FT_Error CFF_Build_Unicode_Charmap( T2_Face face, FT_Error CFF_Build_Unicode_Charmap( T2_Face face,
FT_ULong base_offset, FT_ULong base_offset,
PSNames_Interface* psnames ) PSNames_Interface* psnames )
{ {
CFF_Font* font = (CFF_Font*)face->extra.data; CFF_Font* font = (CFF_Font*)face->extra.data;
FT_Memory memory = FT_FACE_MEMORY(face); FT_Memory memory = FT_FACE_MEMORY(face);
@ -87,8 +98,9 @@
FT_Byte format; FT_Byte format;
FT_Stream stream = face->root.stream; FT_Stream stream = face->root.stream;
charset_offset = dict->charset_offset; charset_offset = dict->charset_offset;
if (!charset_offset) if ( !charset_offset )
{ {
FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" )); FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" ));
error = FT_Err_Invalid_File_Format; error = FT_Err_Invalid_File_Format;
@ -96,7 +108,7 @@
} }
/* allocate the charmap */ /* allocate the charmap */
if ( ALLOC( face->charmap, if ( ALLOC( face->charmap, ...
/* seek to charset table and allocate glyph names table */ /* seek to charset table and allocate glyph names table */
if ( FILE_Seek( base_offset + charset_offset ) || if ( FILE_Seek( base_offset + charset_offset ) ||
@ -104,19 +116,19 @@
goto Exit; goto Exit;
/* now, read each glyph name and store it in the glyph name table */ /* now, read each glyph name and store it in the glyph name table */
if ( READ_Byte(format) ) if ( READ_Byte( format ) )
goto Fail; goto Fail;
switch (format) switch ( format )
{ {
case 0: /* format 0 - one SID per glyph */ case 0: /* format 0 - one SID per glyph */
{ {
const char** gname = glyph_names; const char** gname = glyph_names;
const char** limit = gname + num_glyphs; const char** limit = gname + num_glyphs;
if ( ACCESS_Frame( num_glyphs*2 ) ) if ( ACCESS_Frame( num_glyphs*2 ) )
goto Fail; goto Fail;
for ( ; gname < limit; gname++ ) for ( ; gname < limit; gname++ )
gname[0] = T2_Get_String( &font->string_index, gname[0] = T2_Get_String( &font->string_index,
GET_UShort(), GET_UShort(),
@ -124,22 +136,22 @@
FORGET_Frame(); FORGET_Frame();
break; break;
} }
case 1: /* format 1 - sequential ranges */ case 1: /* format 1 - sequential ranges */
case 2: /* format 2 - sequential ranges with 16-bit counts */ case 2: /* format 2 - sequential ranges with 16-bit counts */
{ {
const char** gname = glyph_names; const char** gname = glyph_names;
const char** limit = gname + num_glyphs; const char** limit = gname + num_glyphs;
FT_UInt len = 3; FT_UInt len = 3;
if (format == 2) if (format == 2)
len++; len++;
while (gname < limit) while (gname < limit)
{ {
FT_UInt first; FT_UInt first;
FT_UInt count; FT_UInt count;
if ( ACCESS_Frame( len ) ) if ( ACCESS_Frame( len ) )
goto Fail; goto Fail;
@ -150,7 +162,7 @@
count = GET_Byte(); count = GET_Byte();
FORGET_Frame(); FORGET_Frame();
for ( ; count > 0; count-- ) for ( ; count > 0; count-- )
{ {
gname[0] = T2_Get_String( &font->string_index, gname[0] = T2_Get_String( &font->string_index,
@ -162,7 +174,7 @@
} }
break; break;
} }
default: /* unknown charset format !! */ default: /* unknown charset format !! */
FT_ERROR(( "CFF: unknown charset format !!\n" )); FT_ERROR(( "CFF: unknown charset format !!\n" ));
error = FT_Err_Invalid_File_Format; error = FT_Err_Invalid_File_Format;
@ -175,14 +187,14 @@
Fail: Fail:
for ( n = 0; n < num_glyphs; n++ ) for ( n = 0; n < num_glyphs; n++ )
FREE( glyph_names[n] ); FREE( glyph_names[n] );
FREE( glyph_names ); FREE( glyph_names );
Exit: Exit:
return error; return error;
} }
#endif
#endif /* 0 */
static static
@ -233,7 +245,7 @@
return ft_encoding_none; return ft_encoding_none;
} }
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -270,13 +282,14 @@
FT_Bool pure_cff = 1; FT_Bool pure_cff = 1;
FT_Bool sfnt_format = 0; FT_Bool sfnt_format = 0;
sfnt = (SFNT_Interface*)FT_Get_Module_Interface( sfnt = (SFNT_Interface*)FT_Get_Module_Interface(
face->root.driver->root.library, "sfnt" ); face->root.driver->root.library, "sfnt" );
if ( !sfnt ) if ( !sfnt )
goto Bad_Format; goto Bad_Format;
psnames = (PSNames_Interface*)FT_Get_Module_Interface( psnames = (PSNames_Interface*)FT_Get_Module_Interface(
face->root.driver->root.library, "psnames" ); face->root.driver->root.library, "psnames" );
/* create input stream from resource */ /* create input stream from resource */
if ( FILE_Seek( 0 ) ) if ( FILE_Seek( 0 ) )
@ -296,27 +309,28 @@
if ( face_index < 0 ) if ( face_index < 0 )
return T2_Err_Ok; return T2_Err_Ok;
sfnt_format = 1; sfnt_format = 1;
/* now, the font can be either an OpenType/CFF font, or a SVG CEF font */ /* now, the font can be either an OpenType/CFF font, or a SVG CEF */
/* in the later case, it doesn't have a "head" table.. */ /* font in the later case; it doesn't have a `head' table */
error = face->goto_table( face, TTAG_head, stream, 0 ); error = face->goto_table( face, TTAG_head, stream, 0 );
if (!error) if ( !error )
{ {
pure_cff = 0; pure_cff = 0;
/* Load font directory */ /* Load font directory */
error = sfnt->load_face( stream, face, face_index, num_params, params ); error = sfnt->load_face( stream, face,
face_index, num_params, params );
if ( error ) if ( error )
goto Exit; goto Exit;
} }
else else
{ {
/* load the "cmap" table by hand */ /* load the `cmap' table by hand */
error = sfnt->load_charmaps( face, stream ); error = sfnt->load_charmaps( face, stream );
if (error) if ( error )
goto Exit; goto Exit;
/* XXX: for now, we don't load the GPOS table, as OpenType Layout */ /* XXX: for now, we don't load the GPOS table, as OpenType Layout */
/* support will be added later to FreeType 2 as a separate module */ /* support will be added later to FreeType 2 as a separate module */
} }
@ -328,12 +342,11 @@
} }
else else
{ {
/* rewind to start of file, we're going to load a pure-CFF font */ /* rewind to start of file; we are going to load a pure-CFF font */
(void)FILE_Seek(0); (void)FILE_Seek( 0 );
error = FT_Err_Ok; error = FT_Err_Ok;
} }
/* now load and parse the CFF table in the file */ /* now load and parse the CFF table in the file */
{ {
CFF_Font* cff; CFF_Font* cff;
@ -347,7 +360,7 @@
goto Exit; goto Exit;
base_offset = FILE_Pos(); base_offset = FILE_Pos();
face->extra.data = cff; face->extra.data = cff;
error = T2_Load_CFF_Font( stream, face_index, cff ); error = T2_Load_CFF_Font( stream, face_index, cff );
if ( error ) if ( error )
@ -355,125 +368,131 @@
/* Complement the root flags with some interesting information. */ /* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts */ /* Note that this is only necessary for pure CFF and CEF fonts */
root = &face->root; root = &face->root;
if (pure_cff) if ( pure_cff )
{ {
CFF_Font_Dict* dict = &cff->top_font.font_dict; CFF_Font_Dict* dict = &cff->top_font.font_dict;
/* we need the psnames module for pure-CFF and CEF formats */
if (!psnames) /* we need the `PSNames' module for pure-CFF and CEF formats */
if ( !psnames )
{ {
FT_ERROR(( "cannot open CFF & CEF fonts without the 'psnames' module\n" )); FT_ERROR(( "T2_Init_Face:" ));
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
FT_ERROR(( " " ));
FT_ERROR(( " without the `PSNames' module\n" ));
goto Bad_Format; goto Bad_Format;
} }
/* compute number of glyphs */ /* compute number of glyphs */
if (dict->cid_registry) if ( dict->cid_registry )
root->num_glyphs = dict->cid_count; root->num_glyphs = dict->cid_count;
else else
root->num_glyphs = cff->charstrings_index.count; root->num_glyphs = cff->charstrings_index.count;
/* set global bbox, as well as EM size */ /* set global bbox, as well as EM size */
root->units_per_EM = FT_DivFix( 1000L << 16, dict->font_matrix.yy ) >> 16; root->units_per_EM = FT_DivFix( 1000L << 16,
root->bbox = dict->font_bbox; dict->font_matrix.yy ) >> 16;
root->ascender = root->bbox.yMax; root->bbox = dict->font_bbox;
root->descender = root->bbox.yMin; root->ascender = root->bbox.yMax;
root->descender = root->bbox.yMin;
/* retrieve font family & style name */ /* retrieve font family & style name */
root->family_name = T2_Get_Name( &cff->name_index, face_index ); root->family_name = T2_Get_Name( &cff->name_index, face_index );
if (dict->cid_registry) if ( dict->cid_registry )
{ {
root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */ root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */
} }
else else
{ {
root->style_name = T2_Get_String( &cff->string_index, root->style_name = T2_Get_String( &cff->string_index,
dict->weight, dict->weight,
psnames ); psnames );
} }
/*********************************************************************/
/* */
/* Compute face flags. */
/* */
flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
if (sfnt_format) /*******************************************************************/
flags |= FT_FACE_FLAG_SFNT; /* */
/* Compute face flags. */
/* fixed width font? */ /* */
if ( dict->is_fixed_pitch ) flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
flags |= FT_FACE_FLAG_FIXED_WIDTH; FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
if ( sfnt_format )
flags |= FT_FACE_FLAG_SFNT;
/* fixed width font? */
if ( dict->is_fixed_pitch )
flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ /* XXXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
#if 0 #if 0
/* kerning available ? */ /* kerning available? */
if ( face->kern_pairs ) if ( face->kern_pairs )
flags |= FT_FACE_FLAG_KERNING; flags |= FT_FACE_FLAG_KERNING;
#endif #endif
root->face_flags = flags; root->face_flags = flags;
/*********************************************************************/
/* */
/* Compute style flags. */
/* */
flags = 0;
if ( dict->italic_angle )
flags |= FT_STYLE_FLAG_ITALIC;
/* XXXX : may not be correct .. */
if ( cff->top_font.private_dict.force_bold )
flags |= FT_STYLE_FLAG_BOLD;
root->style_flags = flags;
/* set the charmaps if any */
if (sfnt_format)
{
/*********************************************************************/
/* */
/* Polish the charmaps. */
/* */
/* Try to set the charmap encoding according to the platform & */
/* encoding ID of each charmap. */
/* */
TT_CharMap charmap;
FT_Int n;
charmap = face->charmaps; /*******************************************************************/
root->num_charmaps = face->num_charmaps; /* */
/* Compute style flags. */
/* allocate table of pointers */ /* */
if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) ) flags = 0;
goto Exit;
if ( dict->italic_angle )
for ( n = 0; n < root->num_charmaps; n++, charmap++ ) flags |= FT_STYLE_FLAG_ITALIC;
{
FT_Int platform = charmap->cmap.platformID; /* XXX: may not be correct */
FT_Int encoding = charmap->cmap.platformEncodingID; if ( cff->top_font.private_dict.force_bold )
flags |= FT_STYLE_FLAG_BOLD;
charmap->root.face = (FT_Face)face; root->style_flags = flags;
charmap->root.platform_id = platform;
charmap->root.encoding_id = encoding; /* set the charmaps if any */
charmap->root.encoding = find_encoding( platform, encoding ); if ( sfnt_format )
{
/* now, set root->charmap with a unicode charmap */ /*****************************************************************/
/* wherever available */ /* */
if ( !root->charmap && /* Polish the charmaps. */
charmap->root.encoding == ft_encoding_unicode ) /* */
root->charmap = (FT_CharMap)charmap; /* Try to set the charmap encoding according to the platform & */
/* encoding ID of each charmap. */
root->charmaps[n] = (FT_CharMap)charmap; /* */
} TT_CharMap charmap;
FT_Int n;
charmap = face->charmaps;
root->num_charmaps = face->num_charmaps;
/* allocate table of pointers */
if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) )
goto Exit;
for ( n = 0; n < root->num_charmaps; n++, charmap++ )
{
FT_Int platform = charmap->cmap.platformID;
FT_Int encoding = charmap->cmap.platformEncodingID;
charmap->root.face = (FT_Face)face;
charmap->root.platform_id = platform;
charmap->root.encoding_id = encoding;
charmap->root.encoding = find_encoding( platform, encoding );
/* now, set root->charmap with a unicode charmap */
/* wherever available */
if ( !root->charmap &&
charmap->root.encoding == ft_encoding_unicode )
root->charmap = (FT_CharMap)charmap;
root->charmaps[n] = (FT_CharMap)charmap;
} }
}
} }
} }
Exit: Exit:
return error; return error;

View File

@ -89,8 +89,8 @@
} T2_Transform; } T2_Transform;
/* this is only used in the case of a pure CFF font with no charmap */ /* this is only used in the case of a pure CFF font with no charmap */
typedef struct T2_CharMapRec_ typedef struct T2_CharMapRec_
{ {
TT_CharMapRec root; TT_CharMapRec root;
PS_Unicodes unicodes; PS_Unicodes unicodes;

View File

@ -17,11 +17,16 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2parse.h" #include "t2parse.h"
#else #else
#include <cff/t2parse.h> #include <cff/t2parse.h>
#endif #endif
#include <freetype/internal/t2errors.h> #include <freetype/internal/t2errors.h>
@ -422,11 +427,17 @@
static const T2_Field_Handler t2_field_handlers[] = static const T2_Field_Handler t2_field_handlers[] =
{ {
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t2tokens.h" #include "t2tokens.h"
#else #else
#include <cff/t2tokens.h> #include <cff/t2tokens.h>
#endif #endif
{ 0, 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0, 0 }
}; };

View File

@ -15,12 +15,18 @@
/* */ /* */
/***************************************************************************/ /***************************************************************************/
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidafm.h" #include "cidafm.h"
#else #else
#include <cid/cidafm.h> #include <cid/cidafm.h>
#endif #endif
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h> #include <freetype/internal/t1errors.h>

View File

@ -19,10 +19,15 @@
#ifndef CIDAFM_H #ifndef CIDAFM_H
#define CIDAFM_H #define CIDAFM_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidobjs.h" #include "cidobjs.h"
#else #else
#include <cid/cidobjs.h> #include <cid/cidobjs.h>
#endif #endif

View File

@ -17,13 +17,18 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidload.h" #include "cidload.h"
#include "cidgload.h" #include "cidgload.h"
#else #else
#include <cid/cidload.h> #include <cid/cidload.h>
#include <cid/cidgload.h> #include <cid/cidgload.h>
#endif #endif
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>

View File

@ -19,12 +19,18 @@
#ifndef CIDGLOAD_H #ifndef CIDGLOAD_H
#define CIDGLOAD_H #define CIDGLOAD_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidobjs.h" #include "cidobjs.h"
#else #else
#include <cid/cidobjs.h> #include <cid/cidobjs.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -23,12 +23,18 @@
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h> #include <freetype/internal/t1errors.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidload.h" #include "cidload.h"
#else #else
#include <cid/cidload.h> #include <cid/cidload.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <ctype.h> /* for isspace(), isalnum() */ #include <ctype.h> /* for isspace(), isalnum() */
@ -243,11 +249,17 @@
static static
const CID_Field_Rec t1_field_records[] = const CID_Field_Rec t1_field_records[] =
{ {
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidtokens.h" #include "cidtokens.h"
#else #else
#include <cid/cidtokens.h> #include <cid/cidtokens.h>
#endif #endif
{ 0, 0, 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0, 0, 0 }
}; };

View File

@ -21,12 +21,18 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidparse.h" #include "cidparse.h"
#else #else
#include <cid/cidparse.h> #include <cid/cidparse.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -19,14 +19,20 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidgload.h" #include "cidgload.h"
#include "cidload.h" #include "cidload.h"
#else #else
#include <cid/cidgload.h> #include <cid/cidgload.h>
#include <cid/cidload.h> #include <cid/cidload.h>
#endif #endif
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>

View File

@ -22,12 +22,18 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/t1errors.h> #include <freetype/internal/t1errors.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidparse.h" #include "cidparse.h"
#else #else
#include <cid/cidparse.h> #include <cid/cidparse.h>
#endif #endif
#include <string.h> /* for strncmp() */ #include <string.h> /* for strncmp() */

View File

@ -17,13 +17,18 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidriver.h" #include "cidriver.h"
#include "cidgload.h" #include "cidgload.h"
#else #else
#include <cid/cidriver.h> #include <cid/cidriver.h>
#include <cid/cidgload.h> #include <cid/cidgload.h>
#endif #endif
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>

View File

@ -19,17 +19,21 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "cidparse.c" #include "cidparse.c"
#include "cidload.c" #include "cidload.c"
#include "cidobjs.c" #include "cidobjs.c"
#include "cidriver.c" #include "cidriver.c"
#include "cidgload.c" #include "cidgload.c"
#else #else
#include <cid/cidparse.c> #include <cid/cidparse.c>
#include <cid/cidload.c> #include <cid/cidload.c>
#include <cid/cidobjs.c> #include <cid/cidobjs.c>
#include <cid/cidriver.c> #include <cid/cidriver.c>
#include <cid/cidgload.c> #include <cid/cidgload.c>
#endif #endif

View File

@ -19,14 +19,20 @@
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
#include <freetype/internal/ftobjs.h> #include <freetype/internal/ftobjs.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "psmodule.h" #include "psmodule.h"
#include "pstables.h" #include "pstables.h"
#else #else
#include <psnames/psmodule.h> #include <psnames/psmodule.h>
#include <psnames/pstables.h> #include <psnames/pstables.h>
#endif #endif
#include <stdlib.h> /* for qsort() */ #include <stdlib.h> /* for qsort() */
#include <string.h> /* for strcmp(), strncpy() */ #include <string.h> /* for strcmp(), strncpy() */

View File

@ -19,12 +19,17 @@
#include <freetype/internal/ftobjs.h> #include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftrend1.h" #include "ftrend1.h"
#include "ftraster.h" #include "ftraster.h"
#else #else
#include <raster1/ftrend1.h> #include <raster1/ftrend1.h>
#include <raster1/ftraster.h> #include <raster1/ftraster.h>
#endif #endif

View File

@ -18,12 +18,17 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftraster.c" #include "ftraster.c"
#include "ftrend1.c" #include "ftrend1.c"
#else #else
#include <raster1/ftraster.c> #include <raster1/ftraster.c>
#include <raster1/ftrend1.c> #include <raster1/ftrend1.c>
#endif #endif

View File

@ -19,20 +19,25 @@
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/internal/ftobjs.h> #include <freetype/internal/ftobjs.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "sfdriver.h" #include "sfdriver.h"
#include "ttload.h" #include "ttload.h"
#include "ttsbit.h" #include "ttsbit.h"
#include "ttpost.h" #include "ttpost.h"
#include "ttcmap.h" #include "ttcmap.h"
#include "sfobjs.h" #include "sfobjs.h"
#else #else
#include <sfnt/sfdriver.h> #include <sfnt/sfdriver.h>
#include <sfnt/ttload.h> #include <sfnt/ttload.h>
#include <sfnt/ttsbit.h> #include <sfnt/ttsbit.h>
#include <sfnt/ttpost.h> #include <sfnt/ttpost.h>
#include <sfnt/ttcmap.h> #include <sfnt/ttcmap.h>
#include <sfnt/sfobjs.h> #include <sfnt/sfobjs.h>
#endif #endif

View File

@ -18,6 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttload.c" #include "ttload.c"
@ -31,8 +32,8 @@
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
#include "ttpost.c" #include "ttpost.c"
#endif #endif
#include "sfdriver.c"
#include "sfdriver.c"
#else /* FT_FLAT_COMPILE */ #else /* FT_FLAT_COMPILE */
@ -47,12 +48,10 @@
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
#include <sfnt/ttpost.c> #include <sfnt/ttpost.c>
#endif #endif
#include <sfnt/sfdriver.c> #include <sfnt/sfdriver.c>
#endif /* FT_FLAT_COMPILE */ #endif /* FT_FLAT_COMPILE */
/* END */ /* END */

View File

@ -17,11 +17,16 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "sfobjs.h" #include "sfobjs.h"
#else #else
#include <sfnt/sfobjs.h> #include <sfnt/sfobjs.h>
#endif #endif
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
#include <freetype/ttnameid.h> #include <freetype/ttnameid.h>

View File

@ -19,17 +19,20 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttload.h" #include "ttload.h"
#include "ttcmap.h" #include "ttcmap.h"
#else #else
#include <sfnt/ttload.h> #include <sfnt/ttload.h>
#include <sfnt/ttcmap.h> #include <sfnt/ttcmap.h>
#endif #endif
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */

View File

@ -21,17 +21,20 @@
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttload.h" #include "ttload.h"
#include "ttcmap.h" #include "ttcmap.h"
#else #else
#include <sfnt/ttload.h> #include <sfnt/ttload.h>
#include <sfnt/ttcmap.h> #include <sfnt/ttcmap.h>
#endif #endif
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */

View File

@ -29,14 +29,18 @@
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttpost.h" #include "ttpost.h"
#include "ttload.h" #include "ttload.h"
#else #else
#include <sfnt/ttpost.h> #include <sfnt/ttpost.h>
#include <sfnt/ttload.h> #include <sfnt/ttload.h>
#endif
#endif
/*************************************************************************/ /*************************************************************************/

View File

@ -20,12 +20,16 @@
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>
#include <freetype/tttags.h> #include <freetype/tttags.h>
#ifdef FT_FLAT_COMPILE
#include "ttsbit.h"
#else
#include <sfnt/ttsbit.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "ttsbit.h"
#else
#include <sfnt/ttsbit.h>
#endif
/*************************************************************************/ /*************************************************************************/

View File

@ -19,12 +19,16 @@
#ifndef TTSBIT_H #ifndef TTSBIT_H
#define TTSBIT_H #define TTSBIT_H
#ifdef FT_FLAT_COMPILE
#include "ttload.h"
#else
#include <sfnt/ttload.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "ttload.h"
#else
#include <sfnt/ttload.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -123,10 +123,15 @@
#else /* _STANDALONE_ */ #else /* _STANDALONE_ */
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftgrays.h" #include "ftgrays.h"
#else #else
#include <smooth/ftgrays.h> #include <smooth/ftgrays.h>
#endif #endif

View File

@ -19,17 +19,20 @@
#include <freetype/internal/ftobjs.h> #include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftsmooth.h" #include "ftsmooth.h"
#include "ftgrays.h" #include "ftgrays.h"
#else #else
#include <smooth/ftsmooth.h> #include <smooth/ftsmooth.h>
#include <smooth/ftgrays.h> #include <smooth/ftgrays.h>
#endif #endif
/* initialize renderer -- init its raster */ /* initialize renderer -- init its raster */
static static
FT_Error ft_smooth_init( FT_Renderer render ) FT_Error ft_smooth_init( FT_Renderer render )

View File

@ -18,15 +18,18 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ftgrays.c" #include "ftgrays.c"
#include "ftsmooth.c" #include "ftsmooth.c"
#else #else
#include <smooth/ftgrays.c> #include <smooth/ftgrays.c>
#include <smooth/ftsmooth.c> #include <smooth/ftsmooth.c>
#endif #endif
/* END */ /* END */

View File

@ -18,27 +18,30 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttdriver.c" /* driver interface */ #include "ttdriver.c" /* driver interface */
#include "ttpload.c" /* tables loader */ #include "ttpload.c" /* tables loader */
#include "ttgload.c" /* glyph loader */ #include "ttgload.c" /* glyph loader */
#include "ttobjs.c" /* object manager */ #include "ttobjs.c" /* object manager */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include "ttinterp.c" /* bytecode interpreter */ #include "ttinterp.c" /* bytecode interpreter */
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <truetype/ttdriver.c> /* driver interface */ #include <truetype/ttdriver.c> /* driver interface */
#include <truetype/ttpload.c> /* tables loader */ #include <truetype/ttpload.c> /* tables loader */
#include <truetype/ttgload.c> /* glyph loader */ #include <truetype/ttgload.c> /* glyph loader */
#include <truetype/ttobjs.c> /* object manager */ #include <truetype/ttobjs.c> /* object manager */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <truetype/ttinterp.c> /* bytecode interpreter */ #include <truetype/ttinterp.c> /* bytecode interpreter */
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
/* END */ /* END */

View File

@ -21,14 +21,18 @@
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/ttnameid.h> #include <freetype/ttnameid.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttdriver.h" #include "ttdriver.h"
#include "ttgload.h" #include "ttgload.h"
#else #else
#include <truetype/ttdriver.h> #include <truetype/ttdriver.h>
#include <truetype/ttgload.h> #include <truetype/ttgload.h>
#endif
#endif
/*************************************************************************/ /*************************************************************************/

View File

@ -23,12 +23,16 @@
#include <freetype/tttags.h> #include <freetype/tttags.h>
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>
#ifdef FT_FLAT_COMPILE
#include "ttgload.h"
#else
#include <truetype/ttgload.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "ttgload.h"
#else
#include <truetype/ttgload.h>
#endif
/*************************************************************************/ /*************************************************************************/
@ -1048,7 +1052,7 @@
pts->tags[k] &= FT_Curve_Tag_On; pts->tags[k] &= FT_Curve_Tag_On;
} }
cur_to_org( num_points+2, pts ); cur_to_org( num_points + 2, pts );
/* now consider hinting */ /* now consider hinting */
if ( IS_HINTED( loader->load_flags ) && n_ins > 0 ) if ( IS_HINTED( loader->load_flags ) && n_ins > 0 )

View File

@ -19,21 +19,24 @@
#ifndef TTGLOAD_H #ifndef TTGLOAD_H
#define TTGLOAD_H #define TTGLOAD_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttobjs.h" #include "ttobjs.h"
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include "ttinterp.h" #include "ttinterp.h"
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <truetype/ttobjs.h> #include <truetype/ttobjs.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <truetype/ttinterp.h> #include <truetype/ttinterp.h>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -20,10 +20,15 @@
#include <freetype/internal/ftcalc.h> #include <freetype/internal/ftcalc.h>
#include <freetype/ftsystem.h> #include <freetype/ftsystem.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttinterp.h" #include "ttinterp.h"
#else #else
#include <truetype/ttinterp.h> #include <truetype/ttinterp.h>
#endif #endif

View File

@ -19,12 +19,16 @@
#ifndef TTINTERP_H #ifndef TTINTERP_H
#define TTINTERP_H #define TTINTERP_H
#ifdef FT_FLAT_COMPILE
#include "ttobjs.h"
#else
#include <truetype/ttobjs.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "ttobjs.h"
#else
#include <truetype/ttobjs.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -25,23 +25,27 @@
#include <freetype/internal/sfnt.h> #include <freetype/internal/sfnt.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "ttgload.h" #include "ttgload.h"
#include "ttpload.h" #include "ttpload.h"
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include "ttinterp.h" #include "ttinterp.h"
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <truetype/ttgload.h> #include <truetype/ttgload.h>
#include <truetype/ttpload.h> #include <truetype/ttpload.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#include <truetype/ttinterp.h> #include <truetype/ttinterp.h>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
#include <freetype/internal/tterrors.h> #include <freetype/internal/tterrors.h>

View File

@ -17,11 +17,16 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1afm.h" #include "t1afm.h"
#else #else
#include <type1/t1afm.h> #include <type1/t1afm.h>
#endif #endif
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>

View File

@ -17,15 +17,20 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1driver.h" #include "t1driver.h"
#include "t1gload.h" #include "t1gload.h"
#include "t1afm.h" #include "t1afm.h"
#else #else
#include <type1/t1driver.h> #include <type1/t1driver.h>
#include <type1/t1gload.h> #include <type1/t1gload.h>
#include <type1/t1afm.h> #include <type1/t1afm.h>
#endif #endif
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
@ -217,8 +222,8 @@
result = psnames->lookup_unicode( &face->unicode_map, result = psnames->lookup_unicode( &face->unicode_map,
(FT_ULong)charcode ); (FT_ULong)charcode );
/* the function returns 0xFFFF when the Unicode charcode has */ /* the function returns 0xFFFF if the Unicode charcode has */
/* no corresponding glyph. */ /* no corresponding glyph */
if ( result == 0xFFFF ) if ( result == 0xFFFF )
result = 0; result = 0;
goto Exit; goto Exit;
@ -264,7 +269,7 @@
if ( gname && gname[0] == glyph_name[0] && if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 ) strcmp( gname, glyph_name ) == 0 )
{ {
result = n; result = n;
break; break;
@ -316,7 +321,7 @@
#ifdef T1_CONFIG_OPTION_NO_AFM #ifdef T1_CONFIG_OPTION_NO_AFM
(FTDriver_getKerning) 0, (FTDriver_getKerning) 0,
(FTDriver_getAdvances) 0, (FTDriver_attachFile) 0,
#else #else
(FTDriver_getKerning) Get_Kerning, (FTDriver_getKerning) Get_Kerning,
(FTDriver_attachFile) T1_Read_AFM, (FTDriver_attachFile) T1_Read_AFM,

View File

@ -19,24 +19,26 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include <type1/t1gload.h> #include <type1/t1gload.h>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.h> #include <type1/t1hinter.h>
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <type1/t1gload.h> #include <type1/t1gload.h>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.h> #include <type1/t1hinter.h>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h> #include <freetype/ftoutln.h>
#include <string.h> /* for strcmp() */ #include <string.h> /* for strcmp() */
@ -181,6 +183,7 @@
/* */ /* */
/* <Input> */ /* <Input> */
/* funcs :: The hinting functions interface. */ /* funcs :: The hinting functions interface. */
/* */
LOCAL_FUNC LOCAL_FUNC
void T1_Init_Decoder( T1_Decoder* decoder, void T1_Init_Decoder( T1_Decoder* decoder,
const T1_Hinter_Funcs* funcs ) const T1_Hinter_Funcs* funcs )

View File

@ -19,10 +19,15 @@
#ifndef T1GLOAD_H #ifndef T1GLOAD_H
#define T1GLOAD_H #define T1GLOAD_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1objs.h" #include "t1objs.h"
#else #else
#include <type1/t1objs.h> #include <type1/t1objs.h>
#endif #endif

View File

@ -26,14 +26,19 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1objs.h" #include "t1objs.h"
#include "t1hinter.h" #include "t1hinter.h"
#else #else
#include <type1/t1objs.h> #include <type1/t1objs.h>
#include <type1/t1hinter.h> #include <type1/t1hinter.h>
#endif
#endif
/*************************************************************************/ /*************************************************************************/

View File

@ -19,14 +19,20 @@
#ifndef T1HINTER_H #ifndef T1HINTER_H
#define T1HINTER_H #define T1HINTER_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1objs.h" #include "t1objs.h"
#include "t1gload.h" #include "t1gload.h"
#else #else
#include <type1/t1objs.h> #include <type1/t1objs.h>
#include <type1/t1gload.h> #include <type1/t1gload.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -20,12 +20,17 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1tokens.h" #include "t1tokens.h"
#include "t1parse.h" #include "t1parse.h"
#else #else
#include <type1/t1tokens.h> #include <type1/t1tokens.h>
#include <type1/t1parse.h> #include <type1/t1parse.h>
#endif #endif

View File

@ -21,10 +21,15 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1parse.h" #include "t1parse.h"
#else #else
#include <type1/t1parse.h> #include <type1/t1parse.h>
#endif #endif

View File

@ -19,32 +19,33 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1gload.h" #include "t1gload.h"
#include "t1load.h" #include "t1load.h"
#include "t1afm.h" #include "t1afm.h"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include "t1hinter.h" #include "t1hinter.h"
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <type1/t1gload.h> #include <type1/t1gload.h>
#include <type1/t1load.h> #include <type1/t1load.h>
#include <type1/t1afm.h> #include <type1/t1afm.h>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.h> #include <type1/t1hinter.h>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -174,7 +175,6 @@
/* */ /* */
/* FACE FUNCTIONS */ /* FACE FUNCTIONS */
/* */ /* */
/* */
/*************************************************************************/ /*************************************************************************/
@ -245,7 +245,8 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> T1_Init_Face */ /* <Function> */
/* T1_Init_Face */
/* */ /* */
/* <Description> */ /* <Description> */
/* The face object constructor. */ /* The face object constructor. */

View File

@ -19,10 +19,15 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1parse.h" #include "t1parse.h"
#else #else
#include <type1/t1parse.h> #include <type1/t1parse.h>
#endif #endif

View File

@ -32,10 +32,15 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1tokens.h" #include "t1tokens.h"
#else #else
#include <type1/t1tokens.h> #include <type1/t1tokens.h>
#endif #endif

View File

@ -32,12 +32,17 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1tokens.h" #include "t1tokens.h"
#include "t1load.h" #include "t1load.h"
#else #else
#include <type1/t1tokens.h> #include <type1/t1tokens.h>
#include <type1/t1load.h> #include <type1/t1load.h>
#endif #endif

View File

@ -19,12 +19,16 @@
#ifndef T1TOKENS_H #ifndef T1TOKENS_H
#define T1TOKENS_H #define T1TOKENS_H
#ifdef FT_FLAT_COMPILE
#include "t1objs.h"
#else
#include <type1/t1objs.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "t1objs.h"
#else
#include <type1/t1objs.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -18,6 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "t1driver.c" #include "t1driver.c"
@ -26,9 +27,11 @@
#include "t1gload.c" #include "t1gload.c"
#include "t1tokens.c" #include "t1tokens.c"
#include "t1parse.c" #include "t1parse.c"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include "t1hinter.c" #include "t1hinter.c"
#endif #endif
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
#include "t1afm.c" #include "t1afm.c"
#endif #endif
@ -41,16 +44,16 @@
#include <type1/t1gload.c> #include <type1/t1gload.c>
#include <type1/t1tokens.c> #include <type1/t1tokens.c>
#include <type1/t1parse.c> #include <type1/t1parse.c>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.c> #include <type1/t1hinter.c>
#endif #endif
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
#include <type1/t1afm.c> #include <type1/t1afm.c>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
/* END */ /* END */

View File

@ -18,6 +18,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT #define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "z1parse.c" #include "z1parse.c"
@ -25,22 +26,24 @@
#include "z1objs.c" #include "z1objs.c"
#include "z1driver.c" #include "z1driver.c"
#include "z1gload.c" #include "z1gload.c"
#ifndef Z1_CONFIG_OPTION_NO_AFM #ifndef Z1_CONFIG_OPTION_NO_AFM
#include "z1afm.c" #include "z1afm.c"
#endif #endif
#else #else /* FT_FLAT_COMPILE */
#include <type1z/z1parse.c> #include <type1z/z1parse.c>
#include <type1z/z1load.c> #include <type1z/z1load.c>
#include <type1z/z1objs.c> #include <type1z/z1objs.c>
#include <type1z/z1driver.c> #include <type1z/z1driver.c>
#include <type1z/z1gload.c> #include <type1z/z1gload.c>
#ifndef Z1_CONFIG_OPTION_NO_AFM #ifndef Z1_CONFIG_OPTION_NO_AFM
#include <type1z/z1afm.c> #include <type1z/z1afm.c>
#endif #endif
#endif #endif /* FT_FLAT_COMPILE */
/* END */ /* END */

View File

@ -17,11 +17,16 @@
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "z1afm.h" #include "z1afm.h"
#else #else
#include <type1z/z1afm.h> #include <type1z/z1afm.h>
#endif #endif
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>

View File

@ -19,12 +19,16 @@
#ifndef Z1AFM_H #ifndef Z1AFM_H
#define Z1AFM_H #define Z1AFM_H
#ifdef FT_FLAT_COMPILE
#include "z1objs.h"
#else
#include <type1z/z1objs.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "z1objs.h"
#else
#include <type1z/z1objs.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,30 +1,35 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1driver.c /* z1driver.c */
* /* */
* High-level Type1 driver interface for FreeType 2.0 /* Experimental Type 1 driver interface (body). */
* /* */
* Copyright 1996-1998 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used, /* This file is part of the FreeType project, and may only be used, */
* modified, and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
******************************************************************/ /***************************************************************************/
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "z1driver.h" #include "z1driver.h"
#include "z1gload.h" #include "z1gload.h"
#include "z1load.h" #include "z1load.h"
#include "z1afm.h" #include "z1afm.h"
#else #else
#include <type1z/z1driver.h> #include <type1z/z1driver.h>
#include <type1z/z1gload.h> #include <type1z/z1gload.h>
#include <type1z/z1load.h> #include <type1z/z1load.h>
#include <type1z/z1afm.h> #include <type1z/z1afm.h>
#endif #endif
@ -32,8 +37,18 @@
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
#include <string.h> /* for strcmp() */
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_t1driver #define FT_COMPONENT trace_z1driver
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -66,8 +81,8 @@
FT_Module_Interface Get_Interface( FT_Driver driver, FT_Module_Interface Get_Interface( FT_Driver driver,
const FT_String* interface ) const FT_String* interface )
{ {
FT_UNUSED(driver); FT_UNUSED( driver );
FT_UNUSED(interface); FT_UNUSED( interface );
#ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT #ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
if ( strcmp( (const char*)interface, "get_mm" ) == 0 ) if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
@ -84,6 +99,8 @@
#ifndef Z1_CONFIG_OPTION_NO_AFM #ifndef Z1_CONFIG_OPTION_NO_AFM
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -124,16 +141,20 @@
{ {
Z1_AFM* afm; Z1_AFM* afm;
kerning->x = 0; kerning->x = 0;
kerning->y = 0; kerning->y = 0;
afm = (Z1_AFM*)face->afm_data; afm = (Z1_AFM*)face->afm_data;
if (afm) if ( afm )
Z1_Get_Kerning( afm, left_glyph, right_glyph, kerning ); Z1_Get_Kerning( afm, left_glyph, right_glyph, kerning );
return T1_Err_Ok; return T1_Err_Ok;
} }
#endif
#endif /* T1_CONFIG_OPTION_NO_AFM */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -158,147 +179,128 @@
FT_UInt result = 0; FT_UInt result = 0;
PSNames_Interface* psnames; PSNames_Interface* psnames;
face = (T1_Face)charmap->face;
face = (T1_Face)charmap->face;
psnames = (PSNames_Interface*)face->psnames; psnames = (PSNames_Interface*)face->psnames;
if (psnames) if ( psnames )
switch (charmap->encoding) switch ( charmap->encoding )
{ {
/********************************************************************/ /*******************************************************************/
/* */ /* */
/* Unicode encoding support */ /* Unicode encoding support */
/* */ /* */
case ft_encoding_unicode: case ft_encoding_unicode:
{ /* use the `PSNames' module to synthetize the Unicode charmap */
/* use the "psnames" module to synthetize the Unicode charmap */ result = psnames->lookup_unicode( &face->unicode_map,
result = psnames->lookup_unicode( &face->unicode_map, (FT_ULong)charcode );
(FT_ULong)charcode );
/* the function returns 0xFFFF when the Unicode charcode has */ /* the function returns 0xFFFF if the Unicode charcode has */
/* no corresponding glyph.. */ /* no corresponding glyph */
if (result == 0xFFFF) if ( result == 0xFFFF )
result = 0; result = 0;
goto Exit; goto Exit;
}
/********************************************************************/ /*******************************************************************/
/* */ /* */
/* Custom Type 1 encoding */ /* Custom Type 1 encoding */
/* */ /* */
case ft_encoding_adobe_custom: case ft_encoding_adobe_custom:
{
T1_Encoding* encoding = &face->type1.encoding;
if ( charcode >= encoding->code_first &&
charcode <= encoding->code_last )
result = encoding->char_index[charcode];
goto Exit;
}
/*******************************************************************/
/* */
/* Adobe Standard & Expert encoding support */
/* */
default:
if ( charcode < 256 )
{
FT_UInt code;
FT_Int n;
const char* glyph_name;
code = psnames->adobe_std_encoding[charcode];
if ( charmap->encoding == ft_encoding_adobe_expert )
code = psnames->adobe_expert_encoding[charcode];
glyph_name = psnames->adobe_std_strings( code );
if ( !glyph_name )
break;
for ( n = 0; n < face->type1.num_glyphs; n++ )
{ {
T1_Encoding* encoding = &face->type1.encoding; const char* gname = face->type1.glyph_names[n];
if (charcode >= encoding->code_first &&
charcode <= encoding->code_last)
if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 )
{ {
result = encoding->char_index[charcode]; result = n;
break;
} }
goto Exit;
} }
}
/********************************************************************/
/* */
/* Adobe Standard & Expert encoding support */
/* */
default:
if (charcode < 256)
{
FT_UInt code;
FT_Int n;
const char* glyph_name;
code = psnames->adobe_std_encoding[charcode];
if (charmap->encoding == ft_encoding_adobe_expert)
code = psnames->adobe_expert_encoding[charcode];
glyph_name = psnames->adobe_std_strings(code);
if (!glyph_name) break;
for ( n = 0; n < face->type1.num_glyphs; n++ )
{
const char* gname = face->type1.glyph_names[n];
if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 )
{
result = n;
break;
}
}
}
} }
Exit: Exit:
return result; return result;
} }
const FT_Driver_Class t1z_driver_class = const FT_Driver_Class t1z_driver_class =
{ {
{ {
ft_module_font_driver | ft_module_driver_scalable, ft_module_font_driver | ft_module_driver_scalable,
sizeof( FT_DriverRec ), sizeof( FT_DriverRec ),
"type1z", "type1z",
0x10000, 0x10000L,
0x20000, 0x20000L,
0, /* format interface */ 0, /* format interface */
(FT_Module_Constructor) Z1_Init_Driver, (FT_Module_Constructor)Z1_Init_Driver,
(FT_Module_Destructor) Z1_Done_Driver, (FT_Module_Destructor) Z1_Done_Driver,
(FT_Module_Requester) Get_Interface, (FT_Module_Requester) Get_Interface,
}, },
sizeof( T1_FaceRec ), sizeof( T1_FaceRec ),
sizeof( Z1_SizeRec ), sizeof( Z1_SizeRec ),
sizeof( Z1_GlyphSlotRec ), sizeof( Z1_GlyphSlotRec ),
(FTDriver_initFace) Z1_Init_Face, (FTDriver_initFace) Z1_Init_Face,
(FTDriver_doneFace) Z1_Done_Face, (FTDriver_doneFace) Z1_Done_Face,
(FTDriver_initSize) 0, (FTDriver_initSize) 0,
(FTDriver_doneSize) 0, (FTDriver_doneSize) 0,
(FTDriver_initGlyphSlot) 0, (FTDriver_initGlyphSlot)0,
(FTDriver_doneGlyphSlot) 0, (FTDriver_doneGlyphSlot)0,
(FTDriver_setCharSizes) 0, (FTDriver_setCharSizes) 0,
(FTDriver_setPixelSizes) 0, (FTDriver_setPixelSizes)0,
(FTDriver_loadGlyph) Z1_Load_Glyph, (FTDriver_loadGlyph) Z1_Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index, (FTDriver_getCharIndex) Get_Char_Index,
#ifdef Z1_CONFIG_OPTION_NO_AFM #ifdef Z1_CONFIG_OPTION_NO_AFM
(FTDriver_getKerning) 0, (FTDriver_getKerning) 0,
(FTDriver_attachFile) 0, (FTDriver_attachFile) 0,
#else #else
(FTDriver_getKerning) Get_Kerning, (FTDriver_getKerning) Get_Kerning,
(FTDriver_attachFile) Z1_Read_AFM, (FTDriver_attachFile) Z1_Read_AFM,
#endif #endif
(FTDriver_getAdvances) 0 (FTDriver_getAdvances) 0
}; };
/******************************************************************/
/* */
/* <Function> Get_FreeType_Driver_Interface */
/* */
/* <Description> */
/* This function is used when compiling the TrueType driver */
/* as a shared library (.DLL or .so). It will be used by the */
/* high-level library of FreeType to retrieve the address of */
/* the driver's generic interface. */
/* */
/* It shouldn't be implemented in a static build, as each */
/* driver must have the same function as an exported entry */
/* point. */
/* */
/* <Return> */
/* address of TrueType's driver generic interface. The */
/* forma-specific interface can then be retrieved through */
/* the method interface->get_format_interface.. */
/* */
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS #ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
EXPORT_FUNC(const FT_Driver_Class*) getDriverClass( void ) EXPORT_FUNC( const FT_Driver_Class* ) getDriverClass( void )
{ {
return &t1z_driver_class; return &t1z_driver_class;
} }
@ -306,3 +308,4 @@
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */ #endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
/* END */

View File

@ -1,26 +1,29 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1driver.h /* z1driver.h */
* /* */
* High-level Type1 driver interface for FreeType 2.0 /* High-level experimental Type 1 driver interface (specification). */
* /* */
* Copyright 1996-1998 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used, /* This file is part of the FreeType project, and may only be used, */
* modified, and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
******************************************************************/ /***************************************************************************/
#ifndef Z1DRIVER_H #ifndef Z1DRIVER_H
#define Z1DRIVER_H #define Z1DRIVER_H
#include <freetype/internal/ftdriver.h> #include <freetype/internal/ftdriver.h>
FT_EXPORT_VAR(const FT_Driver_Class) t1z_driver_class; FT_EXPORT_VAR( const FT_Driver_Class ) t1z_driver_class;
#endif /* Z1DRIVER_H */ #endif /* Z1DRIVER_H */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,33 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1gload.h 1.0 /* z1gload.h */
* /* */
* Type1 Glyph Loader. /* Experimental Type 1 Glyph Loader (specification). */
* /* */
* Copyright 1996-1998 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used /* This file is part of the FreeType project, and may only be used, */
* modified and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
* /***************************************************************************/
* The Type 1 glyph loader uses three distinct objects to build
* scaled and hinted outlines from a charstrings program. These are :
*
* - a glyph builder, Z1_Builder, used to store the built outline
*
* - a glyph hinter, Z1_Hinter, used to record and apply the stem
* hints
*
* - a charstrings interpreter, Z1_Decoder, used to parse the
* Type 1 charstrings stream, manage a stack and call the builder
* and/or hinter depending on the opcodes.
*
* Ideally, a Type 2 glyph loader would only need to have its own
* T2_Decoder object (assuming the hinter is able to manage all
* kinds of hints).
*
******************************************************************/
#ifndef Z1GLOAD_H #ifndef Z1GLOAD_H
#define Z1GLOAD_H #define Z1GLOAD_H
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "z1objs.h" #include "z1objs.h"
#else #else
#include <type1z/z1objs.h> #include <type1z/z1objs.h>
#endif #endif
@ -47,46 +36,55 @@
#endif #endif
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Structure> Z1_Builder */ /* <Structure> */
/* */ /* Z1_Builder */
/* <Description> */ /* */
/* a structure used during glyph loading to store its outline. */ /* <Description> */
/* */ /* A structure used during glyph loading to store its outline. */
/* <Fields> */ /* */
/* system :: current system object */ /* <Fields> */
/* face :: current face object */ /* memory :: The current memory object. */
/* glyph :: current glyph slot */ /* */
/* */ /* face :: The current face object. */
/* current :: current glyph outline */ /* */
/* base :: base glyph outline */ /* glyph :: The current glyph slot. */
/* */ /* */
/* max_points :: maximum points in builder outline */ /* loader :: The current glyph loader. */
/* max_contours :: maximum contours in builder outline */ /* */
/* */ /* current :: The current glyph outline. */
/* last :: last point position */ /* */
/* */ /* base :: The base glyph outline. */
/* scale_x :: horizontal scale ( FUnits to sub-pixels ) */ /* */
/* scale_y :: vertical scale ( FUnits to sub-pixels ) */ /* last :: The last point position. */
/* pos_x :: horizontal translation (composite glyphs) */ /* */
/* pos_y :: vertical translation (composite glyph) */ /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
/* */ /* */
/* left_bearing :: left side bearing point */ /* scale_y :: The vertical scale (FUnits to sub-pixels). */
/* advance :: horizontal advance vector */ /* */
/* */ /* pos_x :: The horizontal translation (for composite glyphs). */
/* path_begun :: flag, indicates that a new path has begun */ /* */
/* load_points :: flag, if not set, no points are loaded */ /* pos_y :: The vertical translation (for composite glyphs). */
/* */ /* */
/* error :: an error code that is only used to report */ /* left_bearing :: The left side bearing point. */
/* memory allocation problems.. */ /* */
/* */ /* advance :: The horizontal advance vector. */
/* metrics_only :: a boolean indicating that we only want to */ /* */
/* compute the metrics of a given glyph, not load */ /* no_recurse :: */
/* all of its points.. */ /* */
/* */ /* bbox :: The glyph's bounding box. */
/* */
typedef struct Z1_Builder_ /* path_begun :: A flag which indicates that a new path has begun. */
/* */
/* load_points :: A flag which indicates, if not set, that no points */
/* are loaded. */
/* */
/* error :: The current error code. */
/* */
/* metrics_only :: A flag whether to compute metrics only. */
/* */
typedef struct Z1_Builder_
{ {
FT_Memory memory; FT_Memory memory;
T1_Face face; T1_Face face;
@ -119,7 +117,7 @@
/* execution context charstring zone */ /* execution context charstring zone */
typedef struct Z1_Decoder_Zone_ typedef struct Z1_Decoder_Zone_
{ {
FT_Byte* base; FT_Byte* base;
FT_Byte* limit; FT_Byte* limit;
@ -128,47 +126,41 @@
} Z1_Decoder_Zone; } Z1_Decoder_Zone;
typedef struct Z1_Decoder_ typedef struct Z1_Decoder_
{ {
Z1_Builder builder; Z1_Builder builder;
FT_Int stack[ T1_MAX_CHARSTRINGS_OPERANDS ]; FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS];
FT_Int* top; FT_Int* top;
Z1_Decoder_Zone zones[ T1_MAX_SUBRS_CALLS+1 ]; Z1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
Z1_Decoder_Zone* zone; Z1_Decoder_Zone* zone;
FT_Int flex_state; FT_Int flex_state;
FT_Int num_flex_vectors; FT_Int num_flex_vectors;
FT_Vector flex_vectors[7]; FT_Vector flex_vectors[7];
T1_Blend* blend; /* for multiple masters */ T1_Blend* blend; /* for multiple masters */
} Z1_Decoder; } Z1_Decoder;
LOCAL_DEF
void Z1_Init_Builder( Z1_Builder* builder,
T1_Face face,
Z1_Size size,
Z1_GlyphSlot glyph );
LOCAL_DEF LOCAL_DEF
void Z1_Init_Builder( Z1_Builder* builder, void Z1_Done_Builder( Z1_Builder* builder );
T1_Face face,
Z1_Size size,
Z1_GlyphSlot glyph );
LOCAL_DEF LOCAL_DEF
void Z1_Done_Builder( Z1_Builder* builder ); void Z1_Init_Decoder( Z1_Decoder* decoder );
LOCAL_DEF
void Z1_Init_Decoder( Z1_Decoder* decoder );
/* Compute the maximum advance width of a font through quick parsing */
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Compute_Max_Advance( T1_Face face, FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int *max_advance ); FT_Int* max_advance );
/* This function is exported, because it is used by the T1Dump utility */
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Parse_CharStrings( Z1_Decoder* decoder, FT_Error Z1_Parse_CharStrings( Z1_Decoder* decoder,
FT_Byte* charstring_base, FT_Byte* charstring_base,
@ -177,8 +169,6 @@
FT_Byte** subrs_base, FT_Byte** subrs_base,
FT_Int* subrs_len ); FT_Int* subrs_len );
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Load_Glyph( Z1_GlyphSlot glyph, FT_Error Z1_Load_Glyph( Z1_GlyphSlot glyph,
Z1_Size size, Z1_Size size,
@ -190,4 +180,8 @@
} }
#endif #endif
#endif /* Z1GLOAD_H */ #endif /* Z1GLOAD_H */
/* END */

View File

@ -1,19 +1,20 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1load.h 2.0 /* z1load.h */
* /* */
* Type1 Loader. /* Experimental Type 1 font loader (specification). */
* /* */
* Copyright 1996-2000 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used /* This file is part of the FreeType project, and may only be used, */
* modified and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
******************************************************************/ /***************************************************************************/
#ifndef Z1LOAD_H #ifndef Z1LOAD_H
#define Z1LOAD_H #define Z1LOAD_H
@ -22,40 +23,46 @@
#include <freetype/internal/t1types.h> #include <freetype/internal/t1types.h>
#include <freetype/ftmm.h> #include <freetype/ftmm.h>
#ifdef FT_FLAT_COMPILE
#include "z1parse.h"
#else
#include <type1z/z1parse.h>
#endif
#ifdef FT_FLAT_COMPILE
#include "z1parse.h"
#else
#include <type1z/z1parse.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct Z1_Loader_ typedef struct Z1_Loader_
{ {
Z1_Parser parser; /* parser used to read the stream */ Z1_Parser parser; /* parser used to read the stream */
FT_Int num_chars; /* number of characters in encoding */ FT_Int num_chars; /* number of characters in encoding */
Z1_Table encoding_table; /* Z1_Table used to store the */ Z1_Table encoding_table; /* Z1_Table used to store the */
/* encoding character names */ /* encoding character names */
FT_Int num_glyphs; FT_Int num_glyphs;
Z1_Table glyph_names; Z1_Table glyph_names;
Z1_Table charstrings; Z1_Table charstrings;
FT_Int num_subrs; FT_Int num_subrs;
Z1_Table subrs; Z1_Table subrs;
FT_Bool fontdata; FT_Bool fontdata;
} Z1_Loader; } Z1_Loader;
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Open_Face( T1_Face face ); FT_Error Z1_Open_Face( T1_Face face );
#ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT #ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Get_Multi_Master( T1_Face face, FT_Error Z1_Get_Multi_Master( T1_Face face,
FT_Multi_Master* master ); FT_Multi_Master* master );
@ -72,7 +79,9 @@
LOCAL_DEF LOCAL_DEF
void Z1_Done_Blend( T1_Face face ); void Z1_Done_Blend( T1_Face face );
#endif
#endif /* !Z1_CONFIG_OPTION_NO_MM_SUPPORT */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,69 +1,79 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1objs.c 1.0 /* z1objs.c */
* /* */
* Type1 Objects manager. /* Experimental Type 1 objects manager (body). */
* /* */
* Copyright 1996-1998 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used /* This file is part of the FreeType project, and may only be used, */
* modified and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
******************************************************************/ /***************************************************************************/
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h> #include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE #ifdef FT_FLAT_COMPILE
#include "z1gload.h" #include "z1gload.h"
#include "z1load.h" #include "z1load.h"
#include "z1afm.h" #include "z1afm.h"
#else #else
#include <type1z/z1gload.h> #include <type1z/z1gload.h>
#include <type1z/z1load.h> #include <type1z/z1load.h>
#include <type1z/z1afm.h> #include <type1z/z1afm.h>
#endif #endif
#include <freetype/internal/psnames.h> #include <freetype/internal/psnames.h>
/* Required by tracing mode */
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1objs
/******************************************************************* /*************************************************************************/
* * /* */
* FACE FUNCTIONS * /* 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_z1objs
/*******************************************************************
*
* <Function> Z1_Done_Face
*
* <Description>
* The face object destructor.
*
* <Input>
* face :: typeless pointer to the face object to destroy
*
* <Return>
* Error code.
*
******************************************************************/
/*************************************************************************/
/* */
/* FACE FUNCTIONS */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* Z1_Done_Face */
/* */
/* <Description> */
/* The face object destructor. */
/* */
/* <Input> */
/* face :: A typeless pointer to the face object to destroy. */
/* */
LOCAL_FUNC LOCAL_FUNC
void Z1_Done_Face( T1_Face face ) void Z1_Done_Face( T1_Face face )
{ {
FT_Memory memory; FT_Memory memory;
T1_Font* type1 = &face->type1; T1_Font* type1 = &face->type1;
if (face)
if ( face )
{ {
memory = face->root.memory; memory = face->root.memory;
@ -77,6 +87,7 @@
{ {
T1_FontInfo* info = &type1->font_info; T1_FontInfo* info = &type1->font_info;
FREE( info->version ); FREE( info->version );
FREE( info->notice ); FREE( info->notice );
FREE( info->full_name ); FREE( info->full_name );
@ -101,7 +112,7 @@
#ifndef Z1_CONFIG_OPTION_NO_AFM #ifndef Z1_CONFIG_OPTION_NO_AFM
/* release afm data if present */ /* release afm data if present */
if ( face->afm_data) if ( face->afm_data )
Z1_Done_AFM( memory, (Z1_AFM*)face->afm_data ); Z1_Done_AFM( memory, (Z1_AFM*)face->afm_data );
#endif #endif
@ -114,22 +125,30 @@
} }
} }
/*******************************************************************
*
* <Function> Z1_Init_Face
*
* <Description>
* The face object constructor.
*
* <Input>
* face :: face record to build
* Input :: input stream where to load font data
*
* <Return>
* Error code.
*
******************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* Z1_Init_Face */
/* */
/* <Description> */
/* The face object constructor. */
/* */
/* <Input> */
/* stream :: input stream where to load font data. */
/* */
/* 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 face record to build. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC LOCAL_FUNC
FT_Error Z1_Init_Face( FT_Stream stream, FT_Error Z1_Init_Face( FT_Stream stream,
T1_Face face, T1_Face face,
@ -137,146 +156,154 @@
FT_Int num_params, FT_Int num_params,
FT_Parameter* params ) FT_Parameter* params )
{ {
FT_Error error; FT_Error error;
PSNames_Interface* psnames; PSNames_Interface* psnames;
FT_UNUSED(num_params); FT_UNUSED( num_params );
FT_UNUSED(params); FT_UNUSED( params );
FT_UNUSED(face_index); FT_UNUSED( face_index );
FT_UNUSED(stream); FT_UNUSED( stream );
face->root.num_faces = 1; face->root.num_faces = 1;
psnames = (PSNames_Interface*)face->psnames; psnames = (PSNames_Interface*)face->psnames;
if (!psnames) if ( !psnames )
{ {
psnames = (PSNames_Interface*) psnames = (PSNames_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" ); FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psnames" );
face->psnames = psnames; face->psnames = psnames;
} }
/* open the tokenizer, this will also check the font format */ /* open the tokenizer, this will also check the font format */
error = Z1_Open_Face( face ); error = Z1_Open_Face( face );
if (error) goto Exit; if ( error )
goto Exit;
/* if we just wanted to check the format, leave successfully now */ /* if we just wanted to check the format, leave successfully now */
if (face_index < 0) if ( face_index < 0 )
goto Exit; goto Exit;
/* check the face index */ /* check the face index */
if ( face_index != 0 ) if ( face_index != 0 )
{ {
FT_ERROR(( "T1.Init_Face : invalid face index\n" )); FT_ERROR(( "Z1_Init_Face: invalid face index\n" ));
error = T1_Err_Invalid_Argument; error = T1_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
/* Now, load the font program into the face object */ /* Now, load the font program into the face object */
/* Init the face object fields */
/* Now set up root face fields */
{ {
/* Init the face object fields */ FT_Face root = (FT_Face)&face->root;
/* Now set up root face fields */
root->num_glyphs = face->type1.num_glyphs;
root->num_charmaps = 1;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
if ( face->type1.font_info.is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( face->blend )
root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
/* XXX: TODO -- add kerning with .afm support */
/* get style name -- be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
root->family_name = face->type1.font_info.family_name;
if ( root->family_name )
{ {
FT_Face root = (FT_Face)&face->root; char* full = face->type1.font_info.full_name;
char* family = root->family_name;
root->num_glyphs = face->type1.num_glyphs;
root->num_charmaps = 1;
root->face_index = face_index; while ( *family && *full == *family )
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
if ( face->type1.font_info.is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( face->blend )
root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
/* XXX : TO DO - add kerning with .afm support */
/* get style name - be careful, some broken fonts only */
/* have a /FontName dictionary entry .. !! */
root->family_name = face->type1.font_info.family_name;
if (root->family_name)
{ {
char* full = face->type1.font_info.full_name; family++;
char* family = root->family_name; full++;
while ( *family && *full == *family )
{
family++;
full++;
}
root->style_name = ( *full == ' ' ? full + 1
: (char *)"Regular" );
}
else
{
/* do we have a /FontName ?? */
if (face->type1.font_name)
{
root->family_name = face->type1.font_name;
root->style_name = "Regular";
}
} }
/* no embedded bitmap support */ root->style_name = ( *full == ' ' ? full + 1
root->num_fixed_sizes = 0; : (char *)"Regular" );
root->available_sizes = 0;
root->bbox = face->type1.font_bbox;
root->units_per_EM = 1000;
root->ascender = (FT_Short)face->type1.font_bbox.yMax;
root->descender = -(FT_Short)face->type1.font_bbox.yMin;
root->height = ((root->ascender + root->descender)*12)/10;
/* now compute the maximum advance width */
root->max_advance_width = face->type1.private_dict.standard_width[0];
/* compute max advance width for proportional fonts */
if (!face->type1.font_info.is_fixed_pitch)
{
FT_Int max_advance;
error = Z1_Compute_Max_Advance( face, &max_advance );
/* in case of error, keep the standard width */
if (!error)
root->max_advance_width = max_advance;
else
error = 0; /* clear error */
}
root->max_advance_height = root->height;
root->underline_position = face->type1.font_info.underline_position;
root->underline_thickness = face->type1.font_info.underline_thickness;
root->max_points = 0;
root->max_contours = 0;
} }
else
{
/* do we have a `/FontName'? */
if ( face->type1.font_name )
{
root->family_name = face->type1.font_name;
root->style_name = "Regular";
}
}
/* no embedded bitmap support */
root->num_fixed_sizes = 0;
root->available_sizes = 0;
root->bbox = face->type1.font_bbox;
root->units_per_EM = 1000;
root->ascender = (FT_Short)face->type1.font_bbox.yMax;
root->descender = -(FT_Short)face->type1.font_bbox.yMin;
root->height = ( ( root->ascender + root->descender ) * 12 ) / 10;
/* now compute the maximum advance width */
root->max_advance_width = face->type1.private_dict.standard_width[0];
/* compute max advance width for proportional fonts */
if ( !face->type1.font_info.is_fixed_pitch )
{
FT_Int max_advance;
error = Z1_Compute_Max_Advance( face, &max_advance );
/* in case of error, keep the standard width */
if ( !error )
root->max_advance_width = max_advance;
else
error = 0; /* clear error */
}
root->max_advance_height = root->height;
root->underline_position = face->type1.font_info.underline_position;
root->underline_thickness = face->type1.font_info.underline_thickness;
root->max_points = 0;
root->max_contours = 0;
} }
/* charmap support - synthetize unicode charmap when possible */ /* charmap support -- synthetize unicode charmap if possible */
{ {
FT_Face root = &face->root; FT_Face root = &face->root;
FT_CharMap charmap = face->charmaprecs; FT_CharMap charmap = face->charmaprecs;
/* synthesize a Unicode charmap if there is support in the "psnames" */
/* module.. */ /* synthesize a Unicode charmap if there is support in the `PSNames' */
if (face->psnames) /* module */
if ( face->psnames )
{ {
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames; PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
if (psnames->unicode_value)
if ( psnames->unicode_value )
{ {
error = psnames->build_unicodes( root->memory, error = psnames->build_unicodes(
face->type1.num_glyphs, root->memory,
(const char**)face->type1.glyph_names, face->type1.num_glyphs,
&face->unicode_map ); (const char**)face->type1.glyph_names,
if (!error) &face->unicode_map );
if ( !error )
{ {
root->charmap = charmap; root->charmap = charmap;
charmap->face = (FT_Face)face; charmap->face = (FT_Face)face;
@ -288,82 +315,81 @@
/* simply clear the error in case of failure (which really) */ /* simply clear the error in case of failure (which really) */
/* means that out of memory or no unicode glyph names */ /* means that out of memory or no unicode glyph names */
error = 0; error = FT_Err_Ok;
} }
} }
/* now, support either the standard, expert, or custom encodings */ /* now, support either the standard, expert, or custom encoding */
charmap->face = (FT_Face)face; charmap->face = (FT_Face)face;
charmap->platform_id = 7; /* a new platform id for Adobe fonts ?? */ charmap->platform_id = 7; /* a new platform id for Adobe fonts? */
switch (face->type1.encoding_type) switch ( face->type1.encoding_type )
{ {
case t1_encoding_standard: case t1_encoding_standard:
charmap->encoding = ft_encoding_adobe_standard; charmap->encoding = ft_encoding_adobe_standard;
charmap->encoding_id = 0; charmap->encoding_id = 0;
break; break;
case t1_encoding_expert: case t1_encoding_expert:
charmap->encoding = ft_encoding_adobe_expert; charmap->encoding = ft_encoding_adobe_expert;
charmap->encoding_id = 1; charmap->encoding_id = 1;
break; break;
default: default:
charmap->encoding = ft_encoding_adobe_custom; charmap->encoding = ft_encoding_adobe_custom;
charmap->encoding_id = 2; charmap->encoding_id = 2;
break; break;
} }
root->charmaps = face->charmaps; root->charmaps = face->charmaps;
root->num_charmaps = charmap - face->charmaprecs + 1; root->num_charmaps = charmap - face->charmaprecs + 1;
face->charmaps[0] = &face->charmaprecs[0]; face->charmaps[0] = &face->charmaprecs[0];
face->charmaps[1] = &face->charmaprecs[1]; face->charmaps[1] = &face->charmaprecs[1];
} }
Exit: Exit:
return error; return error;
} }
/******************************************************************* /*************************************************************************/
* /* */
* <Function> Z1_Init_Driver /* <Function> */
* /* Z1_Init_Driver */
* <Description> /* */
* Initialise a given Type 1 driver object /* <Description> */
* /* Initializes a given Type 1 driver object. */
* <Input> /* */
* driver :: handle to target driver object /* <Input> */
* /* driver :: A handle to the target driver object. */
* <Return> /* */
* Error code. /* <Return> */
* /* FreeType error code. 0 means success. */
******************************************************************/ /* */
LOCAL_FUNC LOCAL_FUNC
FT_Error Z1_Init_Driver( Z1_Driver driver ) FT_Error Z1_Init_Driver( Z1_Driver driver )
{ {
FT_UNUSED(driver); FT_UNUSED( driver );
return T1_Err_Ok; return T1_Err_Ok;
} }
/*************************************************************************/
/******************************************************************* /* */
* /* <Function> */
* <Function> Z1_Done_Driver /* Z1_Done_Driver */
* /* */
* <Description> /* <Description> */
* finalise a given Type 1 driver /* Finalizes a given Type 1 driver. */
* /* */
* <Input> /* <Input> */
* driver :: handle to target Type 1 driver /* driver :: A handle to the target Type 1 driver. */
* /* */
******************************************************************/
LOCAL_DEF LOCAL_DEF
void Z1_Done_Driver( Z1_Driver driver ) void Z1_Done_Driver( Z1_Driver driver )
{ {
FT_UNUSED(driver); FT_UNUSED( driver );
} }

View File

@ -1,19 +1,20 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1objs.h 1.0 /* z1objs.h */
* /* */
* Type1 objects definition. /* Experimental Type 1 objects manager (specification). */
* /* */
* Copyright 1996-1999 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used /* This file is part of the FreeType project, and may only be used, */
* modified and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
******************************************************************/ /***************************************************************************/
#ifndef Z1OBJS_H #ifndef Z1OBJS_H
#define Z1OBJS_H #define Z1OBJS_H
@ -31,86 +32,91 @@
typedef struct Z1_Size_Hints_ Z1_Size_Hints; typedef struct Z1_Size_Hints_ Z1_Size_Hints;
typedef struct Z1_Glyph_Hints_ Z1_Glyph_Hints; typedef struct Z1_Glyph_Hints_ Z1_Glyph_Hints;
/***********************************************************************/
/* */ /*************************************************************************/
/* <Type> Z1_Driver */ /* */
/* */ /* <Type> */
/* <Description> */ /* Z1_Driver */
/* A handle to a Type 1 driver object. */ /* */
/* */ /* <Description> */
/* A handle to a Type 1 driver object. */
/* */
typedef struct Z1_DriverRec_ *Z1_Driver; typedef struct Z1_DriverRec_ *Z1_Driver;
/***********************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> Z1_Size */ /* <Type> */
/* */ /* Z1_Size */
/* <Description> */ /* */
/* A handle to a Type 1 size object. */ /* <Description> */
/* */ /* A handle to a Type 1 size object. */
/* */
typedef struct Z1_SizeRec_* Z1_Size; typedef struct Z1_SizeRec_* Z1_Size;
/***********************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> Z1_GlyphSlot */ /* <Type> */
/* */ /* Z1_GlyphSlot */
/* <Description> */ /* */
/* A handle to a Type 1 glyph slot object. */ /* <Description> */
/* */ /* A handle to a Type 1 glyph slot object. */
/* */
typedef struct Z1_GlyphSlotRec_* Z1_GlyphSlot; typedef struct Z1_GlyphSlotRec_* Z1_GlyphSlot;
/***********************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> Z1_CharMap */ /* <Type> */
/* */ /* Z1_CharMap */
/* <Description> */ /* */
/* A handle to a Type 1 character mapping object. */ /* <Description> */
/* */ /* A handle to a Type 1 character mapping object. */
/* <Note> */ /* */
/* The Type 1 format doesn't use a charmap but an encoding table. */ /* <Note> */
/* The driver is responsible for making up charmap objects */ /* The Type 1 format doesn't use a charmap but an encoding table. */
/* corresponding to these tables.. */ /* The driver is responsible for making up charmap objects */
/* */ /* corresponding to these tables. */
/* */
typedef struct Z1_CharMapRec_* Z1_CharMap; typedef struct Z1_CharMapRec_* Z1_CharMap;
/*************************************************************************/
/**************************************************************************/ /* */
/* */ /* HERE BEGINS THE TYPE1 SPECIFIC STUFF */
/* NOW BEGINS THE TYPE1 SPECIFIC STUFF .............................. */ /* */
/* */ /*************************************************************************/
/**************************************************************************/
/***************************************************/ /*************************************************************************/
/* */ /* */
/* Z1_Size : */ /* <Type> */
/* */ /* Z1_SizeRec */
/* Type 1 size record.. */ /* */
/* */ /* <Description> */
/* Type 1 size record. */
typedef struct Z1_SizeRec_ /* */
typedef struct Z1_SizeRec_
{ {
FT_SizeRec root; FT_SizeRec root;
FT_Bool valid; FT_Bool valid;
Z1_Size_Hints* hints; /* defined in the hinter. This allows */ Z1_Size_Hints* hints; /* defined in the hinter. This allows */
/* us to experiment with different */ /* us to experiment with different */
/* hinting schemes without having to */ /* hinting schemes without having to */
/* change 't1objs' each time.. */ /* change `z1objs' each time. */
} Z1_SizeRec; } Z1_SizeRec;
/*************************************************************************/
/***************************************************/ /* */
/* */ /* <Type> */
/* Z1_GlyphSlot : */ /* Z1_GlyphSlotRec */
/* */ /* */
/* TrueDoc glyph record.. */ /* <Description> */
/* */ /* Type 1 glyph slot record. */
/* */
typedef struct Z1_GlyphSlotRec_ typedef struct Z1_GlyphSlotRec_
{ {
FT_GlyphSlotRec root; FT_GlyphSlotRec root;
@ -128,83 +134,23 @@
} Z1_GlyphSlotRec; } Z1_GlyphSlotRec;
/*******************************************************************
*
* <Function> Z1_Init_Face
*
* <Description>
* Initialise a given Type 1 face object
*
* <Input>
* face_index :: index of font face in resource
* resource :: source font resource
* face :: face record to build
*
* <Return>
* Error code.
*
******************************************************************/
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Init_Face( FT_Stream stream, FT_Error Z1_Init_Face( FT_Stream stream,
T1_Face face, T1_Face face,
FT_Int face_index, FT_Int face_index,
FT_Int num_params, FT_Int num_params,
FT_Parameter* params ); FT_Parameter* params );
/*******************************************************************
*
* <Function> Z1_Done_Face
*
* <Description>
* Finalise a given face object
*
* <Input>
* face :: handle to the face object to destroy
*
******************************************************************/
LOCAL_DEF LOCAL_DEF
void Z1_Done_Face( T1_Face face ); void Z1_Done_Face( T1_Face face );
/*******************************************************************
*
* <Function> Z1_Init_Driver
*
* <Description>
* Initialise a given Type 1 driver object
*
* <Input>
* driver :: handle to target driver object
*
* <Return>
* Error code.
*
******************************************************************/
LOCAL_DEF LOCAL_DEF
FT_Error Z1_Init_Driver( Z1_Driver driver ); FT_Error Z1_Init_Driver( Z1_Driver driver );
/*******************************************************************
*
* <Function> Z1_Done_Driver
*
* <Description>
* finalise a given Type 1 driver
*
* <Input>
* driver :: handle to target Type 1 driver
*
******************************************************************/
LOCAL_DEF LOCAL_DEF
void Z1_Done_Driver( Z1_Driver driver ); void Z1_Done_Driver( Z1_Driver driver );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,20 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1parse.h 2.0 /* z1parse.h */
* /* */
* Type1 parser. /* Experimental Type 1 parser (specification). */
* /* */
* Copyright 1996-1998 by /* Copyright 1996-2000 by */
* David Turner, Robert Wilhelm, and Werner Lemberg. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
* /* */
* This file is part of the FreeType project, and may only be used /* This file is part of the FreeType project, and may only be used, */
* modified and distributed under the terms of the FreeType project /* modified, and distributed under the terms of the FreeType project */
* license, LICENSE.TXT. By continuing to use, modify, or distribute /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* this file you indicate that you have read the license and /* this file you indicate that you have read the license and */
* understand and accept it fully. /* understand and accept it fully. */
* /* */
* The Type 1 parser is in charge of the following: /***************************************************************************/
*
* - provide an implementation of a growing sequence of
* objects called a Z1_Table (used to build various tables
* needed by the loader).
*
* - opening .pfb and .pfa files to extract their top-level
* and private dictionaries
*
* - read numbers, arrays & strings from any dictionary
*
* See "t1load.c" to see how data is loaded from the font file
*
******************************************************************/
#ifndef Z1PARSE_H #ifndef Z1PARSE_H
#define Z1PARSE_H #define Z1PARSE_H
@ -39,7 +27,7 @@
/* simple enumeration type used to identify token types */ /* simple enumeration type used to identify token types */
typedef enum Z1_Token_Type_ typedef enum Z1_Token_Type_
{ {
t1_token_none = 0, t1_token_none = 0,
t1_token_any, t1_token_any,
@ -51,8 +39,9 @@
} Z1_Token_Type; } Z1_Token_Type;
/* a simple structure used to identify tokens */ /* a simple structure used to identify tokens */
typedef struct Z1_Token_Rec_ typedef struct Z1_Token_Rec_
{ {
FT_Byte* start; /* first character of token in input stream */ FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */ FT_Byte* limit; /* first character after the token */
@ -60,8 +49,9 @@
} Z1_Token_Rec; } Z1_Token_Rec;
/* enumeration type used to identify object fields */ /* enumeration type used to identify object fields */
typedef enum Z1_Field_Type_ typedef enum Z1_Field_Type_
{ {
t1_field_none = 0, t1_field_none = 0,
t1_field_bool, t1_field_bool,
@ -76,8 +66,9 @@
} Z1_Field_Type; } Z1_Field_Type;
/* structure type used to model object fields */ /* structure type used to model object fields */
typedef struct Z1_Field_Rec_ typedef struct Z1_Field_Rec_
{ {
Z1_Field_Type type; /* type of field */ Z1_Field_Type type; /* type of field */
FT_UInt offset; /* offset of field in object */ FT_UInt offset; /* offset of field in object */
@ -88,94 +79,114 @@
} Z1_Field_Rec; } Z1_Field_Rec;
#define Z1_FIELD_REF(s,f) (((s*)0)->f)
#define Z1_FIELD_BOOL( _ftype, _fname ) \ #define Z1_FIELD_REF( s, f ) ( ((s*)0)->f )
{ t1_field_bool, \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \
sizeof(Z1_FIELD_REF(_ftype,_fname)), \
0, 0, 0 }
#define Z1_FIELD_NUM( _ftype, _fname ) \ #define Z1_FIELD_BOOL( _ftype, _fname ) \
{ t1_field_integer, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_bool, \
sizeof(Z1_FIELD_REF(_ftype,_fname)), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
0, 0, 0 } sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
0, 0, 0 \
}
#define Z1_FIELD_FIXED( _ftype, _fname, _power ) \ #define Z1_FIELD_NUM( _ftype, _fname ) \
{ t1_field_fixed, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_integer, \
sizeof(Z1_FIELD_REF(_ftype,_fname)), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
0, 0, 0 } sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
0, 0, 0 \
}
#define Z1_FIELD_STRING( _ftype, _fname ) \ #define Z1_FIELD_FIXED( _ftype, _fname, _power ) \
{ t1_field_string, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_fixed, \
sizeof(Z1_FIELD_REF(_ftype,_fname)), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
0, 0, 0 } sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
0, 0, 0 \
}
#define Z1_FIELD_NUM_ARRAY( _ftype, _fname, _fcount, _fmax ) \ #define Z1_FIELD_STRING( _ftype, _fname ) \
{ t1_field_integer, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_string, \
sizeof(Z1_FIELD_REF(_ftype,_fname)[0]), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
_fmax, \ sizeof ( Z1_FIELD_REF( _ftype, _fname ) ), \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fcount), \ 0, 0, 0 \
0 } }
#define Z1_FIELD_NUM_ARRAY( _ftype, _fname, _fcount, _fmax ) \
{ \
t1_field_integer, \
(FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
_fmax, \
(FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fcount ), \
0 \
}
#define Z1_FIELD_FIXED_ARRAY( _ftype, _fname, _fcount, _fmax ) \ #define Z1_FIELD_FIXED_ARRAY( _ftype, _fname, _fcount, _fmax ) \
{ t1_field_fixed, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_fixed, \
sizeof(Z1_FIELD_REF(_ftype,_fname)[0]), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
_fmax, \ sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fcount), \ _fmax, \
0 } (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fcount ), \
0 \
}
#define Z1_FIELD_NUM_ARRAY2( _ftype, _fname, _fmax ) \ #define Z1_FIELD_NUM_ARRAY2( _ftype, _fname, _fmax ) \
{ t1_field_integer, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_integer, \
sizeof(Z1_FIELD_REF(_ftype,_fname)[0]), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
_fmax, \ sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
0, 0 } _fmax, \
0, 0 \
}
#define Z1_FIELD_FIXED_ARRAY2( _ftype, _fname, _fmax ) \ #define Z1_FIELD_FIXED_ARRAY2( _ftype, _fname, _fmax ) \
{ t1_field_fixed, \ { \
(FT_UInt)(char*)&Z1_FIELD_REF(_ftype,_fname), \ t1_field_fixed, \
sizeof(Z1_FIELD_REF(_ftype,_fname)[0]), \ (FT_UInt)(char*)&Z1_FIELD_REF( _ftype, _fname ), \
_fmax, \ sizeof ( Z1_FIELD_REF( _ftype, _fname )[0] ), \
0, 0 } _fmax, \
0, 0 \
}
/*************************************************************************/
/************************************************************************* /* */
* /* <Struct> */
* <Struct> Z1_Table /* Z1_Table */
* /* */
* <Description> /* <Description> */
* A Z1_Table is a simple object used to store an array of objects /* A Z1_Table is a simple object used to store an array of objects in */
* in a single memory block. /* a single memory block. */
* /* */
* <Fields> /* <Fields> */
* block :: address in memory of the growheap's block. This /* block :: The address in memory of the growheap's block. This */
* can change between two object adds, due to the use /* can change between two object adds, due to the use of */
* of 'realloc'. /* reallocation. */
* /* */
* cursor :: current top of the grow heap within its block /* cursor :: The current top of the grow heap within its block. */
* /* */
* capacity :: current size of the heap block. Increments by 1 Kb /* capacity :: The current size of the heap block. Increments in */
* /* 1kByte blocks. */
* init :: boolean. set when the table has been initialized /* */
* (the table user should set this field) /* init :: A boolean. Set when the table has been initialized */
* /* (the table user should set this field). */
* max_elems :: maximum number of elements in table /* */
* num_elems :: current number of elements in table /* max_elems :: The maximum number of elements in the table. */
* /* */
* elements :: table of element addresses within the block /* num_elems :: The current number of elements in the table. */
* lengths :: table of element sizes within the block /* */
* /* elements :: A table of element addresses within the block. */
* memory :: memory object used for memory operations (alloc/realloc) /* */
*/ /* lengths :: A table of element sizes within the block. */
/* */
typedef struct Z1_Table_ /* memory :: The memory object used for memory operations */
/* (allocation/reallocation). */
/* */
typedef struct Z1_Table_
{ {
FT_Byte* block; /* current memory block */ FT_Byte* block; /* current memory block */
FT_Int cursor; /* current cursor in memory block */ FT_Int cursor; /* current cursor in memory block */
@ -192,36 +203,44 @@
} Z1_Table; } Z1_Table;
/************************************************************************* /*************************************************************************/
* /* */
* <Struct> Z1_Parser /* <Struct> */
* /* Z1_Parser */
* <Description> /* */
* A Z1_Parser is an object used to parse a Type 1 fonts very /* <Description> */
* quickly. /* A Z1_Parser is an object used to parse a Type 1 fonts very */
* /* quickly. */
* <Fields> /* */
* stream :: current input stream /* <Fields> */
* memory :: current memory object /* stream :: The current input stream. */
* /* */
* base_dict :: pointer to top-level dictionary /* memory :: The current memory object. */
* base_len :: length in bytes of top dict /* */
* /* base_dict :: A pointer to the top-level dictionary. */
* private_dict :: pointer to private dictionary /* */
* private_len :: length in bytes of private dict /* base_len :: The length in bytes of the top dictionary. */
* /* */
* in_pfb :: boolean. Indicates that we're in a .pfb file /* private_dict :: A pointer to the private dictionary. */
* in_memory :: boolean. Indicates a memory-based stream /* */
* single_block :: boolean. Indicates that the private dict /* private_len :: The length in bytes of the private dictionary. */
* is stored in lieu of the base dict /* */
* /* in_pfb :: A boolean. Indicates that we are handling a PFB */
* cursor :: current parser cursor /* file. */
* limit :: current parser limit (first byte after current /* */
* dictionary). /* in_memory :: A boolean. Indicates a memory-based stream. */
* /* */
* error :: current parsing error /* single_block :: A boolean. Indicates that the private dictionary */
*/ /* is stored in lieu of the base dictionary. */
typedef struct Z1_Parser_ /* */
/* cursor :: The current parser cursor. */
/* */
/* limit :: The current parser limit (first byte after the */
/* current dictionary). */
/* */
/* error :: The current parsing error. */
/* */
typedef struct Z1_Parser_
{ {
FT_Stream stream; FT_Stream stream;
FT_Memory memory; FT_Memory memory;
@ -264,41 +283,38 @@
void Z1_Release_Table( Z1_Table* table ); void Z1_Release_Table( Z1_Table* table );
LOCAL_DEF LOCAL_DEF
FT_Long Z1_ToInt ( Z1_Parser* parser ); FT_Long Z1_ToInt( Z1_Parser* parser );
LOCAL_DEF LOCAL_DEF
FT_Long Z1_ToFixed( Z1_Parser* parser, FT_Int power_ten ); FT_Long Z1_ToFixed( Z1_Parser* parser,
FT_Int power_ten );
LOCAL_DEF LOCAL_DEF
FT_Int Z1_ToCoordArray( Z1_Parser* parser, FT_Int Z1_ToCoordArray( Z1_Parser* parser,
FT_Int max_coords, FT_Int max_coords,
FT_Short* coords ); FT_Short* coords );
LOCAL_DEF LOCAL_DEF
FT_Int Z1_ToFixedArray( Z1_Parser* parser, FT_Int Z1_ToFixedArray( Z1_Parser* parser,
FT_Int max_values, FT_Int max_values,
FT_Fixed* values, FT_Fixed* values,
FT_Int power_ten ); FT_Int power_ten );
#if 0 #if 0
LOCAL_DEF LOCAL_DEF
FT_String* Z1_ToString( Z1_Parser* parser ); FT_String* Z1_ToString( Z1_Parser* parser );
LOCAL_DEF LOCAL_DEF
FT_Bool Z1_ToBool( Z1_Parser* parser ); FT_Bool Z1_ToBool( Z1_Parser* parser );
#endif #endif
LOCAL_DEF
void Z1_Skip_Spaces( Z1_Parser* parser );
LOCAL_DEF LOCAL_DEF
void Z1_Skip_Spaces( Z1_Parser* parser ); void Z1_ToToken( Z1_Parser* parser,
Z1_Token_Rec* token );
LOCAL_DEF
void Z1_ToToken( Z1_Parser* parser,
Z1_Token_Rec* token );
LOCAL_FUNC LOCAL_FUNC
void Z1_ToTokenArray( Z1_Parser* parser, void Z1_ToTokenArray( Z1_Parser* parser,
@ -345,4 +361,3 @@
/* END */ /* END */

View File

@ -1,21 +1,20 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1tokens.h /* z1tokens.h */
* /* */
* Type 1 tokens definition /* Experimental Type 1 tokenizer (specification). */
* /* */
* Copyright 2000 David Turner, Robert Wilhelm and Werner Lemberg. /* 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, */
* license, LICENSE.TXT. By continuing to use, modify or distribute /* modified, and distributed under the terms of the FreeType project */
* this file you indicate that you have read the license and /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* understand and accept it fully. /* this file you indicate that you have read the license and */
* /* understand and accept it fully. */
* This file only contains macros that are expanded when compiling /* */
* the "t1load.c" source file. /***************************************************************************/
*
******************************************************************/
#undef T1TYPE #undef T1TYPE
#define T1TYPE T1_FontInfo #define T1TYPE T1_FontInfo
@ -26,35 +25,38 @@
Z1_FONTINFO_STRING( "FamilyName", family_name ) Z1_FONTINFO_STRING( "FamilyName", family_name )
Z1_FONTINFO_STRING( "Weight", weight ) Z1_FONTINFO_STRING( "Weight", weight )
Z1_FONTINFO_NUM( "ItalicAngle", italic_angle ) Z1_FONTINFO_NUM ( "ItalicAngle", italic_angle )
Z1_FONTINFO_BOOL( "isFixedPitch", is_fixed_pitch ) Z1_FONTINFO_BOOL ( "isFixedPitch", is_fixed_pitch )
Z1_FONTINFO_NUM( "UnderlinePosition", underline_position ) Z1_FONTINFO_NUM ( "UnderlinePosition", underline_position )
Z1_FONTINFO_NUM( "UnderlineThickness", underline_thickness ) Z1_FONTINFO_NUM ( "UnderlineThickness", underline_thickness )
#undef T1TYPE #undef T1TYPE
#define T1TYPE T1_Private #define T1TYPE T1_Private
Z1_PRIVATE_NUM ( "UniqueID", unique_id ) Z1_PRIVATE_NUM ( "UniqueID", unique_id )
Z1_PRIVATE_NUM ( "lenIV", lenIV ) Z1_PRIVATE_NUM ( "lenIV", lenIV )
Z1_PRIVATE_NUM ( "LanguageGroup", language_group ) Z1_PRIVATE_NUM ( "LanguageGroup", language_group )
Z1_PRIVATE_NUM ( "password", password ) Z1_PRIVATE_NUM ( "password", password )
Z1_PRIVATE_FIXED( "BlueScale", blue_scale ) Z1_PRIVATE_FIXED ( "BlueScale", blue_scale )
Z1_PRIVATE_NUM ( "BlueShift", blue_shift ) Z1_PRIVATE_NUM ( "BlueShift", blue_shift )
Z1_PRIVATE_NUM ( "BlueFuzz", blue_fuzz ) Z1_PRIVATE_NUM ( "BlueFuzz", blue_fuzz )
Z1_PRIVATE_NUM_TABLE( "BlueValues", blue_values, 14, num_blue_values ) Z1_PRIVATE_NUM_TABLE ( "BlueValues", blue_values, 14, num_blue_values )
Z1_PRIVATE_NUM_TABLE( "OtherBlues", other_blues, 10, num_other_blues ) Z1_PRIVATE_NUM_TABLE ( "OtherBlues", other_blues, 10, num_other_blues )
Z1_PRIVATE_NUM_TABLE( "FamilyBlues", family_blues, 14, num_family_blues ) Z1_PRIVATE_NUM_TABLE ( "FamilyBlues", family_blues, 14, num_family_blues )
Z1_PRIVATE_NUM_TABLE( "FamilyOtherBlues", family_other_blues, 10, num_family_other_blues ) Z1_PRIVATE_NUM_TABLE ( "FamilyOtherBlues", family_other_blues, 10, \
num_family_other_blues )
Z1_PRIVATE_NUM_TABLE2( "StdHW", standard_width, 1 ) Z1_PRIVATE_NUM_TABLE2( "StdHW", standard_width, 1 )
Z1_PRIVATE_NUM_TABLE2( "StdVW", standard_height, 1 ) Z1_PRIVATE_NUM_TABLE2( "StdVW", standard_height, 1 )
Z1_PRIVATE_NUM_TABLE2( "MinFeature", min_feature, 2 ) Z1_PRIVATE_NUM_TABLE2( "MinFeature", min_feature, 2 )
Z1_PRIVATE_NUM_TABLE ( "StemSnapH", snap_widths, 12, num_snap_widths ) Z1_PRIVATE_NUM_TABLE ( "StemSnapH", snap_widths, 12, num_snap_widths )
Z1_PRIVATE_NUM_TABLE ( "StemSnapV", snap_heights, 12, num_snap_heights ) Z1_PRIVATE_NUM_TABLE ( "StemSnapV", snap_heights, 12, num_snap_heights )
#undef T1TYPE #undef T1TYPE
#define T1TYPE T1_Font #define T1TYPE T1_Font
@ -62,64 +64,69 @@
Z1_TOPDICT_NUM( "FontType", font_type ) Z1_TOPDICT_NUM( "FontType", font_type )
Z1_TOPDICT_NUM( "StrokeWidth", stroke_width ) Z1_TOPDICT_NUM( "StrokeWidth", stroke_width )
#if 0 #if 0
/* define the font info dictionary parsing callbacks */ /* define the font info dictionary parsing callbacks */
#undef FACE #undef FACE
#define FACE (face->type1.font_info) #define FACE (face->type1.font_info)
PARSE_STRING("version",version) PARSE_STRING( "version", version )
PARSE_STRING("Notice",notice) PARSE_STRING( "Notice", notice )
PARSE_STRING("FullName",full_name) PARSE_STRING( "FullName", full_name )
PARSE_STRING("FamilyName",family_name) PARSE_STRING( "FamilyName", family_name )
PARSE_STRING("Weight",weight) PARSE_STRING( "Weight", weight )
PARSE_INT("ItalicAngle",italic_angle) PARSE_INT ( "ItalicAngle", italic_angle )
PARSE_BOOL("isFixedPitch",is_fixed_pitch) PARSE_BOOL ( "isFixedPitch", is_fixed_pitch )
PARSE_NUM("UnderlinePosition",underline_position,FT_Short) PARSE_NUM ( "UnderlinePosition", underline_position, FT_Short )
PARSE_NUM("UnderlineThickness",underline_thickness,FT_UShort) PARSE_NUM ( "UnderlineThickness", underline_thickness, FT_UShort )
/* define the private dict parsing callbacks */
/* define the private dict parsing callbacks */
#undef FACE #undef FACE
#define FACE (face->type1.private_dict) #define FACE (face->type1.private_dict)
PARSE_INT("UniqueID",unique_id) PARSE_INT ("UniqueID", unique_id )
PARSE_INT("lenIV",lenIV) PARSE_INT ("lenIV", lenIV )
PARSE_COORDS( "BlueValues", num_blues, 14, blue_values) PARSE_COORDS ( "BlueValues", num_blues, 14, blue_values)
PARSE_COORDS( "OtherBlues", num_other_blues, 10, other_blues) PARSE_COORDS ( "OtherBlues", num_other_blues, 10, other_blues)
PARSE_COORDS( "FamilyBlues", num_family_blues, 14, family_blues) PARSE_COORDS ( "FamilyBlues", num_family_blues, 14, family_blues )
PARSE_COORDS( "FamilyOtherBlues", num_family_other_blues, 10, family_other_blues) PARSE_COORDS ( "FamilyOtherBlues", num_family_other_blues, 10,
family_other_blues )
PARSE_FIXED( "BlueScale", blue_scale) PARSE_FIXED ( "BlueScale", blue_scale )
PARSE_INT( "BlueShift", blue_shift) PARSE_INT ( "BlueShift", blue_shift )
PARSE_INT( "BlueFuzz", blue_fuzz) PARSE_INT ( "BlueFuzz", blue_fuzz )
PARSE_COORDS2( "StdHW", 1, standard_width ) PARSE_COORDS2( "StdHW", 1, standard_width )
PARSE_COORDS2( "StdVW", 1, standard_height ) PARSE_COORDS2( "StdVW", 1, standard_height )
PARSE_COORDS( "StemSnapH", num_snap_widths, 12, stem_snap_widths ) PARSE_COORDS ( "StemSnapH", num_snap_widths, 12, stem_snap_widths )
PARSE_COORDS( "StemSnapV", num_snap_heights, 12, stem_snap_heights ) PARSE_COORDS ( "StemSnapV", num_snap_heights, 12, stem_snap_heights )
PARSE_INT( "LanguageGroup", language_group ) PARSE_INT ( "LanguageGroup", language_group )
PARSE_INT( "password", password ) PARSE_INT ( "password", password )
PARSE_COORDS2( "MinFeature", 2, min_feature ) PARSE_COORDS2( "MinFeature", 2, min_feature )
/* define the top-level dictionary parsing callbacks */
/* define the top-level dictionary parsing callbacks */
#undef FACE #undef FACE
#define FACE (face->type1) #define FACE (face->type1)
/*PARSE_STRING ( "FontName", font_name ) -- handled by special routine */
/* PARSE_STRING( "FontName", font_name ) -- handled by special routine */ PARSE_NUM ( "PaintType", paint_type, FT_Byte )
PARSE_NUM( "PaintType", paint_type, FT_Byte ) PARSE_NUM ( "FontType", font_type, FT_Byte )
PARSE_NUM( "FontType", font_type, FT_Byte ) PARSE_FIXEDS2( "FontMatrix", 4, font_matrix )
PARSE_FIXEDS2( "FontMatrix", 4, font_matrix ) /*PARSE_COORDS2( "FontBBox", 4, font_bbox ) -- handled by special routine */
/* PARSE_COORDS2( "FontBBox", 4, font_bbox ) -- handled by special func */ PARSE_INT ( "StrokeWidth", stroke_width )
PARSE_INT( "StrokeWidth", stroke_width )
#undef FACE #undef FACE
#endif
#endif /* 0 */
/* END */