Formatting. Fixing some tracing messages.

This commit is contained in:
Werner Lemberg 2000-07-03 07:09:09 +00:00
parent 5811c7c3a5
commit 768c9561f6
8 changed files with 1086 additions and 1028 deletions

View File

@ -117,7 +117,7 @@
while ( p < limit && !isdigit( *p ) )
{
sign = 1;
if (*p == '-')
if ( *p == '-' )
sign = -1;
p++;
@ -248,7 +248,7 @@
FT_Vector* kerning )
{
T1_Kern_Pair *min, *mid, *max;
FT_ULong index = KERN_INDEX( glyph1, glyph2 );
FT_ULong index = KERN_INDEX( glyph1, glyph2 );
/* simple binary search */
@ -260,8 +260,9 @@
FT_ULong midi;
mid = min + ( max - min ) / 2;
mid = min + ( max - min ) / 2;
midi = KERN_INDEX( mid->glyph1, mid->glyph2 );
if ( midi == index )
{
*kerning = mid->kerning;

View File

@ -172,6 +172,7 @@
return T1_Reset_Size( size );
}
/*************************************************************************/
/* */
/* <Function> */
@ -195,7 +196,8 @@
FT_UInt result = 0;
PSNames_Interface* psnames;
face = (T1_Face)charmap->face;
face = (T1_Face)charmap->face;
psnames = (PSNames_Interface*)face->psnames;
if ( psnames )
switch ( charmap->encoding )
@ -205,7 +207,7 @@
/* Unicode encoding support */
/* */
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,
(FT_ULong)charcode );

View File

@ -241,17 +241,17 @@
/* Implements the `seac' Type 1 operator for a Type 1 decoder. */
/* */
/* <Input> */
/* decoder :: The current CID decoder. */
/* decoder :: The current CID decoder. */
/* */
/* asb :: The accent's side bearing. */
/* asb :: The accent's side bearing. */
/* */
/* adx :: The horizontal offset of the accent. */
/* adx :: The horizontal offset of the accent. */
/* */
/* ady :: The vertical offset of the accent. */
/* ady :: The vertical offset of the accent. */
/* */
/* bchar :: The base character's StandardEncoding charcode. */
/* bchar :: The base character's StandardEncoding charcode. */
/* */
/* achar :: The accent character's StandardEncoding charcode. */
/* achar :: The accent character's StandardEncoding charcode. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@ -278,7 +278,8 @@
if ( bchar_index < 0 || achar_index < 0 )
{
FT_ERROR(( "t1operator_seac: invalid seac character code arguments\n" ));
FT_ERROR(( "t1operator_seac:" ));
FT_ERROR(( " invalid seac character code arguments\n" ));
return T1_Err_Syntax_Error;
}
@ -371,6 +372,7 @@
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
}
@ -450,17 +452,17 @@
/* Parses a given Type 1 charstrings program. */
/* */
/* <Input> */
/* decoder :: The current Type 1 decoder. */
/* decoder :: The current Type 1 decoder. */
/* */
/* charstring_base :: The base address of the charstring stream. */
/* charstring_base :: The base address of the charstring stream. */
/* */
/* charstring_len :: The length in bytes of the charstring stream. */
/* charstring_len :: The length in bytes of the charstring stream. */
/* */
/* num_subrs :: The number of sub-routines. */
/* num_subrs :: The number of sub-routines. */
/* */
/* subrs_base :: An array of sub-routines addresses. */
/* subrs_base :: An array of sub-routines addresses. */
/* */
/* subrs_len :: An array of sub-routines lengths. */
/* subrs_len :: An array of sub-routines lengths. */
/* */
/* <Return> */
/* Free error code. 0 means success. */
@ -481,7 +483,8 @@
T1_Builder_Funcs* builds = &builder->funcs;
T1_Hinter_Funcs* hints = &decoder->hinter;
static const FT_Int args_count[op_max] =
static
const FT_Int args_count[op_max] =
{
0, /* none */
0, /* endchar */
@ -528,9 +531,9 @@
/* now, execute loop */
while ( ip < limit )
{
FT_Int* top = decoder->top;
T1_Operator op = op_none;
FT_Long value = 0;
FT_Int* top = decoder->top;
T1_Operator op = op_none;
FT_Long value = 0;
/* Start with the decompression of operator or value */
@ -656,7 +659,8 @@
{
if ( ++ip > limit )
{
FT_ERROR(( "T1_Parse_CharStrings: unexpected EOF in integer\n" ));
FT_ERROR(( "T1_Parse_CharStrings:" ));
FT_ERROR(( " unexpected EOF in integer\n" ));
goto Syntax_Error;
}
@ -674,7 +678,7 @@
}
}
/* push value if needed */
/* push value if necessary */
if ( op == op_none )
{
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
@ -775,10 +779,10 @@
goto Syntax_Error;
}
if (ip[0] != 12 || ip[1] != 17)
if ( ip[0] != 12 || ip[1] != 17 )
{
FT_ERROR(( "T1_Parse_CharStrings: `pop' expected, found (%d %d)\n",
ip[0], ip[1] ));
FT_ERROR(( "T1_Parse_CharStrings:" ));
FT_ERROR(( " `pop' expected, found (%d %d)\n", ip[0], ip[1] ));
goto Syntax_Error;
}
@ -966,7 +970,8 @@
break;
case op_setcurrentpoint:
FT_ERROR(( "T1_Parse_CharStrings: unexpected `setcurrentpoint'\n" ));
FT_ERROR(( "T1_Parse_CharStrings:" ));
FT_ERROR(( " unexpected `setcurrentpoint'\n" ));
goto Syntax_Error;
break;
@ -1224,6 +1229,7 @@
*point++ = *source_point--;
*tags++ = *source_tags--;
num_points--;
} while ( num_points > 0 );
}
@ -1237,6 +1243,7 @@
{
FT_Outline* cur = builder->current;
/* XXXX: We must not include the last point in the path if it */
/* is located on the first point. */
if ( cur->n_points > 1 )
@ -1261,7 +1268,7 @@
cur->contours[cur->n_contours - 1] = cur->n_points - 1;
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
/* hint latest points if needed -- this is not strictly required */
/* hint last points if necessary -- this is not strictly required */
/* there, but it helps for debugging, and doesn't affect performance */
if ( builder->pass == 1 )
T1_Hint_Points( builder );
@ -1275,7 +1282,7 @@
static
FT_Error gload_endchar( T1_Builder* builder )
{
FT_Error error;
FT_Error error;
/* close path if needed */
@ -1526,7 +1533,7 @@
FT_Error error;
/* Pass 1 - try to load first glyph, simply recording points */
/* Pass 1 -- try to load first glyph, simply recording points */
old_points = loader->base.outline.n_points;
old_contours = loader->base.outline.n_contours;
@ -1611,11 +1618,11 @@
builder->base->n_points = old_points;
builder->base->n_contours = old_contours;
/* Pass 2 - record and scale/hint the points */
/* Pass 2 -- record and scale/hint the points */
T1_Reset_Builder( builder, 0 );
builder->pass = 1;
builder->no_recurse = 0;
builder->pass = 1;
builder->no_recurse = 0;
error = T1_Parse_CharStrings( decoder,
type1->charstrings [glyph_index],
@ -1634,7 +1641,7 @@
}
#endif /* T1_CONFIG_OPTION_DISABLE_HINTER */
#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
LOCAL_FUNC
@ -1677,7 +1684,7 @@
}
else
#endif /* T1_CONFIG_OPTION_DISABLE_HINTER */
#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
{
T1_Init_Decoder( &decoder, &gload_hinter_interface );
@ -1771,6 +1778,7 @@
FT_Fixed x_scale = glyph->x_scale;
FT_Fixed y_scale = glyph->y_scale;
/* First of all, scale the points */
for ( n = cur->n_points; n > 0; n--, vec++ )
{

View File

@ -76,7 +76,6 @@
} T1_Builder_Funcs;
/*************************************************************************/
/* */
/* <Structure> */
@ -203,7 +202,6 @@
} T1_Hinter_Funcs;
typedef enum T1_Operator_
{
op_none = 0,

View File

@ -80,6 +80,7 @@
swap = cur[-2]; cur[-2] = cur[0]; cur[0] = swap;
swap = cur[-1]; cur[-1] = cur[1]; cur[1] = swap;
cur -= 2;
} while ( cur > blues );
}
}
@ -658,7 +659,7 @@
max = min;
}
/* now scan the array. If we find a stem with the same borders */
/* Now scan the array. If we find a stem with the same borders */
/* simply activate it. */
cur_stem = stems;
new_stem = 1;
@ -679,7 +680,7 @@
}
}
/* add a new stem to the array when necessary */
/* add a new stem to the array if necessary */
if ( new_stem )
{
if ( cur_stem >= stems + T1_HINTER_MAX_EDGES )
@ -701,7 +702,8 @@
}
else
{
FT_ERROR(( "t1_hinter_stem: fatal glyph loader bug - pass2-stem\n" ));
FT_ERROR(( "t1_hinter_stem:" ));
FT_ERROR(( " fatal glyph loader bug -- pass2-stem\n" ));
return T1_Err_Syntax_Error;
}
}
@ -801,10 +803,10 @@
static
void t1_sort_hints( T1_Stem_Table* table )
{
FT_Int num_stems = table->num_stems;
FT_Int num_active = 0;
FT_Int* sort = table->sort;
T1_Stem_Hint* stems = table->stems;
FT_Int num_stems = table->num_stems;
FT_Int num_active = 0;
FT_Int* sort = table->sort;
T1_Stem_Hint* stems = table->stems;
FT_Int n;
@ -815,7 +817,7 @@
sort[num_active++] = n;
}
/* now sort the indices. There are usually very few stems, */
/* Now sort the indices. There are usually very few stems, */
/* and they are pre-sorted in 90% cases, so we choose a */
/* simple bubble sort (quicksort would be slower). */
for ( n = 1; n < num_active; n++ )
@ -841,6 +843,7 @@
sort[p ] = sort[p + 1];
sort[p + 1] = swap;
p--;
} while ( p >= 0 );
}
@ -1050,8 +1053,7 @@
break;
default: /* no alignment */
/* XXXX TODO: Add management of controlled stems */
/* XXX TODO: Add management of controlled stems */
bottom = ( SCALE( bottom_orus + top_orus ) - width_pix ) / 2;
bottom_pix = ROUND( bottom );
@ -1150,8 +1152,8 @@
/* now place the snapped and rounded stem */
/* XXXX TODO: implement controlled stems for the overlapping */
/* cases */
/* XXX TODO: implement controlled stems for the overlapping */
/* cases */
left = ( SCALE( stem_left + stem_right ) - width_pix ) / 2;
@ -1253,8 +1255,6 @@
}
#if 1
/*************************************************************************/
/* */
/* <Function> */
@ -1333,7 +1333,5 @@
scale_x );
}
#endif /* 1 */
/* END */

View File

@ -97,8 +97,8 @@
/* hint_flags :: Some flags describing the stem properties. */
/* */
/* <Note> */
/* The min and max edges of a ghost stem have the same position, */
/* even if they are coded in a weird way in the charstrings. */
/* The min and max edges of a ghost stem have the same position, even */
/* if they are coded in a weird way in the charstrings. */
/* */
typedef struct T1_Stem_Hint_
{

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,20 @@
/*******************************************************************
*
* t1load.h 1.0
*
* Type1 Loader.
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
/***************************************************************************/
/* */
/* t1load.h */
/* */
/* Type 1 font loader (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef T1LOAD_H
#define T1LOAD_H
@ -25,41 +26,14 @@
extern "C" {
#endif
/*************************************************************************/
/* */
/* <Function> Init_T1_Parser */
/* */
/* <Description> */
/* Initialise a given parser object to build a given T1_Face */
/* */
/* <Input> */
/* parser :: handle to the newly built parser object */
/* face :: handle to target T1 face object */
/* */
LOCAL_DEF
void Init_T1_Parser( T1_Parser* parser,
T1_Face face,
T1_Tokenizer tokenizer );
LOCAL_DEF
void Init_T1_Parser( T1_Parser* parser,
T1_Face face,
T1_Tokenizer tokenizer );
/*************************************************************************/
/* */
/* <Function> Parse_T1_FontProgram */
/* */
/* <Description> */
/* Parses a given Type 1 font file and builds its face object */
/* */
/* <Input> */
/* parser :: handle to target parser object */
/* */
/* <Return> */
/* Error code. 0 means success.. */
/* */
/* <Note> */
/* The parser contains a handle to the target face object. */
/* */
LOCAL_DEF
FT_Error Parse_T1_FontProgram( T1_Parser* parser );
LOCAL_DEF
FT_Error Parse_T1_FontProgram( T1_Parser* parser );
#ifdef __cplusplus