merged freetype 2.4.3
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39524 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3808,7 +3808,7 @@ FT_BEGIN_HEADER
|
|||||||
*/
|
*/
|
||||||
#define FREETYPE_MAJOR 2
|
#define FREETYPE_MAJOR 2
|
||||||
#define FREETYPE_MINOR 4
|
#define FREETYPE_MINOR 4
|
||||||
#define FREETYPE_PATCH 2
|
#define FREETYPE_PATCH 3
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|||||||
@@ -56,9 +56,12 @@ FT_BEGIN_HEADER
|
|||||||
* interpret them in any way.
|
* interpret them in any way.
|
||||||
*
|
*
|
||||||
* Second, the cache calls, only when needed, a client-provided function
|
* Second, the cache calls, only when needed, a client-provided function
|
||||||
* to convert a @FTC_FaceID into a new @FT_Face object. The latter is
|
* to convert an @FTC_FaceID into a new @FT_Face object. The latter is
|
||||||
* then completely managed by the cache, including its termination
|
* then completely managed by the cache, including its termination
|
||||||
* through @FT_Done_Face.
|
* through @FT_Done_Face. To monitor termination of face objects, the
|
||||||
|
* finalizer callback in the `generic' field of the @FT_Face object can
|
||||||
|
* be used, which might also be used to store the @FTC_FaceID of the
|
||||||
|
* face.
|
||||||
*
|
*
|
||||||
* Clients are free to map face IDs to anything else. The most simple
|
* Clients are free to map face IDs to anything else. The most simple
|
||||||
* usage is to associate them to a (pathname,face_index) pair that is
|
* usage is to associate them to a (pathname,face_index) pair that is
|
||||||
|
|||||||
@@ -268,9 +268,21 @@ FT_BEGIN_HEADER
|
|||||||
/* flow. In all cases, the pitch is an offset to add */
|
/* flow. In all cases, the pitch is an offset to add */
|
||||||
/* to a bitmap pointer in order to go down one row. */
|
/* to a bitmap pointer in order to go down one row. */
|
||||||
/* */
|
/* */
|
||||||
|
/* Note that `padding' means the alignment of a */
|
||||||
|
/* bitmap to a byte border, and FreeType functions */
|
||||||
|
/* normally align to the smallest possible integer */
|
||||||
|
/* value. */
|
||||||
|
/* */
|
||||||
/* For the B/W rasterizer, `pitch' is always an even */
|
/* For the B/W rasterizer, `pitch' is always an even */
|
||||||
/* number. */
|
/* number. */
|
||||||
/* */
|
/* */
|
||||||
|
/* To change the pitch of a bitmap (say, to make it a */
|
||||||
|
/* multiple of 4), use @FT_Bitmap_Convert. */
|
||||||
|
/* Alternatively, you might use callback functions to */
|
||||||
|
/* directly render to the application's surface; see */
|
||||||
|
/* the file `example2.cpp' in the tutorial for a */
|
||||||
|
/* demonstration. */
|
||||||
|
/* */
|
||||||
/* buffer :: A typeless pointer to the bitmap buffer. This */
|
/* buffer :: A typeless pointer to the bitmap buffer. This */
|
||||||
/* value should be aligned on 32-bit boundaries in */
|
/* value should be aligned on 32-bit boundaries in */
|
||||||
/* most cases. */
|
/* most cases. */
|
||||||
|
|||||||
@@ -1534,21 +1534,18 @@
|
|||||||
|
|
||||||
|
|
||||||
/* compare to standard width */
|
/* compare to standard width */
|
||||||
if ( axis->width_count > 0 )
|
delta = dist - axis->widths[0].cur;
|
||||||
|
|
||||||
|
if ( delta < 0 )
|
||||||
|
delta = -delta;
|
||||||
|
|
||||||
|
if ( delta < 40 )
|
||||||
{
|
{
|
||||||
delta = dist - axis->widths[0].cur;
|
dist = axis->widths[0].cur;
|
||||||
|
if ( dist < 48 )
|
||||||
|
dist = 48;
|
||||||
|
|
||||||
if ( delta < 0 )
|
goto Done_Width;
|
||||||
delta = -delta;
|
|
||||||
|
|
||||||
if ( delta < 40 )
|
|
||||||
{
|
|
||||||
dist = axis->widths[0].cur;
|
|
||||||
if ( dist < 48 )
|
|
||||||
dist = 48;
|
|
||||||
|
|
||||||
goto Done_Width;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dist < 3 * 64 )
|
if ( dist < 3 * 64 )
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
|
|
||||||
if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
|
if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
|
||||||
slot->format != FT_GLYPH_FORMAT_BITMAP )
|
slot->format != FT_GLYPH_FORMAT_BITMAP )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* some reasonable strength */
|
/* some reasonable strength */
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
xstr = xstr * 2;
|
xstr = xstr * 2;
|
||||||
ystr = xstr;
|
ystr = xstr;
|
||||||
}
|
}
|
||||||
else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
|
else /* slot->format == FT_GLYPH_FORMAT_BITMAP */
|
||||||
{
|
{
|
||||||
/* round to full pixels */
|
/* round to full pixels */
|
||||||
xstr &= ~63;
|
xstr &= ~63;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -346,7 +346,7 @@
|
|||||||
static void
|
static void
|
||||||
FTC_Cache_Clear( FTC_Cache cache )
|
FTC_Cache_Clear( FTC_Cache cache )
|
||||||
{
|
{
|
||||||
if ( cache )
|
if ( cache && cache->buckets )
|
||||||
{
|
{
|
||||||
FTC_Manager manager = cache->manager;
|
FTC_Manager manager = cache->manager;
|
||||||
FT_UFast i;
|
FT_UFast i;
|
||||||
|
|||||||
Vendored
+4
@@ -160,7 +160,11 @@
|
|||||||
!CHECK_CHAR( slot->bitmap_top ) ||
|
!CHECK_CHAR( slot->bitmap_top ) ||
|
||||||
!CHECK_CHAR( xadvance ) ||
|
!CHECK_CHAR( xadvance ) ||
|
||||||
!CHECK_CHAR( yadvance ) )
|
!CHECK_CHAR( yadvance ) )
|
||||||
|
{
|
||||||
|
FT_TRACE2(( "ftc_snode_load:"
|
||||||
|
" glyph too large for small bitmap cache\n"));
|
||||||
goto BadGlyph;
|
goto BadGlyph;
|
||||||
|
}
|
||||||
|
|
||||||
sbit->width = (FT_Byte)bitmap->width;
|
sbit->width = (FT_Byte)bitmap->width;
|
||||||
sbit->height = (FT_Byte)bitmap->rows;
|
sbit->height = (FT_Byte)bitmap->rows;
|
||||||
|
|||||||
@@ -519,6 +519,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX: should check off2 does not exceed the end of this entry; */
|
||||||
|
/* at present, only truncate off2 at the end of this stream */
|
||||||
|
if ( off2 > stream->size + 1 ||
|
||||||
|
idx->data_offset > stream->size - off2 + 1 )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "cff_index_access_element:"
|
||||||
|
" offset to next entry (%d)"
|
||||||
|
" exceeds the end of stream (%d)\n",
|
||||||
|
off2, stream->size - idx->data_offset + 1 ));
|
||||||
|
off2 = stream->size - idx->data_offset + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* access element */
|
/* access element */
|
||||||
if ( off1 && off2 > off1 )
|
if ( off1 && off2 > off1 )
|
||||||
{
|
{
|
||||||
@@ -779,11 +791,12 @@
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
for ( i = 0; i < num_glyphs; i++ )
|
for ( i = 0; i < num_glyphs; i++ )
|
||||||
|
{
|
||||||
if ( charset->sids[i] > max_cid )
|
if ( charset->sids[i] > max_cid )
|
||||||
max_cid = charset->sids[i];
|
max_cid = charset->sids[i];
|
||||||
max_cid++;
|
}
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
|
if ( FT_NEW_ARRAY( charset->cids, (FT_ULong)max_cid + 1 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
/* When multiple GIDs map to the same CID, we choose the lowest */
|
/* When multiple GIDs map to the same CID, we choose the lowest */
|
||||||
@@ -807,7 +820,7 @@
|
|||||||
FT_UInt result = 0;
|
FT_UInt result = 0;
|
||||||
|
|
||||||
|
|
||||||
if ( cid < charset->max_cid )
|
if ( cid <= charset->max_cid )
|
||||||
result = charset->cids[cid];
|
result = charset->cids[cid];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -881,20 +894,7 @@
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
for ( j = 1; j < num_glyphs; j++ )
|
for ( j = 1; j < num_glyphs; j++ )
|
||||||
{
|
charset->sids[j] = FT_GET_USHORT();
|
||||||
FT_UShort sid = FT_GET_USHORT();
|
|
||||||
|
|
||||||
|
|
||||||
/* this constant is given in the CFF specification */
|
|
||||||
if ( sid < 65000L )
|
|
||||||
charset->sids[j] = sid;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FT_TRACE0(( "cff_charset_load:"
|
|
||||||
" invalid SID value %d set to zero\n", sid ));
|
|
||||||
charset->sids[j] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FT_FRAME_EXIT();
|
FT_FRAME_EXIT();
|
||||||
}
|
}
|
||||||
@@ -927,20 +927,12 @@
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check whether the range contains at least one valid glyph; */
|
|
||||||
/* the constant is given in the CFF specification */
|
|
||||||
if ( glyph_sid >= 65000L )
|
|
||||||
{
|
|
||||||
FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
|
|
||||||
error = CFF_Err_Invalid_File_Format;
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try to rescue some of the SIDs if `nleft' is too large */
|
/* try to rescue some of the SIDs if `nleft' is too large */
|
||||||
if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft )
|
if ( glyph_sid > 0xFFFFL - nleft )
|
||||||
{
|
{
|
||||||
FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
|
FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
|
||||||
nleft = ( FT_UInt )( 65000L - 1L - glyph_sid );
|
" nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
|
||||||
|
nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the range of sids -- `nleft + 1' glyphs. */
|
/* Fill in the range of sids -- `nleft + 1' glyphs. */
|
||||||
@@ -1277,9 +1269,7 @@
|
|||||||
if ( gid != 0 )
|
if ( gid != 0 )
|
||||||
{
|
{
|
||||||
encoding->codes[j] = (FT_UShort)gid;
|
encoding->codes[j] = (FT_UShort)gid;
|
||||||
|
encoding->count = j + 1;
|
||||||
if ( encoding->count < j + 1 )
|
|
||||||
encoding->count = j + 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -677,7 +677,7 @@
|
|||||||
|
|
||||||
/* compute number of glyphs */
|
/* compute number of glyphs */
|
||||||
if ( dict->cid_registry != 0xFFFFU )
|
if ( dict->cid_registry != 0xFFFFU )
|
||||||
cffface->num_glyphs = cff->charset.max_cid;
|
cffface->num_glyphs = cff->charset.max_cid + 1;
|
||||||
else
|
else
|
||||||
cffface->num_glyphs = cff->charstrings_index.count;
|
cffface->num_glyphs = cff->charstrings_index.count;
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,6 @@
|
|||||||
FT_Int32 load_flags )
|
FT_Int32 load_flags )
|
||||||
{
|
{
|
||||||
CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
|
CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
|
||||||
CID_Size size = (CID_Size)cidsize;
|
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
CID_Face face = (CID_Face)cidglyph->face;
|
CID_Face face = (CID_Face)cidglyph->face;
|
||||||
@@ -375,7 +374,7 @@
|
|||||||
|
|
||||||
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||||
|
|
||||||
if ( size && cidsize->metrics.y_ppem < 24 )
|
if ( cidsize->metrics.y_ppem < 24 )
|
||||||
cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
|
cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
|
||||||
|
|
||||||
/* apply the font matrix */
|
/* apply the font matrix */
|
||||||
|
|||||||
@@ -1862,12 +1862,10 @@
|
|||||||
point->cur_u = hint->cur_pos + hint->cur_len +
|
point->cur_u = hint->cur_pos + hint->cur_len +
|
||||||
FT_MulFix( delta - hint->org_len, scale );
|
FT_MulFix( delta - hint->org_len, scale );
|
||||||
|
|
||||||
else if ( hint->org_len > 0 )
|
else /* hint->org_len > 0 */
|
||||||
point->cur_u = hint->cur_pos +
|
point->cur_u = hint->cur_pos +
|
||||||
FT_MulDiv( delta, hint->cur_len,
|
FT_MulDiv( delta, hint->cur_len,
|
||||||
hint->org_len );
|
hint->org_len );
|
||||||
else
|
|
||||||
point->cur_u = hint->cur_pos;
|
|
||||||
}
|
}
|
||||||
psh_point_set_fitted( point );
|
psh_point_set_fitted( point );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3385,6 +3385,7 @@
|
|||||||
FT_Raster *araster )
|
FT_Raster *araster )
|
||||||
{
|
{
|
||||||
static TRaster the_raster;
|
static TRaster the_raster;
|
||||||
|
FT_UNUSED( memory );
|
||||||
|
|
||||||
|
|
||||||
*araster = (FT_Raster)&the_raster;
|
*araster = (FT_Raster)&the_raster;
|
||||||
|
|||||||
@@ -680,9 +680,9 @@
|
|||||||
/* broken fonts like `Keystrokes MT' :-( */
|
/* broken fonts like `Keystrokes MT' :-( */
|
||||||
/* */
|
/* */
|
||||||
/* We allocate 64 function entries by default when */
|
/* We allocate 64 function entries by default when */
|
||||||
/* the maxFunctionDefs field is null. */
|
/* the maxFunctionDefs value is smaller. */
|
||||||
|
|
||||||
if ( maxProfile->maxFunctionDefs == 0 )
|
if ( maxProfile->maxFunctionDefs < 64 )
|
||||||
maxProfile->maxFunctionDefs = 64;
|
maxProfile->maxFunctionDefs = 64;
|
||||||
|
|
||||||
/* we add 4 phantom points later */
|
/* we add 4 phantom points later */
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Postcript name table processing for TrueType and OpenType fonts */
|
/* Postcript name table processing for TrueType and OpenType fonts */
|
||||||
/* (body). */
|
/* (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009 by */
|
/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010 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, */
|
||||||
@@ -153,7 +153,8 @@
|
|||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
load_format_20( TT_Face face,
|
load_format_20( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream,
|
||||||
|
FT_Long post_limit )
|
||||||
{
|
{
|
||||||
FT_Memory memory = stream->memory;
|
FT_Memory memory = stream->memory;
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
@@ -230,13 +231,46 @@
|
|||||||
FT_UInt len;
|
FT_UInt len;
|
||||||
|
|
||||||
|
|
||||||
if ( FT_READ_BYTE ( len ) ||
|
if ( FT_STREAM_POS() >= post_limit )
|
||||||
FT_NEW_ARRAY( name_strings[n], len + 1 ) ||
|
break;
|
||||||
FT_STREAM_READ ( name_strings[n], len ) )
|
else
|
||||||
|
{
|
||||||
|
FT_TRACE6(( "load_format_20: %d byte left in post table\n",
|
||||||
|
post_limit - FT_STREAM_POS() ));
|
||||||
|
|
||||||
|
if ( FT_READ_BYTE( len ) )
|
||||||
|
goto Fail1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (FT_Int)len > post_limit ||
|
||||||
|
FT_STREAM_POS() > post_limit - (FT_Int)len )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "load_format_20:"
|
||||||
|
" exceeding string length (%d),"
|
||||||
|
" truncating at end of post table (%d byte left)\n",
|
||||||
|
len, post_limit - FT_STREAM_POS() ));
|
||||||
|
len = FT_MAX( 0, post_limit - FT_STREAM_POS() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( FT_NEW_ARRAY( name_strings[n], len + 1 ) ||
|
||||||
|
FT_STREAM_READ( name_strings[n], len ) )
|
||||||
goto Fail1;
|
goto Fail1;
|
||||||
|
|
||||||
name_strings[n][len] = '\0';
|
name_strings[n][len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( n < num_names )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "load_format_20:"
|
||||||
|
" all entries in post table are already parsed,"
|
||||||
|
" using NULL names for gid %d - %d\n",
|
||||||
|
n, num_names - 1 ));
|
||||||
|
for ( ; n < num_names; n++ )
|
||||||
|
if ( FT_NEW_ARRAY( name_strings[n], 1 ) )
|
||||||
|
goto Fail1;
|
||||||
|
else
|
||||||
|
name_strings[n][0] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all right, set table fields and exit successfully */
|
/* all right, set table fields and exit successfully */
|
||||||
@@ -271,7 +305,8 @@
|
|||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
load_format_25( TT_Face face,
|
load_format_25( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream,
|
||||||
|
FT_Long post_limit )
|
||||||
{
|
{
|
||||||
FT_Memory memory = stream->memory;
|
FT_Memory memory = stream->memory;
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
@@ -279,6 +314,8 @@
|
|||||||
FT_Int num_glyphs;
|
FT_Int num_glyphs;
|
||||||
FT_Char* offset_table = 0;
|
FT_Char* offset_table = 0;
|
||||||
|
|
||||||
|
FT_UNUSED( post_limit );
|
||||||
|
|
||||||
|
|
||||||
/* UNDOCUMENTED! This value appears only in the Apple TT specs. */
|
/* UNDOCUMENTED! This value appears only in the Apple TT specs. */
|
||||||
if ( FT_READ_USHORT( num_glyphs ) )
|
if ( FT_READ_USHORT( num_glyphs ) )
|
||||||
@@ -338,16 +375,20 @@
|
|||||||
FT_Stream stream;
|
FT_Stream stream;
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_Fixed format;
|
FT_Fixed format;
|
||||||
|
FT_ULong post_len;
|
||||||
|
FT_Long post_limit;
|
||||||
|
|
||||||
|
|
||||||
/* get a stream for the face's resource */
|
/* get a stream for the face's resource */
|
||||||
stream = face->root.stream;
|
stream = face->root.stream;
|
||||||
|
|
||||||
/* seek to the beginning of the PS names table */
|
/* seek to the beginning of the PS names table */
|
||||||
error = face->goto_table( face, TTAG_post, stream, 0 );
|
error = face->goto_table( face, TTAG_post, stream, &post_len );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
post_limit = FT_STREAM_POS() + post_len;
|
||||||
|
|
||||||
format = face->postscript.FormatType;
|
format = face->postscript.FormatType;
|
||||||
|
|
||||||
/* go to beginning of subtable */
|
/* go to beginning of subtable */
|
||||||
@@ -356,9 +397,9 @@
|
|||||||
|
|
||||||
/* now read postscript table */
|
/* now read postscript table */
|
||||||
if ( format == 0x00020000L )
|
if ( format == 0x00020000L )
|
||||||
error = load_format_20( face, stream );
|
error = load_format_20( face, stream, post_limit );
|
||||||
else if ( format == 0x00028000L )
|
else if ( format == 0x00028000L )
|
||||||
error = load_format_25( face, stream );
|
error = load_format_25( face, stream, post_limit );
|
||||||
else
|
else
|
||||||
error = SFNT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
|
|
||||||
|
|||||||
+121
-146
@@ -91,6 +91,11 @@
|
|||||||
#define FT_COMPONENT trace_smooth
|
#define FT_COMPONENT trace_smooth
|
||||||
|
|
||||||
|
|
||||||
|
/* The maximum distance of a curve from the chord, in 64ths of a pixel; */
|
||||||
|
/* used when flattening curves. */
|
||||||
|
#define FT_MAX_CURVE_DEVIATION 16
|
||||||
|
|
||||||
|
|
||||||
#ifdef _STANDALONE_
|
#ifdef _STANDALONE_
|
||||||
|
|
||||||
|
|
||||||
@@ -187,7 +192,7 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
shift_, \
|
shift_, \
|
||||||
delta_ \
|
delta_ \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
|
#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, \
|
||||||
raster_new_, raster_reset_, \
|
raster_new_, raster_reset_, \
|
||||||
raster_set_mode_, raster_render_, \
|
raster_set_mode_, raster_render_, \
|
||||||
@@ -354,8 +359,6 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
|
|
||||||
int band_size;
|
int band_size;
|
||||||
int band_shoot;
|
int band_shoot;
|
||||||
int conic_level;
|
|
||||||
int cubic_level;
|
|
||||||
|
|
||||||
ft_jmp_buf jump_buffer;
|
ft_jmp_buf jump_buffer;
|
||||||
|
|
||||||
@@ -888,33 +891,20 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
if ( dx < dy )
|
if ( dx < dy )
|
||||||
dx = dy;
|
dx = dy;
|
||||||
|
|
||||||
|
if ( dx <= FT_MAX_CURVE_DEVIATION )
|
||||||
|
{
|
||||||
|
gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
level = 1;
|
level = 1;
|
||||||
dx = dx / ras.conic_level;
|
dx /= FT_MAX_CURVE_DEVIATION;
|
||||||
while ( dx > 0 )
|
while ( dx > 1 )
|
||||||
{
|
{
|
||||||
dx >>= 2;
|
dx >>= 2;
|
||||||
level++;
|
level++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a shortcut to speed things up */
|
|
||||||
if ( level <= 1 )
|
|
||||||
{
|
|
||||||
/* we compute the mid-point directly in order to avoid */
|
|
||||||
/* calling gray_split_conic() */
|
|
||||||
TPos to_x, to_y, mid_x, mid_y;
|
|
||||||
|
|
||||||
|
|
||||||
to_x = UPSCALE( to->x );
|
|
||||||
to_y = UPSCALE( to->y );
|
|
||||||
mid_x = ( ras.x + to_x + 2 * UPSCALE( control->x ) ) / 4;
|
|
||||||
mid_y = ( ras.y + to_y + 2 * UPSCALE( control->y ) ) / 4;
|
|
||||||
|
|
||||||
gray_render_line( RAS_VAR_ mid_x, mid_y );
|
|
||||||
gray_render_line( RAS_VAR_ to_x, to_y );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
arc = ras.bez_stack;
|
arc = ras.bez_stack;
|
||||||
levels = ras.lev_stack;
|
levels = ras.lev_stack;
|
||||||
top = 0;
|
top = 0;
|
||||||
@@ -957,21 +947,9 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
}
|
}
|
||||||
|
|
||||||
Draw:
|
Draw:
|
||||||
{
|
gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
|
||||||
TPos to_x, to_y, mid_x, mid_y;
|
top--;
|
||||||
|
arc -= 2;
|
||||||
|
|
||||||
to_x = arc[0].x;
|
|
||||||
to_y = arc[0].y;
|
|
||||||
mid_x = ( ras.x + to_x + 2 * arc[1].x ) / 4;
|
|
||||||
mid_y = ( ras.y + to_y + 2 * arc[1].y ) / 4;
|
|
||||||
|
|
||||||
gray_render_line( RAS_VAR_ mid_x, mid_y );
|
|
||||||
gray_render_line( RAS_VAR_ to_x, to_y );
|
|
||||||
|
|
||||||
top--;
|
|
||||||
arc -= 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1011,56 +989,9 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
const FT_Vector* control2,
|
const FT_Vector* control2,
|
||||||
const FT_Vector* to )
|
const FT_Vector* to )
|
||||||
{
|
{
|
||||||
int top, level;
|
|
||||||
int* levels;
|
|
||||||
FT_Vector* arc;
|
FT_Vector* arc;
|
||||||
int mid_x = ( DOWNSCALE( ras.x ) + to->x +
|
|
||||||
3 * (control1->x + control2->x ) ) / 8;
|
|
||||||
int mid_y = ( DOWNSCALE( ras.y ) + to->y +
|
|
||||||
3 * (control1->y + control2->y ) ) / 8;
|
|
||||||
TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 );
|
|
||||||
TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 );
|
|
||||||
|
|
||||||
|
|
||||||
if ( dx < 0 )
|
|
||||||
dx = -dx;
|
|
||||||
if ( dy < 0 )
|
|
||||||
dy = -dy;
|
|
||||||
if ( dx < dy )
|
|
||||||
dx = dy;
|
|
||||||
|
|
||||||
level = 1;
|
|
||||||
dx /= ras.cubic_level;
|
|
||||||
while ( dx > 0 )
|
|
||||||
{
|
|
||||||
dx >>= 2;
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( level <= 1 )
|
|
||||||
{
|
|
||||||
TPos to_x, to_y;
|
|
||||||
|
|
||||||
|
|
||||||
to_x = UPSCALE( to->x );
|
|
||||||
to_y = UPSCALE( to->y );
|
|
||||||
|
|
||||||
/* Recalculation of midpoint is needed only if */
|
|
||||||
/* UPSCALE and DOWNSCALE have any effect. */
|
|
||||||
|
|
||||||
#if ( PIXEL_BITS != 6 )
|
|
||||||
mid_x = ( ras.x + to_x +
|
|
||||||
3 * UPSCALE( control1->x + control2->x ) ) / 8;
|
|
||||||
mid_y = ( ras.y + to_y +
|
|
||||||
3 * UPSCALE( control1->y + control2->y ) ) / 8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gray_render_line( RAS_VAR_ mid_x, mid_y );
|
|
||||||
gray_render_line( RAS_VAR_ to_x, to_y );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
arc = ras.bez_stack;
|
arc = ras.bez_stack;
|
||||||
arc[0].x = UPSCALE( to->x );
|
arc[0].x = UPSCALE( to->x );
|
||||||
arc[0].y = UPSCALE( to->y );
|
arc[0].y = UPSCALE( to->y );
|
||||||
@@ -1071,60 +1002,123 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
arc[3].x = ras.x;
|
arc[3].x = ras.x;
|
||||||
arc[3].y = ras.y;
|
arc[3].y = ras.y;
|
||||||
|
|
||||||
levels = ras.lev_stack;
|
for (;;)
|
||||||
top = 0;
|
|
||||||
levels[0] = level;
|
|
||||||
|
|
||||||
while ( top >= 0 )
|
|
||||||
{
|
{
|
||||||
level = levels[top];
|
/* Check that the arc crosses the current band. */
|
||||||
if ( level > 1 )
|
TPos min, max, y;
|
||||||
|
|
||||||
|
|
||||||
|
min = max = arc[0].y;
|
||||||
|
|
||||||
|
y = arc[1].y;
|
||||||
|
if ( y < min )
|
||||||
|
min = y;
|
||||||
|
if ( y > max )
|
||||||
|
max = y;
|
||||||
|
|
||||||
|
y = arc[2].y;
|
||||||
|
if ( y < min )
|
||||||
|
min = y;
|
||||||
|
if ( y > max )
|
||||||
|
max = y;
|
||||||
|
|
||||||
|
y = arc[3].y;
|
||||||
|
if ( y < min )
|
||||||
|
min = y;
|
||||||
|
if ( y > max )
|
||||||
|
max = y;
|
||||||
|
|
||||||
|
if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
|
||||||
|
goto Draw;
|
||||||
|
|
||||||
|
/* Decide whether to split or draw. See `Rapid Termination */
|
||||||
|
/* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */
|
||||||
|
/* F. Hain, at */
|
||||||
|
/* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pdf */
|
||||||
|
|
||||||
{
|
{
|
||||||
/* check that the arc crosses the current band */
|
TPos dx, dy, dx_, dy_;
|
||||||
TPos min, max, y;
|
TPos dx1, dy1, dx2, dy2;
|
||||||
|
TPos L, s, s_limit;
|
||||||
|
|
||||||
|
|
||||||
min = max = arc[0].y;
|
/* dx and dy are x and y components of the P0-P3 chord vector. */
|
||||||
y = arc[1].y;
|
dx = arc[3].x - arc[0].x;
|
||||||
if ( y < min ) min = y;
|
dy = arc[3].y - arc[0].y;
|
||||||
if ( y > max ) max = y;
|
|
||||||
y = arc[2].y;
|
/* L is an (under)estimate of the Euclidean distance P0-P3. */
|
||||||
if ( y < min ) min = y;
|
/* */
|
||||||
if ( y > max ) max = y;
|
/* If dx >= dy, then r = sqrt(dx^2 + dy^2) can be overestimated */
|
||||||
y = arc[3].y;
|
/* with least maximum error by */
|
||||||
if ( y < min ) min = y;
|
/* */
|
||||||
if ( y > max ) max = y;
|
/* r_upperbound = dx + (sqrt(2) - 1) * dy , */
|
||||||
if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < 0 )
|
/* */
|
||||||
goto Draw;
|
/* where sqrt(2) - 1 can be (over)estimated by 107/256, giving an */
|
||||||
gray_split_cubic( arc );
|
/* error of no more than 8.4%. */
|
||||||
arc += 3;
|
/* */
|
||||||
top ++;
|
/* Similarly, some elementary calculus shows that r can be */
|
||||||
levels[top] = levels[top - 1] = level - 1;
|
/* underestimated with least maximum error by */
|
||||||
continue;
|
/* */
|
||||||
|
/* r_lowerbound = sqrt(2 + sqrt(2)) / 2 * dx */
|
||||||
|
/* + sqrt(2 - sqrt(2)) / 2 * dy . */
|
||||||
|
/* */
|
||||||
|
/* 236/256 and 97/256 are (under)estimates of the two algebraic */
|
||||||
|
/* numbers, giving an error of no more than 8.1%. */
|
||||||
|
|
||||||
|
dx_ = FT_ABS( dx );
|
||||||
|
dy_ = FT_ABS( dy );
|
||||||
|
L = ( 236 * FT_MAX( dx_, dy_ ) + 97 * FT_MIN( dx_, dy_ ) ) >> 8;
|
||||||
|
|
||||||
|
/* Avoid possible arithmetic overflow below by splitting. */
|
||||||
|
if ( L > 32767 )
|
||||||
|
goto Split;
|
||||||
|
|
||||||
|
/* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
|
||||||
|
s_limit = L * (TPos)( FT_MAX_CURVE_DEVIATION / 0.75 );
|
||||||
|
|
||||||
|
/* s is L * the perpendicular distance from P1 to the line P0-P3. */
|
||||||
|
dx1 = arc[1].x - arc[0].x;
|
||||||
|
dy1 = arc[1].y - arc[0].y;
|
||||||
|
s = FT_ABS( dy * dx1 - dx * dy1 );
|
||||||
|
|
||||||
|
if ( s > s_limit )
|
||||||
|
goto Split;
|
||||||
|
|
||||||
|
/* s is L * the perpendicular distance from P2 to the line P0-P3. */
|
||||||
|
dx2 = arc[2].x - arc[0].x;
|
||||||
|
dy2 = arc[2].y - arc[0].y;
|
||||||
|
s = FT_ABS( dy * dx2 - dx * dy2 );
|
||||||
|
|
||||||
|
if ( s > s_limit )
|
||||||
|
goto Split;
|
||||||
|
|
||||||
|
/* If P1 or P2 is outside P0-P3, split the curve. */
|
||||||
|
if ( dy * dy1 + dx * dx1 < 0 ||
|
||||||
|
dy * dy2 + dx * dx2 < 0 ||
|
||||||
|
dy * (arc[3].y - arc[1].y) + dx * (arc[3].x - arc[1].x) < 0 ||
|
||||||
|
dy * (arc[3].y - arc[2].y) + dx * (arc[3].x - arc[2].x) < 0 )
|
||||||
|
goto Split;
|
||||||
|
|
||||||
|
/* No reason to split. */
|
||||||
|
goto Draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Split:
|
||||||
|
gray_split_cubic( arc );
|
||||||
|
arc += 3;
|
||||||
|
continue;
|
||||||
|
|
||||||
Draw:
|
Draw:
|
||||||
{
|
gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
|
||||||
TPos to_x, to_y;
|
|
||||||
|
|
||||||
|
if ( arc == ras.bez_stack )
|
||||||
|
return;
|
||||||
|
|
||||||
to_x = arc[0].x;
|
arc -= 3;
|
||||||
to_y = arc[0].y;
|
|
||||||
mid_x = ( ras.x + to_x + 3 * ( arc[1].x + arc[2].x ) ) / 8;
|
|
||||||
mid_y = ( ras.y + to_y + 3 * ( arc[1].y + arc[2].y ) ) / 8;
|
|
||||||
|
|
||||||
gray_render_line( RAS_VAR_ mid_x, mid_y );
|
|
||||||
gray_render_line( RAS_VAR_ to_x, to_y );
|
|
||||||
top --;
|
|
||||||
arc -= 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gray_move_to( const FT_Vector* to,
|
gray_move_to( const FT_Vector* to,
|
||||||
PWorker worker )
|
PWorker worker )
|
||||||
@@ -1760,25 +1754,6 @@ typedef ptrdiff_t FT_PtrDist;
|
|||||||
ras.count_ex = ras.max_ex - ras.min_ex;
|
ras.count_ex = ras.max_ex - ras.min_ex;
|
||||||
ras.count_ey = ras.max_ey - ras.min_ey;
|
ras.count_ey = ras.max_ey - ras.min_ey;
|
||||||
|
|
||||||
/* simple heuristic used to speed up the bezier decomposition -- see */
|
|
||||||
/* the code in gray_render_conic() and gray_render_cubic() for more */
|
|
||||||
/* details */
|
|
||||||
ras.conic_level = 32;
|
|
||||||
ras.cubic_level = 16;
|
|
||||||
|
|
||||||
{
|
|
||||||
int level = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if ( ras.count_ex > 24 || ras.count_ey > 24 )
|
|
||||||
level++;
|
|
||||||
if ( ras.count_ex > 120 || ras.count_ey > 120 )
|
|
||||||
level++;
|
|
||||||
|
|
||||||
ras.conic_level <<= level;
|
|
||||||
ras.cubic_level <<= level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set up vertical bands */
|
/* set up vertical bands */
|
||||||
num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
|
num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
|
||||||
if ( num_bands == 0 )
|
if ( num_bands == 0 )
|
||||||
|
|||||||
@@ -140,8 +140,26 @@
|
|||||||
cbox.xMax = FT_PIX_CEIL( cbox.xMax );
|
cbox.xMax = FT_PIX_CEIL( cbox.xMax );
|
||||||
cbox.yMax = FT_PIX_CEIL( cbox.yMax );
|
cbox.yMax = FT_PIX_CEIL( cbox.yMax );
|
||||||
|
|
||||||
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
|
if ( cbox.xMin < 0 && cbox.xMax > FT_INT_MAX + cbox.xMin )
|
||||||
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
|
{
|
||||||
|
FT_ERROR(( "ft_smooth_render_generic: glyph too large:"
|
||||||
|
" xMin = %d, xMax = %d\n",
|
||||||
|
cbox.xMin >> 6, cbox.xMax >> 6 ));
|
||||||
|
return Smooth_Err_Raster_Overflow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
|
||||||
|
|
||||||
|
if ( cbox.yMin < 0 && cbox.yMax > FT_INT_MAX + cbox.yMin )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "ft_smooth_render_generic: glyph too large:"
|
||||||
|
" yMin = %d, yMax = %d\n",
|
||||||
|
cbox.yMin >> 6, cbox.yMax >> 6 ));
|
||||||
|
return Smooth_Err_Raster_Overflow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
|
||||||
|
|
||||||
bitmap = &slot->bitmap;
|
bitmap = &slot->bitmap;
|
||||||
memory = render->root.memory;
|
memory = render->root.memory;
|
||||||
|
|
||||||
@@ -202,7 +220,7 @@
|
|||||||
/* but we care realistic cases only. Always pitch <= width. */
|
/* but we care realistic cases only. Always pitch <= width. */
|
||||||
if ( width > 0x7FFFU || height > 0x7FFFU )
|
if ( width > 0x7FFFU || height > 0x7FFFU )
|
||||||
{
|
{
|
||||||
FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
|
FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n",
|
||||||
width, height ));
|
width, height ));
|
||||||
return Smooth_Err_Raster_Overflow;
|
return Smooth_Err_Raster_Overflow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1910,6 +1910,9 @@
|
|||||||
FT_UInt i;
|
FT_UInt i;
|
||||||
|
|
||||||
|
|
||||||
|
FT_TRACE4(( "tt_loader_init: grayscale change,"
|
||||||
|
" re-executing `prep' table\n" ));
|
||||||
|
|
||||||
exec->grayscale = grayscale;
|
exec->grayscale = grayscale;
|
||||||
|
|
||||||
for ( i = 0; i < size->cvt_size; i++ )
|
for ( i = 0; i < size->cvt_size; i++ )
|
||||||
|
|||||||
@@ -6773,12 +6773,11 @@
|
|||||||
{
|
{
|
||||||
if ( ( CUR.pts.tags[point] & mask ) != 0 )
|
if ( ( CUR.pts.tags[point] & mask ) != 0 )
|
||||||
{
|
{
|
||||||
if ( point > 0 )
|
_iup_worker_interpolate( &V,
|
||||||
_iup_worker_interpolate( &V,
|
cur_touched + 1,
|
||||||
cur_touched + 1,
|
point - 1,
|
||||||
point - 1,
|
cur_touched,
|
||||||
cur_touched,
|
point );
|
||||||
point );
|
|
||||||
cur_touched = point;
|
cur_touched = point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8128,6 +8127,15 @@
|
|||||||
*exc = cur;
|
*exc = cur;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If any errors have occurred, function tables may be broken. */
|
||||||
|
/* Force a re-execution of `prep' and `fpgm' tables if no */
|
||||||
|
/* bytecode debugger is run. */
|
||||||
|
if ( CUR.error && !CUR.instruction_trap )
|
||||||
|
{
|
||||||
|
FT_TRACE1(( " The interpreter returned error 0x%x\n", CUR.error ));
|
||||||
|
exc->size->cvt_ready = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return CUR.error;
|
return CUR.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
/* */
|
/* */
|
||||||
/* Objects manager (body). */
|
/* Objects manager (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
|
||||||
|
/* 2010 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, */
|
||||||
@@ -149,12 +150,13 @@
|
|||||||
tt_check_trickyness( FT_String* name )
|
tt_check_trickyness( FT_String* name )
|
||||||
{
|
{
|
||||||
#define TRICK_NAMES_MAX_CHARACTERS 16
|
#define TRICK_NAMES_MAX_CHARACTERS 16
|
||||||
#define TRICK_NAMES_COUNT 7
|
#define TRICK_NAMES_COUNT 8
|
||||||
static const char trick_names[TRICK_NAMES_COUNT][TRICK_NAMES_MAX_CHARACTERS+1] =
|
static const char trick_names[TRICK_NAMES_COUNT][TRICK_NAMES_MAX_CHARACTERS+1] =
|
||||||
{
|
{
|
||||||
"DFKaiSho-SB", /* dfkaisb.ttf */
|
"DFKaiSho-SB", /* dfkaisb.ttf */
|
||||||
"DFKaiShu",
|
"DFKaiShu",
|
||||||
"DFKai-SB", /* kaiu.ttf */
|
"DFKai-SB", /* kaiu.ttf */
|
||||||
|
"HuaTianKaiTi?", /* htkt2.ttf */
|
||||||
"HuaTianSongTi?", /* htst3.ttf */
|
"HuaTianSongTi?", /* htst3.ttf */
|
||||||
"MingLiU", /* mingliu.ttf & mingliu.ttc */
|
"MingLiU", /* mingliu.ttf & mingliu.ttc */
|
||||||
"PMingLiU", /* mingliu.ttc */
|
"PMingLiU", /* mingliu.ttc */
|
||||||
@@ -164,7 +166,7 @@
|
|||||||
|
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
return FALSE;
|
return TRUE;
|
||||||
|
|
||||||
/* Note that we only check the face name at the moment; it might */
|
/* Note that we only check the face name at the moment; it might */
|
||||||
/* be worth to do more checks for a few special cases. */
|
/* be worth to do more checks for a few special cases. */
|
||||||
@@ -458,7 +460,11 @@
|
|||||||
error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
|
error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
|
||||||
|
|
||||||
if ( !error )
|
if ( !error )
|
||||||
|
{
|
||||||
|
FT_TRACE4(( "Executing `fpgm' table.\n" ));
|
||||||
|
|
||||||
error = face->interpreter( exec );
|
error = face->interpreter( exec );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error = TT_Err_Ok;
|
error = TT_Err_Ok;
|
||||||
@@ -520,7 +526,11 @@
|
|||||||
error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
|
error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
|
||||||
|
|
||||||
if ( !error && !size->debug )
|
if ( !error && !size->debug )
|
||||||
|
{
|
||||||
|
FT_TRACE4(( "Executing `prep' table.\n" ));
|
||||||
|
|
||||||
error = face->interpreter( exec );
|
error = face->interpreter( exec );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error = TT_Err_Ok;
|
error = TT_Err_Ok;
|
||||||
|
|||||||
@@ -203,6 +203,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check broken location data */
|
||||||
|
if ( pos1 >= face->glyf_len )
|
||||||
|
{
|
||||||
|
FT_TRACE1(( "tt_face_get_location:"
|
||||||
|
" too large offset=0x%08lx found for gid=0x%04lx,"
|
||||||
|
" exceeding the end of glyf table (0x%08lx)\n",
|
||||||
|
pos1, gindex, face->glyf_len ));
|
||||||
|
*asize = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pos2 >= face->glyf_len )
|
||||||
|
{
|
||||||
|
FT_TRACE1(( "tt_face_get_location:"
|
||||||
|
" too large offset=0x%08lx found for gid=0x%04lx,"
|
||||||
|
" truncate at the end of glyf table (0x%08lx)\n",
|
||||||
|
pos2, gindex + 1, face->glyf_len ));
|
||||||
|
pos2 = face->glyf_len;
|
||||||
|
}
|
||||||
|
|
||||||
/* The `loca' table must be ordered; it refers to the length of */
|
/* The `loca' table must be ordered; it refers to the length of */
|
||||||
/* an entry as the difference between the current and the next */
|
/* an entry as the difference between the current and the next */
|
||||||
/* position. However, there do exist (malformed) fonts which */
|
/* position. However, there do exist (malformed) fonts which */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* FreeType font driver for Windows FNT/FON files */
|
/* FreeType font driver for Windows FNT/FON files */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* Copyright 2003 Huw D M Davies for Codeweavers */
|
/* Copyright 2003 Huw D M Davies for Codeweavers */
|
||||||
/* Copyright 2007 Dmitry Timoshkov for Codeweavers */
|
/* Copyright 2007 Dmitry Timoshkov for Codeweavers */
|
||||||
@@ -944,7 +944,7 @@
|
|||||||
FT_Int32 load_flags )
|
FT_Int32 load_flags )
|
||||||
{
|
{
|
||||||
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
||||||
FNT_Font font = face->font;
|
FNT_Font font;
|
||||||
FT_Error error = FNT_Err_Ok;
|
FT_Error error = FNT_Err_Ok;
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
FT_Int len;
|
FT_Int len;
|
||||||
@@ -955,7 +955,15 @@
|
|||||||
FT_UNUSED( load_flags );
|
FT_UNUSED( load_flags );
|
||||||
|
|
||||||
|
|
||||||
if ( !face || !font ||
|
if ( !face )
|
||||||
|
{
|
||||||
|
error = FNT_Err_Invalid_Argument;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
font = face->font;
|
||||||
|
|
||||||
|
if ( !font ||
|
||||||
glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) )
|
glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) )
|
||||||
{
|
{
|
||||||
error = FNT_Err_Invalid_Argument;
|
error = FNT_Err_Invalid_Argument;
|
||||||
|
|||||||
Reference in New Issue
Block a user