From 22da40a5e5057c2cdea2f54f1ac590ddc9d831cb Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Thu, 21 Dec 2023 13:34:54 +0800
Subject: [PATCH] Accept empty contours in glyphs

* src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2):
Accept empty contours, for they are not invalid, just redundant.
---
 src/sfnt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sfnt.c b/src/sfnt.c
index eb3add7390e..4d377ddf5e5 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -3088,7 +3088,8 @@ sfnt_decompose_glyph_1 (size_t here, size_t last,
   /* The contour is empty.  */
 
   if (here == last)
-    return 1;
+    /* An empty contour, if redundant, is not necessarily invalid.  */
+    return 0;
 
   /* Move the pen to the start of the contour.  Apparently some fonts
      have off the curve points as the start of a contour, so when that
@@ -3227,7 +3228,8 @@ sfnt_decompose_glyph_2 (size_t here, size_t last,
   /* The contour is empty.  */
 
   if (here == last)
-    return 1;
+    /* An empty contour, if redundant, is not necessarily invalid.  */
+    return 0;
 
   /* Move the pen to the start of the contour.  Apparently some fonts
      have off the curve points as the start of a contour, so when that
-- 
2.39.5