[sdf] Correct handling of empty glyphs.
This is a refinement of commit 7b3ebb9
.
* src/sdf/ftsdfrend.c (ft_sdf_render): Goto 'Exit' instead of directly
returning.
(fd_bsdf_render): Ditto, also taking care of setting `FT_GLYPH_OWN_BITMAP`
correctly.
This commit is contained in:
parent
4e1c0e8fba
commit
86d0ca245a
|
@ -300,7 +300,7 @@
|
|||
|
||||
/* nothing to render */
|
||||
if ( !bitmap->rows || !bitmap->pitch )
|
||||
return FT_Err_Ok;
|
||||
goto Exit;
|
||||
|
||||
/* the padding will simply be equal to the `spread' */
|
||||
x_pad = sdf_module->spread;
|
||||
|
@ -508,6 +508,10 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
/* nothing to render */
|
||||
if ( !bitmap->rows || !bitmap->pitch )
|
||||
goto Exit;
|
||||
|
||||
/* Do not generate SDF if the bitmap is not owned by the */
|
||||
/* glyph: it might be that the source buffer is already freed. */
|
||||
if ( !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
|
||||
|
@ -519,10 +523,6 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
/* nothing to render */
|
||||
if ( !bitmap->rows || !bitmap->pitch )
|
||||
return FT_Err_Ok;
|
||||
|
||||
FT_Bitmap_New( &target );
|
||||
|
||||
/* padding will simply be equal to `spread` */
|
||||
|
@ -557,15 +557,14 @@
|
|||
{
|
||||
/* the glyph is successfully converted to a SDF */
|
||||
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
|
||||
{
|
||||
FT_FREE( bitmap->buffer );
|
||||
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
||||
}
|
||||
|
||||
slot->bitmap = target;
|
||||
slot->bitmap_top += y_pad;
|
||||
slot->bitmap_left -= x_pad;
|
||||
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
|
||||
slot->bitmap = target;
|
||||
slot->bitmap_top += y_pad;
|
||||
slot->bitmap_left -= x_pad;
|
||||
|
||||
if ( target.buffer )
|
||||
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
|
||||
}
|
||||
else if ( target.buffer )
|
||||
FT_FREE( target.buffer );
|
||||
|
|
Loading…
Reference in New Issue