[truetype] Don't apply HVAR and VVAR deltas twice (#52683).

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust
`pp1' to `pp4', except if we have an HVAR and/or VVAR table.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle
alternative code branch identically w.r.t. presence of an HVAR
and/or VVAR table.
This commit is contained in:
Werner Lemberg 2017-12-18 07:29:57 +01:00
parent 361af72eea
commit e7935f2910
3 changed files with 54 additions and 2 deletions

View File

@ -1,3 +1,14 @@
2017-12-18 Werner Lemberg <wl@gnu.org>
[truetype] Don't apply HVAR and VVAR deltas twice (#52683).
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust
`pp1' to `pp4', except if we have an HVAR and/or VVAR table.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle
alternative code branch identically w.r.t. presence of an HVAR
and/or VVAR table.
2017-12-17 Jonathan Kew <jfkthame@gmail.com>
[truetype] Correctly handle variation font phantom points (#52683).

View File

@ -1037,9 +1037,22 @@
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
}
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */
if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
#endif
{
loader->pp1 = outline->points[n_points - 4];
loader->pp2 = outline->points[n_points - 3];
}
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */
if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
#endif
{
loader->pp3 = outline->points[n_points - 2];
loader->pp4 = outline->points[n_points - 1];
}

View File

@ -3725,8 +3725,36 @@
FT_Pos delta_y = points_out[j].y - points_org[j].y;
outline->points[j].x += delta_x;
outline->points[j].y += delta_y;
if ( j < n_points - 4 )
{
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 - 4 ) &&
!( face->variation_support &
TT_FACE_FLAG_VAR_LSB ) )
outline->points[j].x += delta_x;
else if ( j == ( n_points - 3 ) &&
!( face->variation_support &
TT_FACE_FLAG_VAR_HADVANCE ) )
outline->points[j].x += delta_x;
else if ( j == ( n_points - 2 ) &&
!( face->variation_support &
TT_FACE_FLAG_VAR_TSB ) )
outline->points[j].y += delta_y;
else if ( j == ( n_points - 1 ) &&
!( face->variation_support &
TT_FACE_FLAG_VAR_VADVANCE ) )
outline->points[j].y += delta_y;
}
#ifdef FT_DEBUG_LEVEL_TRACE
if ( delta_x || delta_y )