diff options
Diffstat (limited to 'src/3rdparty/freetype/src/cff/cffparse.c')
-rw-r--r-- | src/3rdparty/freetype/src/cff/cffparse.c | 548 |
1 files changed, 401 insertions, 147 deletions
diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c index 01266a193d..c79ab623dc 100644 --- a/src/3rdparty/freetype/src/cff/cffparse.c +++ b/src/3rdparty/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009 by */ +/* Copyright 1996-2004, 2007-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,8 +35,6 @@ #define FT_COMPONENT trace_cffparse - - FT_LOCAL_DEF( void ) cff_parser_init( CFF_Parser parser, FT_UInt code, @@ -67,19 +65,17 @@ if ( p + 2 > limit ) goto Bad; - val = (FT_Short)( ( (FT_Int)p[0] << 8 ) | p[1] ); - p += 2; + val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] ); } else if ( v == 29 ) { if ( p + 4 > limit ) goto Bad; - val = ( (FT_Long)p[0] << 24 ) | - ( (FT_Long)p[1] << 16 ) | - ( (FT_Long)p[2] << 8 ) | - p[3]; - p += 4; + val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) | + ( (FT_ULong)p[1] << 16 ) | + ( (FT_ULong)p[2] << 8 ) | + (FT_ULong)p[3] ); } else if ( v < 247 ) { @@ -91,7 +87,6 @@ goto Bad; val = ( v - 247 ) * 256 + p[0] + 108; - p++; } else { @@ -99,7 +94,6 @@ goto Bad; val = -( v - 251 ) * 256 - p[0] - 108; - p++; } Exit: @@ -107,6 +101,7 @@ Bad: val = 0; + FT_TRACE4(( "!!!END OF DATA:!!!" )); goto Exit; } @@ -137,26 +132,23 @@ FT_UInt nib; FT_UInt phase; - FT_Long result, number, rest, exponent; - FT_Int sign = 0, exponent_sign = 0; + FT_Long result, number, exponent; + FT_Int sign = 0, exponent_sign = 0, have_overflow = 0; FT_Long exponent_add, integer_length, fraction_length; if ( scaling ) - *scaling = 0; + *scaling = 0; result = 0; number = 0; - rest = 0; exponent = 0; exponent_add = 0; integer_length = 0; fraction_length = 0; - FT_UNUSED( rest ); - /* First of all, read the integer part. */ phase = 4; @@ -170,7 +162,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -196,7 +188,7 @@ } /* Read fraction part, if any. */ - if ( nib == 0xa ) + if ( nib == 0xA ) for (;;) { /* If we entered this iteration with phase == 4, we need */ @@ -207,7 +199,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -246,7 +238,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -255,17 +247,28 @@ if ( nib >= 10 ) break; - exponent = exponent * 10 + nib; - /* Arbitrarily limit exponent. */ if ( exponent > 1000 ) - goto Exit; + have_overflow = 1; + else + exponent = exponent * 10 + nib; } if ( exponent_sign ) exponent = -exponent; } + if ( !number ) + goto Exit; + + if ( have_overflow ) + { + if ( exponent_sign ) + goto Underflow; + else + goto Overflow; + } + /* We don't check `power_ten' and `exponent_add'. */ exponent += power_ten + exponent_add; @@ -291,20 +294,25 @@ /* Make `scaling' as small as possible. */ new_fraction_length = FT_MIN( exponent, 5 ); - exponent -= new_fraction_length; shift = new_fraction_length - fraction_length; - number *= power_tens[shift]; - if ( number > 0x7FFFL ) + if ( shift > 0 ) { - number /= 10; - exponent += 1; + exponent -= new_fraction_length; + number *= power_tens[shift]; + if ( number > 0x7FFFL ) + { + number /= 10; + exponent += 1; + } } + else + exponent -= fraction_length; } else exponent -= fraction_length; - result = number << 16; + result = (FT_Long)( (FT_ULong)number << 16 ); *scaling = exponent; } } @@ -327,16 +335,25 @@ integer_length += exponent; fraction_length -= exponent; - /* Check for overflow and underflow. */ - if ( FT_ABS( integer_length ) > 5 ) - goto Exit; + if ( integer_length > 5 ) + goto Overflow; + if ( integer_length < -5 ) + goto Underflow; /* Remove non-significant digits. */ - if ( integer_length < 0 ) { + if ( integer_length < 0 ) + { number /= power_tens[-integer_length]; fraction_length += integer_length; } + /* this can only happen if exponent was non-zero */ + if ( fraction_length == 10 ) + { + number /= 10; + fraction_length -= 1; + } + /* Convert into 16.16 format. */ if ( fraction_length > 0 ) { @@ -350,17 +367,32 @@ number *= power_tens[-fraction_length]; if ( number > 0x7FFFL ) - goto Exit; + goto Overflow; - result = number << 16; + result = (FT_Long)( (FT_ULong)number << 16 ); } } + Exit: if ( sign ) result = -result; - Exit: return result; + + Overflow: + result = 0x7FFFFFFFL; + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + goto Exit; + + Underflow: + result = 0; + FT_TRACE4(( "!!!UNDERFLOW:!!!" )); + goto Exit; + + Bad: + result = 0; + FT_TRACE4(( "!!!END OF DATA:!!!" )); + goto Exit; } @@ -375,10 +407,44 @@ /* read a floating point number, either integer or real */ static FT_Fixed + do_fixed( FT_Byte** d, + FT_Long scaling ) + { + if ( **d == 30 ) + return cff_parse_real( d[0], d[1], scaling, NULL ); + else + { + FT_Long val = cff_parse_integer( d[0], d[1] ); + + + if ( scaling ) + val *= power_tens[scaling]; + + if ( val > 0x7FFF ) + { + val = 0x7FFFFFFFL; + goto Overflow; + } + else if ( val < -0x7FFF ) + { + val = -0x7FFFFFFFL; + goto Overflow; + } + + return (FT_Long)( (FT_ULong)val << 16 ); + + Overflow: + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + return val; + } + } + + + /* read a floating point number, either integer or real */ + static FT_Fixed cff_parse_fixed( FT_Byte** d ) { - return **d == 30 ? cff_parse_real( d[0], d[1], 0, NULL ) - : cff_parse_integer( d[0], d[1] ) << 16; + return do_fixed( d, 0 ); } @@ -388,9 +454,7 @@ cff_parse_fixed_scaled( FT_Byte** d, FT_Long scaling ) { - return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL ) - : ( cff_parse_integer( d[0], d[1] ) * - power_tens[scaling] ) << 16; + return do_fixed( d, scaling ); } @@ -433,7 +497,7 @@ else { *scaling = 0; - return number << 16; + return (FT_Long)( (FT_ULong)number << 16 ); } } } @@ -447,7 +511,7 @@ FT_Vector* offset = &dict->font_offset; FT_ULong* upm = &dict->units_per_em; FT_Byte** data = parser->stack; - FT_Error error = CFF_Err_Stack_Underflow; + FT_Error error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 6 ) @@ -455,7 +519,9 @@ FT_Long scaling; - error = CFF_Err_Ok; + error = FT_Err_Ok; + + dict->has_font_matrix = TRUE; /* We expect a well-formed font matrix, this is, the matrix elements */ /* `xx' and `yy' are of approximately the same magnitude. To avoid */ @@ -470,9 +536,15 @@ if ( scaling < 0 || scaling > 9 ) { /* 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->yx = 0; - matrix->yx = 0; + matrix->xy = 0; matrix->yy = 0x10000L; offset->x = 0; offset->y = 0; @@ -488,6 +560,14 @@ offset->y = cff_parse_fixed_scaled( data, scaling ); *upm = power_tens[scaling]; + + FT_TRACE4(( " [%f %f %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, + (double)offset->x / *upm / 65536, + (double)offset->y / *upm / 65536 )); } Exit: @@ -504,7 +584,7 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 4 ) { @@ -512,7 +592,13 @@ bbox->yMin = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) ); - error = CFF_Err_Ok; + error = FT_Err_Ok; + + FT_TRACE4(( " [%d %d %d %d]\n", + bbox->xMin / 65536, + bbox->yMin / 65536, + bbox->xMax / 65536, + bbox->yMax / 65536 )); } return error; @@ -527,13 +613,16 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 2 ) { dict->private_size = cff_parse_num( data++ ); dict->private_offset = cff_parse_num( data ); - error = CFF_Err_Ok; + FT_TRACE4(( " %lu %lu\n", + dict->private_size, dict->private_offset )); + + error = FT_Err_Ok; } return error; @@ -548,73 +637,83 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 3 ) { - dict->cid_registry = (FT_UInt)cff_parse_num ( data++ ); - dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ ); + dict->cid_registry = (FT_UInt)cff_parse_num( data++ ); + dict->cid_ordering = (FT_UInt)cff_parse_num( data++ ); if ( **data == 30 ) FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" )); dict->cid_supplement = cff_parse_num( data ); if ( dict->cid_supplement < 0 ) FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n", dict->cid_supplement )); - error = CFF_Err_Ok; + error = FT_Err_Ok; + + FT_TRACE4(( " %d %d %d\n", + dict->cid_registry, + dict->cid_ordering, + dict->cid_supplement )); } return error; } -#define CFF_FIELD_NUM( code, name ) \ - CFF_FIELD( code, name, cff_kind_num ) -#define CFF_FIELD_FIXED( code, name ) \ - CFF_FIELD( code, name, cff_kind_fixed ) -#define CFF_FIELD_FIXED_1000( code, name ) \ - CFF_FIELD( code, name, cff_kind_fixed_thousand ) -#define CFF_FIELD_STRING( code, name ) \ - CFF_FIELD( code, name, cff_kind_string ) -#define CFF_FIELD_BOOL( code, name ) \ - CFF_FIELD( code, name, cff_kind_bool ) -#define CFF_FIELD_DELTA( code, name, max ) \ - CFF_FIELD( code, name, cff_kind_delta ) +#define CFF_FIELD_NUM( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_num ) +#define CFF_FIELD_FIXED( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_fixed ) +#define CFF_FIELD_FIXED_1000( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_fixed_thousand ) +#define CFF_FIELD_STRING( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_string ) +#define CFF_FIELD_BOOL( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_bool ) #define CFFCODE_TOPDICT 0x1000 #define CFFCODE_PRIVATE 0x2000 + #ifndef FT_CONFIG_OPTION_PIC -#define CFF_FIELD_CALLBACK( code, name ) \ - { \ - cff_kind_callback, \ - code | CFFCODE, \ - 0, 0, \ - cff_parse_ ## name, \ - 0, 0 \ - }, #undef CFF_FIELD -#define CFF_FIELD( code, name, kind ) \ - { \ - kind, \ - code | CFFCODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE( name ), \ - 0, 0, 0 \ +#undef CFF_FIELD_DELTA + + +#ifndef FT_DEBUG_LEVEL_TRACE + + +#define CFF_FIELD_CALLBACK( code, name, id ) \ + { \ + cff_kind_callback, \ + code | CFFCODE, \ + 0, 0, \ + cff_parse_ ## name, \ + 0, 0 \ }, -#undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code, name, max ) \ - { \ - cff_kind_delta, \ - code | CFFCODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE_DELTA( name ), \ - 0, \ - max, \ - FT_FIELD_OFFSET( num_ ## name ) \ - }, +#define CFF_FIELD( code, name, id, kind ) \ + { \ + kind, \ + code | CFFCODE, \ + FT_FIELD_OFFSET( name ), \ + FT_FIELD_SIZE( name ), \ + 0, 0, 0 \ + }, + +#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 ) \ + }, static const CFF_Field_Handler cff_field_handlers[] = { @@ -625,83 +724,200 @@ }; +#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 */ - 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 ) 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; - FT_Error error; - FT_Memory memory = library->memory; - int i=0; + CFF_Field_Handler* clazz = NULL; + FT_Error error; + FT_Memory memory = library->memory; + + int i = 0; + #undef CFF_FIELD +#define CFF_FIELD( code, name, id, kind ) i++; #undef CFF_FIELD_DELTA +#define CFF_FIELD_DELTA( code, name, max, id ) i++; #undef CFF_FIELD_CALLBACK -#define CFF_FIELD_CALLBACK( code, name ) i++; -#define CFF_FIELD( code, name, kind ) i++; -#define CFF_FIELD_DELTA( code, name, max ) i++; +#define CFF_FIELD_CALLBACK( code, name, id ) i++; #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; - i=0; -#undef CFF_FIELD -#undef CFF_FIELD_DELTA + i = 0; + + +#ifndef 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; \ + 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; \ + 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_ ); \ + 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; -#define CFF_FIELD_CALLBACK( code_, name_ ) \ - 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; \ - i++; + +#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_, 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; \ - i++; \ +#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_ ) \ - 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_ ); \ - i++; +#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].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; + return FT_Err_Ok; } @@ -715,9 +931,9 @@ FT_Byte* limit ) { FT_Byte* p = start; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Library library = parser->library; - FT_UNUSED(library); + FT_UNUSED( library ); parser->top = parser->stack; @@ -789,7 +1005,7 @@ } code = code | parser->object_code; - for ( field = FT_CFF_FIELD_HANDLERS_GET; field->kind; field++ ) + for ( field = CFF_FIELD_HANDLERS_GET; field->kind; field++ ) { if ( field->code == (FT_Int)code ) { @@ -798,6 +1014,10 @@ 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 */ /* delta encoded arrays, which can be empty */ if ( field->kind != cff_kind_delta && num_args < 1 ) @@ -836,6 +1056,34 @@ default: /* for 64-bit systems */ *(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; case cff_kind_delta: @@ -849,6 +1097,8 @@ if ( num_args > field->array_max ) num_args = field->array_max; + FT_TRACE4(( " [" )); + /* store count */ *qcount = (FT_Byte)num_args; @@ -874,9 +1124,13 @@ *(FT_Long*)q = val; } + FT_TRACE4(( " %ld", val )); + q += field->size; num_args--; } + + FT_TRACE4(( "]\n" )); } break; @@ -903,15 +1157,15 @@ return error; Stack_Overflow: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; Stack_Underflow: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; Syntax_Error: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } |