poppler/Gfx.cc |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit f9d958ddee1e9a77d41c80793fd20ce5299f08ef
Author: Albert Astals Cid <aa...@kde.org>
Date:   Tue Dec 27 09:38:55 2022 +0100

    Gfx::opBeginMarkedContent: Support Span with Name
    
    Issue #1327

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 17202a07..63e6c963 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Jonathan Blandford <j...@redhat.com>
-// Copyright (C) 2005-2013, 2015-2021 Albert Astals Cid <aa...@kde.org>
+// Copyright (C) 2005-2013, 2015-2022 Albert Astals Cid <aa...@kde.org>
 // Copyright (C) 2006 Thorkild Stray <thork...@ifi.uio.no>
 // Copyright (C) 2006 Kristian Høgsberg <k...@redhat.com>
 // Copyright (C) 2006-2011 Carlos Garcia Campos <carlo...@gnome.org>
@@ -5049,12 +5049,21 @@ void Gfx::opBeginMarkedContent(Object args[], int 
numArgs)
         } else {
             error(errSyntaxError, getPos(), "insufficient arguments for Marked 
Content");
         }
-    } else if (args[0].isName("Span") && numArgs == 2 && args[1].isDict()) {
-        Object obj = args[1].dictLookup("ActualText");
-        if (obj.isString()) {
-            out->beginActualText(state, obj.getString());
-            MarkedContentStack *mc = mcStack;
-            mc->kind = gfxMCActualText;
+    } else if (args[0].isName("Span") && numArgs == 2) {
+        Object dictToUse;
+        if (args[1].isDict()) {
+            dictToUse = args[1].copy();
+        } else if (args[1].isName()) {
+            dictToUse = 
res->lookupMarkedContentNF(args[1].getName()).fetch(xref);
+        }
+
+        if (dictToUse.isDict()) {
+            Object obj = dictToUse.dictLookup("ActualText");
+            if (obj.isString()) {
+                out->beginActualText(state, obj.getString());
+                MarkedContentStack *mc = mcStack;
+                mc->kind = gfxMCActualText;
+            }
         }
     }
 

Reply via email to