Commit 05439f5cc69eaa3deaf3db52a7999af09a2c293a

Werner Lemberg 2019-07-04T14:28:04

[psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580). The same as previous commit but for the old engine. * src/psaux/t1decode.c (t1operator_seac): Implement it.

diff --git a/ChangeLog b/ChangeLog
index de4ea86..84c29a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-07-04  Werner Lemberg  <wl@gnu.org>
+
+	[psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580).
+
+	The same as previous commit but for the old engine.
+
+	* src/psaux/t1decode.c (t1operator_seac): Implement it.
+
 2019-07-04  Chris Liddell <chris.liddell@artifex.com>
 
 	[psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580).
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index c2b3729..06059a6 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -367,6 +367,12 @@
 
     FT_GlyphLoader_Prepare( decoder->builder.loader );  /* prepare loader */
 
+    /* save the left bearing and width of the SEAC   */
+    /* glyph as they will be erased by the next load */
+
+    left_bearing = decoder->builder.left_bearing;
+    advance      = decoder->builder.advance;
+
     /* the seac operator must not be nested */
     decoder->seac = TRUE;
     error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index );
@@ -374,11 +380,14 @@
     if ( error )
       goto Exit;
 
-    /* save the left bearing and width of the base character */
-    /* as they will be erased by the next load.              */
+    /* If the SEAC glyph doesn't have a (H)SBW of its */
+    /* own use the values from the base glyph.        */
 
-    left_bearing = decoder->builder.left_bearing;
-    advance      = decoder->builder.advance;
+    if ( decoder->builder.parse_state != T1_Parse_Have_Width )
+    {
+      left_bearing = decoder->builder.left_bearing;
+      advance      = decoder->builder.advance;
+    }
 
     decoder->builder.left_bearing.x = 0;
     decoder->builder.left_bearing.y = 0;
@@ -396,8 +405,8 @@
     if ( error )
       goto Exit;
 
-    /* restore the left side bearing and   */
-    /* advance width of the base character */
+    /* restore the left side bearing and advance width   */
+    /* of the SEAC glyph or base character (saved above) */
 
     decoder->builder.left_bearing = left_bearing;
     decoder->builder.advance      = advance;