[CHG] FreeType updated to version 2.4.7

[CHG] Updated Doxyfile to version 1.7.5.1
This commit is contained in:
Crayon2000 2011-10-19 01:40:44 +00:00
parent 4aaf39c61f
commit bfa2636b23
22 changed files with 3564 additions and 3162 deletions

View file

@ -95,10 +95,6 @@ FT_BEGIN_HEADER
#endif #endif
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/* FT_UNUSED is a macro used to indicate that a given parameter is not */ /* FT_UNUSED is a macro used to indicate that a given parameter is not */
/* used -- this is only used to get rid of unpleasant compiler warnings */ /* used -- this is only used to get rid of unpleasant compiler warnings */
#ifndef FT_UNUSED #ifndef FT_UNUSED

View file

@ -5,7 +5,7 @@
/* ANSI-specific library and header configuration file (specification */ /* ANSI-specific library and header configuration file (specification */
/* only). */ /* only). */
/* */ /* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ /* Copyright 2002-2007, 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, */
@ -60,6 +60,7 @@
#include <limits.h> #include <limits.h>
#define FT_CHAR_BIT CHAR_BIT #define FT_CHAR_BIT CHAR_BIT
#define FT_USHORT_MAX USHRT_MAX
#define FT_INT_MAX INT_MAX #define FT_INT_MAX INT_MAX
#define FT_INT_MIN INT_MIN #define FT_INT_MIN INT_MIN
#define FT_UINT_MAX UINT_MAX #define FT_UINT_MAX UINT_MAX

View file

@ -3810,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 6 #define FREETYPE_PATCH 7
/*************************************************************************/ /*************************************************************************/

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType utility functions for bitmaps (body). */ /* FreeType utility functions for bitmaps (body). */
/* */ /* */
/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ /* Copyright 2004-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, */
@ -417,6 +417,10 @@
target->pitch = source->width + pad; target->pitch = source->width + pad;
if ( target->pitch > 0 &&
target->rows > FT_ULONG_MAX / target->pitch )
return FT_Err_Invalid_Argument;
if ( target->rows * target->pitch > old_size && if ( target->rows * target->pitch > old_size &&
FT_QREALLOC( target->buffer, FT_QREALLOC( target->buffer,
old_size, target->rows * target->pitch ) ) old_size, target->rows * target->pitch ) )

View file

@ -620,7 +620,8 @@
FT_DRIVER_IS_SCALABLE( driver ) && FT_DRIVER_IS_SCALABLE( driver ) &&
FT_DRIVER_USES_OUTLINES( driver ) && FT_DRIVER_USES_OUTLINES( driver ) &&
!FT_IS_TRICKY( face ) && !FT_IS_TRICKY( face ) &&
( ( face->internal->transform_matrix.yx == 0 && ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) ||
( face->internal->transform_matrix.yx == 0 &&
face->internal->transform_matrix.xx != 0 ) || face->internal->transform_matrix.xx != 0 ) ||
( face->internal->transform_matrix.xx == 0 && ( face->internal->transform_matrix.xx == 0 &&
face->internal->transform_matrix.yx != 0 ) ) ) face->internal->transform_matrix.yx != 0 ) ) )
@ -756,11 +757,11 @@
else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{ {
/* apply `standard' transformation if no renderer is available */ /* apply `standard' transformation if no renderer is available */
if ( &internal->transform_matrix ) if ( internal->transform_flags & 1 )
FT_Outline_Transform( &slot->outline, FT_Outline_Transform( &slot->outline,
&internal->transform_matrix ); &internal->transform_matrix );
if ( &internal->transform_delta ) if ( internal->transform_flags & 2 )
FT_Outline_Translate( &slot->outline, FT_Outline_Translate( &slot->outline,
internal->transform_delta.x, internal->transform_delta.x,
internal->transform_delta.y ); internal->transform_delta.y );
@ -2613,6 +2614,18 @@
metrics->height = bsize->height << 6; metrics->height = bsize->height << 6;
metrics->max_advance = bsize->x_ppem; metrics->max_advance = bsize->x_ppem;
} }
FT_TRACE5(( "FT_Select_Metrics:\n" ));
FT_TRACE5(( " x scale: %d (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
FT_TRACE5(( " y scale: %d (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
} }
@ -2721,6 +2734,18 @@
metrics->x_scale = 1L << 16; metrics->x_scale = 1L << 16;
metrics->y_scale = 1L << 16; metrics->y_scale = 1L << 16;
} }
FT_TRACE5(( "FT_Request_Metrics:\n" ));
FT_TRACE5(( " x scale: %d (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
FT_TRACE5(( " y scale: %d (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
} }
@ -2742,7 +2767,33 @@
clazz = face->driver->clazz; clazz = face->driver->clazz;
if ( clazz->select_size ) if ( clazz->select_size )
return clazz->select_size( face->size, (FT_ULong)strike_index ); {
FT_Error error;
error = clazz->select_size( face->size, (FT_ULong)strike_index );
#ifdef FT_DEBUG_LEVEL_TRACE
{
FT_Size_Metrics* metrics = &face->size->metrics;
FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" ));
FT_TRACE5(( " x scale: %d (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
FT_TRACE5(( " y scale: %d (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
#endif
return error;
}
FT_Select_Metrics( face, (FT_ULong)strike_index ); FT_Select_Metrics( face, (FT_ULong)strike_index );
@ -2770,7 +2821,33 @@
clazz = face->driver->clazz; clazz = face->driver->clazz;
if ( clazz->request_size ) if ( clazz->request_size )
return clazz->request_size( face->size, req ); {
FT_Error error;
error = clazz->request_size( face->size, req );
#ifdef FT_DEBUG_LEVEL_TRACE
{
FT_Size_Metrics* metrics = &face->size->metrics;
FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" ));
FT_TRACE5(( " x scale: %d (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
FT_TRACE5(( " y scale: %d (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
#endif
return error;
}
/* /*
* The reason that a driver doesn't have `request_size' defined is * The reason that a driver doesn't have `request_size' defined is

View file

@ -2222,9 +2222,13 @@
if ( error ) if ( error )
goto Exit; goto Exit;
/* don't try to end the path if no segments have been generated */
if ( !stroker->first_point )
{
error = FT_Stroker_EndSubPath( stroker ); error = FT_Stroker_EndSubPath( stroker );
if ( error ) if ( error )
goto Exit; goto Exit;
}
first = last + 1; first = last + 1;
} }

View file

@ -4,8 +4,7 @@
/* */ /* */
/* OpenType and CFF data/program tables loader (body). */ /* OpenType and CFF data/program tables 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, */
@ -1337,7 +1336,10 @@
error = cff_index_access_element( idx, font_index, &dict, &dict_len ); error = cff_index_access_element( idx, font_index, &dict, &dict_len );
if ( !error ) if ( !error )
{
FT_TRACE4(( " top dictionary:\n" ));
error = cff_parser_run( &parser, dict, dict + dict_len ); error = cff_parser_run( &parser, dict, dict + dict_len );
}
cff_index_forget_element( idx, &dict ); cff_index_forget_element( idx, &dict );
@ -1366,6 +1368,7 @@
FT_FRAME_ENTER( font->font_dict.private_size ) ) FT_FRAME_ENTER( font->font_dict.private_size ) )
goto Exit; goto Exit;
FT_TRACE4(( " private dictionary:\n" ));
error = cff_parser_run( &parser, error = cff_parser_run( &parser,
(FT_Byte*)stream->cursor, (FT_Byte*)stream->cursor,
(FT_Byte*)stream->limit ); (FT_Byte*)stream->limit );
@ -1494,6 +1497,7 @@
goto Exit; goto Exit;
/* now, parse the top-level font dictionary */ /* now, parse the top-level font dictionary */
FT_TRACE4(( "parsing top-level\n" ));
error = cff_subfont_load( &font->top_font, error = cff_subfont_load( &font->top_font,
&font->font_dict_index, &font->font_dict_index,
face_index, face_index,
@ -1546,6 +1550,7 @@
for ( idx = 0; idx < fd_index.count; idx++ ) for ( idx = 0; idx < fd_index.count; idx++ )
{ {
sub = font->subfonts[idx]; sub = font->subfonts[idx];
FT_TRACE4(( "parsing subfont %u\n", idx ));
error = cff_subfont_load( sub, &fd_index, idx, error = cff_subfont_load( sub, &fd_index, idx,
stream, base_offset, library ); stream, base_offset, library );
if ( error ) if ( error )

View file

@ -607,7 +607,25 @@
goto Bad_Format; goto Bad_Format;
} }
if ( !dict->units_per_em ) #ifdef FT_DEBUG_LEVEL_TRACE
{
FT_UInt idx;
FT_String* s;
FT_TRACE4(( "SIDs\n" ));
/* dump string index, including default strings for convenience */
for ( idx = 0; idx < cff->num_strings + 390; idx++ )
{
s = cff_index_get_sid_string( cff, idx );
if ( s )
FT_TRACE4((" %5d %s\n", idx, s ));
}
}
#endif /* FT_DEBUG_LEVEL_TRACE */
if ( !dict->has_font_matrix )
dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM; dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
/* Normalize the font matrix so that `matrix->xx' is 1; the */ /* Normalize the font matrix so that `matrix->xx' is 1; the */
@ -652,11 +670,16 @@
FT_Fixed temp; FT_Fixed temp;
if ( sub->units_per_em ) if ( sub->has_font_matrix )
{ {
FT_Long scaling; FT_Long scaling;
/* if we have a top-level matrix, */
/* concatenate the subfont matrix */
if ( top->has_font_matrix )
{
if ( top->units_per_em > 1 && sub->units_per_em > 1 ) if ( top->units_per_em > 1 && sub->units_per_em > 1 )
scaling = FT_MIN( top->units_per_em, sub->units_per_em ); scaling = FT_MIN( top->units_per_em, sub->units_per_em );
else else
@ -673,6 +696,7 @@
top->units_per_em, top->units_per_em,
scaling ); scaling );
} }
}
else else
{ {
sub->font_matrix = top->font_matrix; sub->font_matrix = top->font_matrix;
@ -690,16 +714,6 @@
{ {
*upm = FT_DivFix( *upm, temp ); *upm = FT_DivFix( *upm, temp );
/* if *upm is larger than 100*1000 we divide by 1000 -- */
/* this can happen if e.g. there is no top-font FontMatrix */
/* and the subfont FontMatrix already contains the complete */
/* scaling for the subfont (see section 5.11 of the PLRM) */
/* 100 is a heuristic value */
if ( *upm > 100L * 1000L )
*upm = ( *upm + 500 ) / 1000;
matrix->xx = FT_DivFix( matrix->xx, temp ); matrix->xx = FT_DivFix( matrix->xx, temp );
matrix->yx = FT_DivFix( matrix->yx, temp ); matrix->yx = FT_DivFix( matrix->yx, temp );
matrix->xy = FT_DivFix( matrix->xy, temp ); matrix->xy = FT_DivFix( matrix->xy, temp );

View file

@ -460,6 +460,8 @@
error = CFF_Err_Ok; error = CFF_Err_Ok;
dict->has_font_matrix = TRUE;
/* We expect a well-formed font matrix, this is, the matrix elements */ /* We expect a well-formed font matrix, this is, the matrix elements */
/* `xx' and `yy' are of approximately the same magnitude. To avoid */ /* `xx' and `yy' are of approximately the same magnitude. To avoid */
/* loss of precision, we use the magnitude of element `xx' to scale */ /* loss of precision, we use the magnitude of element `xx' to scale */
@ -481,7 +483,7 @@
matrix->xx = 0x10000L; matrix->xx = 0x10000L;
matrix->yx = 0; matrix->yx = 0;
matrix->yx = 0; matrix->xy = 0;
matrix->yy = 0x10000L; matrix->yy = 0x10000L;
offset->x = 0; offset->x = 0;
offset->y = 0; offset->y = 0;
@ -498,11 +500,13 @@
*upm = power_tens[scaling]; *upm = power_tens[scaling];
FT_TRACE4(( " font matrix: [%f %f %f %f]\n", FT_TRACE4(( " [%f %f %f %f %f %f]\n",
(double)matrix->xx / *upm / 65536, (double)matrix->xx / *upm / 65536,
(double)matrix->xy / *upm / 65536, (double)matrix->xy / *upm / 65536,
(double)matrix->yx / *upm / 65536, (double)matrix->yx / *upm / 65536,
(double)matrix->yy / *upm / 65536 )); (double)matrix->yy / *upm / 65536,
(double)offset->x / *upm / 65536,
(double)offset->y / *upm / 65536 ));
} }
Exit: Exit:
@ -529,7 +533,7 @@
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", FT_TRACE4(( " [%d %d %d %d]\n",
bbox->xMin / 65536, bbox->xMin / 65536,
bbox->yMin / 65536, bbox->yMin / 65536,
bbox->xMax / 65536, bbox->xMax / 65536,
@ -554,6 +558,9 @@
{ {
dict->private_size = cff_parse_num( data++ ); dict->private_size = cff_parse_num( data++ );
dict->private_offset = cff_parse_num( data ); dict->private_offset = cff_parse_num( data );
FT_TRACE4(( " %lu %lu\n",
dict->private_size, dict->private_offset ));
error = CFF_Err_Ok; error = CFF_Err_Ok;
} }
@ -583,7 +590,7 @@
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", FT_TRACE4(( " %d %d %d\n",
dict->cid_registry, dict->cid_registry,
dict->cid_ordering, dict->cid_ordering,
dict->cid_supplement )); dict->cid_supplement ));
@ -593,25 +600,32 @@
} }
#define CFF_FIELD_NUM( code, name ) \ #define CFF_FIELD_NUM( code, name, id ) \
CFF_FIELD( code, name, cff_kind_num ) CFF_FIELD( code, name, id, cff_kind_num )
#define CFF_FIELD_FIXED( code, name ) \ #define CFF_FIELD_FIXED( code, name, id ) \
CFF_FIELD( code, name, cff_kind_fixed ) CFF_FIELD( code, name, id, cff_kind_fixed )
#define CFF_FIELD_FIXED_1000( code, name ) \ #define CFF_FIELD_FIXED_1000( code, name, id ) \
CFF_FIELD( code, name, cff_kind_fixed_thousand ) CFF_FIELD( code, name, id, cff_kind_fixed_thousand )
#define CFF_FIELD_STRING( code, name ) \ #define CFF_FIELD_STRING( code, name, id ) \
CFF_FIELD( code, name, cff_kind_string ) CFF_FIELD( code, name, id, cff_kind_string )
#define CFF_FIELD_BOOL( code, name ) \ #define CFF_FIELD_BOOL( code, name, id ) \
CFF_FIELD( code, name, cff_kind_bool ) CFF_FIELD( code, name, id, cff_kind_bool )
#define CFF_FIELD_DELTA( code, name, max ) \
CFF_FIELD( code, name, cff_kind_delta )
#define CFFCODE_TOPDICT 0x1000 #define CFFCODE_TOPDICT 0x1000
#define CFFCODE_PRIVATE 0x2000 #define CFFCODE_PRIVATE 0x2000
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define CFF_FIELD_CALLBACK( code, name ) \
#undef CFF_FIELD
#undef CFF_FIELD_DELTA
#ifndef FT_DEBUG_LEVEL_TRACE
#define CFF_FIELD_CALLBACK( code, name, id ) \
{ \ { \
cff_kind_callback, \ cff_kind_callback, \
code | CFFCODE, \ code | CFFCODE, \
@ -620,8 +634,7 @@
0, 0 \ 0, 0 \
}, },
#undef CFF_FIELD #define CFF_FIELD( code, name, id, kind ) \
#define CFF_FIELD( code, name, kind ) \
{ \ { \
kind, \ kind, \
code | CFFCODE, \ code | CFFCODE, \
@ -630,8 +643,7 @@
0, 0, 0 \ 0, 0, 0 \
}, },
#undef CFF_FIELD_DELTA #define CFF_FIELD_DELTA( code, name, max, id ) \
#define CFF_FIELD_DELTA( code, name, max ) \
{ \ { \
cff_kind_delta, \ cff_kind_delta, \
code | CFFCODE, \ code | CFFCODE, \
@ -651,41 +663,102 @@
}; };
#else /* FT_DEBUG_LEVEL_TRACE */
#define CFF_FIELD_CALLBACK( code, name, id ) \
{ \
cff_kind_callback, \
code | CFFCODE, \
0, 0, \
cff_parse_ ## name, \
0, 0, \
id \
},
#define CFF_FIELD( code, name, id, kind ) \
{ \
kind, \
code | CFFCODE, \
FT_FIELD_OFFSET( name ), \
FT_FIELD_SIZE( name ), \
0, 0, 0, \
id \
},
#define CFF_FIELD_DELTA( code, name, max, id ) \
{ \
cff_kind_delta, \
code | CFFCODE, \
FT_FIELD_OFFSET( name ), \
FT_FIELD_SIZE_DELTA( name ), \
0, \
max, \
FT_FIELD_OFFSET( num_ ## name ), \
id \
},
static const CFF_Field_Handler cff_field_handlers[] =
{
#include "cfftoken.h"
{ 0, 0, 0, 0, 0, 0, 0, 0 }
};
#endif /* FT_DEBUG_LEVEL_TRACE */
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
void FT_Destroy_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz)
void
FT_Destroy_Class_cff_field_handlers( FT_Library library,
CFF_Field_Handler* clazz )
{ {
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
if ( clazz ) if ( clazz )
FT_FREE( clazz ); FT_FREE( clazz );
} }
FT_Error FT_Create_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class)
FT_Error
FT_Create_Class_cff_field_handlers( FT_Library library,
CFF_Field_Handler** output_class )
{ {
CFF_Field_Handler* clazz; CFF_Field_Handler* clazz;
FT_Error error; FT_Error error;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
int i=0;
int i = 0;
#undef CFF_FIELD #undef CFF_FIELD
#define CFF_FIELD( code, name, id, kind ) i++;
#undef CFF_FIELD_DELTA #undef CFF_FIELD_DELTA
#define CFF_FIELD_DELTA( code, name, max, id ) i++;
#undef CFF_FIELD_CALLBACK #undef CFF_FIELD_CALLBACK
#define CFF_FIELD_CALLBACK( code, name ) i++; #define CFF_FIELD_CALLBACK( code, name, id ) i++;
#define CFF_FIELD( code, name, kind ) i++;
#define CFF_FIELD_DELTA( code, name, max ) i++;
#include "cfftoken.h" #include "cfftoken.h"
i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/
if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) ) i++; /* { 0, 0, 0, 0, 0, 0, 0 } */
if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) )
return error; return error;
i=0; i = 0;
#undef CFF_FIELD
#undef CFF_FIELD_DELTA
#undef CFF_FIELD_CALLBACK
#define CFF_FIELD_CALLBACK( code_, name_ ) \
#ifndef FT_DEBUG_LEVEL_TRACE
#undef CFF_FIELD_CALLBACK
#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
clazz[i].kind = cff_kind_callback; \ clazz[i].kind = cff_kind_callback; \
clazz[i].code = code_ | CFFCODE; \ clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = 0; \ clazz[i].offset = 0; \
@ -696,7 +769,7 @@
i++; i++;
#undef CFF_FIELD #undef CFF_FIELD
#define CFF_FIELD( code_, name_, kind_ ) \ #define CFF_FIELD( code_, name_, id_, kind_ ) \
clazz[i].kind = kind_; \ clazz[i].kind = kind_; \
clazz[i].code = code_ | CFFCODE; \ clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
@ -707,7 +780,7 @@
i++; \ i++; \
#undef CFF_FIELD_DELTA #undef CFF_FIELD_DELTA
#define CFF_FIELD_DELTA( code_, name_, max_ ) \ #define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
clazz[i].kind = cff_kind_delta; \ clazz[i].kind = cff_kind_delta; \
clazz[i].code = code_ | CFFCODE; \ clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
@ -727,7 +800,63 @@
clazz[i].array_max = 0; clazz[i].array_max = 0;
clazz[i].count_offset = 0; clazz[i].count_offset = 0;
#else /* FT_DEBUG_LEVEL_TRACE */
#undef CFF_FIELD_CALLBACK
#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \
clazz[i].kind = cff_kind_callback; \
clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = 0; \
clazz[i].size = 0; \
clazz[i].reader = cff_parse_ ## name_; \
clazz[i].array_max = 0; \
clazz[i].count_offset = 0; \
clazz[i].id = id_; \
i++;
#undef CFF_FIELD
#define CFF_FIELD( code_, name_, id_, kind_ ) \
clazz[i].kind = kind_; \
clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
clazz[i].size = FT_FIELD_SIZE( name_ ); \
clazz[i].reader = 0; \
clazz[i].array_max = 0; \
clazz[i].count_offset = 0; \
clazz[i].id = id_; \
i++; \
#undef CFF_FIELD_DELTA
#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \
clazz[i].kind = cff_kind_delta; \
clazz[i].code = code_ | CFFCODE; \
clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
clazz[i].reader = 0; \
clazz[i].array_max = max_; \
clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
clazz[i].id = id_; \
i++;
#include "cfftoken.h"
clazz[i].kind = 0;
clazz[i].code = 0;
clazz[i].offset = 0;
clazz[i].size = 0;
clazz[i].reader = 0;
clazz[i].array_max = 0;
clazz[i].count_offset = 0;
clazz[i].id = 0;
#endif /* FT_DEBUG_LEVEL_TRACE */
*output_class = clazz; *output_class = clazz;
return CFF_Err_Ok; return CFF_Err_Ok;
} }
@ -743,7 +872,7 @@
FT_Byte* p = start; FT_Byte* p = start;
FT_Error error = CFF_Err_Ok; FT_Error error = CFF_Err_Ok;
FT_Library library = parser->library; FT_Library library = parser->library;
FT_UNUSED(library); FT_UNUSED( library );
parser->top = parser->stack; parser->top = parser->stack;
@ -824,6 +953,10 @@
FT_Byte* q = (FT_Byte*)parser->object + field->offset; FT_Byte* q = (FT_Byte*)parser->object + field->offset;
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE4(( " %s", field->id ));
#endif
/* check that we have enough arguments -- except for */ /* check that we have enough arguments -- except for */
/* delta encoded arrays, which can be empty */ /* delta encoded arrays, which can be empty */
if ( field->kind != cff_kind_delta && num_args < 1 ) if ( field->kind != cff_kind_delta && num_args < 1 )
@ -862,6 +995,34 @@
default: /* for 64-bit systems */ default: /* for 64-bit systems */
*(FT_Long*)q = val; *(FT_Long*)q = val;
} }
#ifdef FT_DEBUG_LEVEL_TRACE
switch ( field->kind )
{
case cff_kind_bool:
FT_TRACE4(( " %s\n", val ? "true" : "false" ));
break;
case cff_kind_string:
FT_TRACE4(( " %ld (SID)\n", val ));
break;
case cff_kind_num:
FT_TRACE4(( " %ld\n", val ));
break;
case cff_kind_fixed:
FT_TRACE4(( " %f\n", (double)val / 65536 ));
break;
case cff_kind_fixed_thousand:
FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 ));
default:
; /* never reached */
}
#endif
break; break;
case cff_kind_delta: case cff_kind_delta:
@ -875,6 +1036,8 @@
if ( num_args > field->array_max ) if ( num_args > field->array_max )
num_args = field->array_max; num_args = field->array_max;
FT_TRACE4(( " [" ));
/* store count */ /* store count */
*qcount = (FT_Byte)num_args; *qcount = (FT_Byte)num_args;
@ -900,9 +1063,13 @@
*(FT_Long*)q = val; *(FT_Long*)q = val;
} }
FT_TRACE4(( " %ld", val ));
q += field->size; q += field->size;
num_args--; num_args--;
} }
FT_TRACE4(( "]\n" ));
} }
break; break;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CFF token stream parser (specification) */ /* CFF token stream parser (specification) */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003 by */ /* Copyright 1996-2003, 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, */
@ -90,6 +90,10 @@ FT_BEGIN_HEADER
FT_UInt array_max; FT_UInt array_max;
FT_UInt count_offset; FT_UInt count_offset;
#ifdef FT_DEBUG_LEVEL_TRACE
const char* id;
#endif
} CFF_Field_Handler; } CFF_Field_Handler;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CFF token definitions (specification only). */ /* CFF token definitions (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003 by */ /* Copyright 1996-2003, 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, */
@ -22,48 +22,48 @@
#undef CFFCODE #undef CFFCODE
#define CFFCODE CFFCODE_TOPDICT #define CFFCODE CFFCODE_TOPDICT
CFF_FIELD_STRING ( 0, version ) CFF_FIELD_STRING ( 0, version, "Version" )
CFF_FIELD_STRING ( 1, notice ) CFF_FIELD_STRING ( 1, notice, "Notice" )
CFF_FIELD_STRING ( 0x100, copyright ) CFF_FIELD_STRING ( 0x100, copyright, "Copyright" )
CFF_FIELD_STRING ( 2, full_name ) CFF_FIELD_STRING ( 2, full_name, "FullName" )
CFF_FIELD_STRING ( 3, family_name ) CFF_FIELD_STRING ( 3, family_name, "FamilyName" )
CFF_FIELD_STRING ( 4, weight ) CFF_FIELD_STRING ( 4, weight, "Weight" )
CFF_FIELD_BOOL ( 0x101, is_fixed_pitch ) CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" )
CFF_FIELD_FIXED ( 0x102, italic_angle ) CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" )
CFF_FIELD_FIXED ( 0x103, underline_position ) CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" )
CFF_FIELD_FIXED ( 0x104, underline_thickness ) CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" )
CFF_FIELD_NUM ( 0x105, paint_type ) CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" )
CFF_FIELD_NUM ( 0x106, charstring_type ) CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" )
CFF_FIELD_CALLBACK( 0x107, font_matrix ) CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" )
CFF_FIELD_NUM ( 13, unique_id ) CFF_FIELD_NUM ( 13, unique_id, "UniqueID" )
CFF_FIELD_CALLBACK( 5, font_bbox ) CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" )
CFF_FIELD_NUM ( 0x108, stroke_width ) CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" )
CFF_FIELD_NUM ( 15, charset_offset ) CFF_FIELD_NUM ( 15, charset_offset, "charset" )
CFF_FIELD_NUM ( 16, encoding_offset ) CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" )
CFF_FIELD_NUM ( 17, charstrings_offset ) CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" )
CFF_FIELD_CALLBACK( 18, private_dict ) CFF_FIELD_CALLBACK( 18, private_dict, "Private" )
CFF_FIELD_NUM ( 0x114, synthetic_base ) CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" )
CFF_FIELD_STRING ( 0x115, embedded_postscript ) CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" )
#if 0 #if 0
CFF_FIELD_STRING ( 0x116, base_font_name ) CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" )
CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 ) CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" )
CFF_FIELD_CALLBACK( 0x118, multiple_master ) CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" )
CFF_FIELD_CALLBACK( 0x119, blend_axis_types ) CFF_FIELD_CALLBACK( 0x119, blend_axis_types, "BlendAxisTypes" )
#endif #endif
CFF_FIELD_CALLBACK( 0x11E, cid_ros ) CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" )
CFF_FIELD_NUM ( 0x11F, cid_font_version ) CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" )
CFF_FIELD_NUM ( 0x120, cid_font_revision ) CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" )
CFF_FIELD_NUM ( 0x121, cid_font_type ) CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" )
CFF_FIELD_NUM ( 0x122, cid_count ) CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" )
CFF_FIELD_NUM ( 0x123, cid_uid_base ) CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" )
CFF_FIELD_NUM ( 0x124, cid_fd_array_offset ) CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" )
CFF_FIELD_NUM ( 0x125, cid_fd_select_offset ) CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" )
CFF_FIELD_STRING ( 0x126, cid_font_name ) CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" )
#if 0 #if 0
CFF_FIELD_NUM ( 0x127, chameleon ) CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" )
#endif #endif
@ -72,26 +72,26 @@
#undef CFFCODE #undef CFFCODE
#define CFFCODE CFFCODE_PRIVATE #define CFFCODE CFFCODE_PRIVATE
CFF_FIELD_DELTA ( 6, blue_values, 14 ) CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" )
CFF_FIELD_DELTA ( 7, other_blues, 10 ) CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" )
CFF_FIELD_DELTA ( 8, family_blues, 14 ) CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" )
CFF_FIELD_DELTA ( 9, family_other_blues, 10 ) CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" )
CFF_FIELD_FIXED_1000( 0x109, blue_scale ) CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" )
CFF_FIELD_NUM ( 0x10A, blue_shift ) CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" )
CFF_FIELD_NUM ( 0x10B, blue_fuzz ) CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" )
CFF_FIELD_NUM ( 10, standard_width ) CFF_FIELD_NUM ( 10, standard_width, "StdHW" )
CFF_FIELD_NUM ( 11, standard_height ) CFF_FIELD_NUM ( 11, standard_height, "StdVW" )
CFF_FIELD_DELTA ( 0x10C, snap_widths, 13 ) CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" )
CFF_FIELD_DELTA ( 0x10D, snap_heights, 13 ) CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" )
CFF_FIELD_BOOL ( 0x10E, force_bold ) CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" )
CFF_FIELD_FIXED ( 0x10F, force_bold_threshold ) CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" )
CFF_FIELD_NUM ( 0x110, lenIV ) CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" )
CFF_FIELD_NUM ( 0x111, language_group ) CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" )
CFF_FIELD_FIXED ( 0x112, expansion_factor ) CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" )
CFF_FIELD_NUM ( 0x113, initial_random_seed ) CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" )
CFF_FIELD_NUM ( 19, local_subrs_offset ) CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" )
CFF_FIELD_NUM ( 20, default_width ) CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" )
CFF_FIELD_NUM ( 21, nominal_width ) CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" )
/* END */ /* END */

View file

@ -117,6 +117,7 @@ FT_BEGIN_HEADER
FT_Int paint_type; FT_Int paint_type;
FT_Int charstring_type; FT_Int charstring_type;
FT_Matrix font_matrix; FT_Matrix font_matrix;
FT_Bool has_font_matrix;
FT_ULong units_per_em; /* temporarily used as scaling value also */ FT_ULong units_per_em; /* temporarily used as scaling value also */
FT_Vector font_offset; FT_Vector font_offset;
FT_ULong unique_id; FT_ULong unique_id;

View file

@ -173,6 +173,7 @@
FT_UShort store; FT_UShort store;
#endif #endif
FT_ULong offset; FT_ULong offset;
FT_Long gid_limit;
lig_action = FT_NEXT_ULONG( p ); lig_action = FT_NEXT_ULONG( p );
@ -186,8 +187,9 @@
/* this offset is 30-bit signed value to add to GID */ /* this offset is 30-bit signed value to add to GID */
/* it is different from the location offset in mort */ /* it is different from the location offset in mort */
if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL ) if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL )
{ { /* negative offset */
if ( offset + valid->face->num_glyphs > 0x40000000UL ) gid_limit = valid->face->num_glyphs - ( offset & 0x0000FFFFUL );
if ( gid_limit > 0 )
return; return;
GXV_TRACE(( "ligature action table includes" GXV_TRACE(( "ligature action table includes"
@ -197,8 +199,8 @@
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
} }
else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL ) else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL )
{ { /* positive offset */
if ( offset + valid->face->num_glyphs < 0 ) if ( (FT_Long)offset < valid->face->num_glyphs )
return; return;
GXV_TRACE(( "ligature action table includes" GXV_TRACE(( "ligature action table includes"

View file

@ -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 2005, 2006, 2007, 2009 by David Turner. */ /* Copyright 2005-2007, 2009, 2011 by David Turner. */
/* */ /* */
/* 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, */
/* modified, and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
@ -124,6 +124,15 @@
old_size = 0; old_size = 0;
} }
/* requirement of the character stack larger than 1<<LZW_MAX_BITS */
/* implies bug in the decompression code */
if ( new_size > ( 1 << LZW_MAX_BITS ) )
{
new_size = 1 << LZW_MAX_BITS;
if ( new_size == old_size )
return -1;
}
if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) ) if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) )
return -1; return -1;
@ -279,7 +288,7 @@
: state->max_free + 1; : state->max_free + 1;
c = ft_lzwstate_get_code( state ); c = ft_lzwstate_get_code( state );
if ( c < 0 ) if ( c < 0 || c > 255 )
goto Eof; goto Eof;
old_code = old_char = (FT_UInt)c; old_code = old_char = (FT_UInt)c;
@ -312,11 +321,12 @@
/* why not LZW_FIRST-256 ? */ /* why not LZW_FIRST-256 ? */
state->free_ent = ( LZW_FIRST - 1 ) - 256; state->free_ent = ( LZW_FIRST - 1 ) - 256;
state->buf_clear = 1; state->buf_clear = 1;
c = ft_lzwstate_get_code( state );
if ( c < 0 )
goto Eof;
code = (FT_UInt)c; /* not quite right, but at least more predictable */
old_code = 0;
old_char = 0;
goto NextCode;
} }
in_code = code; /* save code for later */ in_code = code; /* save code for later */
@ -326,6 +336,10 @@
/* special case for KwKwKwK */ /* special case for KwKwKwK */
if ( code - 256U >= state->free_ent ) if ( code - 256U >= state->free_ent )
{ {
/* corrupted LZW stream */
if ( code - 256U > state->free_ent )
goto Eof;
FTLZW_STACK_PUSH( old_char ); FTLZW_STACK_PUSH( old_char );
code = old_code; code = old_code;
} }

View file

@ -764,6 +764,13 @@
if ( arg_cnt != 0 ) if ( arg_cnt != 0 )
goto Unexpected_OtherSubr; goto Unexpected_OtherSubr;
if ( decoder->flex_state == 0 )
{
FT_ERROR(( "t1_decoder_parse_charstrings:"
" missing flex start\n" ));
goto Syntax_Error;
}
/* note that we should not add a point for index 0; */ /* note that we should not add a point for index 0; */
/* this will move our current position to the flex */ /* this will move our current position to the flex */
/* point without adding any point to the outline */ /* point without adding any point to the outline */

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType glyph rasterizer interface (body). */ /* The FreeType glyph rasterizer interface (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ /* Copyright 1996-2003, 2005, 2006, 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, */
@ -176,6 +176,13 @@
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX )
{
error = Raster_Err_Invalid_Argument;
goto Exit;
}
bitmap = &slot->bitmap; bitmap = &slot->bitmap;
memory = render->root.memory; memory = render->root.memory;

View file

@ -872,6 +872,7 @@ typedef ptrdiff_t FT_PtrDist;
const FT_Vector* to ) const FT_Vector* to )
{ {
TPos dx, dy; TPos dx, dy;
TPos min, max, y;
int top, level; int top, level;
int* levels; int* levels;
FT_Vector* arc; FT_Vector* arc;
@ -884,32 +885,17 @@ typedef ptrdiff_t FT_PtrDist;
arc[1].y = UPSCALE( control->y ); arc[1].y = UPSCALE( control->y );
arc[2].x = ras.x; arc[2].x = ras.x;
arc[2].y = ras.y; arc[2].y = ras.y;
top = 0;
dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x ); dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x );
dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y ); dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y );
if ( dx < dy ) if ( dx < dy )
dx = dy; dx = dy;
level = 0; if ( dx < ONE_PIXEL / 4 )
while ( dx > ONE_PIXEL / 6 ) goto Draw;
{
dx >>= 2;
level++;
}
levels = ras.lev_stack;
levels[0] = level;
top = 0;
do
{
level = levels[top];
if ( level > 1 )
{
/* check that the arc crosses the current band */
TPos min, max, y;
/* short-cut the arc that crosses the current band */
min = max = arc[0].y; min = max = arc[0].y;
y = arc[1].y; y = arc[1].y;
@ -923,6 +909,21 @@ typedef ptrdiff_t FT_PtrDist;
if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
goto Draw; goto Draw;
level = 0;
do
{
dx >>= 2;
level++;
} while ( dx > ONE_PIXEL / 4 );
levels = ras.lev_stack;
levels[0] = level;
do
{
level = levels[top];
if ( level > 0 )
{
gray_split_conic( arc ); gray_split_conic( arc );
arc += 2; arc += 2;
top++; top++;
@ -973,6 +974,7 @@ typedef ptrdiff_t FT_PtrDist;
const FT_Vector* to ) const FT_Vector* to )
{ {
FT_Vector* arc; FT_Vector* arc;
TPos min, max, y;
arc = ras.bez_stack; arc = ras.bez_stack;
@ -985,12 +987,7 @@ 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;
for (;;) /* Short-cut the arc that crosses the current band. */
{
/* Check that the arc crosses the current band. */
TPos min, max, y;
min = max = arc[0].y; min = max = arc[0].y;
y = arc[1].y; y = arc[1].y;
@ -1014,6 +1011,8 @@ typedef ptrdiff_t FT_PtrDist;
if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
goto Draw; goto Draw;
for (;;)
{
/* Decide whether to split or draw. See `Rapid Termination */ /* Decide whether to split or draw. See `Rapid Termination */
/* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */ /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */
/* F. Hain, at */ /* F. Hain, at */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* TrueType GX Font Variation loader */ /* TrueType GX Font Variation loader */
/* */ /* */
/* Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* Copyright 2004-2011 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */ /* */
/* 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, */
@ -1474,6 +1474,9 @@
{ {
for ( j = 0; j < point_count; ++j ) for ( j = 0; j < point_count; ++j )
{ {
if ( localpoints[j] >= n_points )
continue;
delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply ); delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply );
delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply ); delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply );
} }

View file

@ -16,6 +16,10 @@
/***************************************************************************/ /***************************************************************************/
/* Greg Hitchcock from Microsoft has helped a lot in resolving unclear */
/* issues; many thanks! */
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H #include FT_INTERNAL_CALC_H
@ -664,7 +668,7 @@
FT_Int i; FT_Int i;
/* XXXX: Will probably disappear soon with all the code range */ /* XXX: Will probably disappear soon with all the code range */
/* management, which is now rather obsolete. */ /* management, which is now rather obsolete. */
/* */ /* */
size->num_function_defs = exec->numFDefs; size->num_function_defs = exec->numFDefs;
@ -2841,6 +2845,17 @@
A = p1->x - p2->x; A = p1->x - p2->x;
B = p1->y - p2->y; B = p1->y - p2->y;
/* If p1 == p2, SPVTL and SFVTL behave the same as */
/* SPVTCA[X] and SFVTCA[X], respectively. */
/* */
/* Confirmed by Greg Hitchcock. */
if ( A == 0 && B == 0 )
{
A = 0x4000;
aOpc = 0;
}
if ( ( aOpc & 1 ) != 0 ) if ( ( aOpc & 1 ) != 0 )
{ {
C = B; /* counter clockwise rotation */ C = B; /* counter clockwise rotation */
@ -5095,8 +5110,8 @@
CUR_Func_move( &CUR.zp2, L, args[1] - K ); CUR_Func_move( &CUR.zp2, L, args[1] - K );
/* not part of the specs, but here for safety */ /* UNDOCUMENTED! The MS rasterizer does that with */
/* twilight points (confirmed by Greg Hitchcock) */
if ( CUR.GS.gep2 == 0 ) if ( CUR.GS.gep2 == 0 )
CUR.zp2.org[L] = CUR.zp2.cur[L]; CUR.zp2.org[L] = CUR.zp2.cur[L];
} }
@ -5178,6 +5193,7 @@
{ {
FT_Long A, B, C; FT_Long A, B, C;
FT_UShort p1, p2; /* was FT_Int in pas type ERROR */ FT_UShort p1, p2; /* was FT_Int in pas type ERROR */
FT_Int aOpc = CUR.opcode;
p1 = (FT_UShort)args[1]; p1 = (FT_UShort)args[1];
@ -5198,9 +5214,20 @@
A = v1->x - v2->x; A = v1->x - v2->x;
B = v1->y - v2->y; B = v1->y - v2->y;
/* If v1 == v2, SDPVTL behaves the same as */
/* SVTCA[X], respectively. */
/* */
/* Confirmed by Greg Hitchcock. */
if ( A == 0 && B == 0 )
{
A = 0x4000;
aOpc = 0;
}
} }
if ( ( CUR.opcode & 1 ) != 0 ) if ( ( aOpc & 1 ) != 0 )
{ {
C = B; /* counter clockwise rotation */ C = B; /* counter clockwise rotation */
B = A; B = A;
@ -5218,7 +5245,7 @@
B = v1->y - v2->y; B = v1->y - v2->y;
} }
if ( ( CUR.opcode & 1 ) != 0 ) if ( ( aOpc & 1 ) != 0 )
{ {
C = B; /* counter clockwise rotation */ C = B; /* counter clockwise rotation */
B = A; B = A;
@ -5704,7 +5731,6 @@
} }
} }
else else
/* XXX: UNDOCUMENTED! SHP touches the points */
MOVE_Zp2_Point( point, dx, dy, TRUE ); MOVE_Zp2_Point( point, dx, dy, TRUE );
CUR.GS.loop--; CUR.GS.loop--;
@ -5765,7 +5791,6 @@
last_point = 0; last_point = 0;
} }
/* XXX: UNDOCUMENTED! SHC touches the points */
for ( i = first_point; i <= last_point; i++ ) for ( i = first_point; i <= last_point; i++ )
{ {
if ( zp.cur != CUR.zp2.cur || refp != i ) if ( zp.cur != CUR.zp2.cur || refp != i )
@ -5920,9 +5945,9 @@
return; return;
} }
/* XXX: UNDOCUMENTED! behaviour */ /* UNDOCUMENTED! The MS rasterizer does that with */
if ( CUR.GS.gep1 == 0 ) /* if the point that is to be moved */ /* twilight points (confirmed by Greg Hitchcock) */
/* is in twilight zone */ if ( CUR.GS.gep1 == 0 )
{ {
CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0]; CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0];
CUR_Func_move_orig( &CUR.zp1, point, args[1] ); CUR_Func_move_orig( &CUR.zp1, point, args[1] );
@ -5965,8 +5990,6 @@
return; return;
} }
/* XXX: Is there some undocumented feature while in the */
/* twilight zone? ? */
if ( ( CUR.opcode & 1 ) != 0 ) if ( ( CUR.opcode & 1 ) != 0 )
{ {
cur_dist = CUR_fast_project( &CUR.zp0.cur[point] ); cur_dist = CUR_fast_project( &CUR.zp0.cur[point] );
@ -6009,34 +6032,34 @@
goto Fail; goto Fail;
} }
/* XXX: UNDOCUMENTED! */ /* UNDOCUMENTED! */
/* */ /* */
/* The behaviour of an MIAP instruction is quite */ /* The behaviour of an MIAP instruction is quite different when used */
/* different when used in the twilight zone. */ /* in the twilight zone. */
/* */ /* */
/* First, no control value cut-in test is performed */ /* First, no control value cut-in test is performed as it would fail */
/* as it would fail anyway. Second, the original */ /* anyway. Second, the original point, i.e. (org_x,org_y) of */
/* point, i.e. (org_x,org_y) of zp0.point, is set */ /* zp0.point, is set to the absolute, unrounded distance found in the */
/* to the absolute, unrounded distance found in */ /* CVT. */
/* the CVT. */
/* */ /* */
/* This is used in the CVT programs of the Microsoft */ /* This is used in the CVT programs of the Microsoft fonts Arial, */
/* fonts Arial, Times, etc., in order to re-adjust */ /* Times, etc., in order to re-adjust some key font heights. It */
/* some key font heights. It allows the use of the */ /* allows the use of the IP instruction in the twilight zone, which */
/* IP instruction in the twilight zone, which */ /* otherwise would be invalid according to the specification. */
/* otherwise would be `illegal' according to the */
/* specification. */
/* */ /* */
/* We implement it with a special sequence for the */ /* We implement it with a special sequence for the twilight zone. */
/* twilight zone. This is a bad hack, but it seems */ /* This is a bad hack, but it seems to work. */
/* to work. */ /* */
/* Confirmed by Greg Hitchcock. */
distance = CUR_Func_read_cvt( cvtEntry ); distance = CUR_Func_read_cvt( cvtEntry );
if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */ if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */
{ {
CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.x ); CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance,
CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.y ), CUR.GS.freeVector.x );
CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance,
CUR.GS.freeVector.y ),
CUR.zp0.cur[point] = CUR.zp0.org[point]; CUR.zp0.cur[point] = CUR.zp0.org[point];
} }
@ -6220,18 +6243,16 @@
cvt_dist = -CUR.GS.single_width_value; cvt_dist = -CUR.GS.single_width_value;
} }
/* XXX: UNDOCUMENTED! -- twilight zone */ /* UNDOCUMENTED! The MS rasterizer does that with */
/* twilight points (confirmed by Greg Hitchcock) */
if ( CUR.GS.gep1 == 0 ) if ( CUR.GS.gep1 == 0 )
{ {
CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x + CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
TT_MulFix14( (FT_UInt32)cvt_dist, TT_MulFix14( (FT_UInt32)cvt_dist,
CUR.GS.freeVector.x ); CUR.GS.freeVector.x );
CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y + CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
TT_MulFix14( (FT_UInt32)cvt_dist, TT_MulFix14( (FT_UInt32)cvt_dist,
CUR.GS.freeVector.y ); CUR.GS.freeVector.y );
CUR.zp1.cur[point] = CUR.zp0.cur[point]; CUR.zp1.cur[point] = CUR.zp0.cur[point];
} }
@ -6306,7 +6327,6 @@
if ( ( CUR.opcode & 16 ) != 0 ) if ( ( CUR.opcode & 16 ) != 0 )
CUR.GS.rp0 = point; CUR.GS.rp0 = point;
/* XXX: UNDOCUMENTED! */
CUR.GS.rp2 = point; CUR.GS.rp2 = point;
} }

View file

@ -896,7 +896,7 @@
} }
#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */ #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
@ -2140,8 +2140,10 @@
} }
} }
} }
else
face->len_buildchar = 0;
#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */ #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
/* now, propagate the subrs, charstrings, and glyphnames tables */ /* now, propagate the subrs, charstrings, and glyphnames tables */
/* to the Type1 data */ /* to the Type1 data */

View file

@ -1,4 +1,4 @@
# Doxyfile 1.7.5 # Doxyfile 1.7.5.1
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project # doxygen (www.doxygen.org) for a project