Commit 7b3ebb9c1275d3cded7ea7e683cb43993bcc4cd4

Anuj Verma 2022-04-30T22:43:33

[sdf] Do not throw errors for invisible glyphs. * src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Return `FT_Err_Ok` if width or height is zero, since some glyphs do not generate visible bitmaps. Fixes #1150.

diff --git a/src/sdf/ftsdfrend.c b/src/sdf/ftsdfrend.c
index 37dbd40..b0213a4 100644
--- a/src/sdf/ftsdfrend.c
+++ b/src/sdf/ftsdfrend.c
@@ -298,15 +298,9 @@
       goto Exit;
     }
 
-    /* the rows and pitch must be valid after presetting the */
-    /* bitmap using outline                                  */
+    /* nothing to render */
     if ( !bitmap->rows || !bitmap->pitch )
-    {
-      FT_ERROR(( "ft_sdf_render: failed to preset bitmap\n" ));
-
-      error = FT_THROW( Cannot_Render_Glyph );
-      goto Exit;
-    }
+      return FT_Err_Ok;
 
     /* the padding will simply be equal to the `spread' */
     x_pad = sdf_module->spread;
@@ -525,13 +519,9 @@
       goto Exit;
     }
 
+    /* nothing to render */
     if ( !bitmap->rows || !bitmap->pitch )
-    {
-      FT_ERROR(( "ft_bsdf_render: invalid bitmap size\n" ));
-
-      error = FT_THROW( Invalid_Argument );
-      goto Exit;
-    }
+      return FT_Err_Ok;
 
     FT_Bitmap_New( &target );