From d44daf9e9b3b3f14f3e813a9aaa6dc6ce375c4d4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 21 Dec 2016 23:03:48 +0100 Subject: [PATCH] * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. Don't apply deltas twice for non-phantom points. Spotted by Ben Wagner. --- ChangeLog | 8 ++++++++ src/autofit/afglobal.c | 13 ++----------- src/base/ftmm.c | 28 ++++++++++++++++++++++++++++ src/truetype/ttgxvar.c | 42 ++++++++++++++++++++++++++++-------------- 4 files changed, 66 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b710867a..8496616c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-12-21 Werner Lemberg + + * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. + + Don't apply deltas twice for non-phantom points. + + Spotted by Ben Wagner. + 2016-12-21 Werner Lemberg [cff, truetype] Another try for #49829. diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index ac6dcafc0..db070e768 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -417,17 +417,8 @@ globals->hb_buf = NULL; #endif - globals->glyph_count = 0; - globals->stem_darkening_for_ppem = 0; - globals->darken_x = 0; - globals->darken_y = 0; - globals->standard_vertical_width = 0; - globals->standard_horizontal_width = 0; - globals->scale_down_factor = 0; - /* no need to free this one! */ - globals->glyph_styles = NULL; - globals->face = NULL; - + /* no need to free `globals->glyph_styles'; */ + /* it is part of the `globals' array */ FT_FREE( globals ); } } diff --git a/src/base/ftmm.c b/src/base/ftmm.c index c3528035d..1b724ace6 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -140,6 +140,13 @@ error = service->set_mm_design( face, num_coords, coords ); } + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + return error; } @@ -168,6 +175,13 @@ error = service->set_var_design( face, num_coords, coords ); } + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + return error; } @@ -224,6 +238,13 @@ error = service->set_mm_blend( face, num_coords, coords ); } + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + return error; } @@ -255,6 +276,13 @@ error = service->set_mm_blend( face, num_coords, coords ); } + /* enforce recomputation of auto-hinting data */ + if ( !error && face->autohint.finalizer ) + { + face->autohint.finalizer( face->autohint.data ); + face->autohint.data = NULL; + } + return error; } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 3b73283c9..5a74ae75a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2616,22 +2616,36 @@ FT_Pos delta_y = FT_MulFix( deltas_y[j], apply ); - /* To avoid double adjustment of advance width or height, */ - /* adjust phantom points only if there is no HVAR or VVAR */ - /* table, respectively. */ - if ( j != ( n_points - 3 ) || - !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) - outline->points[j].x += delta_x; - if ( j != ( n_points - 2 ) || - !( face->variation_support & TT_FACE_FLAG_VAR_LSB ) ) + if ( j < n_points - 3 ) + { outline->points[j].x += delta_x; + outline->points[j].y += delta_y; + } + else + { + /* To avoid double adjustment of advance width or height, */ + /* adjust phantom points only if there is no HVAR or VVAR */ + /* support, respectively. */ + if ( j == ( n_points - 3 ) || + !( face->variation_support & + TT_FACE_FLAG_VAR_HADVANCE ) ) + outline->points[j].x += delta_x; - if ( j != ( n_points - 1 ) || - !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) - outline->points[j].y += delta_y; - if ( j != ( n_points - 0 ) || - !( face->variation_support & TT_FACE_FLAG_VAR_TSB ) ) - outline->points[j].y += delta_y; + else if ( j == ( n_points - 2 ) || + !( face->variation_support & + TT_FACE_FLAG_VAR_LSB ) ) + outline->points[j].x += delta_x; + + else if ( j == ( n_points - 1 ) || + !( face->variation_support & + TT_FACE_FLAG_VAR_VADVANCE ) ) + outline->points[j].y += delta_y; + + else if ( j == ( n_points - 0 ) || + !( face->variation_support & + TT_FACE_FLAG_VAR_TSB ) ) + outline->points[j].y += delta_y; + } #ifdef FT_DEBUG_LEVEL_TRACE if ( delta_x || delta_y )