* modules.cfg: Compile in ftotval.c and ftxf86.c by default for ABI

compatibility.

* src/sfnt/sfobjs.c (sfnt_done_face): Fix a memory leak.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_byte_aligned) [FT_OPTIMIZE_MEMORY]: Fix sbit
loading. (only tested with bit aligned sbit with x_pos == 0)

* src/truetype/ttpload.c (tt_face_load_hdmx,
tt_face_get_device_metrics) [FT_OPTIMIZE_MEMORY]: hdmx is not actually
used.
This commit is contained in:
Wu, Chia-I (吳佳一) 2006-02-22 07:59:35 +00:00
parent 0b5dc4df88
commit facd9af542
5 changed files with 75 additions and 28 deletions

View File

@ -1,3 +1,18 @@
2006-02-22 Chia-I Wu <b90201047@ntu.edu.tw>
* modules.cfg: Compile in ftotval.c and ftxf86.c by default for ABI
compatibility.
* src/sfnt/sfobjs.c (sfnt_done_face): Fix a memory leak.
* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_byte_aligned) [FT_OPTIMIZE_MEMORY]: Fix sbit
loading. (only tested with bit aligned sbit with x_pos == 0)
* src/truetype/ttpload.c (tt_face_load_hdmx,
tt_face_get_device_metrics) [FT_OPTIMIZE_MEMORY]: hdmx is not actually
used.
2006-02-21 David Turner <david@freetype.org>
* include/freetype/ftmodapi.h, include/internal/ftserv.h,

View File

@ -176,7 +176,7 @@ BASE_EXTENSIONS += ftmm.c
# Interface for otvalid module (which is required).
#
# See include/freetype/ftotval.h for the API.
# BASE_EXTENSIONS += ftotval.c
BASE_EXTENSIONS += ftotval.c
# Interface for accessing PFR-specific data. Needs PFR font driver.
#
@ -209,7 +209,7 @@ BASE_EXTENSIONS += ftwinfnt.c
# server.
#
# See include/freetype/ftxf86.h for the API.
# BASE_EXTENSIONS += ftxf86.c
BASE_EXTENSIONS += ftxf86.c
####

View File

@ -1022,7 +1022,7 @@
}
/* freeing the horizontal metrics */
#ifdef FT_OPTIMIZE_MEMORY
#if defined FT_OPTIMIZE_MEMORY && !defined FT_CONFIG_OPTION_OLD_INTERNALS
{
FT_Stream stream = FT_FACE_STREAM( face );

View File

@ -489,9 +489,18 @@
}
if ( w > 0 )
wval = (FT_UInt)(wval | ( *p++ & ( 0xFF00U >> w ) ) );
wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) );
/* all bits read and there are ( x_pos + w ) bits to be written */
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
if ( x_pos + w > 8 )
{
write++;
wval <<= 8;
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
}
}
}
@ -509,9 +518,9 @@
{
FT_Error error = SFNT_Err_Ok;
FT_Byte* line;
FT_Int bit_height, bit_width, pitch, width, height, h;
FT_Int bit_height, bit_width, pitch, width, height, h, nbits;
FT_Bitmap* bitmap;
FT_UInt32 rval;
FT_UShort rval;
if ( !decoder->bitmap_allocated )
@ -538,7 +547,7 @@
goto Exit;
}
if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
if ( p + ( ( width * height + 7 ) >> 3 ) > limit )
{
error = SFNT_Err_Invalid_File_Format;
goto Exit;
@ -547,39 +556,61 @@
/* now do the blit */
line += y_pos * pitch + ( x_pos >> 3 );
x_pos &= 7;
rval = 0x10000UL;
/* the higher byte of `rval' is used as a buffer */
rval = 0;
nbits = 0;
for ( h = height; h > 0; h--, line += pitch )
{
FT_Byte* write = line;
FT_UInt32 wval = 0x100 << x_pos;
FT_Int w;
FT_Byte* write = line;
FT_Int w = width;
for ( w = width; w >= 8; w -= 8 )
if ( x_pos )
{
if ( rval & 0x10000UL )
rval = 0x100 | *p++;
w = ( width < 8 - x_pos ) ? width : 8 - x_pos;
wval |= rval & 0x80;
wval <<= 1;
rval <<= 1;
if ( wval & 0x10000UL )
if ( nbits < w )
{
write[0] = (FT_Byte)( write[0] | ( wval >> 8 ) );
write += 1;
wval = 0x100;
rval |= *p++;
nbits += 8 - w;
}
else
{
rval >>= 8;
nbits -= w;
}
*write++ |= ( ( rval >> nbits ) & 0xFF ) & ~( 0xFF << w );
rval <<= 8;
w = width - w;
}
if ( wval != 0x100 )
for ( ; w >= 8; w -= 8 )
{
while ( wval > 0x1FF )
wval >>= 1;
rval |= *p++;
*write++ |= ( rval >> nbits ) & 0xFF;
write[0] = (FT_Byte)( write[0] | wval );
rval <<= 8;
}
if ( w > 0 )
{
if ( nbits < w )
{
rval |= *p++;
*write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
nbits += 8 - w;
rval <<= 8;
}
else
{
*write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
nbits -= w;
}
}
}

View File

@ -582,6 +582,7 @@
face->hdmx_record_count = nn;
face->hdmx_table_size = table_size;
face->hdmx_record_size = record_size;
Exit:
return error;
@ -723,7 +724,7 @@
{
gindex += 2;
if ( gindex < record_size )
result = record + gindex;
result = record + nn * record_size + gindex;
break;
}