ref: 545a75fdd76cb9f3ae4d4ea3dca4c0b578ea7aee
parent: 1987fb2f72b8a0c3d81db1084535d94d3cc68d9c
author: Werner Lemberg <[email protected]>
date: Sun Mar 31 06:18:15 EST 2002
* src/psaux/t1cmap.c: s/index/idx/. * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug messages.
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,13 @@
2002-03-31 Werner Lemberg <[email protected]>
* 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 <[email protected]>
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -471,7 +471,7 @@
/* */
typedef struct SFNT_Interface_
{
- TT_Goto_Table_Func goto_table;
+ TT_Loader_GotoTableFunc goto_table;
TT_Init_Face_Func init_face;
TT_Load_Face_Func load_face;
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1165,7 +1165,7 @@
/*************************************************************************/
/* */
/* <FuncType> */
- /* TT_Goto_Table_Func */
+ /* TT_Loader_GotoTableFunc */
/* */
/* <Description> */
/* Seeks a stream to the start of a given TrueType table. */
@@ -1188,10 +1188,10 @@
/* The stream cursor must be at the font file's origin. */
/* */
typedef FT_Error
- (*TT_Goto_Table_Func)( TT_Face face,
- FT_ULong tag,
- FT_Stream stream,
- FT_ULong* length );
+ (*TT_Loader_GotoTableFunc)( TT_Face face,
+ FT_ULong tag,
+ FT_Stream stream,
+ FT_ULong* length );
/*************************************************************************/
@@ -1493,7 +1493,7 @@
#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_EndGlyphFunc forget_glyph_frame;
--- a/src/psaux/Jamfile
+++ b/src/psaux/Jamfile
@@ -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 ;
--- a/src/psaux/descrip.mms
+++ b/src/psaux/descrip.mms
@@ -3,7 +3,7 @@
#
-# Copyright 2001 by
+# Copyright 2001, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
--- a/src/psaux/psaux.c
+++ b/src/psaux/psaux.c
@@ -4,7 +4,7 @@
/* */
/* FreeType auxiliary PostScript driver component (body only). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType auxiliary PostScript module implementation (body). */
/* */
-/* Copyright 2000-2001 by */
+/* Copyright 2000-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -54,7 +54,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
- PS_Table_New( PS_Table table,
+ PS_Table_New( PS_Table table,
FT_Int count,
FT_Memory memory )
{
@@ -85,7 +85,7 @@
static void
shift_elements( PS_Table table,
- FT_Byte* old_base )
+ FT_Byte* old_base )
{
FT_Long delta = (FT_Long)( table->block - old_base );
FT_Byte** offset = table->elements;
@@ -102,7 +102,7 @@
static FT_Error
reallocate_t1_table( PS_Table table,
- FT_Int new_size )
+ FT_Int new_size )
{
FT_Memory memory = table->memory;
FT_Byte* old_base = table->block;
@@ -200,7 +200,8 @@
/* PS_Table_Done */
/* */
/* <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> */
/* table :: The target table. */
@@ -306,7 +307,7 @@
FT_LOCAL_DEF( void )
PS_Parser_ToToken( PS_Parser parser,
- T1_Token token )
+ T1_Token token )
{
FT_Byte* cur;
FT_Byte* limit;
@@ -389,9 +390,9 @@
FT_LOCAL_DEF( void )
PS_Parser_ToTokenArray( PS_Parser parser,
- T1_Token tokens,
- FT_UInt max_tokens,
- FT_Int* pnum_tokens )
+ T1_Token tokens,
+ FT_UInt max_tokens,
+ FT_Int* pnum_tokens )
{
T1_TokenRec master;
@@ -401,8 +402,8 @@
PS_Parser_ToToken( parser, &master );
if ( master.type == T1_TOKEN_TYPE_ARRAY )
{
- FT_Byte* old_cursor = parser->cursor;
- FT_Byte* old_limit = parser->limit;
+ FT_Byte* old_cursor = parser->cursor;
+ FT_Byte* old_limit = parser->limit;
T1_Token cur = tokens;
T1_Token limit = cur + max_tokens;
@@ -785,17 +786,17 @@
/* Load a simple field (i.e. non-table) into the current list of objects */
FT_LOCAL_DEF( FT_Error )
PS_Parser_LoadField( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags )
+ const T1_Field field,
+ void** objects,
+ FT_UInt max_objects,
+ FT_ULong* pflags )
{
T1_TokenRec token;
- FT_Byte* cur;
- FT_Byte* limit;
- FT_UInt count;
- FT_UInt idx;
- FT_Error error;
+ FT_Byte* cur;
+ FT_Byte* limit;
+ FT_UInt count;
+ FT_UInt idx;
+ FT_Error error;
PS_Parser_ToToken( parser, &token );
@@ -852,7 +853,7 @@
*(FT_UInt32*)q = (FT_UInt32)val;
break;
- default: /* for 64-bit systems */
+ default: /* for 64-bit systems */
*(FT_Long*)q = val;
}
break;
@@ -906,19 +907,20 @@
FT_LOCAL_DEF( FT_Error )
PS_Parser_LoadFieldTable( PS_Parser parser,
- const T1_Field field,
- void** objects,
- FT_UInt max_objects,
- FT_ULong* pflags )
+ const T1_Field field,
+ void** objects,
+ FT_UInt max_objects,
+ FT_ULong* pflags )
{
- T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS];
- T1_Token token;
- FT_Int num_elements;
- FT_Error error = 0;
- FT_Byte* old_cursor;
- FT_Byte* old_limit;
- T1_FieldRec fieldrec = *(T1_Field)field;
+ T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS];
+ T1_Token token;
+ FT_Int num_elements;
+ FT_Error error = 0;
+ FT_Byte* old_cursor;
+ FT_Byte* old_limit;
+ T1_FieldRec fieldrec = *(T1_Field)field;
+
#if 1
fieldrec.type = T1_FIELD_TYPE_INTEGER;
if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY )
@@ -977,7 +979,7 @@
FT_LOCAL_DEF( FT_Fixed )
PS_Parser_ToFixed( PS_Parser parser,
- FT_Int power_ten )
+ FT_Int power_ten )
{
return t1_tofixed( &parser->cursor, parser->limit, power_ten );
}
@@ -985,8 +987,8 @@
FT_LOCAL_DEF( FT_Int )
PS_Parser_ToCoordArray( PS_Parser parser,
- FT_Int max_coords,
- FT_Short* coords )
+ FT_Int max_coords,
+ FT_Short* coords )
{
return t1_tocoordarray( &parser->cursor, parser->limit,
max_coords, coords );
@@ -995,9 +997,9 @@
FT_LOCAL_DEF( FT_Int )
PS_Parser_ToFixedArray( PS_Parser parser,
- FT_Int max_values,
- FT_Fixed* values,
- FT_Int power_ten )
+ FT_Int max_values,
+ FT_Fixed* values,
+ FT_Int power_ten )
{
return t1_tofixedarray( &parser->cursor, parser->limit,
max_values, values, power_ten );
@@ -1024,9 +1026,9 @@
FT_LOCAL_DEF( void )
PS_Parser_Init( PS_Parser parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory )
+ FT_Byte* base,
+ FT_Byte* limit,
+ FT_Memory memory )
{
parser->error = 0;
parser->base = base;
@@ -1070,8 +1072,10 @@
/* */
/* glyph :: The current glyph object. */
/* */
+ /* hinting :: Whether hinting should be applied. */
+ /* */
FT_LOCAL_DEF( void )
- T1_Builder_Init( T1_Builder builder,
+ T1_Builder_Init( T1_Builder builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot glyph,
@@ -1143,10 +1147,10 @@
}
- /* 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 )
T1_Builder_Check_Points( T1_Builder builder,
- FT_Int count )
+ FT_Int count )
{
return FT_GlyphLoader_CheckPoints( builder->loader, count, 0 );
}
@@ -1155,9 +1159,9 @@
/* add a new point, do not check space */
FT_LOCAL_DEF( void )
T1_Builder_Add_Point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag )
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag )
{
FT_Outline* outline = builder->current;
@@ -1186,8 +1190,8 @@
/* check space for a new on-curve point, then add it */
FT_LOCAL_DEF( FT_Error )
T1_Builder_Add_Point1( T1_Builder builder,
- FT_Pos x,
- FT_Pos y )
+ FT_Pos x,
+ FT_Pos y )
{
FT_Error error;
@@ -1231,8 +1235,8 @@
/* if a path was begun, add its first on-curve point */
FT_LOCAL_DEF( FT_Error )
T1_Builder_Start_Point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y )
+ FT_Pos x,
+ FT_Pos y )
{
FT_Error error = 0;
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (specification). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -47,15 +47,15 @@
FT_LOCAL( FT_Error )
- PS_Table_New( PS_Table table,
+ PS_Table_New( PS_Table table,
FT_Int count,
FT_Memory memory );
FT_LOCAL( FT_Error )
PS_Table_Add( PS_Table table,
- FT_Int index,
- void* object,
- FT_Int length );
+ FT_Int index,
+ void* object,
+ FT_Int length );
FT_LOCAL( void )
PS_Table_Done( PS_Table table );
@@ -110,7 +110,7 @@
FT_LOCAL( FT_Fixed )
PS_Parser_ToFixed( PS_Parser parser,
- FT_Int power_ten );
+ FT_Int power_ten );
FT_LOCAL( FT_Int )
@@ -127,9 +127,9 @@
FT_LOCAL( void )
PS_Parser_Init( PS_Parser parser,
- FT_Byte* base,
- FT_Byte* limit,
- FT_Memory memory );
+ FT_Byte* base,
+ FT_Byte* limit,
+ FT_Memory memory );
FT_LOCAL( void )
PS_Parser_Done( PS_Parser parser );
@@ -155,18 +155,18 @@
FT_LOCAL( FT_Error )
T1_Builder_Check_Points( T1_Builder builder,
- FT_Int count );
+ FT_Int count );
FT_LOCAL( void )
T1_Builder_Add_Point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag );
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag );
FT_LOCAL( FT_Error )
T1_Builder_Add_Point1( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
+ FT_Pos x,
+ FT_Pos y );
FT_LOCAL( FT_Error )
T1_Builder_Add_Contour( T1_Builder builder );
@@ -174,8 +174,8 @@
FT_LOCAL( FT_Error )
T1_Builder_Start_Point( T1_Builder builder,
- FT_Pos x,
- FT_Pos y );
+ FT_Pos x,
+ FT_Pos y );
FT_LOCAL( void )
--- a/src/psaux/rules.mk
+++ b/src/psaux/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -1,16 +1,35 @@
+/***************************************************************************/
+/* */
+/* 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 <stdlib.h>
+#include <stdlib.h> /* for qsort() */
#include FT_INTERNAL_DEBUG_H
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
static void
t1_cmap_std_init( T1_CMapStd cmap,
FT_Int is_expert )
@@ -18,6 +37,7 @@
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
PSNames_Service psnames = (PSNames_Service)face->psnames;
+
cmap->num_glyphs = face->type1.num_glyphs;
cmap->glyph_names = (const char* const*)face->type1.glyph_names;
cmap->sid_to_string = psnames->adobe_std_strings;
@@ -39,18 +59,20 @@
FT_CALLBACK_DEF( FT_UInt )
- t1_cmap_std_char_index( T1_CMapStd cmap,
- FT_UInt32 char_code )
+ t1_cmap_std_char_index( T1_CMapStd cmap,
+ FT_UInt32 char_code )
{
FT_UInt result = 0;
+
if ( char_code < 256 )
{
FT_UInt code, n;
const char* glyph_name;
- /* conver character code to Adobe SID string */
- code = cmap->code_to_sid[ char_code ];
+
+ /* convert character code to Adobe SID string */
+ code = cmap->code_to_sid[char_code];
glyph_name = cmap->sid_to_string( code );
/* look for the corresponding glyph name */
@@ -58,6 +80,7 @@
{
const char* gname = cmap->glyph_names[n];
+
if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 )
{
@@ -66,6 +89,7 @@
}
}
}
+
return result;
}
@@ -74,9 +98,10 @@
t1_cmap_std_char_next( T1_CMapStd cmap,
FT_UInt32 *pchar_code )
{
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code + 1;
+ FT_UInt result = 0;
+ FT_UInt32 char_code = *pchar_code + 1;
+
while ( char_code < 256 )
{
result = t1_cmap_std_char_index( cmap, char_code );
@@ -104,17 +129,15 @@
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
t1_cmap_standard_class_rec =
{
- sizeof( T1_CMapStdRec ),
+ sizeof ( T1_CMapStdRec ),
- (FT_CMap_InitFunc) t1_cmap_standard_init,
- (FT_CMap_DoneFunc) t1_cmap_std_done,
- (FT_CMap_CharIndexFunc) t1_cmap_std_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_std_char_next
+ (FT_CMap_InitFunc) t1_cmap_standard_init,
+ (FT_CMap_DoneFunc) t1_cmap_std_done,
+ (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
+ (FT_CMap_CharNextFunc) t1_cmap_std_char_next
};
-
-
FT_CALLBACK_DEF( FT_Error )
t1_cmap_expert_init( T1_CMapStd cmap )
{
@@ -125,34 +148,33 @@
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
t1_cmap_expert_class_rec =
{
- sizeof( T1_CMapStdRec ),
+ sizeof ( T1_CMapStdRec ),
- (FT_CMap_InitFunc) t1_cmap_expert_init,
- (FT_CMap_DoneFunc) t1_cmap_std_done,
- (FT_CMap_CharIndexFunc) t1_cmap_std_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_std_char_next
+ (FT_CMap_InitFunc) t1_cmap_expert_init,
+ (FT_CMap_DoneFunc) t1_cmap_std_done,
+ (FT_CMap_CharIndexFunc)t1_cmap_std_char_index,
+ (FT_CMap_CharNextFunc) t1_cmap_std_char_next
};
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 CUSTOM ENCODING CMAP *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 CUSTOM ENCODING CMAP *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
-
-
FT_CALLBACK_DEF( FT_Error )
t1_cmap_custom_init( T1_CMapCustom cmap )
{
- T1_Face face = (T1_Face) FT_CMAP_FACE(cmap);
+ T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Encoding encoding = &face->type1.encoding;
+
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;
FT_ASSERT( cmap->indices != NULL );
@@ -176,12 +198,13 @@
FT_UInt32 char_code )
{
FT_UInt result = 0;
- FT_UInt32 index;
+ FT_UInt32 idx;
- index = (FT_UInt32)( char_code - cmap->first );
- if ( index < cmap->count )
- result = cmap->indices[ index ];
+ idx = (FT_UInt32)( char_code - cmap->first );
+ if ( idx < cmap->count )
+ result = cmap->indices[idx];
+
return result;
}
@@ -190,19 +213,20 @@
t1_cmap_custom_char_next( T1_CMapCustom cmap,
FT_UInt32 *pchar_code )
{
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code;
- FT_UInt32 index;
+ FT_UInt result = 0;
+ FT_UInt32 char_code = *pchar_code;
+ FT_UInt32 idx;
+
++char_code;
if ( char_code < cmap->first )
char_code = cmap->first;
- index = (FT_UInt32)( char_code - cmap->first );
- for ( ; index < cmap->count; index++, char_code++ )
+ idx = (FT_UInt32)( char_code - cmap->first );
+ for ( ; idx < cmap->count; idx++, char_code++ )
{
- result = cmap->indices[index];
+ result = cmap->indices[idx];
if ( result != 0 )
goto Exit;
}
@@ -218,24 +242,23 @@
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
t1_cmap_custom_class_rec =
{
- sizeof( T1_CMapCustomRec ),
- (FT_CMap_InitFunc) t1_cmap_custom_init,
- (FT_CMap_DoneFunc) t1_cmap_custom_done,
- (FT_CMap_CharIndexFunc) t1_cmap_custom_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_custom_char_next
+ sizeof ( T1_CMapCustomRec ),
+
+ (FT_CMap_InitFunc) t1_cmap_custom_init,
+ (FT_CMap_DoneFunc) t1_cmap_custom_done,
+ (FT_CMap_CharIndexFunc)t1_cmap_custom_char_index,
+ (FT_CMap_CharNextFunc) t1_cmap_custom_char_next
};
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
-
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
-
FT_CALLBACK_DEF( FT_Int )
t1_cmap_uni_pair_compare( const void* pair1,
const void* pair2 )
@@ -243,6 +266,7 @@
FT_UInt32 u1 = ((T1_CMapUniPair)pair1)->unicode;
FT_UInt32 u2 = ((T1_CMapUniPair)pair2)->unicode;
+
if ( u1 < u2 )
return -1;
@@ -253,7 +277,6 @@
}
-
FT_CALLBACK_DEF( FT_Error )
t1_cmap_unicode_init( T1_CMapUnicode cmap )
{
@@ -281,6 +304,7 @@
{
const char* gname = face->type1.glyph_names[n];
+
/* build unsorted pair table by matching glyph names */
if ( gname )
{
@@ -298,7 +322,7 @@
new_count = (FT_UInt)( pair - cmap->pairs );
if ( new_count == 0 )
{
- /* there are no unicode characters in here !! */
+ /* there are no unicode characters in here! */
FT_FREE( cmap->pairs );
error = FT_Err_Invalid_Argument;
}
@@ -305,8 +329,8 @@
else
{
/* re-allocate if the new array is much smaller than the original */
- /* one.. */
- if ( new_count != count && new_count < count/2 )
+ /* one */
+ if ( new_count != count && new_count < count / 2 )
{
(void)FT_RENEW_ARRAY( cmap->pairs, count, new_count );
error = 0;
@@ -315,7 +339,7 @@
/* sort the pairs table to allow efficient binary searches */
qsort( cmap->pairs,
new_count,
- sizeof(T1_CMapUniPairRec),
+ sizeof ( T1_CMapUniPairRec ),
t1_cmap_uni_pair_compare );
cmap->num_pairs = new_count;
@@ -337,7 +361,6 @@
}
-
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_index( T1_CMapUnicode cmap,
FT_UInt32 char_code )
@@ -347,9 +370,10 @@
FT_UInt mid;
T1_CMapUniPair pair;
+
while ( min < max )
{
- mid = min + (max - min)/2;
+ mid = min + ( max - min ) / 2;
pair = cmap->pairs + mid;
if ( pair->unicode == char_code )
@@ -356,7 +380,7 @@
return pair->gindex;
if ( pair->unicode < char_code )
- min = mid+1;
+ min = mid + 1;
else
max = mid;
}
@@ -368,9 +392,10 @@
t1_cmap_unicode_char_next( T1_CMapUnicode cmap,
FT_UInt32 *pchar_code )
{
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code + 1;
+ FT_UInt result = 0;
+ FT_UInt32 char_code = *pchar_code + 1;
+
Restart:
{
FT_UInt min = 0;
@@ -378,9 +403,10 @@
FT_UInt mid;
T1_CMapUniPair pair;
+
while ( min < max )
{
- mid = min + ((max - min) >> 1);
+ mid = min + ( ( max - min ) >> 1 );
pair = cmap->pairs + mid;
if ( pair->unicode == char_code )
@@ -420,12 +446,13 @@
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
t1_cmap_unicode_class_rec =
{
- sizeof( T1_CMapUnicodeRec ),
- (FT_CMap_InitFunc) t1_cmap_unicode_init,
- (FT_CMap_DoneFunc) t1_cmap_unicode_done,
- (FT_CMap_CharIndexFunc) t1_cmap_unicode_char_index,
- (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next
+ sizeof ( T1_CMapUnicodeRec ),
+
+ (FT_CMap_InitFunc) t1_cmap_unicode_init,
+ (FT_CMap_DoneFunc) t1_cmap_unicode_done,
+ (FT_CMap_CharIndexFunc)t1_cmap_unicode_char_index,
+ (FT_CMap_CharNextFunc) t1_cmap_unicode_char_next
};
-
+/* END */
--- a/src/psaux/t1cmap.h
+++ b/src/psaux/t1cmap.h
@@ -1,6 +1,24 @@
-#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 FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TYPE1_TYPES_H
@@ -8,18 +26,19 @@
FT_BEGIN_HEADER
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
- /* standard (and expert) encoding cmaps */
- typedef struct T1_CMapStdRec_* T1_CMapStd;
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- typedef struct T1_CMapStdRec_
+ /* standard (and expert) encoding cmaps */
+ typedef struct T1_CMapStdRec_* T1_CMapStd;
+
+ typedef struct T1_CMapStdRec_
{
FT_CMapRec cmap;
@@ -38,40 +57,43 @@
FT_CALLBACK_TABLE const FT_CMap_ClassRec
t1_cmap_expert_class_rec;
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 CUSTOM ENCODING CMAP *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
- typedef struct T1_CMapCustomRec_* T1_CMapCustom;
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 CUSTOM ENCODING CMAP *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef struct T1_CMapCustomRec_* T1_CMapCustom;
- typedef struct T1_CMapCustomRec_
+ typedef struct T1_CMapCustomRec_
{
- FT_CMapRec cmap;
- FT_UInt first;
- FT_UInt count;
- FT_UShort* indices;
+ FT_CMapRec cmap;
+ FT_UInt first;
+ FT_UInt count;
+ FT_UShort* indices;
} T1_CMapCustomRec;
+
FT_CALLBACK_TABLE const FT_CMap_ClassRec
t1_cmap_custom_class_rec;
- /***************************************************************************/
- /***************************************************************************/
- /***** *****/
- /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
- /***** *****/
- /***************************************************************************/
- /***************************************************************************/
- /* unicode (syntehtic) cmaps */
- typedef struct T1_CMapUnicodeRec_* T1_CMapUnicode;
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 SYNTHETIC UNICODE ENCODING CMAP *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
- typedef struct T1_CMapUniPairRec_
+ /* unicode (syntehtic) cmaps */
+ typedef struct T1_CMapUnicodeRec_* T1_CMapUnicode;
+
+ typedef struct T1_CMapUniPairRec_
{
FT_UInt32 unicode;
FT_UInt gindex;
@@ -79,7 +101,7 @@
} T1_CMapUniPairRec, *T1_CMapUniPair;
- typedef struct T1_CMapUnicodeRec_
+ typedef struct T1_CMapUnicodeRec_
{
FT_CMapRec cmap;
FT_UInt num_pairs;
@@ -92,7 +114,11 @@
t1_cmap_unicode_class_rec;
/* */
+
FT_END_HEADER
-#endif /* __FT_TYPE1_CMAP_H__ */
+#endif /* __T1CMAP_H__ */
+
+
+/* END */
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2001 by */
+/* Copyright 2000-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -70,6 +70,7 @@
} T1_Operator;
+
static
const FT_Int t1_args_count[op_max] =
{
@@ -122,11 +123,11 @@
/* */
static FT_Int
t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder,
- FT_Int charcode )
+ FT_Int charcode )
{
- FT_UInt n;
- const FT_String* glyph_name;
- PSNames_Service psnames = decoder->psnames;
+ FT_UInt n;
+ const FT_String* glyph_name;
+ PSNames_Service psnames = decoder->psnames;
/* check range of standard char code */
@@ -176,11 +177,11 @@
/* */
static FT_Error
t1operator_seac( T1_Decoder decoder,
- FT_Pos asb,
- FT_Pos adx,
- FT_Pos ady,
- FT_Int bchar,
- FT_Int achar )
+ FT_Pos asb,
+ FT_Pos adx,
+ FT_Pos ady,
+ FT_Int bchar,
+ FT_Int achar )
{
FT_Error error;
FT_Int bchar_index, achar_index;
@@ -217,8 +218,8 @@
/* accent character and return the array of subglyphs. */
if ( decoder->builder.no_recurse )
{
- FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
- FT_GlyphLoader loader = glyph->internal->loader;
+ FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
+ FT_GlyphLoader loader = glyph->internal->loader;
FT_SubGlyph subg;
@@ -289,7 +290,7 @@
decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance;
- /* XXX: old code doesn't work with postscript hinter */
+ /* XXX: old code doesn't work with PostScript hinter */
#if 0
/* Finally, move the accent */
if ( decoder->builder.load_points )
@@ -332,17 +333,17 @@
/* */
FT_LOCAL_DEF( FT_Error )
T1_Decoder_Parse_Charstrings( T1_Decoder decoder,
- FT_Byte* charstring_base,
- FT_UInt charstring_len )
+ FT_Byte* charstring_base,
+ FT_UInt charstring_len )
{
- FT_Error error;
+ FT_Error error;
T1_Decoder_Zone zone;
- FT_Byte* ip;
- FT_Byte* limit;
+ FT_Byte* ip;
+ FT_Byte* limit;
T1_Builder builder = &decoder->builder;
- FT_Pos x, y, orig_x, orig_y;
+ FT_Pos x, y, orig_x, orig_y;
- T1_Hints_Funcs hinter;
+ T1_Hints_Funcs hinter;
/* we don't want to touch the source code -- use macro trick */
@@ -360,7 +361,7 @@
builder->path_begun = 0;
- hinter = (T1_Hints_Funcs) builder->hints_funcs;
+ hinter = (T1_Hints_Funcs)builder->hints_funcs;
zone->base = charstring_base;
limit = zone->limit = charstring_base + charstring_len;
@@ -448,7 +449,7 @@
case 12:
if ( ip > limit )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+EOF)\n" ));
goto Syntax_Error;
}
@@ -484,7 +485,7 @@
break;
default:
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+%d)\n",
ip[-1] ));
goto Syntax_Error;
@@ -494,7 +495,7 @@
case 255: /* four bytes integer */
if ( ip + 4 > limit )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unexpected EOF in integer\n" ));
goto Syntax_Error;
}
@@ -515,7 +516,7 @@
{
if ( ++ip > limit )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: " ));
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected EOF in integer\n" ));
goto Syntax_Error;
}
@@ -528,7 +529,7 @@
}
else
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid byte (%d)\n", ip[-1] ));
goto Syntax_Error;
}
@@ -543,7 +544,7 @@
{
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;
}
@@ -600,7 +601,7 @@
if ( decoder->flex_state == 0 ||
decoder->num_flex_vectors != 7 )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unexpected flex end\n" ));
goto Syntax_Error;
}
@@ -611,7 +612,7 @@
ip[2] != 12 || ip[3] != 17 || /* pop */
ip[4] != 12 || ip[5] != 33 ) /* setcurpoint */
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid flex charstring\n" ));
goto Syntax_Error;
}
@@ -627,7 +628,7 @@
/* eat the following `pop' */
if ( ip + 2 > limit )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid escape (12+%d)\n", ip[-1] ));
goto Syntax_Error;
}
@@ -634,7 +635,7 @@
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] ));
goto Syntax_Error;
}
@@ -658,14 +659,14 @@
case 18: /* multiple masters */
{
PS_Blend blend = decoder->blend;
- FT_UInt num_points, nn, mm;
- FT_Long* delta;
- FT_Long* values;
+ FT_UInt num_points, nn, mm;
+ FT_Long* delta;
+ FT_Long* values;
if ( !blend )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: " ));
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected multiple masters operator!\n" ));
goto Syntax_Error;
}
@@ -673,12 +674,12 @@
num_points = top[1] - 13 + ( top[1] == 18 );
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" ));
goto Syntax_Error;
}
- top -= blend->num_designs*num_points;
+ top -= blend->num_designs * num_points;
if ( top < decoder->stack )
goto Stack_Underflow;
@@ -715,7 +716,7 @@
default:
Unexpected_OtherSubr:
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invalid othersubr [%d %d]!\n", top[0], top[1] ));
goto Syntax_Error;
}
@@ -927,7 +928,7 @@
}
else
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: division by 0\n" ));
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: division by 0\n" ));
goto Syntax_Error;
}
break;
@@ -942,7 +943,7 @@
idx = top[0];
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" ));
goto Syntax_Error;
}
@@ -949,7 +950,7 @@
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" ));
goto Syntax_Error;
}
@@ -977,7 +978,7 @@
if ( !zone->base )
{
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"invoking empty subrs!\n" ));
goto Syntax_Error;
}
@@ -1000,7 +1001,7 @@
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;
}
@@ -1056,6 +1057,7 @@
{
FT_Pos dx = orig_x;
+
top[0] += dx;
top[2] += dx;
top[4] += dx;
@@ -1066,12 +1068,12 @@
case op_setcurrentpoint:
FT_TRACE4(( " setcurrentpoint" ));
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: " ));
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
FT_ERROR(( "unexpected `setcurrentpoint'\n" ));
goto Syntax_Error;
default:
- FT_ERROR(( "T1_Decoder_Parse_CharStrings: "
+ FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
"unhandled opcode %d\n", op ));
goto Syntax_Error;
}
@@ -1100,20 +1102,20 @@
/* parse a single Type 1 glyph */
FT_LOCAL_DEF( FT_Error )
T1_Decoder_Parse_Glyph( T1_Decoder decoder,
- FT_UInt glyph )
+ FT_UInt glyph )
{
return decoder->parse_callback( decoder, glyph );
}
- /* initialise T1 decoder */
+ /* initialize T1 decoder */
FT_LOCAL_DEF( FT_Error )
- T1_Decoder_Init( T1_Decoder decoder,
+ T1_Decoder_Init( T1_Decoder decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
- PS_Blend blend,
+ PS_Blend blend,
FT_Bool hinting,
T1_Decoder_Callback parse_callback )
{
@@ -1125,7 +1127,7 @@
psnames = (PSNames_Service)FT_Get_Module_Interface(
- FT_FACE_LIBRARY(face), "psnames" );
+ FT_FACE_LIBRARY(face), "psnames" );
if ( !psnames )
{
FT_ERROR(( "T1_Decoder_Init: " ));
@@ -1135,6 +1137,7 @@
decoder->psnames = psnames;
}
+
T1_Builder_Init( &decoder->builder, face, size, slot, hinting );
decoder->num_glyphs = face->num_glyphs;
@@ -1142,7 +1145,7 @@
decoder->blend = blend;
decoder->parse_callback = parse_callback;
- decoder->funcs = t1_decoder_funcs;
+ decoder->funcs = t1_decoder_funcs;
return 0;
}
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (specification). */
/* */
-/* Copyright 2000-2001 by */
+/* Copyright 2000-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -35,20 +35,20 @@
FT_LOCAL( FT_Error )
T1_Decoder_Parse_Glyph( T1_Decoder decoder,
- FT_UInt glyph_index );
+ FT_UInt glyph_index );
FT_LOCAL( FT_Error )
T1_Decoder_Parse_Charstrings( T1_Decoder decoder,
- FT_Byte* base,
- FT_UInt len );
+ FT_Byte* base,
+ FT_UInt len );
FT_LOCAL( FT_Error )
- T1_Decoder_Init( T1_Decoder decoder,
+ T1_Decoder_Init( T1_Decoder decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
- PS_Blend blend,
+ PS_Blend blend,
FT_Bool hinting,
T1_Decoder_Callback parse_glyph );