[sdf] Fix SDF positioning.

* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
`bitmap_top' and `bitmap_left'.

* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
This commit is contained in:
Alexei Podtelezhnikov 2021-06-09 10:40:30 -04:00
parent 8dc02fb999
commit 7833e308ef
3 changed files with 22 additions and 8 deletions

View File

@ -1,3 +1,12 @@
2021-06-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[sdf] Fix SDF positioning.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
`bitmap_top' and `bitmap_left'.
* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
2021-06-08 Werner Lemberg <wl@gnu.org>
Fix 'devel' build for COLR 'v1'.

View File

@ -3520,6 +3520,11 @@
if ( !shape || !bitmap || !shape->memory )
return FT_THROW( Invalid_Argument );
/* Disable `flip_sign` to avoid extra complication */
/* during the combination phase. */
flip_sign = internal_params.flip_sign;
internal_params.flip_sign = 0;
contour = shape->contours;
memory = shape->memory;
temp_shape.memory = memory;
@ -3544,11 +3549,6 @@
(FT_UInt)num_contours * sizeof ( *orientations ) ) )
goto Exit;
/* Disable `flip_sign` to avoid extra complication */
/* during the combination phase. */
flip_sign = internal_params.flip_sign;
internal_params.flip_sign = 0;
contour = shape->contours;
/* Iterate over all contours and generate SDF separately. */

View File

@ -323,8 +323,11 @@
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
x_shift = 64 * -( slot->bitmap_left - x_pad );
y_shift = 64 * -( slot->bitmap_top + y_pad );
slot->bitmap_top += y_pad;
slot->bitmap_left -= x_pad;
x_shift = 64 * -slot->bitmap_left;
y_shift = 64 * -slot->bitmap_top;
y_shift += 64 * (FT_Int)bitmap->rows;
if ( origin )
@ -520,7 +523,7 @@
y_pad = sdf_module->spread;
/* apply padding, which extends to all directions */
target.rows = bitmap->rows + y_pad * 2;
target.rows = bitmap->rows + y_pad * 2;
target.width = bitmap->width + x_pad * 2;
/* set up the target bitmap */
@ -553,6 +556,8 @@
}
slot->bitmap = target;
slot->bitmap_top += y_pad;
slot->bitmap_left -= x_pad;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
}
else if ( target.buffer )