Formatting.
This commit is contained in:
parent
5d02b8a151
commit
ebf5585dd0
55
ChangeLog
55
ChangeLog
|
@ -1,25 +1,48 @@
|
||||||
2005-03-15 David Turner <david@freetype.org>
|
2005-03-15 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* src/bdf/bdflib.c: removing compiler warnings
|
* src/bdf/bdflib.c: Remove compiler warnings.
|
||||||
|
(hash_rehash, hash_init): Don't call FT_MEM_ZERO.
|
||||||
|
(_bdf_list_t): Add `memory' field.
|
||||||
|
(_bdf_list_init, _bdf_list_done, _bdf_list_ensure): New functions.
|
||||||
|
(_bdf_shift, _bdf_join): Rename to...
|
||||||
|
(_bdf_list_shift, _bdf_list_join): This.
|
||||||
|
(_bdf_split): Renamed to...
|
||||||
|
(_bdf_list_split): This. Use new functions.
|
||||||
|
(bdf_internal_readstream): Removed.
|
||||||
|
(NO_SKIP): New macro.
|
||||||
|
(_bdf_readstream): Rewritten.
|
||||||
|
(bdf_create_property, _bdf_add_comment): Improve allocation.
|
||||||
|
(_bdf_set_default_spacing, _bdf_parse_glyphs): Updated. Improve
|
||||||
|
allocation.
|
||||||
|
(_bdf_parse_properties, _bdf_parse_start): Updated.
|
||||||
|
(bdf_load_font): Updated to use new functions.
|
||||||
|
|
||||||
* docs/CHANGES: updating
|
* src/type1/t1parse.c (check_type1_format): New function.
|
||||||
|
(T1_New_Parser): Use it to check font header before allocating
|
||||||
* src/type1/t1parse.c (T1_New_Parser), src/type42/t42parse.c
|
anything on the heap.
|
||||||
(t42_parser_init): modifying functions to check the font header before
|
|
||||||
allocating anything on the heap.
|
|
||||||
|
|
||||||
* internal/freetype/ftmemory.h: introducing the new macros FT_ARRAY_MAX
|
* src/type42/t42parse.c (t42_parser_init): Modify functions to check
|
||||||
and FT_ARRAY_CHECK
|
the font header before allocating anything on the heap.
|
||||||
|
|
||||||
* src/pcf/pcfread.c, src/pcf/pcfutil.c: minor fixes and simplifications.
|
|
||||||
try to protect the PCF driver from doing stupid things with broken fonts.
|
|
||||||
|
|
||||||
* src/lzw/ftlzw.c (FT_Stream_OpenLZW): modified the function to check
|
* include/freetype/internal/ftmemory.h (FT_ARRAY_MAX,
|
||||||
the LZW header before doing anything else. This helps avoid un-necessary
|
FT_ARRAY_CHECK): New macros.
|
||||||
heap allocations (400 Kb of heap memory for the LZW decoder ! Oh my !)
|
|
||||||
|
|
||||||
* src/gzip/ftgzip.c (FT_Stream_OpenGZip): ditto for the .gz decoder,
|
* src/base/ftstream.c (FT_Stream_TryRead): New function.
|
||||||
though the code savings is smaller.
|
* include/freetype/internal/ftstream.h: Updated.
|
||||||
|
|
||||||
|
* src/pcf/pcfread.c (pcf_read_TOC), src/pcf/pcfutil.c
|
||||||
|
(BitOrderInvert, TwoByteSwap, FourByteSwap): Minor fixes and
|
||||||
|
simplifications. Try to protect the PCF driver from doing stupid
|
||||||
|
things with broken fonts.
|
||||||
|
|
||||||
|
* src/lzw/ftlzw.c (FT_Stream_OpenLZW): Check the LZW header before
|
||||||
|
doing anything else. This avoids unnecessary heap allocations
|
||||||
|
(400KByte of heap memory for the LZW decoder).
|
||||||
|
|
||||||
|
* src/gzip/ftgzip.c (FT_Stream_OpenGZip): Ditto for the gzip
|
||||||
|
decoder, although the code savings are smaller.
|
||||||
|
|
||||||
|
* docs/CHANGES: Updated.
|
||||||
|
|
||||||
2005-03-10 David Turner <david@freetype.org>
|
2005-03-10 David Turner <david@freetype.org>
|
||||||
|
|
||||||
|
|
32
docs/CHANGES
32
docs/CHANGES
|
@ -19,28 +19,28 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9
|
||||||
|
|
||||||
- FreeType didn't properly parse empty Type 1 glyphs.
|
- FreeType didn't properly parse empty Type 1 glyphs.
|
||||||
|
|
||||||
- An unbounded dynamic buffer growth was fixed in the PFR loader
|
- An unbound dynamic buffer growth was fixed in the PFR loader.
|
||||||
|
|
||||||
- Several bugs were fixed in the cache sub-system.
|
- Several bugs have been fixed in the cache sub-system.
|
||||||
|
|
||||||
- Fixed bug #12263: incorrect behaviour when resizing to distinct but
|
- FreeType behaved incorrectly when resizing two distinct but very
|
||||||
very close character pixel sizes through FT_Set_Char_Size
|
close character pixel sizes through `FT_Set_Char_Size' (Savannah
|
||||||
|
bug #12263).
|
||||||
|
|
||||||
- The auto-hinter didn't work when a font didn't have a Unicode charmap.
|
- The auto-hinter didn't work properly for fonts without a Unicode
|
||||||
it even refused to load the glyphs !
|
charmap -- it even refused to load the glyphs.
|
||||||
|
|
||||||
|
|
||||||
II. IMPORTANT CHANGES
|
II. IMPORTANT CHANGES
|
||||||
|
|
||||||
- a LOT of work has been done in order to drastically reduce the
|
- Many fixes have been applied to drastically reduce the amount of
|
||||||
amount of heap memory used by FreeType, especially when using
|
heap memory used by FreeType, especially when using
|
||||||
memory-mapped font files (which is the default on Unix systems
|
memory-mapped font files (which is the default on Unix systems
|
||||||
which support them). This should be good news for any Unix distribution
|
which support them).
|
||||||
upgrading to this release of the font engine.
|
|
||||||
|
|
||||||
- The auto-hinter has been completely rewritten as a new module,
|
- The auto-hinter has been completely rewritten as a new module,
|
||||||
called the 'auto-fitter'. The latter is the new default auto-hinting
|
called the `auto-fitter', which is now the default auto-hinting
|
||||||
module. It also consumes a lot less memory than its predecessor.
|
module. It consumes a lot less memory than its predecessor.
|
||||||
|
|
||||||
- George Williams contributed code to read kerning data from PFM
|
- George Williams contributed code to read kerning data from PFM
|
||||||
files.
|
files.
|
||||||
|
@ -63,6 +63,7 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9
|
||||||
an FT_Bitmap structure in 1bpp, 2bpp, 4bpp, or 8bpp format into
|
an FT_Bitmap structure in 1bpp, 2bpp, 4bpp, or 8bpp format into
|
||||||
another 8bpp FT_Bitmap, probably using a different pitch.
|
another 8bpp FT_Bitmap, probably using a different pitch.
|
||||||
|
|
||||||
|
|
||||||
III. MISCELLANEOUS
|
III. MISCELLANEOUS
|
||||||
|
|
||||||
- The BDF driver no longer converts all returned bitmaps with a
|
- The BDF driver no longer converts all returned bitmaps with a
|
||||||
|
@ -87,6 +88,9 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9
|
||||||
the array in a novel compressed way that saves about 20 Kb of code
|
the array in a novel compressed way that saves about 20 Kb of code
|
||||||
as well.
|
as well.
|
||||||
|
|
||||||
|
|
||||||
|
======================================================================
|
||||||
|
|
||||||
LATEST CHANGES BETWEEN 2.1.9 and 2.1.8
|
LATEST CHANGES BETWEEN 2.1.9 and 2.1.8
|
||||||
|
|
||||||
I. IMPORTANT BUG FIXES
|
I. IMPORTANT BUG FIXES
|
||||||
|
|
|
@ -270,13 +270,16 @@ FT_BEGIN_HEADER
|
||||||
#define FT_ARRAY_MOVE( dest, source, count ) \
|
#define FT_ARRAY_MOVE( dest, source, count ) \
|
||||||
FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )
|
FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )
|
||||||
|
|
||||||
/* return the maximum number of adressable elements in an array
|
|
||||||
* we limit ourselves to INT_MAX, rather than UINT_MAX, to avoid
|
|
||||||
* any problems
|
|
||||||
*/
|
|
||||||
#define FT_ARRAY_MAX( ptr ) (FT_INT_MAX/sizeof( *(ptr) ))
|
|
||||||
|
|
||||||
#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX(ptr) )
|
/*
|
||||||
|
* Return the maximum number of adressable elements in an array.
|
||||||
|
* We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid
|
||||||
|
* any problems.
|
||||||
|
*/
|
||||||
|
#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) )
|
||||||
|
|
||||||
|
#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) )
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Stream handling (specification). */
|
/* Stream handling (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2004 by */
|
/* Copyright 1996-2001, 2002, 2004, 2005 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, */
|
||||||
|
@ -385,9 +385,8 @@ FT_BEGIN_HEADER
|
||||||
FT_Byte* buffer,
|
FT_Byte* buffer,
|
||||||
FT_ULong count );
|
FT_ULong count );
|
||||||
|
|
||||||
/* try to read bytes at the end of a stream, return
|
/* try to read bytes at the end of a stream; return number of bytes */
|
||||||
* the number of bytes really available
|
/* really available */
|
||||||
*/
|
|
||||||
FT_BASE( FT_ULong )
|
FT_BASE( FT_ULong )
|
||||||
FT_Stream_TryRead( FT_Stream stream,
|
FT_Stream_TryRead( FT_Stream stream,
|
||||||
FT_Byte* buffer,
|
FT_Byte* buffer,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* I/O stream support (body). */
|
/* I/O stream support (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2000-2001, 2002, 2004 by */
|
/* Copyright 2000-2001, 2002, 2004, 2005 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, */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2000 Computing Research Labs, New Mexico State University
|
* Copyright 2000 Computing Research Labs, New Mexico State University
|
||||||
* Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
|
* Copyright 2001, 2002, 2003, 2004, 2005 Francesco Zappa Nardelli
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -392,19 +392,21 @@
|
||||||
_bdf_list_init( _bdf_list_t* list,
|
_bdf_list_init( _bdf_list_t* list,
|
||||||
FT_Memory memory )
|
FT_Memory memory )
|
||||||
{
|
{
|
||||||
FT_ZERO(list);
|
FT_ZERO( list );
|
||||||
list->memory = memory;
|
list->memory = memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bdf_list_done( _bdf_list_t* list )
|
_bdf_list_done( _bdf_list_t* list )
|
||||||
{
|
{
|
||||||
FT_Memory memory = list->memory;
|
FT_Memory memory = list->memory;
|
||||||
|
|
||||||
|
|
||||||
if ( memory )
|
if ( memory )
|
||||||
{
|
{
|
||||||
FT_FREE( list->field );
|
FT_FREE( list->field );
|
||||||
FT_ZERO(list);
|
FT_ZERO( list );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,18 +415,20 @@
|
||||||
_bdf_list_ensure( _bdf_list_t* list,
|
_bdf_list_ensure( _bdf_list_t* list,
|
||||||
int num_items )
|
int num_items )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = BDF_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
if ( num_items > (int)list->size )
|
if ( num_items > (int)list->size )
|
||||||
{
|
{
|
||||||
int oldsize = list->size;
|
int oldsize = list->size;
|
||||||
int newsize = oldsize + (oldsize >> 1) + 4;
|
int newsize = oldsize + ( oldsize >> 1 ) + 4;
|
||||||
int bigsize = FT_INT_MAX / sizeof(char*);
|
int bigsize = FT_INT_MAX / sizeof ( char* );
|
||||||
FT_Memory memory = list->memory;
|
FT_Memory memory = list->memory;
|
||||||
|
|
||||||
|
|
||||||
if ( oldsize == bigsize )
|
if ( oldsize == bigsize )
|
||||||
{
|
{
|
||||||
error = FT_Err_Out_Of_Memory;
|
error = BDF_Err_Out_Of_Memory;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
else if ( newsize < oldsize || newsize > bigsize )
|
else if ( newsize < oldsize || newsize > bigsize )
|
||||||
|
@ -435,6 +439,7 @@
|
||||||
|
|
||||||
list->size = newsize;
|
list->size = newsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -493,13 +498,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* An empty string for empty fields. */
|
/* An empty string for empty fields. */
|
||||||
|
|
||||||
static const char empty[1] = { 0 }; /* XXX eliminate this */
|
static const char empty[1] = { 0 }; /* XXX eliminate this */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
_bdf_list_split( _bdf_list_t* list,
|
_bdf_list_split( _bdf_list_t* list,
|
||||||
char* separators,
|
char* separators,
|
||||||
|
@ -553,7 +556,7 @@
|
||||||
/* Resize the list if necessary. */
|
/* Resize the list if necessary. */
|
||||||
if ( list->used == list->size )
|
if ( list->used == list->size )
|
||||||
{
|
{
|
||||||
error = _bdf_list_ensure( list, list->used+1 );
|
error = _bdf_list_ensure( list, list->used + 1 );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
@ -582,7 +585,7 @@
|
||||||
/* Finally, NULL-terminate the list. */
|
/* Finally, NULL-terminate the list. */
|
||||||
if ( list->used + final_empty >= list->size )
|
if ( list->used + final_empty >= list->size )
|
||||||
{
|
{
|
||||||
error = _bdf_list_ensure( list, list->used+final_empty+1 );
|
error = _bdf_list_ensure( list, list->used + final_empty + 1 );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
@ -597,9 +600,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NO_SKIP 256 /* this value cannot be stored in a 'char' */
|
#define NO_SKIP 256 /* this value cannot be stored in a 'char' */
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
_bdf_readstream( FT_Stream stream,
|
_bdf_readstream( FT_Stream stream,
|
||||||
_bdf_line_func_t callback,
|
_bdf_line_func_t callback,
|
||||||
|
@ -621,29 +624,28 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initial size and allocation of the input buffer
|
/* initial size and allocation of the input buffer */
|
||||||
*/
|
|
||||||
buf_size = 1024;
|
buf_size = 1024;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( buf, buf_size ) )
|
if ( FT_NEW_ARRAY( buf, buf_size ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
cb = callback;
|
cb = callback;
|
||||||
lineno = 1;
|
lineno = 1;
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
start = 0;
|
start = 0;
|
||||||
end = 0;
|
end = 0;
|
||||||
avail = 0;
|
avail = 0;
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
refill = 1;
|
refill = 1;
|
||||||
to_skip = NO_SKIP;
|
to_skip = NO_SKIP;
|
||||||
bytes = 0; /* make compiler happy */
|
bytes = 0; /* make compiler happy */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if ( refill )
|
if ( refill )
|
||||||
{
|
{
|
||||||
bytes = (int) FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
|
bytes = (int)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
|
||||||
(FT_ULong)(buf_size - cursor) );
|
(FT_ULong)(buf_size - cursor) );
|
||||||
avail = cursor + bytes;
|
avail = cursor + bytes;
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
|
@ -652,7 +654,7 @@
|
||||||
|
|
||||||
end = start;
|
end = start;
|
||||||
|
|
||||||
/* should we skip an optional character like \n or \r ? */
|
/* should we skip an optional character like \n or \r? */
|
||||||
if ( start < avail && buf[start] == to_skip )
|
if ( start < avail && buf[start] == to_skip )
|
||||||
{
|
{
|
||||||
start += 1;
|
start += 1;
|
||||||
|
@ -664,9 +666,8 @@
|
||||||
while ( end < avail && buf[end] != '\n' && buf[end] != '\r' )
|
while ( end < avail && buf[end] != '\n' && buf[end] != '\r' )
|
||||||
end++;
|
end++;
|
||||||
|
|
||||||
/* if we hit the end of the buffer, try shifting its content
|
/* if we hit the end of the buffer, try shifting its content */
|
||||||
* or even resizing it
|
/* or even resizing it */
|
||||||
*/
|
|
||||||
if ( end >= avail )
|
if ( end >= avail )
|
||||||
{
|
{
|
||||||
if ( bytes == 0 ) /* last line in file doesn't end in \r or \n */
|
if ( bytes == 0 ) /* last line in file doesn't end in \r or \n */
|
||||||
|
@ -674,18 +675,18 @@
|
||||||
|
|
||||||
if ( start == 0 )
|
if ( start == 0 )
|
||||||
{
|
{
|
||||||
/* this line is definitely too long, try resizing the input buffer
|
/* this line is definitely too long; try resizing the input */
|
||||||
* a bit to handle it.
|
/* buffer a bit to handle it. */
|
||||||
*/
|
|
||||||
FT_ULong new_size;
|
FT_ULong new_size;
|
||||||
|
|
||||||
if ( buf_size >= 65536UL ) /* limit ourselves to 64 Kb */
|
|
||||||
|
if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */
|
||||||
{
|
{
|
||||||
error = BDF_Err_Invalid_Argument;
|
error = BDF_Err_Invalid_Argument;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_size = buf_size*2;
|
new_size = buf_size * 2;
|
||||||
if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )
|
if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
@ -696,7 +697,7 @@
|
||||||
{
|
{
|
||||||
bytes = avail - start;
|
bytes = avail - start;
|
||||||
|
|
||||||
FT_MEM_COPY( buf, buf+start, bytes );
|
FT_MEM_COPY( buf, buf + start, bytes );
|
||||||
|
|
||||||
cursor = bytes;
|
cursor = bytes;
|
||||||
avail -= bytes;
|
avail -= bytes;
|
||||||
|
@ -713,14 +714,15 @@
|
||||||
/* XXX: Use encoding independent value for 0x1a */
|
/* XXX: Use encoding independent value for 0x1a */
|
||||||
if ( buf[start] != '#' && buf[start] != 0x1a && end > start )
|
if ( buf[start] != '#' && buf[start] != 0x1a && end > start )
|
||||||
{
|
{
|
||||||
error = (*cb)( buf+start, end-start, lineno, (void*)&cb, client_data );
|
error = (*cb)( buf + start, end - start, lineno,
|
||||||
|
(void*)&cb, client_data );
|
||||||
if ( error )
|
if ( error )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineno += 1;
|
lineno += 1;
|
||||||
buf[end] = (char)hold;
|
buf[end] = (char)hold;
|
||||||
start = end+1;
|
start = end + 1;
|
||||||
|
|
||||||
if ( hold == '\n' )
|
if ( hold == '\n' )
|
||||||
to_skip = '\r';
|
to_skip = '\r';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/* parse compressed PCF fonts, as found with many X11 server */
|
/* parse compressed PCF fonts, as found with many X11 server */
|
||||||
/* distributions. */
|
/* distributions. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2002, 2003, 2004 by */
|
/* Copyright 2002, 2003, 2004, 2005 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, */
|
||||||
|
@ -561,9 +561,11 @@
|
||||||
FT_Memory memory = source->memory;
|
FT_Memory memory = source->memory;
|
||||||
FT_GZipFile zip;
|
FT_GZipFile zip;
|
||||||
|
|
||||||
/* check the header right now, this prevents allocating un-necessary
|
|
||||||
* objects when we don't need them
|
/*
|
||||||
*/
|
* check the header right now; this prevents allocating un-necessary
|
||||||
|
* objects when we don't need them
|
||||||
|
*/
|
||||||
error = ft_gzip_check_header( source );
|
error = ft_gzip_check_header( source );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/* be used to parse compressed PCF fonts, as found with many X11 server */
|
/* be used to parse compressed PCF fonts, as found with many X11 server */
|
||||||
/* distributions. */
|
/* distributions. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2004 by */
|
/* Copyright 2004, 2005 by */
|
||||||
/* Albert Chin-A-Young. */
|
/* Albert Chin-A-Young. */
|
||||||
/* */
|
/* */
|
||||||
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
|
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
|
||||||
|
@ -414,13 +414,14 @@
|
||||||
FT_Memory memory = source->memory;
|
FT_Memory memory = source->memory;
|
||||||
FT_LZWFile zip;
|
FT_LZWFile zip;
|
||||||
|
|
||||||
/* check the header right now, this will prevent us from
|
|
||||||
* allocating a huge LZWFile object (400 Kb of heap memory !!)
|
/*
|
||||||
* when not necessary.
|
* Check the header right now; this prevents allocation a huge
|
||||||
*
|
* LZWFile object (400 KByte of heap memory) if not necessary.
|
||||||
* Did I mention that you should never use .Z compressed font
|
*
|
||||||
* file ?
|
* Did I mention that you should never use .Z compressed font
|
||||||
*/
|
* file?
|
||||||
|
*/
|
||||||
error = ft_lzw_check_header( source );
|
error = ft_lzw_check_header( source );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
FreeType font driver for pcf fonts
|
FreeType font driver for pcf fonts
|
||||||
|
|
||||||
Copyright 2000, 2001, 2002, 2003, 2004 by
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005 by
|
||||||
Francesco Zappa Nardelli
|
Francesco Zappa Nardelli
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -44,9 +44,10 @@ in this Software without prior written authorization from The Open Group.
|
||||||
{
|
{
|
||||||
unsigned int val = *buf;
|
unsigned int val = *buf;
|
||||||
|
|
||||||
val = ((val >> 1) & 0x55) | ((val << 1) & 0xAA);
|
|
||||||
val = ((val >> 2) & 0x33) | ((val << 2) & 0xCC);
|
val = ( ( val >> 1 ) & 0x55 ) | ( ( val << 1 ) & 0xAA );
|
||||||
val = ((val >> 4) & 0x0F) | ((val << 4) & 0xF0);
|
val = ( ( val >> 2 ) & 0x33 ) | ( ( val << 2 ) & 0xCC );
|
||||||
|
val = ( ( val >> 4 ) & 0x0F ) | ( ( val << 4 ) & 0xF0 );
|
||||||
|
|
||||||
*buf = (unsigned char)val;
|
*buf = (unsigned char)val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
FT_UShort tag;
|
FT_UShort tag;
|
||||||
FT_Long size;
|
FT_Long size;
|
||||||
|
|
||||||
|
|
||||||
if ( FT_STREAM_SEEK( 0 ) )
|
if ( FT_STREAM_SEEK( 0 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@
|
||||||
parser->in_memory = 0;
|
parser->in_memory = 0;
|
||||||
parser->single_block = 0;
|
parser->single_block = 0;
|
||||||
|
|
||||||
/* check the header format */
|
/* check the header format */
|
||||||
error = check_type1_format( stream, "%!PS-AdobeFont-1", 16 );
|
error = check_type1_format( stream, "%!PS-AdobeFont-1", 16 );
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
|
@ -216,8 +217,8 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* read segment in memory - yeah that sucks, but so does the format */
|
/* read segment in memory - this is clumsy, but so does the format */
|
||||||
if ( FT_ALLOC( parser->base_dict, size ) ||
|
if ( FT_ALLOC( parser->base_dict, size ) ||
|
||||||
FT_STREAM_READ( parser->base_dict, size ) )
|
FT_STREAM_READ( parser->base_dict, size ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
parser->base_len = size;
|
parser->base_len = size;
|
||||||
|
|
Loading…
Reference in New Issue