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

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Feb 15 22:19:38 CET 2023


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

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

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

    Provide some internal functions


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

c6bc89e0e8b1c14d29de570078ac3021039f13f5
 l3backend/l3backend-color.dtx                   | 26 +++++++++++++++++--------
 l3kernel/testfiles-backend/d3pdfmode.luatex.tlg |  3 ++-
 l3kernel/testfiles-backend/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 076364c4c..cc595f031 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -1645,22 +1645,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>
@@ -1670,6 +1680,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!
 %
@@ -1677,9 +1689,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-backend/d3pdfmode.luatex.tlg b/l3kernel/testfiles-backend/d3pdfmode.luatex.tlg
index 8fdff2ffa..d07c438f1 100644
--- a/l3kernel/testfiles-backend/d3pdfmode.luatex.tlg
+++ b/l3kernel/testfiles-backend/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-backend/d3xetex.luatex.tlg b/l3kernel/testfiles-backend/d3xetex.luatex.tlg
index c63aeb087..ac3bfb372 100644
--- a/l3kernel/testfiles-backend/d3xetex.luatex.tlg
+++ b/l3kernel/testfiles-backend/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 423e6d2a5..ea81d3d71 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -74,7 +74,8 @@ Defining \__color_backend_stroke_reset: 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 423e6d2a5..ea81d3d71 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -74,7 +74,8 @@ Defining \__color_backend_stroke_reset: 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.