[CHG] FreeType updated to version 2.4.6

This commit is contained in:
Crayon2000 2011-07-30 18:07:07 +00:00
parent 96321c05f9
commit 46174e2847
15 changed files with 864 additions and 331 deletions

View file

@ -199,7 +199,7 @@ dist:
currdir=`pwd` ; \ currdir=`pwd` ; \
for f in `find . -wholename '*/.git' -prune \ for f in `find . -wholename '*/.git' -prune \
-o -name .cvsignore \ -o -name .gitignore \
-o -type d \ -o -type d \
-o -print` ; do \ -o -print` ; do \
ln -s $$currdir/$$f tmp/$$f ; \ ln -s $$currdir/$$f tmp/$$f ; \

View file

@ -203,6 +203,17 @@ FT_BEGIN_HEADER
/* #define FT_CONFIG_OPTION_USE_BZIP2 */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */
/*************************************************************************/
/* */
/* Define to disable the use of file stream functions and types, FILE, */
/* fopen() etc. Enables the use of smaller system libraries on embedded */
/* systems that have multiple system libraries, some with or without */
/* file stream support, in the cases where file stream support is not */
/* necessary such as memory loading of font files. */
/* */
/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* DLL export compilation */ /* DLL export compilation */

View file

@ -1063,8 +1063,8 @@ FT_BEGIN_HEADER
/* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
/* probably never want this except for demonstration purposes. */ /* probably never want this except for demonstration purposes. */
/* */ /* */
/* Currently, there are six TrueType fonts in the list of tricky */ /* Currently, there are about a dozen TrueType fonts in the list of */
/* fonts; they are hard-coded in file `ttobjs.c'. */ /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
/* */ /* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
@ -2107,8 +2107,8 @@ FT_BEGIN_HEADER
/* used to determine both scaling values. */ /* used to determine both scaling values. */
/* */ /* */
/* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
/* The real dimension. The sum of the the `Ascender' and (minus */ /* The real dimension. The sum of the the `ascender' and (minus */
/* of) the `Descender' fields of @FT_FaceRec are used to determine */ /* of) the `descender' fields of @FT_FaceRec are used to determine */
/* both scaling values. */ /* both scaling values. */
/* */ /* */
/* FT_SIZE_REQUEST_TYPE_BBOX :: */ /* FT_SIZE_REQUEST_TYPE_BBOX :: */
@ -2916,6 +2916,10 @@ FT_BEGIN_HEADER
/* The glyph name is truncated to fit within the buffer if it is too */ /* The glyph name is truncated to fit within the buffer if it is too */
/* long. The returned string is always zero-terminated. */ /* long. The returned string is always zero-terminated. */
/* */ /* */
/* Be aware that FreeType reorders glyph indices internally so that */
/* glyph index~0 always corresponds to the `missing glyph' (called */
/* `.notdef'). */
/* */
/* This function is not compiled within the library if the config */ /* This function is not compiled within the library if the config */
/* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
/* `include/freetype/config/ftoptions.h'. */ /* `include/freetype/config/ftoptions.h'. */
@ -3326,6 +3330,9 @@ FT_BEGIN_HEADER
/* in the @PS_FontInfoRec structure which is only guaranteed to */ /* in the @PS_FontInfoRec structure which is only guaranteed to */
/* return the correct results for Type~1 fonts. */ /* return the correct results for Type~1 fonts. */
/* */ /* */
/* <Since> */
/* 2.3.8 */
/* */
FT_EXPORT( FT_UShort ) FT_EXPORT( FT_UShort )
FT_Get_FSType_Flags( FT_Face face ); FT_Get_FSType_Flags( FT_Face face );
@ -3803,7 +3810,7 @@ FT_BEGIN_HEADER
*/ */
#define FREETYPE_MAJOR 2 #define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 4 #define FREETYPE_MINOR 4
#define FREETYPE_PATCH 5 #define FREETYPE_PATCH 6
/*************************************************************************/ /*************************************************************************/

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType path stroker (specification). */ /* FreeType path stroker (specification). */
/* */ /* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ /* Copyright 2002-2006, 2008, 2009, 2011 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, */
@ -75,20 +75,44 @@ FT_BEGIN_HEADER
* to join two lines smoothly. * to join two lines smoothly.
* *
* FT_STROKER_LINEJOIN_BEVEL :: * FT_STROKER_LINEJOIN_BEVEL ::
* Used to render beveled line joins; i.e., the two joining lines * Used to render beveled line joins. The outer corner of
* are extended until they intersect. * the joined lines is filled by enclosing the triangular
* region of the corner with a straight line between the
* outer corners of each stroke.
* *
* FT_STROKER_LINEJOIN_MITER_FIXED ::
* Used to render mitered line joins, with fixed bevels if the
* miter limit is exceeded. The outer edges of the strokes
* for the two segments are extended until they meet at an
* angle. If the segments meet at too sharp an angle (such
* that the miter would extend from the intersection of the
* segments a distance greater than the product of the miter
* limit value and the border radius), then a bevel join (see
* above) is used instead. This prevents long spikes being
* created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter
* line join as used in PostScript and PDF.
*
* FT_STROKER_LINEJOIN_MITER_VARIABLE ::
* FT_STROKER_LINEJOIN_MITER :: * FT_STROKER_LINEJOIN_MITER ::
* Same as beveled rendering, except that an additional line * Used to render mitered line joins, with variable bevels if
* break is added if the angle between the two joining lines * the miter limit is exceeded. The intersection of the
* is too closed (this is useful to avoid unpleasant spikes * strokes is clipped at a line perpendicular to the bisector
* in beveled rendering). * of the angle between the strokes, at the distance from the
* intersection of the segments equal to the product of the
* miter limit value and the border radius. This prevents
* long spikes being created.
* FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line
* join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias
* for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for
* backwards compatibility.
*/ */
typedef enum FT_Stroker_LineJoin_ typedef enum FT_Stroker_LineJoin_
{ {
FT_STROKER_LINEJOIN_ROUND = 0, FT_STROKER_LINEJOIN_ROUND = 0,
FT_STROKER_LINEJOIN_BEVEL, FT_STROKER_LINEJOIN_BEVEL = 1,
FT_STROKER_LINEJOIN_MITER FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,
FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,
FT_STROKER_LINEJOIN_MITER_FIXED = 3
} FT_Stroker_LineJoin; } FT_Stroker_LineJoin;
@ -245,7 +269,8 @@ FT_BEGIN_HEADER
* The line join style. * The line join style.
* *
* miter_limit :: * miter_limit ::
* The miter limit for the FT_STROKER_LINEJOIN_MITER style, * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and
* FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles,
* expressed as 16.16 fixed point value. * expressed as 16.16 fixed point value.
* *
* @note: * @note:

View file

@ -155,6 +155,9 @@
(const FT_Byte*)args->memory_base, (const FT_Byte*)args->memory_base,
args->memory_size ); args->memory_size );
} }
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
else if ( args->flags & FT_OPEN_PATHNAME ) else if ( args->flags & FT_OPEN_PATHNAME )
{ {
/* create a normal system stream */ /* create a normal system stream */
@ -170,6 +173,9 @@
FT_FREE( stream ); FT_FREE( stream );
stream = args->stream; stream = args->stream;
} }
#endif
else else
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;

View file

@ -269,7 +269,7 @@
#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \ #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
!defined( TT_CONFIG_OPTION_BYTECODE_INTEPRETER ) !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
if ( face && FT_IS_SFNT( face ) ) if ( face && FT_IS_SFNT( face ) )
{ {
result = !face->internal->ignore_unpatented_hinter; result = !face->internal->ignore_unpatented_hinter;

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
/* */ /* */
/* ANSI-specific FreeType low-level system interface (body). */ /* ANSI-specific FreeType low-level system interface (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2006, 2008, 2009, 2010 by */ /* Copyright 1996-2002, 2006, 2008-2011 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, */
@ -137,6 +137,7 @@
/* */ /* */
/*************************************************************************/ /*************************************************************************/
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -267,6 +268,7 @@
return FT_Err_Ok; return FT_Err_Ok;
} }
#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
#ifdef FT_DEBUG_MEMORY #ifdef FT_DEBUG_MEMORY

View file

@ -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, 2005, 2006, 2007, 2009, 2010 * Copyright 2001-2011
* Francesco Zappa Nardelli * 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
@ -983,7 +983,7 @@
FT_Error error = BDF_Err_Ok; FT_Error error = BDF_Err_Ok;
/* First check to see if the property has */ /* First check whether the property has */
/* already been added or not. If it has, then */ /* already been added or not. If it has, then */
/* simply ignore it. */ /* simply ignore it. */
if ( hash_lookup( name, &(font->proptbl) ) ) if ( hash_lookup( name, &(font->proptbl) ) )
@ -1276,7 +1276,7 @@
FT_Error error = BDF_Err_Ok; FT_Error error = BDF_Err_Ok;
/* First, check to see if the property already exists in the font. */ /* First, check whether the property already exists in the font. */
if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 ) if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 )
{ {
/* The property already exists in the font, so simply replace */ /* The property already exists in the font, so simply replace */
@ -1530,8 +1530,8 @@
goto Exit; goto Exit;
} }
/* Check to see whether a glyph is being scanned but should be */ /* Check whether a glyph is being scanned but should be */
/* ignored because it is an unencoded glyph. */ /* ignored because it is an unencoded glyph. */
if ( ( p->flags & _BDF_GLYPH ) && if ( ( p->flags & _BDF_GLYPH ) &&
p->glyph_enc == -1 && p->glyph_enc == -1 &&
p->opts->keep_unencoded == 0 ) p->opts->keep_unencoded == 0 )
@ -1585,17 +1585,18 @@
p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 ); p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
/* Check that the encoding is in the range [0,65536] because */ /* Check that the encoding is in the range [0,65536] because */
/* otherwise p->have (a bitmap with static size) overflows. */ /* otherwise p->have (a bitmap with static size) overflows. */
if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 ) if ( p->glyph_enc > 0 &&
(size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
{ {
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
/* Check to see whether this encoding has already been encountered. */ /* Check whether this encoding has already been encountered. */
/* If it has then change it to unencoded so it gets added if */ /* If it has then change it to unencoded so it gets added if */
/* indicated. */ /* indicated. */
if ( p->glyph_enc >= 0 ) if ( p->glyph_enc >= 0 )
{ {
if ( _bdf_glyph_modified( p->have, p->glyph_enc ) ) if ( _bdf_glyph_modified( p->have, p->glyph_enc ) )
@ -1634,8 +1635,8 @@
} }
else else
{ {
/* Unencoded glyph. Check to see whether it should */ /* Unencoded glyph. Check whether it should */
/* be added or not. */ /* be added or not. */
if ( p->opts->keep_unencoded != 0 ) if ( p->opts->keep_unencoded != 0 )
{ {
/* Allocate the next unencoded glyph. */ /* Allocate the next unencoded glyph. */
@ -1676,7 +1677,7 @@
else else
glyph = font->glyphs + ( font->glyphs_used - 1 ); glyph = font->glyphs + ( font->glyphs_used - 1 );
/* Check to see whether a bitmap is being constructed. */ /* Check whether a bitmap is being constructed. */
if ( p->flags & _BDF_BITMAP ) if ( p->flags & _BDF_BITMAP )
{ {
/* If there are more rows than are specified in the glyph metrics, */ /* If there are more rows than are specified in the glyph metrics, */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CFF token stream parser (body) */ /* CFF token stream parser (body) */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010 by */ /* Copyright 1996-2004, 2007-2011 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, */
@ -35,8 +35,6 @@
#define FT_COMPONENT trace_cffparse #define FT_COMPONENT trace_cffparse
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
cff_parser_init( CFF_Parser parser, cff_parser_init( CFF_Parser parser,
FT_UInt code, FT_UInt code,
@ -475,6 +473,12 @@
if ( scaling < 0 || scaling > 9 ) if ( scaling < 0 || scaling > 9 )
{ {
/* Return default matrix in case of unlikely values. */ /* Return default matrix in case of unlikely values. */
FT_TRACE1(( "cff_parse_font_matrix:"
" strange scaling value for xx element (%d),\n"
" "
" using default matrix\n", scaling ));
matrix->xx = 0x10000L; matrix->xx = 0x10000L;
matrix->yx = 0; matrix->yx = 0;
matrix->yx = 0; matrix->yx = 0;
@ -493,6 +497,12 @@
offset->y = cff_parse_fixed_scaled( data, scaling ); offset->y = cff_parse_fixed_scaled( data, scaling );
*upm = power_tens[scaling]; *upm = power_tens[scaling];
FT_TRACE4(( " font matrix: [%f %f %f %f]\n",
(double)matrix->xx / *upm / 65536,
(double)matrix->xy / *upm / 65536,
(double)matrix->yx / *upm / 65536,
(double)matrix->yy / *upm / 65536 ));
} }
Exit: Exit:
@ -518,6 +528,12 @@
bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) );
bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) ); bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) );
error = CFF_Err_Ok; error = CFF_Err_Ok;
FT_TRACE4(( " bbox: [%d %d %d %d]\n",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
bbox->yMax / 65536 ));
} }
return error; return error;
@ -557,8 +573,8 @@
if ( parser->top >= parser->stack + 3 ) if ( parser->top >= parser->stack + 3 )
{ {
dict->cid_registry = (FT_UInt)cff_parse_num ( data++ ); dict->cid_registry = (FT_UInt)cff_parse_num( data++ );
dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ ); dict->cid_ordering = (FT_UInt)cff_parse_num( data++ );
if ( **data == 30 ) if ( **data == 30 )
FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" )); FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
dict->cid_supplement = cff_parse_num( data ); dict->cid_supplement = cff_parse_num( data );
@ -566,6 +582,11 @@
FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n", FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
dict->cid_supplement )); dict->cid_supplement ));
error = CFF_Err_Ok; error = CFF_Err_Ok;
FT_TRACE4(( " ROS: registry sid %d, ordering sid %d, supplement %d\n",
dict->cid_registry,
dict->cid_ordering,
dict->cid_supplement ));
} }
return error; return error;

View file

@ -4,8 +4,7 @@
/* */ /* */
/* PostScript Type 1 decoding routines (body). */ /* PostScript Type 1 decoding routines (body). */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ /* Copyright 2000-2011 by */
/* 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, */
@ -28,6 +27,8 @@
#include "psauxerr.h" #include "psauxerr.h"
/* ensure proper sign extension */
#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) )
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -396,7 +397,7 @@
FT_ASSERT( ( decoder->len_buildchar == 0 ) == FT_ASSERT( ( decoder->len_buildchar == 0 ) ==
( decoder->buildchar == NULL ) ); ( decoder->buildchar == NULL ) );
if ( decoder->len_buildchar > 0 ) if ( decoder->buildchar && decoder->len_buildchar > 0 )
ft_memset( &decoder->buildchar[0], ft_memset( &decoder->buildchar[0],
0, 0,
sizeof( decoder->buildchar[0] ) * decoder->len_buildchar ); sizeof( decoder->buildchar[0] ) * decoder->len_buildchar );
@ -662,7 +663,7 @@
if ( large_int ) if ( large_int )
FT_TRACE4(( " %ld", value )); FT_TRACE4(( " %ld", value ));
else else
FT_TRACE4(( " %ld", (FT_Int32)( value >> 16 ) )); FT_TRACE4(( " %ld", Fix2Int( value ) ));
#endif #endif
*top++ = value; *top++ = value;
@ -684,8 +685,8 @@
top -= 2; top -= 2;
subr_no = (FT_Int)( top[1] >> 16 ); subr_no = Fix2Int( top[1] );
arg_cnt = (FT_Int)( top[0] >> 16 ); arg_cnt = Fix2Int( top[0] );
/***********************************************************/ /***********************************************************/
/* */ /* */
@ -724,6 +725,24 @@
switch ( subr_no ) switch ( subr_no )
{ {
case 0: /* end flex feature */
if ( arg_cnt != 3 )
goto Unexpected_OtherSubr;
if ( decoder->flex_state == 0 ||
decoder->num_flex_vectors != 7 )
{
FT_ERROR(( "t1_decoder_parse_charstrings:"
" unexpected flex end\n" ));
goto Syntax_Error;
}
/* the two `results' are popped by the following setcurrentpoint */
top[0] = x;
top[1] = y;
known_othersubr_result_cnt = 2;
break;
case 1: /* start flex feature */ case 1: /* start flex feature */
if ( arg_cnt != 0 ) if ( arg_cnt != 0 )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
@ -757,24 +776,6 @@
} }
break; break;
case 0: /* end flex feature */
if ( arg_cnt != 3 )
goto Unexpected_OtherSubr;
if ( decoder->flex_state == 0 ||
decoder->num_flex_vectors != 7 )
{
FT_ERROR(( "t1_decoder_parse_charstrings:"
" unexpected flex end\n" ));
goto Syntax_Error;
}
/* the two `results' are popped by the following setcurrentpoint */
top[0] = x;
top[1] = y;
known_othersubr_result_cnt = 2;
break;
case 3: /* change hints */ case 3: /* change hints */
if ( arg_cnt != 1 ) if ( arg_cnt != 1 )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
@ -818,17 +819,18 @@
goto Syntax_Error; goto Syntax_Error;
} }
/* we want to compute: */ /* We want to compute */
/* */ /* */
/* a0*w0 + a1*w1 + ... + ak*wk */ /* a0*w0 + a1*w1 + ... + ak*wk */
/* */ /* */
/* but we only have the a0, a1-a0, a2-a0, .. ak-a0 */ /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */
/* however, given that w0 + w1 + ... + wk == 1, we can */
/* rewrite it easily as: */
/* */ /* */
/* a0 + (a1-a0)*w1 + (a2-a0)*w2 + .. + (ak-a0)*wk */ /* However, given that w0 + w1 + ... + wk == 1, we can */
/* rewrite it easily as */
/* */ /* */
/* where k == num_designs-1 */ /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */
/* */
/* where k == num_designs-1. */
/* */ /* */
/* I guess that's why it's written in this `compact' */ /* I guess that's why it's written in this `compact' */
/* form. */ /* form. */
@ -862,7 +864,7 @@
if ( arg_cnt != 1 || blend == NULL ) if ( arg_cnt != 1 || blend == NULL )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
idx = (FT_Int)( top[0] >> 16 ); idx = Fix2Int( top[0] );
if ( idx < 0 || if ( idx < 0 ||
idx + blend->num_designs > decoder->len_buildchar ) idx + blend->num_designs > decoder->len_buildchar )
@ -930,7 +932,7 @@
if ( arg_cnt != 2 || blend == NULL ) if ( arg_cnt != 2 || blend == NULL )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
idx = (FT_Int)( top[1] >> 16 ); idx = Fix2Int( top[1] );
if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
@ -951,7 +953,7 @@
if ( arg_cnt != 1 || blend == NULL ) if ( arg_cnt != 1 || blend == NULL )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
idx = (FT_Int)( top[0] >> 16 ); idx = Fix2Int( top[0] );
if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
@ -1009,11 +1011,15 @@
break; break;
default: default:
FT_ERROR(( "t1_decoder_parse_charstrings:" if ( arg_cnt >= 0 && subr_no >= 0 )
" unknown othersubr [%d %d], wish me luck\n", {
arg_cnt, subr_no )); FT_ERROR(( "t1_decoder_parse_charstrings:"
unknown_othersubr_result_cnt = arg_cnt; " unknown othersubr [%d %d], wish me luck\n",
break; arg_cnt, subr_no ));
unknown_othersubr_result_cnt = arg_cnt;
break;
}
/* fall through */
Unexpected_OtherSubr: Unexpected_OtherSubr:
FT_ERROR(( "t1_decoder_parse_charstrings:" FT_ERROR(( "t1_decoder_parse_charstrings:"
@ -1139,8 +1145,8 @@
top[0], top[0],
top[1], top[1],
top[2], top[2],
(FT_Int)( top[3] >> 16 ), Fix2Int( top[3] ),
(FT_Int)( top[4] >> 16 ) ); Fix2Int( top[4] ) );
case op_sbw: case op_sbw:
FT_TRACE4(( " sbw" )); FT_TRACE4(( " sbw" ));
@ -1324,7 +1330,7 @@
FT_TRACE4(( " callsubr" )); FT_TRACE4(( " callsubr" ));
idx = (FT_Int)( top[0] >> 16 ); idx = Fix2Int( top[0] );
if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )
{ {
FT_ERROR(( "t1_decoder_parse_charstrings:" FT_ERROR(( "t1_decoder_parse_charstrings:"

View file

@ -582,12 +582,12 @@
/* do we have outlines in there? */ /* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 || has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
tt_face_lookup_table( face, TTAG_glyf ) != 0 || tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
tt_face_lookup_table( face, TTAG_CFF ) != 0 ); tt_face_lookup_table( face, TTAG_CFF ) != 0 );
#else #else
has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 || has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
tt_face_lookup_table( face, TTAG_CFF ) != 0 ); tt_face_lookup_table( face, TTAG_CFF ) != 0 );
#endif #endif
is_apple_sbit = 0; is_apple_sbit = 0;
@ -662,8 +662,9 @@
if ( face->format_tag == TTAG_true ) if ( face->format_tag == TTAG_true )
{ {
FT_TRACE2(( "This is an SFNT Mac font.\n" )); FT_TRACE2(( "This is an SFNT Mac font.\n" ));
has_outline = 0; has_outline = 0;
error = SFNT_Err_Ok; error = SFNT_Err_Ok;
} }
else else
{ {
@ -998,40 +999,36 @@
/* table cannot be used to compute the text height reliably! */ /* table cannot be used to compute the text height reliably! */
/* */ /* */
/* The ascender/descender/height are computed from the OS/2 table */ /* The ascender and descender are taken from the `hhea' table. */
/* when found. Otherwise, they're taken from the horizontal */ /* If zero, they are taken from the `OS/2' table. */
/* header. */
/* */
root->ascender = face->horizontal.Ascender; root->ascender = face->horizontal.Ascender;
root->descender = face->horizontal.Descender; root->descender = face->horizontal.Descender;
root->height = (FT_Short)( root->ascender - root->descender + root->height = (FT_Short)( root->ascender - root->descender +
face->horizontal.Line_Gap ); face->horizontal.Line_Gap );
#if 0 if ( !( root->ascender || root->descender ) )
/* if the line_gap is 0, we add an extra 15% to the text height -- */
/* this computation is based on various versions of Times New Roman */
if ( face->horizontal.Line_Gap == 0 )
root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
#endif /* 0 */
#if 0
/* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */
/* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */
if ( face->os2.version != 0xFFFFU && root->ascender )
{ {
FT_Int height; if ( face->os2.version != 0xFFFFU )
{
if ( face->os2.sTypoAscender || face->os2.sTypoDescender )
{
root->ascender = face->os2.sTypoAscender;
root->descender = face->os2.sTypoDescender;
root->height = (FT_Short)( root->ascender - root->descender +
face->os2.sTypoLineGap );
}
else
{
root->ascender = (FT_Short)face->os2.usWinAscent;
root->descender = -(FT_Short)face->os2.usWinDescent;
root->ascender = face->os2.sTypoAscender; root->height = (FT_UShort)( root->ascender - root->descender );
root->descender = -face->os2.sTypoDescender; }
}
height = root->ascender + root->descender + face->os2.sTypoLineGap;
if ( height > root->height )
root->height = height;
} }
#endif /* 0 */
root->max_advance_width = face->horizontal.advance_Width_Max; root->max_advance_width = face->horizontal.advance_Width_Max;
root->max_advance_height = (FT_Short)( face->vertical_info root->max_advance_height = (FT_Short)( face->vertical_info

View file

@ -246,7 +246,10 @@
FT_Request_Metrics( size->face, req ); FT_Request_Metrics( size->face, req );
if ( FT_IS_SCALABLE( size->face ) ) if ( FT_IS_SCALABLE( size->face ) )
{
error = tt_size_reset( ttsize ); error = tt_size_reset( ttsize );
ttsize->root.metrics = ttsize->metrics;
}
return error; return error;
} }

View file

@ -409,6 +409,54 @@
} }
/* Check whether `.notdef' is the only glyph in the `loca' table. */
static FT_Bool
tt_check_single_notdef( FT_Face ttface )
{
FT_Bool result = FALSE;
TT_Face face = (TT_Face)ttface;
FT_UInt asize;
FT_ULong i;
FT_ULong glyph_index = 0;
FT_UInt count = 0;
for( i = 0; i < face->num_locations; i++ )
{
tt_face_get_location( face, i, &asize );
if ( asize > 0 )
{
count += 1;
if ( count > 1 )
break;
glyph_index = i;
}
}
/* Only have a single outline. */
if ( count == 1 )
{
if ( glyph_index == 0 )
result = TRUE;
else
{
/* FIXME: Need to test glyphname == .notdef ? */
FT_Error error;
char buf[8];
error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );
if ( !error &&
buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) )
result = TRUE;
}
}
return result;
}
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -504,6 +552,20 @@
if ( !error ) if ( !error )
error = tt_face_load_prep( face, stream ); error = tt_face_load_prep( face, stream );
/* Check the scalable flag based on `loca'. */
if ( !ttface->internal->incremental_interface &&
ttface->num_fixed_sizes &&
face->glyph_locations &&
tt_check_single_notdef( ttface ) )
{
FT_TRACE5(( "tt_face_init:"
" Only the `.notdef' glyph has an outline.\n"
" "
" Resetting scalable flag to FALSE.\n" ));
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
}
#else #else
if ( !error ) if ( !error )
@ -515,6 +577,19 @@
if ( !error ) if ( !error )
error = tt_face_load_prep( face, stream ); error = tt_face_load_prep( face, stream );
/* Check the scalable flag based on `loca'. */
if ( ttface->num_fixed_sizes &&
face->glyph_locations &&
tt_check_single_notdef( ttface ) )
{
FT_TRACE5(( "tt_face_init:"
" Only the `.notdef' glyph has an outline.\n"
" "
" Resetting scalable flag to FALSE.\n" ));
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
}
#endif #endif
} }

View file

@ -4,8 +4,7 @@
/* */ /* */
/* Type 1 font loader (body). */ /* Type 1 font loader (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ /* Copyright 1996-2011 by */
/* 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, */
@ -922,6 +921,9 @@
PS_Blend blend = face->blend; PS_Blend blend = face->blend;
if ( blend && blend->num_designs == 0 )
blend = NULL;
/* if the keyword has a dedicated callback, call it */ /* if the keyword has a dedicated callback, call it */
if ( field->type == T1_FIELD_TYPE_CALLBACK ) if ( field->type == T1_FIELD_TYPE_CALLBACK )
{ {