From da68bce1d25d68087ca3b70134a61ae1c3a96b67 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 15 Jun 2022 03:00:50 +0000
Subject: CTAN sync 202206150300

---
 .../pdfmanagement-firstaid.dtx                     | 43 ++++++++++++++++++++--
 1 file changed, 40 insertions(+), 3 deletions(-)

(limited to 'macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx')

diff --git a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
index 009f1bf07f..107c9150ab 100644
--- a/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
+++ b/macros/latex/contrib/pdfmanagement-testphase/pdfmanagement-firstaid.dtx
@@ -48,7 +48,7 @@
 %    }^^A
 % }
 %
-% \date{Version 0.95o, released 2022-05-11}
+% \date{Version 0.95p, released 2022-06-14}
 %
 % \maketitle
 % \begin{documentation}
@@ -64,11 +64,11 @@
 % |debug={firstaidoff={name1,name2,...},...}|.
 %    \begin{macrocode}
 %<*package>
-\ProvidesExplPackage{pdfmanagement-firstaid}{2022-05-11}{0.95o}
+\ProvidesExplPackage{pdfmanagement-firstaid}{2022-06-14}{0.95p}
   {LaTeX PDF management testphase bundle / firstaid-patches}
 
 %<@@=pdfmanagement>
-\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color,beamer,output,colorspace}
+\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color,beamer,output,colorspace,fontspec}
   {
     \bool_new:c       { g_@@_firstaid_#1_bool }
     \bool_gset_true:c { g_@@_firstaid_#1_bool }
@@ -82,6 +82,43 @@
   }
 \msg_new:nnn  { pdfmanagement } { firstaid }
               { loading~pdfmanagement~firstaid~code~for~#1 }
+\msg_new:nnn  { pdfmanagement } { firstaid-changed }
+              { package~#1~has~changed.~Check~if~patch~is~still~valid! }
+%    \end{macrocode}
+% \subsection{Fontspec}
+% When using luaLaTeX opacity is broken (issue \#30) as
+% fontspec/luaotfload doesn't use the pdfmanagement but write to ExtGState directly
+% To repair this some new lua code is needed. This also
+% improves the color parsing and allows to use cmyk and spot colors as font colors.
+% It is also needed to use a patch version of \texttt{fontspec-luatex.sty} to
+% slightly change the way how the Opacity and Color key are handled.
+% The patch is only executed if luaotfload is new enough.
+%    \begin{macrocode}
+\sys_if_engine_luatex:T
+   {
+     \lua_now:n
+       {
+        if~not~luaotfload.set_transparent_colorstack~
+        then~
+          tex.print("\\bool_set_false:N\\g_@@_firstaid_fontspec_bool")~
+        end
+       }
+     \bool_if:NT \g_@@_firstaid_fontspec_bool
+       {
+            \msg_info:nnn{pdfmanagement}{firstaid}{fontspec}
+            \file_if_exist:nT { luaotfload-l3color-tmp.lua }
+              {
+                \lua_load_module:n { luaotfload-l3color-tmp.lua }
+              }
+
+         \declare@file@substitution{fontspec-luatex.sty}{fontspec-luatex-tmp-ltx.sty}
+         \AddToHook{package/fontspec/after}
+          {
+            \str_if_eq:vnF{ver@fontspec.sty}{2022/01/15~v2.8a~Font~selection~for~XeLaTeX~and~LuaLaTeX}
+             {\msg_warn:nnn{pdfmanagement}{firstaid-changed}{fontspec}}
+          }
+       }
+   }
 %    \end{macrocode}
 % \subsection{Output routine}
 % This load as few patches for the LaTeX output routine commands. They add
-- 
cgit v1.2.3

