From fa6cf999526cffbe92222a06bfe191f838db6c9b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 21 Feb 2021 22:09:56 +0000 Subject: luacolor git-svn-id: svn://tug.org/texlive/trunk@57829 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/luacolor/luacolor.pdf | Bin 322070 -> 329760 bytes .../texmf-dist/source/latex/luacolor/luacolor.dtx | 53 ++++++++++++++++----- Master/texmf-dist/tex/latex/luacolor/luacolor.lua | 20 ++++++-- Master/texmf-dist/tex/latex/luacolor/luacolor.sty | 20 +++++--- 4 files changed, 70 insertions(+), 23 deletions(-) diff --git a/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf b/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf index b01a36cc92f..3f6acfa53a8 100644 Binary files a/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf and b/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf differ diff --git a/Master/texmf-dist/source/latex/luacolor/luacolor.dtx b/Master/texmf-dist/source/latex/luacolor/luacolor.dtx index 68c92f056aa..8f072db0f15 100644 --- a/Master/texmf-dist/source/latex/luacolor/luacolor.dtx +++ b/Master/texmf-dist/source/latex/luacolor/luacolor.dtx @@ -1,12 +1,12 @@ % \iffalse meta-comment % % File: luacolor.dtx -% Version: 2020-02-24 v1.15 +% Version: 2021-02-17 v1.17 % Info: Color support via LuaTeX's attributes % % Copyright (C) % 2007, 2009-2011 Heiko Oberdiek -% 2016-2020 Oberdiek Package Support Group +% 2016-2021 Oberdiek Package Support Group % https://github.com/ho-tex/luacolor/issues % % This work may be distributed and/or modified under the @@ -80,7 +80,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: luacolor 2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)} +\Msg{* Package: luacolor 2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)} \Msg{************************************************************************} \keepsilent @@ -92,11 +92,11 @@ This is a generated file. Project: luacolor -Version: 2020-02-24 v1.15 +Version: 2021-02-17 v1.17 Copyright (C) 2007, 2009-2011 Heiko Oberdiek - 2016-2020 Oberdiek Package Support Group + 2016-2021 Oberdiek Package Support Group This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -169,7 +169,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luacolor.drv}% - [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]% + [2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2011/11/22] \usepackage{paralist} @@ -189,7 +189,7 @@ and the derived files % \GetFileInfo{luacolor.drv} % % \title{The \xpackage{luacolor} package} -% \date{2020-02-24 v1.15} +% \date{2021-02-17 v1.17} % \author{Heiko Oberdiek\thanks % {Please report any issues at \url{https://github.com/ho-tex/luacolor/issues}}} % @@ -332,7 +332,7 @@ and the derived files % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luacolor}% - [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)] + [2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)] % \end{macrocode} % % \subsection{Check for \LuaTeX} @@ -376,7 +376,7 @@ and the derived files % \end{macrocode} % \begin{macrocode} \begingroup - \edef\x{\directlua{tex.write("2020-02-24 v1.15")}}% + \edef\x{\directlua{tex.write("2021-02-17 v1.17")}}% \edef\y{% \directlua{% if oberdiek.luacolor.getversion then % @@ -471,9 +471,15 @@ and the derived files % \end{macro} % % \begin{macrocode} -\RequirePackage{atbegshi}[2011/01/30] -\AtBeginShipout{% - \luacolorProcessBox\AtBeginShipoutBox +\directlua{% + if luatexbase.callbacktypes.pre_shipout_filter then + token.get_next() + end +}\@secondoftwo\@gobble{ + \RequirePackage{atbegshi}[2011/01/30] + \AtBeginShipout{% + \luacolorProcessBox\AtBeginShipoutBox + } } % \end{macrocode} % @@ -608,7 +614,7 @@ oberdiek.luacolor = luacolor % \begin{macro}{getversion()} % \begin{macrocode} function luacolor.getversion() - tex.write("2020-02-24 v1.15") + tex.write("2021-02-17 v1.17") end % \end{macrocode} % \end{macro} @@ -727,6 +733,7 @@ local LIST = 1 local LIST_LEADERS = 2 local LIST_DISC = 3 local COLOR = 4 +local NOCOLOR = 5 local RULE = node.id("rule") local node_types = { [node.id("hlist")] = LIST, @@ -735,6 +742,10 @@ local node_types = { [node.id("glyph")] = COLOR, [node.id("disc")] = LIST_DISC, [node.id("whatsit")] = { + [node.subtype("pdf_colorstack")] = + function(n) + return n.stack == 0 and NOCOLOR or nil + end, [node.subtype("special")] = COLOR, [node.subtype("pdf_literal")] = COLOR, [node.subtype("pdf_save")] = COLOR, @@ -829,6 +840,8 @@ local function traverse(list, color, dry) end end end + elseif t == NOCOLOR then + color = '' end end if get_type(list) == LIST then @@ -848,6 +861,13 @@ function luacolor.process(box) local list = tex.getbox(box) traverse(list, color, DRY_FALSE) end + +if luatexbase.callbacktypes.pre_shipout_filter then + luatexbase.add_to_callback("pre_shipout_filter", function(list) + traverse(list, "", DRY_FALSE) + return true + end, "luacolor.process") +end % \end{macrocode} % \end{macro} % For recent versions of luaotfload, we can register a callback to @@ -1129,6 +1149,13 @@ end % \begin{Version}{2020-02-24 v1.15} % \item Grab all possible arguments for \verb|\saveboxresource|\slash \verb|\pdfxform| % \end{Version} +% \begin{Version}{2020-04-04 v1.16} +% \item Reset color after \verb|pdf_colorstack| whatsits. +% \end{Version} +% \begin{Version}{2021-02-17 v1.17} +% \item Use \LaTeXe's new \verb|pre_shipout_filter| callback if it's available to +% allow coloring background and foregrund layer material +% \end{Version} % \end{History} % % \PrintIndex diff --git a/Master/texmf-dist/tex/latex/luacolor/luacolor.lua b/Master/texmf-dist/tex/latex/luacolor/luacolor.lua index e95192a2fef..851b72c5190 100644 --- a/Master/texmf-dist/tex/latex/luacolor/luacolor.lua +++ b/Master/texmf-dist/tex/latex/luacolor/luacolor.lua @@ -9,11 +9,11 @@ -- This is a generated file. -- -- Project: luacolor --- Version: 2020-02-24 v1.15 +-- Version: 2021-02-17 v1.17 -- -- Copyright (C) -- 2007, 2009-2011 Heiko Oberdiek --- 2016-2020 Oberdiek Package Support Group +-- 2016-2021 Oberdiek Package Support Group -- -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either @@ -41,7 +41,7 @@ oberdiek = oberdiek or {} local luacolor = oberdiek.luacolor or {} oberdiek.luacolor = luacolor function luacolor.getversion() - tex.write("2020-02-24 v1.15") + tex.write("2021-02-17 v1.17") end local ifpdf = tonumber(tex.outputmode or tex.pdfoutput) > 0 local prefix @@ -116,6 +116,7 @@ local LIST = 1 local LIST_LEADERS = 2 local LIST_DISC = 3 local COLOR = 4 +local NOCOLOR = 5 local RULE = node.id("rule") local node_types = { [node.id("hlist")] = LIST, @@ -124,6 +125,10 @@ local node_types = { [node.id("glyph")] = COLOR, [node.id("disc")] = LIST_DISC, [node.id("whatsit")] = { + [node.subtype("pdf_colorstack")] = + function(n) + return n.stack == 0 and NOCOLOR or nil + end, [node.subtype("special")] = COLOR, [node.subtype("pdf_literal")] = COLOR, [node.subtype("pdf_save")] = COLOR, @@ -202,6 +207,8 @@ local function traverse(list, color, dry) end end end + elseif t == NOCOLOR then + color = '' end end if get_type(list) == LIST then @@ -216,6 +223,13 @@ function luacolor.process(box) local list = tex.getbox(box) traverse(list, color, DRY_FALSE) end + +if luatexbase.callbacktypes.pre_shipout_filter then + luatexbase.add_to_callback("pre_shipout_filter", function(list) + traverse(list, "", DRY_FALSE) + return true + end, "luacolor.process") +end if luaotfload.set_colorhandler then local set_attribute = node.direct.set_attribute luaotfload.set_colorhandler(function(head, n, color) diff --git a/Master/texmf-dist/tex/latex/luacolor/luacolor.sty b/Master/texmf-dist/tex/latex/luacolor/luacolor.sty index af5de64684d..b82069ea648 100644 --- a/Master/texmf-dist/tex/latex/luacolor/luacolor.sty +++ b/Master/texmf-dist/tex/latex/luacolor/luacolor.sty @@ -9,11 +9,11 @@ %% This is a generated file. %% %% Project: luacolor -%% Version: 2020-02-24 v1.15 +%% Version: 2021-02-17 v1.17 %% %% Copyright (C) %% 2007, 2009-2011 Heiko Oberdiek -%% 2016-2020 Oberdiek Package Support Group +%% 2016-2021 Oberdiek Package Support Group %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -89,7 +89,7 @@ \edef\LuaCol@AtEnd{\LuaCol@AtEnd\noexpand\endinput} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luacolor}% - [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)] + [2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)] \RequirePackage{color} \ifx\directlua\@undefined \PackageError{luacolor}{% @@ -112,7 +112,7 @@ require("luacolor")% } \begingroup - \edef\x{\directlua{tex.write("2020-02-24 v1.15")}}% + \edef\x{\directlua{tex.write("2021-02-17 v1.17")}}% \edef\y{% \directlua{% if oberdiek.luacolor.getversion then % @@ -176,9 +176,15 @@ oberdiek.luacolor.process(\number#1)% }% } -\RequirePackage{atbegshi}[2011/01/30] -\AtBeginShipout{% - \luacolorProcessBox\AtBeginShipoutBox +\directlua{% + if luatexbase.callbacktypes.pre_shipout_filter then + token.get_next() + end +}\@secondoftwo\@gobble{ + \RequirePackage{atbegshi}[2011/01/30] + \AtBeginShipout{% + \luacolorProcessBox\AtBeginShipoutBox + } } \set@color \ifnum\outputmode=\@ne -- cgit v1.2.3