summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-25 01:20:35 +0000
committerKarl Berry <karl@freefriends.org>2020-02-25 01:20:35 +0000
commit17ea4c24b987d526d95d6b72406341fab755b78d (patch)
tree3edfdf57ec812dd8ca643ca586285920ba3dafb6
parentc1ab1e338ec295e77a4e66c90e809d183b4da895 (diff)
luacolor (25feb20)
git-svn-id: svn://tug.org/texlive/trunk@53901 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/luacolor/luacolor.pdfbin322335 -> 316983 bytes
-rw-r--r--Master/texmf-dist/source/latex/luacolor/luacolor.dtx318
-rw-r--r--Master/texmf-dist/tex/latex/luacolor/luacolor.lua (renamed from Master/texmf-dist/scripts/luacolor/luacolor.lua)14
-rw-r--r--Master/texmf-dist/tex/latex/luacolor/luacolor.sty98
4 files changed, 101 insertions, 329 deletions
diff --git a/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf b/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf
index a3bcae1cf29..edcf74c1362 100644
--- a/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf
+++ b/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/luacolor/luacolor.dtx b/Master/texmf-dist/source/latex/luacolor/luacolor.dtx
index 7ce99e53220..3073f2be034 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: 2019/11/29 v1.13
+% Version: 2020-02-22 v1.14
% Info: Color support via LuaTeX's attributes
%
% Copyright (C)
% 2007, 2009-2011 Heiko Oberdiek
-% 2016-2019 Oberdiek Package Support Group
+% 2016-2020 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 2019/11/29 v1.13 Color support via LuaTeX's attributes (HO)}
+\Msg{* Package: luacolor 2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -92,11 +92,11 @@
This is a generated file.
Project: luacolor
-Version: 2019/11/29 v1.13
+Version: 2020-02-22 v1.14
Copyright (C)
2007, 2009-2011 Heiko Oberdiek
- 2016-2019 Oberdiek Package Support Group
+ 2016-2020 Oberdiek Package Support Group
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -118,7 +118,6 @@ https://github.com/ho-tex/luacolor/issues
This work consists of the main source file luacolor.dtx
and the derived files
luacolor.sty, luacolor.pdf, luacolor.ins, luacolor.drv,
- luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex,
luacolor.lua,
\endpreamble
@@ -129,14 +128,6 @@ and the derived files
\file{luacolor.drv}{\from{luacolor.dtx}{driver}}%
\usedir{tex/latex/luacolor}%
\file{luacolor.sty}{\from{luacolor.dtx}{package}}%
-% \usedir{doc/latex/luacolor/test}%
-% \file{luacolor-test1.tex}{\from{luacolor.dtx}{test1}}%
-% \file{luacolor-test2.tex}{\from{luacolor.dtx}{test2}}%
-% \file{luacolor-test3.tex}{\from{luacolor.dtx}{test3}}%
- \nopreamble
- \nopostamble
-% \usedir{source/latex/luacolor/catalogue}%
-% \file{luacolor.xml}{\from{luacolor.dtx}{catalogue}}%
}
\def\MetaPrefix{-- }
\def\defaultpostamble{%
@@ -178,7 +169,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luacolor.drv}%
- [2019/11/29 v1.13 Color support via LuaTeX's attributes (HO)]%
+ [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2011/11/22]
\usepackage{paralist}
@@ -194,26 +185,11 @@ and the derived files
% \fi
%
%
-% \CharacterTable
-% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-% Digits \0\1\2\3\4\5\6\7\8\9
-% Exclamation \! Double quote \" Hash (number) \#
-% Dollar \$ Percent \% Ampersand \&
-% Acute accent \' Left paren \( Right paren \)
-% Asterisk \* Plus \+ Comma \,
-% Minus \- Point \. Solidus \/
-% Colon \: Semicolon \; Less than \<
-% Equals \= Greater than \> Question mark \?
-% Commercial at \@ Left bracket \[ Backslash \\
-% Right bracket \] Circumflex \^ Underscore \_
-% Grave accent \` Left brace \{ Vertical bar \|
-% Right brace \} Tilde \~}
%
% \GetFileInfo{luacolor.drv}
%
% \title{The \xpackage{luacolor} package}
-% \date{2019/11/29 v1.13}
+% \date{2020-02-22 v1.14}
% \author{Heiko Oberdiek\thanks
% {Please report any issues at \url{https://github.com/ho-tex/luacolor/issues}}}
%
@@ -356,44 +332,31 @@ and the derived files
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
- [2019/11/29 v1.13 Color support via LuaTeX's attributes (HO)]
+ [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]
% \end{macrocode}
%
% \subsection{Check for \LuaTeX}
%
% Without \LuaTeX\ there is no point in using this package.
% \begin{macrocode}
-\RequirePackage{infwarerr}[2010/04/08]%
-\RequirePackage{iftex}[2019/11/07]%
-\RequirePackage{ltxcmds}[2011/04/18]%
\RequirePackage{color}
% \end{macrocode}
-% require ltluatex rather than luatex package support for \LuaTeX\ allocations.
+%
% \begin{macrocode}
-\ifluatex
- \ifx\newattribute\@undefined
- \RequirePackage{ltluatex}%
- \fi
-\else
- \@PackageError{luacolor}{%
+\ifx\directlua\@undefined
+ \PackageError{luacolor}{%
This package may only be run using LuaTeX%
}\@ehc
\expandafter\LuaCol@AtEnd
\fi%
% \end{macrocode}
%
-% \begin{macro}{\LuaCol@directlua}
-% \begin{macrocode}
- \let\LuaCol@directlua\directlua
-% \end{macrocode}
-% \end{macro}
-%
% \subsection{Check for disabled colors}
%
% \begin{macrocode}
\ifcolors@
\else
- \@PackageWarningNoLine{luacolor}{%
+ \PackageWarningNoLine{luacolor}{%
Colors are disabled by option `monochrome'%
}%
\def\set@color{}%
@@ -407,15 +370,15 @@ and the derived files
% \subsection{Load module and check version}
%
% \begin{macrocode}
-\LuaCol@directlua{%
+\directlua{%
require("luacolor")%
}
% \end{macrocode}
% \begin{macrocode}
\begingroup
- \edef\x{\LuaCol@directlua{tex.write("2019/11/29 v1.13")}}%
+ \edef\x{\directlua{tex.write("2020-02-22 v1.14")}}%
\edef\y{%
- \LuaCol@directlua{%
+ \directlua{%
if oberdiek.luacolor.getversion then %
oberdiek.luacolor.getversion()%
end%
@@ -423,7 +386,7 @@ and the derived files
}%
\ifx\x\y
\else
- \@PackageError{luacolor}{%
+ \PackageError{luacolor}{%
Wrong version of lua module.\MessageBreak
Package version: \x\MessageBreak
Lua module: \y
@@ -435,7 +398,7 @@ and the derived files
% \subsection{Find driver}
%
% \begin{macrocode}
-\ifpdf
+\ifnum\outputmode=\@ne
\else
\begingroup
\def\current@color{}%
@@ -446,21 +409,21 @@ and the derived files
\endgroup
}%
\edef\reserved@a{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.dvidetect()%
}%
}%
\ifx\reserved@a\@empty
- \@PackageError{luacolor}{%
+ \PackageError{luacolor}{%
DVI driver detection failed because of\MessageBreak
unrecognized color \string\special
}\@ehc
\endgroup
\expandafter\expandafter\expandafter\LuaCol@AtEnd
\else
- \@PackageInfoNoLine{luacolor}{%
+ \PackageInfo{luacolor}{%
Type of color \string\special: \reserved@a
- }%
+ \@gobble}%
\fi%
\endgroup
\fi
@@ -470,17 +433,9 @@ and the derived files
%
% \begin{macro}{\LuaCol@Attribute}
% \begin{macrocode}
-\ltx@IfUndefined{newluatexattribute}{%
- \newattribute\LuaCol@Attribute
-}{%
- \newluatexattribute\LuaCol@Attribute
-}
-\ltx@IfUndefined{setluatexattribute}{%
- \let\LuaCol@setattribute\setattribute
-}{%
- \let\LuaCol@setattribute\setluatexattribute
-}
-\LuaCol@directlua{%
+\newattribute\LuaCol@Attribute
+\let\LuaCol@setattribute\setattribute
+\directlua{%
oberdiek.luacolor.setattribute(\number\allocationnumber)%
}
% \end{macrocode}
@@ -490,7 +445,7 @@ and the derived files
% \begin{macrocode}
\protected\def\set@color{%
\LuaCol@setattribute\LuaCol@Attribute{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.get("\luaescapestring{\current@color}")%
}%
}%
@@ -508,7 +463,7 @@ and the derived files
% \begin{macro}{\luacolorProcessBox}
% \begin{macrocode}
\def\luacolorProcessBox#1{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.process(\number#1)%
}%
}
@@ -527,44 +482,26 @@ and the derived files
\set@color
% \end{macrocode}
%
-% \subsection{\cs{pdfxform} support}
+% \subsection{\cs{pdfxform}/\cs{saveboxresource} support}
%
% \begin{macrocode}
-\ifpdf
- \ifx\pdfxform\@undefined
- \let\pdfxform\saveboxresource
- \fi
- \ltx@IfUndefined{pdfxform}{%
- \directlua{%
- tex.enableprimitives('',{%
- 'pdfxform','pdflastxform','pdfrefxform'%
- })%
+\ifnum\outputmode=\@ne
+ \let\LuaCol@org@pdfxform\saveboxresource
+% \end{macrocode}
+% This is written in Lua so the integer setting is expandable and does not interfere with
+% a preceding \verb|\immediate|.
+% \begin{macrocode}
+ \protected\def\saveboxresource{%
+ \directlua{
+ local c = token.scan_int()
+ oberdiek.luacolor.process(c)
+ token.put_next(token.create'LuaCol@org@pdfxform', token.new(c, token.command_id'char_given'))
}%
- }{}%
- \ltx@IfUndefined{protected}{%
- \directlua{tex.enableprimitives('',{'protected'})}%
- }{}%
- \ltx@IfUndefined{pdfxform}{%
- \@PackageWarning{luacolor}{\string\pdfxform\space not found}%
- }{%
- \let\LuaCol@org@pdfxform\pdfxform
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname protected\endcsname\relax
- \@PackageWarning{luacolor}{\string\protected\space not found}%
- \else
- \expandafter\protected
- \fi
- \def\pdfxform{%
- \begingroup
- \afterassignment\LuaCol@pdfxform
- \count@=%
}%
- \def\LuaCol@pdfxform{%
- \luacolorProcessBox\count@
- \LuaCol@org@pdfxform\count@
- \endgroup
- }%
- }%
+% \end{macrocode}
+% Legacy alias.
+% \begin{macrocode}
+ \let\pdfxform\saveboxresource
\fi
% \end{macrocode}
%
@@ -589,7 +526,7 @@ oberdiek.luacolor = luacolor
% \begin{macro}{getversion()}
% \begin{macrocode}
function luacolor.getversion()
- tex.write("2019/11/29 v1.13")
+ tex.write("2020-02-22 v1.14")
end
% \end{macrocode}
% \end{macro}
@@ -784,8 +721,10 @@ local function traverse(list, color, dry)
traverse(n.leader, color, DRY_FALSE or dry)
else
traverse(n.leader, '', DRY_FALSE or dry)
+% \end{macrocode}
% The color status is unknown here, because the leader box
% will or will not be set.
+% \begin{macrocode}
color = ''
end
elseif t == COLOR then
@@ -829,160 +768,21 @@ function luacolor.process(box)
end
% \end{macrocode}
% \end{macro}
-%
-% \begin{macrocode}
-%</lua>
-% \end{macrocode}
-%
-% \section{Test}
-%
-% \begin{macrocode}
-%<*test1>
-\documentclass{article}
-\usepackage{color}
-%</test1>
-% \end{macrocode}
-% \subsection{Catcode checks for loading}
-%
-% \begin{macrocode}
-%<*test1>
-% \end{macrocode}
+% For recent versions of luaotfload, we can register a callback to
+% control how coloring glyph is handled for the color feature.
% \begin{macrocode}
-\catcode`\{=1 %
-\catcode`\}=2 %
-\catcode`\#=6 %
-\catcode`\@=11 %
-\expandafter\ifx\csname count@\endcsname\relax
- \countdef\count@=255 %
-\fi
-\expandafter\ifx\csname @gobble\endcsname\relax
- \long\def\@gobble#1{}%
-\fi
-\expandafter\ifx\csname @firstofone\endcsname\relax
- \long\def\@firstofone#1{#1}%
-\fi
-\expandafter\ifx\csname loop\endcsname\relax
- \expandafter\@firstofone
-\else
- \expandafter\@gobble
-\fi
-{%
- \def\loop#1\repeat{%
- \def\body{#1}%
- \iterate
- }%
- \def\iterate{%
- \body
- \let\next\iterate
- \else
- \let\next\relax
- \fi
- \next
- }%
- \let\repeat=\fi
-}%
-\def\RestoreCatcodes{}
-\count@=0 %
-\loop
- \edef\RestoreCatcodes{%
- \RestoreCatcodes
- \catcode\the\count@=\the\catcode\count@\relax
- }%
-\ifnum\count@<255 %
- \advance\count@ 1 %
-\repeat
-
-\def\RangeCatcodeInvalid#1#2{%
- \count@=#1\relax
- \loop
- \catcode\count@=15 %
- \ifnum\count@<#2\relax
- \advance\count@ 1 %
- \repeat
-}
-\def\RangeCatcodeCheck#1#2#3{%
- \count@=#1\relax
- \loop
- \ifnum#3=\catcode\count@
- \else
- \errmessage{%
- Character \the\count@\space
- with wrong catcode \the\catcode\count@\space
- instead of \number#3%
- }%
- \fi
- \ifnum\count@<#2\relax
- \advance\count@ 1 %
- \repeat
-}
-\def\space{ }
-\expandafter\ifx\csname LoadCommand\endcsname\relax
- \def\LoadCommand{\input luacolor.sty\relax}%
-\fi
-\def\Test{%
- \RangeCatcodeInvalid{0}{47}%
- \RangeCatcodeInvalid{58}{64}%
- \RangeCatcodeInvalid{91}{96}%
- \RangeCatcodeInvalid{123}{255}%
- \catcode`\@=12 %
- \catcode`\\=0 %
- \catcode`\%=14 %
- \LoadCommand
- \RangeCatcodeCheck{0}{36}{15}%
- \RangeCatcodeCheck{37}{37}{14}%
- \RangeCatcodeCheck{38}{47}{15}%
- \RangeCatcodeCheck{48}{57}{12}%
- \RangeCatcodeCheck{58}{63}{15}%
- \RangeCatcodeCheck{64}{64}{12}%
- \RangeCatcodeCheck{65}{90}{11}%
- \RangeCatcodeCheck{91}{91}{15}%
- \RangeCatcodeCheck{92}{92}{0}%
- \RangeCatcodeCheck{93}{96}{15}%
- \RangeCatcodeCheck{97}{122}{11}%
- \RangeCatcodeCheck{123}{255}{15}%
- \RestoreCatcodes
-}
-\Test
-\csname @@end\endcsname
-\end
-% \end{macrocode}
-% \begin{macrocode}
-%</test1>
-% \end{macrocode}
-%
-% \subsection{Driver detection}
-%
-% \begin{macrocode}
-%<*test2>
-\NeedsTeXFormat{LaTeX2e}
-\ifcsname driver\endcsname
- \expandafter\PassOptionsToPackage\expandafter{\driver}{color}%
- \pdfoutput=0 %
-\fi
-\documentclass{minimal}
-\usepackage{luacolor}[2018/11/01]
-\csname @@end\endcsname
-\end
-%</test2>
+if luaotfload.set_colorhandler then
+ local set_attribute = node.direct.set_attribute
+ luaotfload.set_colorhandler(function(head, n, color)
+ set_attribute(n, attribute, luacolor.getvalue(color))
+ return head, n
+ end)
+end
% \end{macrocode}
%
% \begin{macrocode}
-%<*test3>
-\NeedsTeXFormat{LaTeX2e}
-% \end{macrocode}
-% \begin{macrocode}
-\documentclass{minimal}
-\usepackage{luacolor}[2018/11/01]
-\usepackage{qstest}
-\IncludeTests{*}
-\LogTests{log}{*}{*}
-\makeatletter
-% \end{macrocode}
-% \begin{macrocode}
-\@@end
-%</test3>
+%</lua>
% \end{macrocode}
-%
% \section{Installation}
%
% \subsection{Download}
@@ -1236,6 +1036,14 @@ end
% Documentation updates.
% \item Use \xpackage{iftex} directly.
% \end{Version}
+% \begin{Version}{2020-02-22 v1.14}
+% \item Drop use of \textsf{iftex} \textsf{ltxcmds} and \textsf{infwarerr}.
+% \item Assume \textsf{ltluatex} preloaded into format (true since 2015).
+% \item Patch \verb|\saveboxresource| rather than \verb|\pdfxform| (keep old name as alias).
+% \item Grab the number via Lua so that a \verb|\immediate| prefix still works with
+% \verb|\saveboxresource|\slash \verb|\pdfxform|.
+% \item Added handler for the color feature of luaotfload
+% \end{Version}
% \end{History}
%
% \PrintIndex
diff --git a/Master/texmf-dist/scripts/luacolor/luacolor.lua b/Master/texmf-dist/tex/latex/luacolor/luacolor.lua
index 38dd24e0f24..d1075136a73 100644
--- a/Master/texmf-dist/scripts/luacolor/luacolor.lua
+++ b/Master/texmf-dist/tex/latex/luacolor/luacolor.lua
@@ -9,11 +9,11 @@
-- This is a generated file.
--
-- Project: luacolor
--- Version: 2019/11/29 v1.13
+-- Version: 2020-02-22 v1.14
--
-- Copyright (C)
-- 2007, 2009-2011 Heiko Oberdiek
--- 2016-2019 Oberdiek Package Support Group
+-- 2016-2020 Oberdiek Package Support Group
--
-- This work may be distributed and/or modified under the
-- conditions of the LaTeX Project Public License, either
@@ -35,14 +35,13 @@
-- This work consists of the main source file luacolor.dtx
-- and the derived files
-- luacolor.sty, luacolor.pdf, luacolor.ins, luacolor.drv,
--- luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex,
-- luacolor.lua,
--
oberdiek = oberdiek or {}
local luacolor = oberdiek.luacolor or {}
oberdiek.luacolor = luacolor
function luacolor.getversion()
- tex.write("2019/11/29 v1.13")
+ tex.write("2020-02-22 v1.14")
end
local ifpdf = tonumber(tex.outputmode or tex.pdfoutput) > 0
local prefix
@@ -217,5 +216,12 @@ function luacolor.process(box)
local list = tex.getbox(box)
traverse(list, color, DRY_FALSE)
end
+if luaotfload.set_colorhandler then
+ local set_attribute = node.direct.set_attribute
+ luaotfload.set_colorhandler(function(head, n, color)
+ set_attribute(n, attribute, luacolor.getvalue(color))
+ return head, n
+ end)
+end
--
-- End of File `luacolor.lua'.
diff --git a/Master/texmf-dist/tex/latex/luacolor/luacolor.sty b/Master/texmf-dist/tex/latex/luacolor/luacolor.sty
index 08c38b5f543..bad536ceae4 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: 2019/11/29 v1.13
+%% Version: 2020-02-22 v1.14
%%
%% Copyright (C)
%% 2007, 2009-2011 Heiko Oberdiek
-%% 2016-2019 Oberdiek Package Support Group
+%% 2016-2020 Oberdiek Package Support Group
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -35,7 +35,6 @@
%% This work consists of the main source file luacolor.dtx
%% and the derived files
%% luacolor.sty, luacolor.pdf, luacolor.ins, luacolor.drv,
-%% luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex,
%% luacolor.lua,
%%
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -90,25 +89,17 @@
\edef\LuaCol@AtEnd{\LuaCol@AtEnd\noexpand\endinput}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
- [2019/11/29 v1.13 Color support via LuaTeX's attributes (HO)]
-\RequirePackage{infwarerr}[2010/04/08]%
-\RequirePackage{iftex}[2019/11/07]%
-\RequirePackage{ltxcmds}[2011/04/18]%
+ [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]
\RequirePackage{color}
-\ifluatex
- \ifx\newattribute\@undefined
- \RequirePackage{ltluatex}%
- \fi
-\else
- \@PackageError{luacolor}{%
+\ifx\directlua\@undefined
+ \PackageError{luacolor}{%
This package may only be run using LuaTeX%
}\@ehc
\expandafter\LuaCol@AtEnd
\fi%
- \let\LuaCol@directlua\directlua
\ifcolors@
\else
- \@PackageWarningNoLine{luacolor}{%
+ \PackageWarningNoLine{luacolor}{%
Colors are disabled by option `monochrome'%
}%
\def\set@color{}%
@@ -117,13 +108,13 @@
\def\define@color#1#2{}%
\expandafter\LuaCol@AtEnd
\fi%
-\LuaCol@directlua{%
+\directlua{%
require("luacolor")%
}
\begingroup
- \edef\x{\LuaCol@directlua{tex.write("2019/11/29 v1.13")}}%
+ \edef\x{\directlua{tex.write("2020-02-22 v1.14")}}%
\edef\y{%
- \LuaCol@directlua{%
+ \directlua{%
if oberdiek.luacolor.getversion then %
oberdiek.luacolor.getversion()%
end%
@@ -131,14 +122,14 @@
}%
\ifx\x\y
\else
- \@PackageError{luacolor}{%
+ \PackageError{luacolor}{%
Wrong version of lua module.\MessageBreak
Package version: \x\MessageBreak
Lua module: \y
}\@ehc
\fi
\endgroup
-\ifpdf
+\ifnum\outputmode=\@ne
\else
\begingroup
\def\current@color{}%
@@ -149,47 +140,39 @@
\endgroup
}%
\edef\reserved@a{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.dvidetect()%
}%
}%
\ifx\reserved@a\@empty
- \@PackageError{luacolor}{%
+ \PackageError{luacolor}{%
DVI driver detection failed because of\MessageBreak
unrecognized color \string\special
}\@ehc
\endgroup
\expandafter\expandafter\expandafter\LuaCol@AtEnd
\else
- \@PackageInfoNoLine{luacolor}{%
+ \PackageInfo{luacolor}{%
Type of color \string\special: \reserved@a
- }%
+ \@gobble}%
\fi%
\endgroup
\fi
-\ltx@IfUndefined{newluatexattribute}{%
- \newattribute\LuaCol@Attribute
-}{%
- \newluatexattribute\LuaCol@Attribute
-}
-\ltx@IfUndefined{setluatexattribute}{%
- \let\LuaCol@setattribute\setattribute
-}{%
- \let\LuaCol@setattribute\setluatexattribute
-}
-\LuaCol@directlua{%
+\newattribute\LuaCol@Attribute
+\let\LuaCol@setattribute\setattribute
+\directlua{%
oberdiek.luacolor.setattribute(\number\allocationnumber)%
}
\protected\def\set@color{%
\LuaCol@setattribute\LuaCol@Attribute{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.get("\luaescapestring{\current@color}")%
}%
}%
}
\def\reset@color{}
\def\luacolorProcessBox#1{%
- \LuaCol@directlua{%
+ \directlua{%
oberdiek.luacolor.process(\number#1)%
}%
}
@@ -198,41 +181,16 @@
\luacolorProcessBox\AtBeginShipoutBox
}
\set@color
-\ifpdf
- \ifx\pdfxform\@undefined
- \let\pdfxform\saveboxresource
- \fi
- \ltx@IfUndefined{pdfxform}{%
- \directlua{%
- tex.enableprimitives('',{%
- 'pdfxform','pdflastxform','pdfrefxform'%
- })%
+\ifnum\outputmode=\@ne
+ \let\LuaCol@org@pdfxform\saveboxresource
+ \protected\def\saveboxresource{%
+ \directlua{
+ local c = token.scan_int()
+ oberdiek.luacolor.process(c)
+ token.put_next(token.create'LuaCol@org@pdfxform', token.new(c, token.command_id'char_given'))
}%
- }{}%
- \ltx@IfUndefined{protected}{%
- \directlua{tex.enableprimitives('',{'protected'})}%
- }{}%
- \ltx@IfUndefined{pdfxform}{%
- \@PackageWarning{luacolor}{\string\pdfxform\space not found}%
- }{%
- \let\LuaCol@org@pdfxform\pdfxform
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname protected\endcsname\relax
- \@PackageWarning{luacolor}{\string\protected\space not found}%
- \else
- \expandafter\protected
- \fi
- \def\pdfxform{%
- \begingroup
- \afterassignment\LuaCol@pdfxform
- \count@=%
}%
- \def\LuaCol@pdfxform{%
- \luacolorProcessBox\count@
- \LuaCol@org@pdfxform\count@
- \endgroup
- }%
- }%
+ \let\pdfxform\saveboxresource
\fi
\LuaCol@AtEnd%
\endinput