[latex3-commits] [git/LaTeX3-latex3-pdfresources] develop: add firstaid for luacolor, issue #45 (d12d5e7)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jan 31 00:33:20 CET 2023


Repository : https://github.com/latex3/pdfresources
On branch  : develop
Link       : https://github.com/latex3/pdfresources/commit/d12d5e76747dd1e9deabb5eaa4f58a44ec3438cb

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

commit d12d5e76747dd1e9deabb5eaa4f58a44ec3438cb
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jan 31 00:33:20 2023 +0100

    add firstaid for luacolor, issue #45


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

d12d5e76747dd1e9deabb5eaa4f58a44ec3438cb
 CHANGELOG.md               |  3 +++
 pdfmanagement-firstaid.dtx | 63 +++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5779af..905fd7e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ this project uses date-based 'snapshot' version identifiers.
  - pdf A4 uses pdfaid:rev not pdfaid:year.
  - pdfcreationdate and pdfmoddate key 
  
+### Added
+ - firstaid support for luacolor  (pdfmode)
+
 ## [2022-11-03] 
 
 ### Added 
diff --git a/pdfmanagement-firstaid.dtx b/pdfmanagement-firstaid.dtx
index 45174de..12b4cac 100644
--- a/pdfmanagement-firstaid.dtx
+++ b/pdfmanagement-firstaid.dtx
@@ -67,7 +67,9 @@
   {LaTeX PDF management testphase bundle / firstaid-patches}
 
 %<@@=pdfmanagement>
-\clist_map_inline:nn {pgf,transparent,xmp,pdflscape,xcolor,color,beamer,output,colorspace,fontspec}
+\clist_map_inline:nn 
+  {pgf,transparent,xmp,pdflscape,xcolor,color,
+   beamer,output,colorspace,fontspec,luacolor}
   {
     \bool_new:c       { g_@@_firstaid_#1_bool }
     \bool_gset_true:c { g_@@_firstaid_#1_bool }
@@ -195,6 +197,65 @@
        {\RequirePackage{xcolor-patches-tmp-ltx}}
   }
 %    \end{macrocode}
+%
+% \subsection{luacolor}
+% 
+%  The luacolor package doesn't take colors from l3color into account.
+%  We add a fix, but only for pdf mode. It is disable if luacolor is updated,
+%  assuming that the update will then handle it (or expl3 directly)
+%    \begin{macrocode}
+\bool_lazy_all:nT 
+  { 
+    {\sys_if_engine_luatex_p:} 
+    {\g_@@_firstaid_luacolor_bool} 
+    {\sys_if_output_pdf_p:} 
+  }
+  {
+    \AddToHook{package/luacolor/after}
+     {
+      \@ifpackagelater{luacolor}{2021-02-18}{}
+        {
+          \cs_set_protected:Npn \__color_backend_select:nn #1#2
+           {
+             \tl_set:Nn \l__color_backend_fill_tl {#1}
+             \tl_set:Nn \l__color_backend_stroke_tl {#2}
+             \LuaCol at setattribute\LuaCol at Attribute
+               {
+                 \directlua
+                   {
+                     oberdiek.luacolor.get("\luaescapestring{#1~#2}")
+                   }
+               }
+            }
+          \cs_set_protected:Npn \__color_backend_fill:n #1
+            {
+             \tl_set:Nn \l__color_backend_fill_tl {#1}
+             \LuaCol at setattribute\LuaCol at Attribute
+               {
+                 \directlua
+                   {
+                     oberdiek.luacolor.get("\luaescapestring{#1}")
+                   }
+               } 
+            }
+          \cs_set_protected:Npn \__color_backend_stroke:n #1
+            {
+              \tl_set:Nn \l__color_backend_stroke_tl {#1}
+              \LuaCol at setattribute\LuaCol at Attribute
+                {
+                  \directlua
+                    {
+                      oberdiek.luacolor.get("\luaescapestring{#1}")
+                    }
+                } 
+            }
+          \cs_set_protected:Npn \__color_backend_reset:  {}
+          \cs_set_eq:NN \__color_backend_fill_reset:   \__color_backend_reset:
+          \cs_set_eq:NN \__color_backend_stroke_reset: \__color_backend_reset:
+        }
+     }   
+  }  
+%    \end{macrocode}
 % \subsection{\pkg{pgf}}
 %
 % In \pkg{pgf}, resource management is set up in the file |pgfutil-common.tex|.





More information about the latex3-commits mailing list.