diff options
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/psaux')
21 files changed, 110 insertions, 50 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/Jamfile b/Build/source/libs/freetype2/freetype-src/src/psaux/Jamfile index 30bcc1c0978..9a13816cb42 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/Jamfile +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/psaux Jamfile # -# Copyright (C) 2001-2019 by +# Copyright (C) 2001-2020 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c index f78adbba3d8..b957158aec2 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h index 2ceb77553b2..50f4834b3f7 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c index 17cccf818b4..172e3b23a3c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -330,7 +330,7 @@ builder->left_bearing.x = 0; builder->left_bearing.y = 0; - builder->pos_x = adx - asb; + builder->pos_x = SUB_LONG( adx, asb ); builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ @@ -530,6 +530,9 @@ builder->path_begun = 0; + if ( !charstring_base ) + return FT_Err_Ok; + zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h index a6691979f0c..5dc968b255c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk index bb0886abdfc..651db014263 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c index 1db04625514..96d2484e9d8 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psaux.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript driver component (body only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h index 523e1886c22..df8b09ff78a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c index 5df8e690561..bb520792e00 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h index a0eda0bfc03..6e2eb670424 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c index c88761681cc..c813a0596ca 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h index 6b24bf6fc95..2cd5c60e4b2 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c index 54be4683430..50b40bf8fe1 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c @@ -313,7 +313,7 @@ FT_Error error = FT_Err_Ok; CF2_Font font; - FT_Bool is_t1 = decoder->builder.is_t1; + FT_Bool is_t1 = decoder->builder.is_t1; FT_ASSERT( decoder && @@ -385,7 +385,7 @@ FT_ZERO( &buf ); buf.start = buf.ptr = charstring_base; - buf.end = charstring_base + charstring_len; + buf.end = FT_OFFSET( charstring_base, charstring_len ); FT_ZERO( &transform ); @@ -697,7 +697,7 @@ FT_ASSERT( charstring + len >= charstring ); buf->start = charstring; - buf->end = charstring + len; + buf->end = FT_OFFSET( charstring, len ); buf->ptr = buf->start; return FT_Err_Ok; @@ -820,7 +820,7 @@ /* The CID driver stores subroutines with seed bytes. This */ /* case is taken care of when decoder->subrs_len == 0. */ if ( decoder->locals_len ) - buf->end = buf->start + decoder->locals_len[idx]; + buf->end = FT_OFFSET( buf->start, decoder->locals_len[idx] ); else { /* We are using subroutines from a CID font. We must adjust */ diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c index e2f3accdd5c..0a841455350 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c @@ -1433,6 +1433,13 @@ lastError = error2; /* pass FreeType error through */ goto exit; } + + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + cf2_interpT2CharString( font, &component, callbacks, @@ -1443,11 +1450,14 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* save the left bearing and width of the base */ - /* character as they will be erased by the next load */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = *decoder->builder.left_bearing; - advance = *decoder->builder.advance; + if ( !haveWidth ) + { + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + } decoder->builder.left_bearing->x = 0; decoder->builder.left_bearing->y = 0; @@ -1473,8 +1483,8 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ *decoder->builder.left_bearing = left_bearing; *decoder->builder.advance = advance; diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c index 8bfdb923327..b37a78832c9 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -214,7 +214,7 @@ } /* add the object to the base block and adjust offset */ - table->elements[idx] = table->block + table->cursor; + table->elements[idx] = FT_OFFSET( table->block, table->cursor ); table->lengths [idx] = length; FT_MEM_COPY( table->block + table->cursor, object, length ); @@ -2577,7 +2577,7 @@ FT_UShort seed ) { PS_Conv_EexecDecode( &buffer, - buffer + length, + FT_OFFSET( buffer, length ), buffer, length, &seed ); diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h index c44dc450ec6..d37638d0ca2 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk index 2de734d5474..f49aecbc794 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2019 by +# Copyright (C) 1996-2020 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c index d62d2d5c816..451b2765373 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h index d325e7b5a65..5411913831f 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c index c2b3729b539..fa1745d9e01 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -367,6 +367,12 @@ FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + /* the seac operator must not be nested */ decoder->seac = TRUE; error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index ); @@ -374,11 +380,14 @@ if ( error ) goto Exit; - /* save the left bearing and width of the base character */ - /* as they will be erased by the next load. */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = decoder->builder.left_bearing; - advance = decoder->builder.advance; + if ( decoder->builder.parse_state != T1_Parse_Have_Width ) + { + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + } decoder->builder.left_bearing.x = 0; decoder->builder.left_bearing.y = 0; @@ -396,8 +405,8 @@ if ( error ) goto Exit; - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ decoder->builder.left_bearing = left_bearing; decoder->builder.advance = advance; @@ -650,10 +659,8 @@ if ( value > 32000 || value < -32000 ) { if ( large_int ) - { FT_ERROR(( "t1_decoder_parse_charstrings:" " no `div' after large integer\n" )); - } else large_int = TRUE; } @@ -1690,6 +1697,7 @@ FT_Byte* ip; FT_Byte* limit; T1_Builder builder = &decoder->builder; + FT_Bool large_int; #ifdef FT_DEBUG_LEVEL_TRACE FT_Bool bol = TRUE; @@ -1707,6 +1715,8 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; + large_int = FALSE; + /* now, execute loop */ while ( ip < limit ) { @@ -1767,6 +1777,9 @@ case 7: op = op_sbw; break; + case 12: + op = op_div; + break; default: goto No_Width; @@ -1796,13 +1809,19 @@ /* anyway. */ if ( value > 32000 || value < -32000 ) { - FT_ERROR(( "t1_decoder_parse_metrics:" - " large integer found for width\n" )); - goto Syntax_Error; + if ( large_int ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + else + large_int = TRUE; } else { - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } break; @@ -1827,7 +1846,8 @@ value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); } - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } else { @@ -1837,6 +1857,13 @@ } } + if ( large_int && !( op == op_none || op == op_div ) ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + /********************************************************************** * * Push value on stack, or process operator @@ -1851,6 +1878,9 @@ } #ifdef FT_DEBUG_LEVEL_TRACE + if ( large_int ) + FT_TRACE4(( " %d", value )); + else FT_TRACE4(( " %d", value / 65536 )); #endif @@ -1869,11 +1899,14 @@ #ifdef FT_DEBUG_LEVEL_TRACE - if ( top - decoder->stack != num_args ) - FT_TRACE0(( "t1_decoder_parse_metrics:" - " too much operands on the stack" - " (seen %d, expected %d)\n", - top - decoder->stack, num_args )); + if ( op != op_div ) + { + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %d, expected %d)\n", + top - decoder->stack, num_args )); + } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -1917,12 +1950,26 @@ FT_TRACE4(( "\n" )); return FT_Err_Ok; + case op_div: + FT_TRACE4(( " div" )); + + /* if `large_int' is set, we divide unscaled numbers; */ + /* otherwise, we divide numbers in 16.16 format -- */ + /* in both cases, it is the same operation */ + *top = FT_DivFix( top[0], top[1] ); + top++; + + large_int = FALSE; + break; + default: FT_ERROR(( "t1_decoder_parse_metrics:" " unhandled opcode %d\n", op )); goto Syntax_Error; } + decoder->top = top; + } /* general operator processing */ } /* while ip < limit */ diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h index 1b5d6263d37..231947e852d 100644 --- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h +++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, |