some fixes for 64-bit systems. Mainly changed some

FT_TRACE calls to use %p instead of %lx when dumping
a pointer address
This commit is contained in:
David Turner 2000-05-18 16:18:05 +00:00
parent 109fcf6086
commit 51179f0ae3
12 changed files with 130 additions and 21 deletions

View File

@ -1,5 +1,8 @@
LATEST_CHANGES
- some fixes for 64-bit systems (mainly changing some FT_TRACE calls
to use %p instead of %lx).. Thanks to Karl Robillard
- fixed some bugs in the sbit loader (src/base/sfnt/ttsbit.c) + added
a new flag, FT_LOAD_CROP_BITMAP to query that bitmaps be cropped when
loaded from a file (maybe I should move the bitmap cropper to the

View File

@ -358,7 +358,7 @@
TT_Load_Table_Func load_kerning;
TT_Load_Table_Func load_gasp;
TT_Load_Table_Func load_pclt;
/* see `ttsbit.h' */
TT_Load_Table_Func load_sbits;

View File

@ -1971,6 +1971,7 @@
TTC_Header ttc_header;
FT_ULong format_tag;
TT_UShort num_tables;
TT_Table* dir_tables;
@ -2018,6 +2019,9 @@
/* grid-fitting and scaling table */
TT_Gasp gasp; /* the `gasp' table */
/* PCL 5 table */
TT_PCLT pclt;
/* embedded bitmaps support */
TT_Int num_sbit_strikes;
TT_SBit_Strike* sbit_strikes;

View File

@ -392,6 +392,34 @@
} TT_Postscript;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_PCLT */
/* */
/* <Description> */
/* A structure used to model a TrueType PCLT table. All fields */
/* comply to the TrueType table. */
/* */
typedef struct TT_PCLT_
{
FT_Fixed Version;
FT_ULong FontNumber;
FT_UShort Pitch;
FT_UShort xHeight;
FT_UShort Style;
FT_UShort TypeFamily;
FT_UShort CapHeight;
FT_UShort SymbolSet;
FT_Char TypeFace[16];
FT_Char CharacterComplement[8];
FT_Char FileName[6];
FT_Char StrokeWeight[6];
FT_Char WidthType;
FT_Byte SerifStyle;
FT_Byte Reserved;
} TT_PCLT;
/*************************************************************************/
/* */
@ -491,6 +519,7 @@
ft_sfnt_hhea = 3,
ft_sfnt_vhea = 4,
ft_sfnt_post = 5,
ft_sfnt_pclt = 6,
sfnt_max /* don't remove */

View File

@ -204,8 +204,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */
/* */
EXPORT_FUNC(FT_Int32) FT_DivFix( FT_Long a,
FT_Long b )
EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a,
FT_Long b )
{
FT_Int32 s;
FT_Word32 q;

View File

@ -89,8 +89,8 @@
*P = NULL;
FT_TRACE2(( "FT_Alloc:" ));
FT_TRACE2(( " size = %ld, block = 0x%08lx, ref = 0x%08lx\n",
size, (long)*P, (long)P ));
FT_TRACE2(( " size = %ld, block = 0x%08p, ref = 0x%08p\n",
size, *P, P ));
return FT_Err_Ok;
}
@ -193,8 +193,8 @@
void** P )
{
FT_TRACE2(( "FT_Free:" ));
FT_TRACE2(( " Freeing block 0x%08lx, ref 0x%08lx\n",
(long)P, (P ? (long)*P : -1) ));
FT_TRACE2(( " Freeing block 0x%08p, ref 0x%08p\n",
P, (P ? *P : (void*)0) ));
FT_Assert( P != 0 );

View File

@ -28,6 +28,7 @@
TT_Load_Kern,
TT_Load_Gasp,
TT_Load_PCLT,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttsbit.h' */

View File

@ -57,8 +57,8 @@
TT_Table* entry;
TT_Table* limit;
FT_TRACE4(( "TT_LookUp_Table( %08lx, %c%c%c%c )\n",
(TT_Long)face,
FT_TRACE4(( "TT_LookUp_Table( %08p, %c%c%c%c )\n",
face,
(TT_Char)(tag >> 24),
(TT_Char)(tag >> 16),
(TT_Char)(tag >> 8),
@ -156,8 +156,8 @@
FT_FRAME_END };
#endif
FT_TRACE2(( "TT_Load_Format_Tag(%08lx, %ld )\n",
(TT_Long)face, faceIndex ));
FT_TRACE2(( "TT_Load_Format_Tag(%08p, %ld )\n",
face, faceIndex ));
face->ttc_header.Tag = 0;
face->ttc_header.version = 0;
@ -269,8 +269,8 @@
UNUSED(faceIndex);
FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n",
(TT_Long)face, faceIndex ));
FT_TRACE2(( "TT_Load_Directory( %08p, %ld )\n",
face, faceIndex ));
#ifdef READ_FIELDS
if ( READ_Fields( table_dir_fields, &tableDir ) )
@ -462,7 +462,7 @@
FT_FRAME_END };
#endif
FT_TRACE2(( "Load_TT_Header( %08lx )\n", (TT_Long)face ));
FT_TRACE2(( "Load_TT_Header( %08p )\n", face ));
error = face->goto_table( face, TTAG_head, stream, 0 );
if ( error )
@ -558,7 +558,7 @@
FT_FRAME_END };
#endif
FT_TRACE2(( "Load_TT_MaxProfile( %08lx )\n", (TT_Long)face ));
FT_TRACE2(( "Load_TT_MaxProfile( %08p )\n", face ));
error = face->goto_table( face, TTAG_maxp, stream, 0 );
if (error) goto Exit;
@ -658,8 +658,8 @@
TT_LongMetrics** longs;
TT_ShortMetrics** shorts;
FT_TRACE2(( "TT_Load_%s_Metrics( %08lx )\n",
vertical ? "Vertical" : "Horizontal", (TT_Long)face ));
FT_TRACE2(( "TT_Load_%s_Metrics( %08p )\n",
vertical ? "Vertical" : "Horizontal", face ));
if ( vertical )
{
@ -1413,7 +1413,7 @@
TT_Error error;
TT_Postscript* post = &face->postscript;
#ifdef READ_FIELDS
const FT_Frame_Field post_fields[] = {
static const FT_Frame_Field post_fields[] = {
FT_FRAME_START(32),
FT_FRAME_ULONG( TT_Postscript, FormatType ),
FT_FRAME_ULONG( TT_Postscript, italicAngle ),
@ -1461,6 +1461,70 @@
}
/*************************************************************************/
/* */
/* <Function> */
/* TT_Load_PCLT */
/* */
/* <Description> */
/* Loads the PCL 5 Table. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* stream :: A handle to the input stream. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
LOCAL_FUNC
TT_Error TT_Load_PCLT( TT_Face face,
FT_Stream stream )
{
static const FT_Frame_Field pclt_fields[] = {
FT_FRAME_START( 20 ),
FT_FRAME_ULONG ( TT_PCLT, Version ),
FT_FRAME_ULONG ( TT_PCLT, FontNumber ),
FT_FRAME_USHORT( TT_PCLT, Pitch ),
FT_FRAME_USHORT( TT_PCLT, xHeight ),
FT_FRAME_USHORT( TT_PCLT, Style ),
FT_FRAME_USHORT( TT_PCLT, TypeFamily ),
FT_FRAME_USHORT( TT_PCLT, CapHeight ),
FT_FRAME_END };
static const FT_Frame_Field pclt_fields2[] = {
FT_FRAME_START( 4 ),
FT_FRAME_CHAR( TT_PCLT, StrokeWeight ),
FT_FRAME_CHAR( TT_PCLT, WidthType ),
FT_FRAME_BYTE( TT_PCLT, SerifStyle ),
FT_FRAME_BYTE( TT_PCLT, Reserved ),
FT_FRAME_END };
TT_Error error;
TT_PCLT* pclt = &face->pclt;
FT_TRACE2(( "PCLT " ));
/* optional table */
error = face->goto_table( face, TTAG_PCLT, stream, 0 );
if (error)
{
FT_TRACE2(( "missing (optional)\n" ));
pclt->Version = 0;
return 0;
}
if ( READ_Fields( pclt_fields, pclt ) ||
FILE_Read ( pclt->TypeFace, 16 ) ||
FILE_Read ( pclt->CharacterComplement, 8 ) ||
FILE_Read ( pclt->FileName, 6 ) ||
READ_Fields( pclt_fields2, pclt ) )
goto Exit;
FT_TRACE2(( "loaded\n" ));
Exit:
return error;
}
/*************************************************************************/
/* */
/* <Function> */
@ -1487,7 +1551,7 @@
TT_GaspRange* gaspranges;
FT_TRACE2(( "TT_Load_Gasp( %08lx )\n", (TT_Long)face ));
FT_TRACE2(( "TT_Load_Gasp( %08p )\n", face ));
/* the gasp table is optional */
error = face->goto_table( face, TTAG_gasp, stream, 0 );

View File

@ -103,6 +103,9 @@
TT_Error TT_Load_Hdmx( TT_Face face,
FT_Stream stream );
LOCAL_DEF
TT_Error TT_Load_PCLT( TT_Face face,
FT_Stream stream );
LOCAL_DEF
void TT_Free_Names( TT_Face face );

View File

@ -651,6 +651,7 @@
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 ); break;
case ft_sfnt_post: table = &face->postscript; break;
case ft_sfnt_maxp: table = &face->max_profile; break;
case ft_sfnt_pclt: table = face->pclt.Version ? &face->pclt : 0 ; break;
default:
table = 0;

View File

@ -435,8 +435,8 @@
TT_Error error;
FT_TRACE1(( "TT.Create_Create: new object at 0x%08lx, parent = 0x%08lx\n",
(long)exec, (long)face ));
FT_TRACE1(( "TT.Create_Create: new object at 0x%08p, parent = 0x%08p\n",
exec, face ));
/* XXX: We don't reserve arrays anymore, this is done automatically */
/* during a call to Context_Load(). */

View File

@ -215,6 +215,9 @@
goto Exit;
}
/* store format tag */
face->format_tag = format_tag;
/* Load font directory */
error = sfnt->load_directory( face, stream, face_index );
if ( error ) goto Exit;
@ -254,6 +257,7 @@
if ( LOAD_( hdmx ) ||
LOAD_( gasp ) ||
LOAD_( kerning ) ||
LOAD_( pclt ) ||
(error = TT_Load_Locations( face, stream )) != TT_Err_Ok ||
(error = TT_Load_CVT ( face, stream )) != TT_Err_Ok ||