shithub: freetype+ttf2subf

Download patch

ref: 7b3ebb9c1275d3cded7ea7e683cb43993bcc4cd4
parent: 62bc04f4c5b4369cc493ff24b1de27aabd79e0c6
author: Anuj Verma <anuj@posteo.net>
date: Sat Apr 30 18:43:33 EDT 2022

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/sdf/ftsdfrend.c
+++ b/src/sdf/ftsdfrend.c
@@ -298,16 +298,10 @@
       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" ));
+      return FT_Err_Ok;
 
-      error = FT_THROW( Cannot_Render_Glyph );
-      goto Exit;
-    }
-
     /* the padding will simply be equal to the `spread' */
     x_pad = sdf_module->spread;
     y_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 );