[latex3-commits] [git/LaTeX3-latex3-latex3] luacolor: Provide some internal functions (665ac0274)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jun 7 23:55:25 CEST 2021


Repository : https://github.com/latex3/latex3
On branch  : luacolor
Link       : https://github.com/latex3/latex3/commit/665ac0274d1b5df9bd6757cb1d4950aedc2b550a

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

commit 665ac0274d1b5df9bd6757cb1d4950aedc2b550a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jun 7 22:55:25 2021 +0100

    Provide some internal functions


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

665ac0274d1b5df9bd6757cb1d4950aedc2b550a
 l3backend/l3backend-color.dtx            | 26 ++++++++++++++++++--------
 l3kernel/testfiles/d3pdfmode.luatex.tlg  |  3 ++-
 l3kernel/testfiles/d3xetex.luatex.tlg    |  3 ++-
 l3kernel/testfiles/m3expl001.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3expl002.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3expl003.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3expl004.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3expl006.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3expl007.luatex.tlg  |  3 ++-
 l3kernel/testfiles/m3names001.luatex.tlg |  2 +-
 10 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index e0e8b2739..8b87c239c 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -1552,22 +1552,32 @@ end
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\tex_pdfxform:D}
-%   We redefine the \pkg{expl3} version of the primitive to do the replacement
-%   implicitly. The keywords \texttt{margin} and \texttt{type} are not
-%   documented at the \TeX{} level.
+%<@@=pdfxform>
+%
+% \begin{macro}{pdfxform}
+% \begin{macro}{\@@_backend_now:w, \@@_backend_shipout:w}
+%   Here we define an internal for the |pdfxform| module: the
+%   same ideas work in \pdfTeX{} as macros, and other engines don't
+%   use quite the same abstraction.
 %    \begin{macrocode}
-luacmd('tex_pdfxform:D', function()
+local function pdfxform(immediate)
   local attr = scan_keyword'attr' and scan_string() or nil
   local resources = scan_keyword'length' and scan_string() or nil
   local xtype = scan_keyword'type' and scan_string() or nil
   local margin = scan_keyword'margin' and scan_string() or nil
   local n = scan_int() or nil
   traverse(getbox(n),"")
-  saveboxresources(n,attr,resources,false,xtype,margin)
+  saveboxresources(n,attr,resources,immediate,xtype,margin)
+end
+luacmd('@@_backend_now:w', function()
+  pdfxform(true)
+end,'global','protected')
+luacmd('@@_backend_shipout:w', function()
+  pdfxform(false)
 end,'global','protected')
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 %    \begin{macrocode}
 %</lua>
@@ -1577,6 +1587,8 @@ end,'global','protected')
 %<*package>
 %    \end{macrocode}
 %
+%<@@=color>
+%
 % At present we only set up for \LuaTeX{} in PDF mode: later we will expand
 % on that!
 %
@@ -1584,9 +1596,7 @@ end,'global','protected')
 %<*luatex>
 %    \end{macrocode}
 %
-% This needs some work: undefine from Lua?
 %    \begin{macrocode}
-\cs_undefine:N \tex_pdfxform:D
 \lua_now:n { require("l3backend-luatex") }
 %    \end{macrocode}
 %
diff --git a/l3kernel/testfiles/d3pdfmode.luatex.tlg b/l3kernel/testfiles/d3pdfmode.luatex.tlg
index 10f863519..41f2d6fb2 100644
--- a/l3kernel/testfiles/d3pdfmode.luatex.tlg
+++ b/l3kernel/testfiles/d3pdfmode.luatex.tlg
@@ -10,7 +10,8 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 ))
 Author: Joseph Wright
diff --git a/l3kernel/testfiles/d3xetex.luatex.tlg b/l3kernel/testfiles/d3xetex.luatex.tlg
index 3e67d78b3..f10b01138 100644
--- a/l3kernel/testfiles/d3xetex.luatex.tlg
+++ b/l3kernel/testfiles/d3xetex.luatex.tlg
@@ -18,7 +18,8 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 ))
 Author: Joseph Wright
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index ddf3c23da..2931784e7 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -66,7 +66,8 @@ Defining \__color_backend_stroke_devicen:nn on line ...
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 Defining \__box_backend_clip:N on line ...
 Defining \__box_backend_rotate:Nn on line ...
 Defining \__box_backend_rotate_aux:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl002.luatex.tlg b/l3kernel/testfiles/m3expl002.luatex.tlg
index 9fa8361c9..91ac67bef 100644
--- a/l3kernel/testfiles/m3expl002.luatex.tlg
+++ b/l3kernel/testfiles/m3expl002.luatex.tlg
@@ -10,6 +10,7 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 ))
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index ddf3c23da..2931784e7 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -66,7 +66,8 @@ Defining \__color_backend_stroke_devicen:nn on line ...
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 Defining \__box_backend_clip:N on line ...
 Defining \__box_backend_rotate:Nn on line ...
 Defining \__box_backend_rotate_aux:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl004.luatex.tlg b/l3kernel/testfiles/m3expl004.luatex.tlg
index ec438d958..daaa9c2ac 100644
--- a/l3kernel/testfiles/m3expl004.luatex.tlg
+++ b/l3kernel/testfiles/m3expl004.luatex.tlg
@@ -8,6 +8,7 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 ))
diff --git a/l3kernel/testfiles/m3expl006.luatex.tlg b/l3kernel/testfiles/m3expl006.luatex.tlg
index 2062ed15c..27e0b54be 100644
--- a/l3kernel/testfiles/m3expl006.luatex.tlg
+++ b/l3kernel/testfiles/m3expl006.luatex.tlg
@@ -9,6 +9,7 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 ))
diff --git a/l3kernel/testfiles/m3expl007.luatex.tlg b/l3kernel/testfiles/m3expl007.luatex.tlg
index 5892ad73b..b41cb1327 100644
--- a/l3kernel/testfiles/m3expl007.luatex.tlg
+++ b/l3kernel/testfiles/m3expl007.luatex.tlg
@@ -9,7 +9,8 @@ File: l3backend-luatex.def ....-..-.. L3 backend support: PDF output (LuaTeX)
 Lua module: l3backend-luatex ....-..-..
 Lua-only attribute color = 1
 Inserting `color' at position 1 in `pre_shipout_filter'.
-Lua function tex_pdfxform:D = ...
+Lua function __pdfxform_backend_now:w = ...
+Lua function __pdfxform_backend_shipout:w = ...
 \l__pdf_internal_box=\box...
 )) (expl3.sty
 Package: expl3 ....-..-.. L3 programming layer (loader) 
diff --git a/l3kernel/testfiles/m3names001.luatex.tlg b/l3kernel/testfiles/m3names001.luatex.tlg
index b61b2ad27..afa948f71 100644
--- a/l3kernel/testfiles/m3names001.luatex.tlg
+++ b/l3kernel/testfiles/m3names001.luatex.tlg
@@ -17,5 +17,5 @@ Don't change this file in any respect.
 \tex_pdfoutput:D=\outputmode
 \tex_pdfrefxform:D=\useboxresource
 \tex_pdfrefximage:D=\useimageresource
-\tex_pdfxform:D=luacall 13
+\tex_pdfxform:D=\saveboxresource
 \tex_pdfximage:D=\saveimageresource





More information about the latex3-commits mailing list.