fixed a few 64-bit related bugs in "sfnt/ttload.c" and
"base/ftstream.c" Note that "TT_PCLT" was incorrectly defined in <freetype/tttables.h>
This commit is contained in:
parent
768c9561f6
commit
d18388e44b
|
@ -22,6 +22,7 @@
|
||||||
#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
|
#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
|
||||||
#define FT_FRAME_OP_LONG 4 /* read 4-byte value */
|
#define FT_FRAME_OP_LONG 4 /* read 4-byte value */
|
||||||
#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
|
#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
|
||||||
|
#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */
|
||||||
|
|
||||||
typedef enum FT_Frame_Op_
|
typedef enum FT_Frame_Op_
|
||||||
{
|
{
|
||||||
|
@ -44,7 +45,9 @@ typedef enum FT_Frame_Op_
|
||||||
ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
|
ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
|
||||||
ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
|
ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
|
||||||
ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
|
ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
|
||||||
ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 )
|
ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
|
||||||
|
|
||||||
|
ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 )
|
||||||
|
|
||||||
} FT_Frame_Op;
|
} FT_Frame_Op;
|
||||||
|
|
||||||
|
@ -87,6 +90,13 @@ typedef struct FT_Frame_Field_
|
||||||
#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
|
#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
|
||||||
#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
|
#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
|
||||||
|
|
||||||
|
#define FT_FRAME_BYTES( struct_type, field, count ) \
|
||||||
|
{ \
|
||||||
|
ft_frame_bytes, \
|
||||||
|
count, \
|
||||||
|
(FT_UShort)(char*)&FT_FIELD_REF(struct_type,field) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
|
|
@ -418,7 +418,7 @@
|
||||||
FT_Char TypeFace[16];
|
FT_Char TypeFace[16];
|
||||||
FT_Char CharacterComplement[8];
|
FT_Char CharacterComplement[8];
|
||||||
FT_Char FileName[6];
|
FT_Char FileName[6];
|
||||||
FT_Char StrokeWeight[6];
|
FT_Char StrokeWeight;
|
||||||
FT_Char WidthType;
|
FT_Char WidthType;
|
||||||
FT_Byte SerifStyle;
|
FT_Byte SerifStyle;
|
||||||
FT_Byte Reserved;
|
FT_Byte Reserved;
|
||||||
|
|
|
@ -561,7 +561,6 @@
|
||||||
/* <Note> */
|
/* <Note> */
|
||||||
/* The 2x2 transformation matrix is also applied to the glyph's */
|
/* The 2x2 transformation matrix is also applied to the glyph's */
|
||||||
/* advance vector. */
|
/* advance vector. */
|
||||||
/* */
|
|
||||||
FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph,
|
FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph,
|
||||||
FT_Matrix* matrix,
|
FT_Matrix* matrix,
|
||||||
FT_Vector* delta )
|
FT_Vector* delta )
|
||||||
|
|
|
@ -539,6 +539,21 @@
|
||||||
fields++;
|
fields++;
|
||||||
continue; /* loop! */
|
continue; /* loop! */
|
||||||
|
|
||||||
|
case ft_frame_bytes: /* read a byte sequence */
|
||||||
|
{
|
||||||
|
FT_Int len = stream->limit - stream->cursor;
|
||||||
|
|
||||||
|
if (len > fields->size)
|
||||||
|
len = fields->size;
|
||||||
|
|
||||||
|
p = (FT_Byte*)structure + fields->offset;
|
||||||
|
MEM_Copy( p, stream->cursor, len );
|
||||||
|
stream->cursor += len;
|
||||||
|
fields++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
case ft_frame_byte:
|
case ft_frame_byte:
|
||||||
case ft_frame_schar: /* read a single byte */
|
case ft_frame_schar: /* read a single byte */
|
||||||
value = GET_Byte();
|
value = GET_Byte();
|
||||||
|
@ -611,13 +626,12 @@
|
||||||
value = 0;
|
value = 0;
|
||||||
p = stream->cursor;
|
p = stream->cursor;
|
||||||
|
|
||||||
if ( p + 3 < stream->limit )
|
if ( p + 2 < stream->limit )
|
||||||
{
|
{
|
||||||
value = (FT_ULong)p[0] |
|
value = (FT_ULong)p[0] |
|
||||||
( (FT_ULong)p[1] << 8 ) |
|
( (FT_ULong)p[1] << 8 ) |
|
||||||
( (FT_ULong)p[2] << 16 ) |
|
( (FT_ULong)p[2] << 16 );
|
||||||
( (FT_ULong)p[3] << 24 );
|
stream->cursor += 3;
|
||||||
stream->cursor += 4;
|
|
||||||
}
|
}
|
||||||
sign_shift = 8;
|
sign_shift = 8;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1330,7 +1330,7 @@
|
||||||
{
|
{
|
||||||
static const FT_Frame_Field pclt_fields[] =
|
static const FT_Frame_Field pclt_fields[] =
|
||||||
{
|
{
|
||||||
FT_FRAME_START( 20 ),
|
FT_FRAME_START( 54 ),
|
||||||
FT_FRAME_ULONG ( TT_PCLT, Version ),
|
FT_FRAME_ULONG ( TT_PCLT, Version ),
|
||||||
FT_FRAME_ULONG ( TT_PCLT, FontNumber ),
|
FT_FRAME_ULONG ( TT_PCLT, FontNumber ),
|
||||||
FT_FRAME_USHORT( TT_PCLT, Pitch ),
|
FT_FRAME_USHORT( TT_PCLT, Pitch ),
|
||||||
|
@ -1338,16 +1338,19 @@
|
||||||
FT_FRAME_USHORT( TT_PCLT, Style ),
|
FT_FRAME_USHORT( TT_PCLT, Style ),
|
||||||
FT_FRAME_USHORT( TT_PCLT, TypeFamily ),
|
FT_FRAME_USHORT( TT_PCLT, TypeFamily ),
|
||||||
FT_FRAME_USHORT( TT_PCLT, CapHeight ),
|
FT_FRAME_USHORT( TT_PCLT, CapHeight ),
|
||||||
|
FT_FRAME_BYTES ( TT_PCLT, TypeFace, 16 ),
|
||||||
|
FT_FRAME_BYTES ( TT_PCLT, CharacterComplement, 8 ),
|
||||||
|
FT_FRAME_BYTES ( TT_PCLT, FileName, 6 ),
|
||||||
|
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
|
FT_FRAME_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const FT_Frame_Field pclt_fields2[] =
|
static const FT_Frame_Field pclt_fields2[] =
|
||||||
{
|
{
|
||||||
FT_FRAME_START( 4 ),
|
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
|
FT_FRAME_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1366,11 +1369,7 @@
|
||||||
return TT_Err_Ok;
|
return TT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( READ_Fields( pclt_fields, pclt ) ||
|
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;
|
goto Exit;
|
||||||
|
|
||||||
FT_TRACE2(( "loaded\n" ));
|
FT_TRACE2(( "loaded\n" ));
|
||||||
|
|
Loading…
Reference in New Issue