From 3a1e65bd8ead5f8376e2794500e57315d294c5aa Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Sat, 23 Sep 2023 09:31:17 +0800
Subject: [PATCH] Properly apply XY offsets to compound component glyphs

* src/sfnt.c (sfnt_decompose_compound_glyph): Avoid overwriting
X and Y if defer_offsets is false.
---
 src/sfnt.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/sfnt.c b/src/sfnt.c
index c0ab1e6587d..9340d8abc66 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -2948,16 +2948,11 @@ sfnt_decompose_compound_glyph (struct sfnt_glyph *glyph,
 	  /* When an anchor point is being used to translate the
 	     glyph, and the subglyph in question is actually a
 	     compound glyph, it is impossible to know which offset to
-	     use until the compound subglyph has actually been
-	     loaded.
+	     use until the compound subglyph has actually been loaded.
 
-	     As a result, the offset is calculated here, using the
-	     points in the loaded child compound glyph.  But first, X
-	     and Y must be reset to 0, as otherwise the translation
-	     might be applied twice if defer_offsets is not set.  */
-
-	  x = 0;
-	  y = 0;
+	     defer_offsets is set to true if these conditions apply,
+	     whereupon the offset is calculated here, using the points
+	     in the loaded child compound glyph.  */
 
 	  if (defer_offsets)
 	    {
-- 
2.39.5