[truetype] More fixes for GX.

This finally fixes the rendering of the cyclist and the lizard in
the `Zycon' font.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point
index is always cumulative.

(tt_handle_deltas): Rename to...
(tt_interpolate_deltas): ... This.
Add new parameter for output point array.
Update caller.

(TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds
the intermediate results of `tt_interpolate_deltas' that are to be
added to `outline->points'.
This commit is contained in:
Werner Lemberg 2016-07-16 07:06:21 +02:00
parent aafff57428
commit f147fb2881
2 changed files with 44 additions and 14 deletions

View File

@ -1,3 +1,22 @@
2016-07-14 Behdad Esfahbod <behdad@behdad.org>
[truetype] More fixes for GX.
This finally fixes the rendering of the cyclist and the lizard in
the `Zycon' font.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point
index is always cumulative.
(tt_handle_deltas): Rename to...
(tt_interpolate_deltas): ... This.
Add new parameter for output point array.
Update caller.
(TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds
the intermediate results of `tt_interpolate_deltas' that are to be
added to `outline->points'.
2016-07-15 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko.

View File

@ -163,6 +163,7 @@
*point_cnt = n;
first = 0;
i = 0;
while ( i < n )
{
@ -170,7 +171,7 @@
if ( runcnt & GX_PT_POINTS_ARE_WORDS )
{
runcnt &= GX_PT_POINT_RUN_COUNT_MASK;
first = FT_GET_USHORT();
first += FT_GET_USHORT();
points[i++] = first;
if ( runcnt < 1 || i + runcnt > n )
@ -185,7 +186,7 @@
}
else
{
first = FT_GET_BYTE();
first += FT_GET_BYTE();
points[i++] = first;
if ( runcnt < 1 || i + runcnt > n )
@ -1716,12 +1717,11 @@
/* modeled after `Ins_IUP */
static void
tt_handle_deltas( FT_Outline* outline,
FT_Vector* in_points,
FT_Bool* has_delta )
tt_interpolate_deltas( FT_Outline* outline,
FT_Vector* out_points,
FT_Vector* in_points,
FT_Bool* has_delta )
{
FT_Vector* out_points;
FT_Int first_point;
FT_Int end_point;
@ -1736,8 +1736,6 @@
if ( !outline->n_contours )
return;
out_points = outline->points;
contour = 0;
point = 0;
@ -1841,6 +1839,7 @@
GX_Blend blend = face->blend;
FT_Vector* points_org = NULL;
FT_Vector* points_out = NULL;
FT_Bool* has_delta = NULL;
FT_Error error;
@ -1872,6 +1871,7 @@
}
if ( FT_NEW_ARRAY( points_org, n_points ) ||
FT_NEW_ARRAY( points_out, n_points ) ||
FT_NEW_ARRAY( has_delta, n_points ) )
goto Fail1;
@ -2060,7 +2060,10 @@
/* we have to interpolate the missing deltas similar to the */
/* IUP bytecode instruction */
for ( j = 0; j < n_points; j++ )
{
has_delta[j] = FALSE;
points_out[j] = points_org[j];
}
for ( j = 0; j < point_count; j++ )
{
@ -2072,15 +2075,22 @@
has_delta[idx] = TRUE;
outline->points[idx].x += FT_MulFix( deltas_x[j], apply );
outline->points[idx].y += FT_MulFix( deltas_y[j], apply );
points_out[idx].x += FT_MulFix( deltas_x[j], apply );
points_out[idx].y += FT_MulFix( deltas_y[j], apply );
}
/* no need to handle phantom points here, */
/* since solitary points can't be interpolated */
tt_handle_deltas( outline,
points_org,
has_delta );
tt_interpolate_deltas( outline,
points_out,
points_org,
has_delta );
for ( j = 0; j < n_points; j++ )
{
outline->points[j].x += points_out[j].x - points_org[j].x;
outline->points[j].y += points_out[j].y - points_org[j].y;
}
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE7(( " point deltas:\n" ));
@ -2128,6 +2138,7 @@
Fail1:
FT_FREE( points_org );
FT_FREE( points_out );
FT_FREE( has_delta );
return error;