| Index: third_party/freetype/src/cff/cf2ft.c
|
| diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c b/third_party/freetype/src/cff/cf2ft.c
|
| similarity index 88%
|
| rename from core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c
|
| rename to third_party/freetype/src/cff/cf2ft.c
|
| index 7f82b247af28094df42b5c26d714d6cfedbfe2f2..ebba4694ce8339e1d37af9f1023d42d59ad2ff37 100644
|
| --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/cff/cf2ft.c
|
| +++ b/third_party/freetype/src/cff/cf2ft.c
|
| @@ -4,7 +4,7 @@
|
| /* */
|
| /* FreeType Glue Component to Adobe's Interpreter (body). */
|
| /* */
|
| -/* Copyright 2013 Adobe Systems Incorporated. */
|
| +/* Copyright 2013-2014 Adobe Systems Incorporated. */
|
| /* */
|
| /* This software, and all works of authorship, whether in source or */
|
| /* object code form as indicated by the copyright notice(s) included */
|
| @@ -37,7 +37,7 @@
|
|
|
|
|
| #include "cf2ft.h"
|
| -#include "../../include/freetype/internal/ftdebug.h"
|
| +#include FT_INTERNAL_DEBUG_H
|
|
|
| #include "cf2font.h"
|
| #include "cf2error.h"
|
| @@ -61,7 +61,9 @@
|
|
|
| FT_ASSERT( unitsPerEm > 0 );
|
|
|
| - FT_ASSERT( transform->a > 0 && transform->d > 0 );
|
| + if ( transform->a <= 0 || transform->d <= 0 )
|
| + return FT_THROW( Invalid_Size_Handle );
|
| +
|
| FT_ASSERT( transform->b == 0 && transform->c == 0 );
|
| FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
|
|
|
| @@ -140,10 +142,11 @@
|
| cf2_builder_lineTo( CF2_OutlineCallbacks callbacks,
|
| const CF2_CallbackParams params )
|
| {
|
| + FT_Error error;
|
| +
|
| /* downcast the object pointer */
|
| CF2_Outline outline = (CF2_Outline)callbacks;
|
| CFF_Builder* builder;
|
| - FT_Error error;
|
|
|
|
|
| FT_ASSERT( outline && outline->decoder );
|
| @@ -155,18 +158,27 @@
|
| {
|
| /* record the move before the line; also check points and set */
|
| /* `path_begun' */
|
| - error = cff_builder_start_point(builder,
|
| - params->pt0.x,
|
| - params->pt0.y );
|
| - if (callbacks && callbacks->error) *callbacks->error = error;
|
| - if (error) return;
|
| + error = cff_builder_start_point( builder,
|
| + params->pt0.x,
|
| + params->pt0.y );
|
| + if ( error )
|
| + {
|
| + if ( !*callbacks->error )
|
| + *callbacks->error = error;
|
| + return;
|
| + }
|
| }
|
|
|
| /* `cff_builder_add_point1' includes a check_points call for one point */
|
| - error = cff_builder_add_point1(builder,
|
| - params->pt1.x,
|
| - params->pt1.y );
|
| - if (callbacks && callbacks->error) *callbacks->error = error;
|
| + error = cff_builder_add_point1( builder,
|
| + params->pt1.x,
|
| + params->pt1.y );
|
| + if ( error )
|
| + {
|
| + if ( !*callbacks->error )
|
| + *callbacks->error = error;
|
| + return;
|
| + }
|
| }
|
|
|
|
|
| @@ -174,10 +186,11 @@
|
| cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks,
|
| const CF2_CallbackParams params )
|
| {
|
| + FT_Error error;
|
| +
|
| /* downcast the object pointer */
|
| CF2_Outline outline = (CF2_Outline)callbacks;
|
| CFF_Builder* builder;
|
| - FT_Error error;
|
|
|
|
|
| FT_ASSERT( outline && outline->decoder );
|
| @@ -190,16 +203,24 @@
|
| /* record the move before the line; also check points and set */
|
| /* `path_begun' */
|
| error = cff_builder_start_point( builder,
|
| - params->pt0.x,
|
| - params->pt0.y );
|
| - if (callbacks && callbacks->error) *callbacks->error = error;
|
| - if (error) return;
|
| + params->pt0.x,
|
| + params->pt0.y );
|
| + if ( error )
|
| + {
|
| + if ( !*callbacks->error )
|
| + *callbacks->error = error;
|
| + return;
|
| + }
|
| }
|
|
|
| /* prepare room for 3 points: 2 off-curve, 1 on-curve */
|
| error = cff_check_points( builder, 3 );
|
| - if (callbacks && callbacks->error) *callbacks->error = error;
|
| - if (error) return;
|
| + if ( error )
|
| + {
|
| + if ( !*callbacks->error )
|
| + *callbacks->error = error;
|
| + return;
|
| + }
|
|
|
| cff_builder_add_point( builder,
|
| params->pt1.x,
|
| @@ -245,10 +266,8 @@
|
|
|
| if ( *hinted )
|
| {
|
| - *x_scale = FT_DivFix( decoder->builder.glyph->x_scale,
|
| - cf2_intToFixed( 64 ) );
|
| - *y_scale = FT_DivFix( decoder->builder.glyph->y_scale,
|
| - cf2_intToFixed( 64 ) );
|
| + *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
|
| + *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
|
| }
|
| else
|
| {
|
| @@ -353,13 +372,25 @@
|
| if ( scaled && !driver->no_stem_darkening )
|
| font->renderingFlags |= CF2_FlagsDarkened;
|
|
|
| + font->darkenParams[0] = driver->darken_params[0];
|
| + font->darkenParams[1] = driver->darken_params[1];
|
| + font->darkenParams[2] = driver->darken_params[2];
|
| + font->darkenParams[3] = driver->darken_params[3];
|
| + font->darkenParams[4] = driver->darken_params[4];
|
| + font->darkenParams[5] = driver->darken_params[5];
|
| + font->darkenParams[6] = driver->darken_params[6];
|
| + font->darkenParams[7] = driver->darken_params[7];
|
| +
|
| /* now get an outline for this glyph; */
|
| /* also get units per em to validate scale */
|
| font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
|
|
|
| - error2 = cf2_checkTransform( &transform, font->unitsPerEm );
|
| - if ( error2 )
|
| - return error2;
|
| + if ( scaled )
|
| + {
|
| + error2 = cf2_checkTransform( &transform, font->unitsPerEm );
|
| + if ( error2 )
|
| + return error2;
|
| + }
|
|
|
| error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
|
| if ( error2 )
|
| @@ -389,8 +420,16 @@
|
| FT_ASSERT( decoder &&
|
| decoder->builder.face &&
|
| decoder->builder.face->root.size );
|
| - FT_ASSERT( decoder->builder.face->root.size->metrics.y_ppem );
|
|
|
| + /*
|
| + * Note that `y_ppem' can be zero if there wasn't a call to
|
| + * `FT_Set_Char_Size' or something similar. However, this isn't a
|
| + * problem since we come to this place in the code only if
|
| + * FT_LOAD_NO_SCALE is set (the other case gets caught by
|
| + * `cf2_checkTransform'). The ppem value is needed to compute the stem
|
| + * darkening, which is disabled for getting the unscaled outline.
|
| + *
|
| + */
|
| return cf2_intToFixed(
|
| decoder->builder.face->root.size->metrics.y_ppem );
|
| }
|
| @@ -508,7 +547,7 @@
|
| CF2_UInt idx,
|
| CF2_Buffer buf )
|
| {
|
| - FT_ASSERT( decoder && decoder->globals );
|
| + FT_ASSERT( decoder );
|
|
|
| FT_ZERO( buf );
|
|
|
| @@ -516,6 +555,8 @@
|
| if ( idx >= decoder->num_globals )
|
| return TRUE; /* error */
|
|
|
| + FT_ASSERT( decoder->globals );
|
| +
|
| buf->start =
|
| buf->ptr = decoder->globals[idx];
|
| buf->end = decoder->globals[idx + 1];
|
| @@ -581,7 +622,7 @@
|
| CF2_UInt idx,
|
| CF2_Buffer buf )
|
| {
|
| - FT_ASSERT( decoder && decoder->locals );
|
| + FT_ASSERT( decoder );
|
|
|
| FT_ZERO( buf );
|
|
|
| @@ -589,6 +630,8 @@
|
| if ( idx >= decoder->num_locals )
|
| return TRUE; /* error */
|
|
|
| + FT_ASSERT( decoder->locals );
|
| +
|
| buf->start =
|
| buf->ptr = decoder->locals[idx];
|
| buf->end = decoder->locals[idx + 1];
|
|
|