summaryrefslogtreecommitdiff
path: root/macros/generic/tex-ini-files/luatexconfig.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/tex-ini-files/luatexconfig.tex
Initial commit
Diffstat (limited to 'macros/generic/tex-ini-files/luatexconfig.tex')
-rw-r--r--macros/generic/tex-ini-files/luatexconfig.tex69
1 files changed, 69 insertions, 0 deletions
diff --git a/macros/generic/tex-ini-files/luatexconfig.tex b/macros/generic/tex-ini-files/luatexconfig.tex
new file mode 100644
index 0000000000..5ad8913b65
--- /dev/null
+++ b/macros/generic/tex-ini-files/luatexconfig.tex
@@ -0,0 +1,69 @@
+% tex-ini-files 2016-04-15: luatexconfig.tex
+
+% Load shared (PDF) settings in LuaTeX
+
+\begingroup
+ \catcode`\{=1 %
+ \catcode`\}=2 %
+ \catcode`\#=6 %
+ % Settings that were primitives
+ % accessed in newer LuaTeX releases via \pdfvariable
+ \def\list{%
+ {compresslevel}%
+ {decimaldigits}%
+ {horigin}%
+ {minorversion}%
+ {objcompresslevel}%
+ {pkresolution}%
+ {vorigin}%
+ }%
+ \def\do#1{%
+ \ifx\relax#1\else
+ \directlua{tex.enableprimitives("", {"pdf#1"})}%
+ \expandafter\do
+ \fi
+ }%
+ % Enable all \pdf... primitives in one go
+ \expandafter\do\list{output}{pageheight}{pagewidth}{variable}\relax
+ % Other required primitives that are not named \pdf...
+ \directlua{tex.enableprimitives("",
+ {"pageheight", "pagewidth", "outputmode"})}%
+ % Newer LuaTeX releases don't have \pdfoutput, etc.:
+ % emulate names where appropriate
+ \ifx\pdfoutput\undefined
+ \global\let\pdfoutput\outputmode
+ \global\let\pdfpageheight\pageheight
+ \global\let\pdfpagewidth\pagewidth
+ \def\do#1{%
+ \ifx\relax#1\else
+ \expandafter\xdef\csname pdf#1\endcsname{\pdfvariable #1}%
+ \expandafter\do
+ \fi
+ }%
+ \expandafter\do\list\relax
+ \fi
+ % The file pdftexconfig.tex contains only <primitive> = <value> lines
+ % so can now be read using the (emulated) primitives
+ % This needs to be global so set \globaldefs for this step
+ \globaldefs=1 %
+ \input{pdftexconfig}%
+ \globaldefs=0 %
+ % Pick up on a request for DVI mode and apply it whilst \pdfoutput is
+ % still defined
+ \ifx\dvimode\relax
+ \global\pdfoutput=0 %
+ \fi
+ \global\let\dvimode\undefined
+ % Clean up all of the globally-allocated names
+ \def\do#1{%
+ \ifx\relax#1\else
+ \global\expandafter\let\csname pdf#1\endcsname\undefined
+ \expandafter\do
+ \fi
+ }%
+ \expandafter\do\list{output}{pageheight}{pagewidth}{variable}\relax
+ \global\let\outputmode\undefined
+ \global\let\pageheight\undefined
+ \global\let\pagewidth\undefined
+ \global\let\dvimode\undefined
+\endgroup