* src/psaux/t1cmap.c: s/index/idx/.

* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug
messages.
This commit is contained in:
Werner Lemberg 2002-03-31 11:18:15 +00:00
parent 1987fb2f72
commit 545a75fdd7
14 changed files with 319 additions and 252 deletions

View File

@ -5,6 +5,13 @@
2002-03-31 Werner Lemberg <wl@gnu.org> 2002-03-31 Werner Lemberg <wl@gnu.org>
* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/. * src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
* src/psaux/t1cmap.c: Ditto.
* include/freetype/internal/tttypes.h,
include/freetype/internal/sfnt.h (TT_Goto_Table_Func): Renamed to ...
(TT_Loader_GotoTableFunc): This.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug
messages.
2002-03-30 David Turner <david@freetype.org> 2002-03-30 David Turner <david@freetype.org>

View File

@ -471,7 +471,7 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct SFNT_Interface_ typedef struct SFNT_Interface_
{ {
TT_Goto_Table_Func goto_table; TT_Loader_GotoTableFunc goto_table;
TT_Init_Face_Func init_face; TT_Init_Face_Func init_face;
TT_Load_Face_Func load_face; TT_Load_Face_Func load_face;

View File

@ -1165,7 +1165,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <FuncType> */ /* <FuncType> */
/* TT_Goto_Table_Func */ /* TT_Loader_GotoTableFunc */
/* */ /* */
/* <Description> */ /* <Description> */
/* Seeks a stream to the start of a given TrueType table. */ /* Seeks a stream to the start of a given TrueType table. */
@ -1188,7 +1188,7 @@ FT_BEGIN_HEADER
/* The stream cursor must be at the font file's origin. */ /* The stream cursor must be at the font file's origin. */
/* */ /* */
typedef FT_Error typedef FT_Error
(*TT_Goto_Table_Func)( TT_Face face, (*TT_Loader_GotoTableFunc)( TT_Face face,
FT_ULong tag, FT_ULong tag,
FT_Stream stream, FT_Stream stream,
FT_ULong* length ); FT_ULong* length );
@ -1493,7 +1493,7 @@ FT_BEGIN_HEADER
#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ #endif /* !FT_CONFIG_OPTION_USE_CMAPS */
TT_Goto_Table_Func goto_table; TT_Loader_GotoTableFunc goto_table;
TT_Loader_StartGlyphFunc access_glyph_frame; TT_Loader_StartGlyphFunc access_glyph_frame;
TT_Loader_EndGlyphFunc forget_glyph_frame; TT_Loader_EndGlyphFunc forget_glyph_frame;

View File

@ -1,4 +1,4 @@
# FreeType 2 src/psaux Jamfile (c) 2001 David Turner # FreeType 2 src/psaux Jamfile (c) 2001, 2002 David Turner
# #
SubDir FT2_TOP src psaux ; SubDir FT2_TOP src psaux ;

View File

@ -3,7 +3,7 @@
# #
# Copyright 2001 by # Copyright 2001, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType auxiliary PostScript driver component (body only). */ /* FreeType auxiliary PostScript driver component (body only). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 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, */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType auxiliary PostScript module implementation (body). */ /* FreeType auxiliary PostScript module implementation (body). */
/* */ /* */
/* Copyright 2000-2001 by */ /* Copyright 2000-2001, 2002 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, */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Auxiliary functions for PostScript fonts (body). */ /* Auxiliary functions for PostScript fonts (body). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 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, */
@ -200,7 +200,8 @@
/* PS_Table_Done */ /* PS_Table_Done */
/* */ /* */
/* <Description> */ /* <Description> */
/* Finalizes a PS_TableRec (i.e., reallocate it to its current cursor). */ /* Finalizes a PS_TableRec (i.e., reallocate it to its current */
/* cursor). */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* table :: The target table. */ /* table :: The target table. */
@ -919,6 +920,7 @@
FT_Byte* old_limit; FT_Byte* old_limit;
T1_FieldRec fieldrec = *(T1_Field)field; T1_FieldRec fieldrec = *(T1_Field)field;
#if 1 #if 1
fieldrec.type = T1_FIELD_TYPE_INTEGER; fieldrec.type = T1_FIELD_TYPE_INTEGER;
if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY ) if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY )
@ -1070,6 +1072,8 @@
/* */ /* */
/* glyph :: The current glyph object. */ /* glyph :: The current glyph object. */
/* */ /* */
/* hinting :: Whether hinting should be applied. */
/* */
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
T1_Builder_Init( T1_Builder builder, T1_Builder_Init( T1_Builder builder,
FT_Face face, FT_Face face,
@ -1143,7 +1147,7 @@
} }
/* check that there is enough room for `count' more points */ /* check that there is enough space for `count' more points */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
T1_Builder_Check_Points( T1_Builder builder, T1_Builder_Check_Points( T1_Builder builder,
FT_Int count ) FT_Int count )

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Auxiliary functions for PostScript fonts (specification). */ /* Auxiliary functions for PostScript fonts (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 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, */

View File

@ -3,7 +3,7 @@
# #
# Copyright 1996-2000 by # Copyright 1996-2000, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,15 +1,34 @@
/***************************************************************************/
/* */
/* t1cmap.c */
/* */
/* Type 1 character map support (body). */
/* */
/* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include "t1cmap.h" #include "t1cmap.h"
#include <stdlib.h> #include <stdlib.h> /* for qsort() */
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
/***************************************************************************/
/***************************************************************************/ /*************************************************************************/
/*************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/ /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
static void static void
t1_cmap_std_init( T1_CMapStd cmap, t1_cmap_std_init( T1_CMapStd cmap,
@ -18,6 +37,7 @@
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
PSNames_Service psnames = (PSNames_Service)face->psnames; PSNames_Service psnames = (PSNames_Service)face->psnames;
cmap->num_glyphs = face->type1.num_glyphs; cmap->num_glyphs = face->type1.num_glyphs;
cmap->glyph_names = (const char* const*)face->type1.glyph_names; cmap->glyph_names = (const char* const*)face->type1.glyph_names;
cmap->sid_to_string = psnames->adobe_std_strings; cmap->sid_to_string = psnames->adobe_std_strings;
@ -44,12 +64,14 @@
{ {
FT_UInt result = 0; FT_UInt result = 0;
if ( char_code < 256 ) if ( char_code < 256 )
{ {
FT_UInt code, n; FT_UInt code, n;
const char* glyph_name; const char* glyph_name;
/* conver character code to Adobe SID string */
/* convert character code to Adobe SID string */
code = cmap->code_to_sid[char_code]; code = cmap->code_to_sid[char_code];
glyph_name = cmap->sid_to_string( code ); glyph_name = cmap->sid_to_string( code );
@ -58,6 +80,7 @@
{ {
const char* gname = cmap->glyph_names[n]; const char* gname = cmap->glyph_names[n];
if ( gname && gname[0] == glyph_name[0] && if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 ) strcmp( gname, glyph_name ) == 0 )
{ {
@ -66,6 +89,7 @@
} }
} }
} }
return result; return result;
} }
@ -77,6 +101,7 @@
FT_UInt result = 0; FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code + 1; FT_UInt32 char_code = *pchar_code + 1;
while ( char_code < 256 ) while ( char_code < 256 )
{ {
result = t1_cmap_std_char_index( cmap, char_code ); result = t1_cmap_std_char_index( cmap, char_code );
@ -113,8 +138,6 @@
}; };
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
t1_cmap_expert_init( T1_CMapStd cmap ) t1_cmap_expert_init( T1_CMapStd cmap )
{ {
@ -134,15 +157,13 @@
}; };
/*************************************************************************/
/*************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 CUSTOM ENCODING CMAP *****/ /***** TYPE1 CUSTOM ENCODING CMAP *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
@ -151,6 +172,7 @@
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Encoding encoding = &face->type1.encoding; T1_Encoding encoding = &face->type1.encoding;
cmap->first = encoding->code_first; cmap->first = encoding->code_first;
cmap->count = (FT_UInt)( encoding->code_last - cmap->first + 1 ); cmap->count = (FT_UInt)( encoding->code_last - cmap->first + 1 );
cmap->indices = encoding->char_index; cmap->indices = encoding->char_index;
@ -176,11 +198,12 @@
FT_UInt32 char_code ) FT_UInt32 char_code )
{ {
FT_UInt result = 0; FT_UInt result = 0;
FT_UInt32 index; FT_UInt32 idx;
index = (FT_UInt32)( char_code - cmap->first );
if ( index < cmap->count ) idx = (FT_UInt32)( char_code - cmap->first );
result = cmap->indices[ index ]; if ( idx < cmap->count )
result = cmap->indices[idx];
return result; return result;
} }
@ -192,17 +215,18 @@
{ {
FT_UInt result = 0; FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code; FT_UInt32 char_code = *pchar_code;
FT_UInt32 index; FT_UInt32 idx;
++char_code; ++char_code;
if ( char_code < cmap->first ) if ( char_code < cmap->first )
char_code = cmap->first; char_code = cmap->first;
index = (FT_UInt32)( char_code - cmap->first ); idx = (FT_UInt32)( char_code - cmap->first );
for ( ; index < cmap->count; index++, char_code++ ) for ( ; idx < cmap->count; idx++, char_code++ )
{ {
result = cmap->indices[index]; result = cmap->indices[idx];
if ( result != 0 ) if ( result != 0 )
goto Exit; goto Exit;
} }
@ -219,6 +243,7 @@
t1_cmap_custom_class_rec = t1_cmap_custom_class_rec =
{ {
sizeof ( T1_CMapCustomRec ), sizeof ( T1_CMapCustomRec ),
(FT_CMap_InitFunc) t1_cmap_custom_init, (FT_CMap_InitFunc) t1_cmap_custom_init,
(FT_CMap_DoneFunc) t1_cmap_custom_done, (FT_CMap_DoneFunc) t1_cmap_custom_done,
(FT_CMap_CharIndexFunc)t1_cmap_custom_char_index, (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,
@ -226,15 +251,13 @@
}; };
/*************************************************************************/
/*************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/ /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
FT_CALLBACK_DEF( FT_Int ) FT_CALLBACK_DEF( FT_Int )
t1_cmap_uni_pair_compare( const void* pair1, t1_cmap_uni_pair_compare( const void* pair1,
@ -243,6 +266,7 @@
FT_UInt32 u1 = ((T1_CMapUniPair)pair1)->unicode; FT_UInt32 u1 = ((T1_CMapUniPair)pair1)->unicode;
FT_UInt32 u2 = ((T1_CMapUniPair)pair2)->unicode; FT_UInt32 u2 = ((T1_CMapUniPair)pair2)->unicode;
if ( u1 < u2 ) if ( u1 < u2 )
return -1; return -1;
@ -253,7 +277,6 @@
} }
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
t1_cmap_unicode_init( T1_CMapUnicode cmap ) t1_cmap_unicode_init( T1_CMapUnicode cmap )
{ {
@ -281,6 +304,7 @@
{ {
const char* gname = face->type1.glyph_names[n]; const char* gname = face->type1.glyph_names[n];
/* build unsorted pair table by matching glyph names */ /* build unsorted pair table by matching glyph names */
if ( gname ) if ( gname )
{ {
@ -298,14 +322,14 @@
new_count = (FT_UInt)( pair - cmap->pairs ); new_count = (FT_UInt)( pair - cmap->pairs );
if ( new_count == 0 ) if ( new_count == 0 )
{ {
/* there are no unicode characters in here !! */ /* there are no unicode characters in here! */
FT_FREE( cmap->pairs ); FT_FREE( cmap->pairs );
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;
} }
else else
{ {
/* re-allocate if the new array is much smaller than the original */ /* re-allocate if the new array is much smaller than the original */
/* one.. */ /* one */
if ( new_count != count && new_count < count / 2 ) if ( new_count != count && new_count < count / 2 )
{ {
(void)FT_RENEW_ARRAY( cmap->pairs, count, new_count ); (void)FT_RENEW_ARRAY( cmap->pairs, count, new_count );
@ -337,7 +361,6 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_index( T1_CMapUnicode cmap, t1_cmap_unicode_char_index( T1_CMapUnicode cmap,
FT_UInt32 char_code ) FT_UInt32 char_code )
@ -347,6 +370,7 @@
FT_UInt mid; FT_UInt mid;
T1_CMapUniPair pair; T1_CMapUniPair pair;
while ( min < max ) while ( min < max )
{ {
mid = min + ( max - min ) / 2; mid = min + ( max - min ) / 2;
@ -371,6 +395,7 @@
FT_UInt result = 0; FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code + 1; FT_UInt32 char_code = *pchar_code + 1;
Restart: Restart:
{ {
FT_UInt min = 0; FT_UInt min = 0;
@ -378,6 +403,7 @@
FT_UInt mid; FT_UInt mid;
T1_CMapUniPair pair; T1_CMapUniPair pair;
while ( min < max ) while ( min < max )
{ {
mid = min + ( ( max - min ) >> 1 ); mid = min + ( ( max - min ) >> 1 );
@ -421,6 +447,7 @@
t1_cmap_unicode_class_rec = t1_cmap_unicode_class_rec =
{ {
sizeof ( T1_CMapUnicodeRec ), sizeof ( T1_CMapUnicodeRec ),
(FT_CMap_InitFunc) t1_cmap_unicode_init, (FT_CMap_InitFunc) t1_cmap_unicode_init,
(FT_CMap_DoneFunc) t1_cmap_unicode_done, (FT_CMap_DoneFunc) t1_cmap_unicode_done,
(FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index, (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,
@ -428,4 +455,4 @@
}; };
/* END */

View File

@ -1,5 +1,23 @@
#ifndef __FT_TYPE1_CMAP_H__ /***************************************************************************/
#define __FT_TYPE1_CMAP_H__ /* */
/* t1cmap.h */
/* */
/* Type 1 character map support (specification). */
/* */
/* Copyright 2002 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 __T1CMAP_H__
#define __T1CMAP_H__
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
@ -8,13 +26,14 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
/***************************************************************************/
/***************************************************************************/ /*************************************************************************/
/*************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/ /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
/* standard (and expert) encoding cmaps */ /* standard (and expert) encoding cmaps */
typedef struct T1_CMapStdRec_* T1_CMapStd; typedef struct T1_CMapStdRec_* T1_CMapStd;
@ -38,13 +57,14 @@ FT_BEGIN_HEADER
FT_CALLBACK_TABLE const FT_CMap_ClassRec FT_CALLBACK_TABLE const FT_CMap_ClassRec
t1_cmap_expert_class_rec; t1_cmap_expert_class_rec;
/***************************************************************************/
/***************************************************************************/ /*************************************************************************/
/*************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 CUSTOM ENCODING CMAP *****/ /***** TYPE1 CUSTOM ENCODING CMAP *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
typedef struct T1_CMapCustomRec_* T1_CMapCustom; typedef struct T1_CMapCustomRec_* T1_CMapCustom;
@ -57,16 +77,18 @@ FT_BEGIN_HEADER
} T1_CMapCustomRec; } T1_CMapCustomRec;
FT_CALLBACK_TABLE const FT_CMap_ClassRec FT_CALLBACK_TABLE const FT_CMap_ClassRec
t1_cmap_custom_class_rec; t1_cmap_custom_class_rec;
/***************************************************************************/
/***************************************************************************/ /*************************************************************************/
/*************************************************************************/
/***** *****/ /***** *****/
/***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/ /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
/***** *****/ /***** *****/
/***************************************************************************/ /*************************************************************************/
/***************************************************************************/ /*************************************************************************/
/* unicode (syntehtic) cmaps */ /* unicode (syntehtic) cmaps */
typedef struct T1_CMapUnicodeRec_* T1_CMapUnicode; typedef struct T1_CMapUnicodeRec_* T1_CMapUnicode;
@ -93,6 +115,10 @@ FT_BEGIN_HEADER
/* */ /* */
FT_END_HEADER FT_END_HEADER
#endif /* __FT_TYPE1_CMAP_H__ */ #endif /* __T1CMAP_H__ */
/* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* PostScript Type 1 decoding routines (body). */ /* PostScript Type 1 decoding routines (body). */
/* */ /* */
/* Copyright 2000-2001 by */ /* Copyright 2000-2001, 2002 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, */
@ -70,6 +70,7 @@
} T1_Operator; } T1_Operator;
static static
const FT_Int t1_args_count[op_max] = const FT_Int t1_args_count[op_max] =
{ {
@ -289,7 +290,7 @@
decoder->builder.left_bearing = left_bearing; decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance; decoder->builder.advance = advance;
/* XXX: old code doesn't work with postscript hinter */ /* XXX: old code doesn't work with PostScript hinter */
#if 0 #if 0
/* Finally, move the accent */ /* Finally, move the accent */
if ( decoder->builder.load_points ) if ( decoder->builder.load_points )
@ -448,7 +449,7 @@
case 12: case 12:
if ( ip > limit ) if ( ip > limit )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+EOF)\n" )); "invalid escape (12+EOF)\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -484,7 +485,7 @@
break; break;
default: default:
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+%d)\n", "invalid escape (12+%d)\n",
ip[-1] )); ip[-1] ));
goto Syntax_Error; goto Syntax_Error;
@ -494,7 +495,7 @@
case 255: /* four bytes integer */ case 255: /* four bytes integer */
if ( ip + 4 > limit ) if ( ip + 4 > limit )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unexpected EOF in integer\n" )); "unexpected EOF in integer\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -515,7 +516,7 @@
{ {
if ( ++ip > limit ) if ( ++ip > limit )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected EOF in integer\n" )); FT_ERROR(( "unexpected EOF in integer\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -528,7 +529,7 @@
} }
else else
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid byte (%d)\n", ip[-1] )); "invalid byte (%d)\n", ip[-1] ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -543,7 +544,7 @@
{ {
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: stack overflow!\n" )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: stack overflow!\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -600,7 +601,7 @@
if ( decoder->flex_state == 0 || if ( decoder->flex_state == 0 ||
decoder->num_flex_vectors != 7 ) decoder->num_flex_vectors != 7 )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unexpected flex end\n" )); "unexpected flex end\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -611,7 +612,7 @@
ip[2] != 12 || ip[3] != 17 || /* pop */ ip[2] != 12 || ip[3] != 17 || /* pop */
ip[4] != 12 || ip[5] != 33 ) /* setcurpoint */ ip[4] != 12 || ip[5] != 33 ) /* setcurpoint */
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid flex charstring\n" )); "invalid flex charstring\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -627,14 +628,14 @@
/* eat the following `pop' */ /* eat the following `pop' */
if ( ip + 2 > limit ) if ( ip + 2 > limit )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+%d)\n", ip[-1] )); "invalid escape (12+%d)\n", ip[-1] ));
goto Syntax_Error; goto Syntax_Error;
} }
if ( ip[0] != 12 || ip[1] != 17 ) if ( ip[0] != 12 || ip[1] != 17 )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "`pop' expected, found (%d %d)\n", ip[0], ip[1] )); FT_ERROR(( "`pop' expected, found (%d %d)\n", ip[0], ip[1] ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -665,7 +666,7 @@
if ( !blend ) if ( !blend )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected multiple masters operator!\n" )); FT_ERROR(( "unexpected multiple masters operator!\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -673,7 +674,7 @@
num_points = top[1] - 13 + ( top[1] == 18 ); num_points = top[1] - 13 + ( top[1] == 18 );
if ( top[0] != (FT_Int)( num_points * blend->num_designs ) ) if ( top[0] != (FT_Int)( num_points * blend->num_designs ) )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "incorrect number of mm arguments\n" )); FT_ERROR(( "incorrect number of mm arguments\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -715,7 +716,7 @@
default: default:
Unexpected_OtherSubr: Unexpected_OtherSubr:
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid othersubr [%d %d]!\n", top[0], top[1] )); "invalid othersubr [%d %d]!\n", top[0], top[1] ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -927,7 +928,7 @@
} }
else else
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: division by 0\n" )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: division by 0\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
break; break;
@ -942,14 +943,14 @@
idx = top[0]; idx = top[0];
if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid subrs index\n" )); "invalid subrs index\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS ) if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"too many nested subrs\n" )); "too many nested subrs\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -977,7 +978,7 @@
if ( !zone->base ) if ( !zone->base )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invoking empty subrs!\n" )); "invoking empty subrs!\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -1000,7 +1001,7 @@
if ( zone <= decoder->zones ) if ( zone <= decoder->zones )
{ {
FT_ERROR(( "T1_Decoder_Parse_CharStrings: unexpected return\n" )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: unexpected return\n" ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -1056,6 +1057,7 @@
{ {
FT_Pos dx = orig_x; FT_Pos dx = orig_x;
top[0] += dx; top[0] += dx;
top[2] += dx; top[2] += dx;
top[4] += dx; top[4] += dx;
@ -1066,12 +1068,12 @@
case op_setcurrentpoint: case op_setcurrentpoint:
FT_TRACE4(( " setcurrentpoint" )); FT_TRACE4(( " setcurrentpoint" ));
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " )); FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected `setcurrentpoint'\n" )); FT_ERROR(( "unexpected `setcurrentpoint'\n" ));
goto Syntax_Error; goto Syntax_Error;
default: default:
FT_ERROR(( "T1_Decoder_Parse_CharStrings: " FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unhandled opcode %d\n", op )); "unhandled opcode %d\n", op ));
goto Syntax_Error; goto Syntax_Error;
} }
@ -1106,7 +1108,7 @@
} }
/* initialise T1 decoder */ /* initialize T1 decoder */
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
T1_Decoder_Init( T1_Decoder decoder, T1_Decoder_Init( T1_Decoder decoder,
FT_Face face, FT_Face face,
@ -1135,6 +1137,7 @@
decoder->psnames = psnames; decoder->psnames = psnames;
} }
T1_Builder_Init( &decoder->builder, face, size, slot, hinting ); T1_Builder_Init( &decoder->builder, face, size, slot, hinting );
decoder->num_glyphs = face->num_glyphs; decoder->num_glyphs = face->num_glyphs;

View File

@ -4,7 +4,7 @@
/* */ /* */
/* PostScript Type 1 decoding routines (specification). */ /* PostScript Type 1 decoding routines (specification). */
/* */ /* */
/* Copyright 2000-2001 by */ /* Copyright 2000-2001, 2002 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, */