[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: added pageresources for luatex (1870601)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Aug 10 21:13:56 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/187060142d36c0177cbfb894b03afe6d89f47c47

>---------------------------------------------------------------

commit 187060142d36c0177cbfb894b03afe6d89f47c47
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Aug 10 21:13:56 2019 +0200

    added pageresources for luatex


>---------------------------------------------------------------

187060142d36c0177cbfb894b03afe6d89f47c47
 experiments/extgstate.tex |  1 +
 pdfresources.dtx          | 38 ++++++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/experiments/extgstate.tex b/experiments/extgstate.tex
index ffae728..a44bc21 100644
--- a/experiments/extgstate.tex
+++ b/experiments/extgstate.tex
@@ -22,6 +22,7 @@ x\directlua{tex.sprint(l3kernel.pdf.object_ref("PageN/Resources/ExtGState"))}x
 abc
 \newpage
 \pdf_pageresources_gput:nnn {ExtGState}{duckopacity}{<</ca~0.2/CA~0.2>>}
+\pdf_pageresources_gput:nnn {Pattern}{duckpattern}{<</ca~0.2/CA~0.2>>}
 \pdf_pageresources_gput:nnn {ExtGState}{efalantopacity}{<</ca~0.8/CA~0.8>>}
 
 test% \special {pdf:code~/duckopacity ~gs} test
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 8f7c950..316f147 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -1315,10 +1315,23 @@
       {#1}
   }
  % values are only stored in a prop and will be output at end document.
- \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
-  {
-   \@@_tree_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
-  }
+ \sys_if_engine_luatex:TF
+ {
+  \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
+   {
+    \@@_tree_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
+     % luatex must also trigger the lua side
+     \tex_latelua:D{l3kernel.@@.Page.Resources.#1=true}
+     \tex_latelua:D{l3kernel.pdf.Page_Resources_gpush( tex.count["g_@@_abspage_int"])}
+   }
+ }
+ {
+  \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
+   {
+    \@@_tree_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
+   }
+ }
+
  % code for end of document code
  \cs_new_protected:Npn \@@_backend_pageresources_end_run:
  {
@@ -2364,6 +2377,7 @@ l3kernel.@@.Page.dflt = l3kernel.@@.Page.dflt or {}
 l3kernel= l3kernel or {}
 l3kernel.@@.Page.Resources = l3kernel.@@.Resources or {}
 l3kernel.@@.Page.Resources.Properties = l3kernel.@@.Page.Resources.Properties or {}
+l3kernel.@@.Page.Resources.List={"ExtGState","ColorSpace","Pattern","Shading"}
 l3kernel.@@.object = l3kernel.@@.object or {}
 
 l3kernel.pdf= l3kernel.pdf or {} -- for "public" functions
@@ -2426,8 +2440,8 @@ function l3kernel.@@.backend_Page_gclear ()
 end
 
 
-local Properties= l3kernel.@@.Page.Resources.Properties
-
+local Properties  = l3kernel.@@.Page.Resources.Properties
+local ResourceList= l3kernel.@@.Page.Resources.List
 local function @@_backend_PageN_Resources_gpush (page)
  local token=""
  if Properties[page] then
@@ -2436,6 +2450,14 @@ local function @@_backend_PageN_Resources_gpush (page)
   end
   token = "/Properties <<"..token..">>"
  end
+ --  print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
+  for i,name in ipairs(ResourceList) do
+ -- print(name)
+  if l3kernel.@@.Page.Resources[name] then
+ -- print(name)
+  token = token .. "/"..name.." "..l3kernel.pdf.object_ref("PageN/Resources/"..name)
+  end
+  end
  -- add ExtGstate etc here ....
  return token
 end
@@ -2447,6 +2469,10 @@ function l3kernel.pdf.Page_Resources_Properties_gput (page,name,value) -- tex.co
  pdf.setpageresources(@@_backend_PageN_Resources_gpush (page))
 end
 
+function l3kernel.pdf.Page_Resources_gpush(page)
+ pdf.setpageresources(@@_backend_PageN_Resources_gpush (page))
+end
+
 function l3kernel.pdf.object_ref (objname)
  if l3kernel.@@.object[objname] then
   local ref= l3kernel.@@.object[objname]





More information about the latex3-commits mailing list