From d71a9549e50dcf7f39e7084670248289ac211cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Mon, 13 Jul 2020 20:29:47 +0200 Subject: [PATCH] Make initialization more similar to luatex --- build.lua | 4 ++-- luametalatex.ini | 25 +++++++++++++++---------- luametatexconfig.tex | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 luametatexconfig.tex diff --git a/build.lua b/build.lua index c97ab36..5520b10 100644 --- a/build.lua +++ b/build.lua @@ -4,5 +4,5 @@ module = "luametalatex" tdsroot = "luametatex" -- Would be luametalatex but we use the same files for luametaplain -installfiles = {"luameta*.lua", "luameta*.ini", "kpse.*", "luametalatex-ltexpl-hook.tex"} -sourcefiles = {"luameta*.lua", "luameta*.ini", "kpse.*", "luametalatex-ltexpl-hook.tex"} +installfiles = {"luameta*.lua", "luameta*.ini", "*.so", "*.dll", "luametatexconfig.tex", "luametalatex-ltexpl-hook.tex"} +sourcefiles = {"luameta*.lua", "luameta*.ini", "*.so", "*.dll", "luametatexconfig.tex", "luametalatex-ltexpl-hook.tex"} diff --git a/luametalatex.ini b/luametalatex.ini index 2be29e6..20b7524 100644 --- a/luametalatex.ini +++ b/luametalatex.ini @@ -1,14 +1,19 @@ -% Thomas Esser, 1998. public domain. -% +% Based on lualatex.ini, originally written 2008 by Karl Berry. Public domain. + +\input luametatexconfig.tex -\scrollmode \begingroup -\catcode`\{=1 -\catcode`\}=2 -\global\chardef\eTeXversion=2 -\global\def\eTeXrevision{.2} + \catcode`\{=1 % + \catcode`\}=2 % + % Set up job name quoting before latex.ltx + % Web2c pdfTeX/XeTeX quote job names containing spaces, but LuaTeX does + % not do this at the engine level. The behaviour can be changed using + % a callback. Originally this code was loaded via lualatexquotejobname.tex + % but that required a hack around latex.ltx: the behaviour has been altered + % to allow the callback route to be used directly. + \global\everyjob{\directlua{require("lualatexquotejobname.lua")}} + \global\chardef\eTeXversion=2 + \global\def\eTeXrevision{.2} \endgroup -% \let\savedversionofdump\dump -% \let\dump\relax + \input latex.ltx -\endinput diff --git a/luametatexconfig.tex b/luametatexconfig.tex new file mode 100644 index 0000000..9d9979d --- /dev/null +++ b/luametatexconfig.tex @@ -0,0 +1,41 @@ +% Adapted based on tex-ini-files 2016-04-15: luatexconfig.tex + +% Load shared (PDF) settings in LuaMetaTeX + +\begingroup + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \def\list{% + {compresslevel}% + {decimaldigits}% + {horigin}% + {minorversion}% + {objcompresslevel}% + {pkresolution}% + {vorigin}% + }% + % LuaMetaTeX doesn't have \pdfoutput, etc.: + % emulate names where appropriate + \let\pdfoutput\outputmode + \let\pdfpageheight\pageheight + \let\pdfpagewidth\pagewidth + \def\do#1{% + \ifx\relax#1\else + \expandafter\edef\csname pdf#1\endcsname{\pdfvariable #1}% + \expandafter\do + \fi + }% + \expandafter\do\list\relax + % The file pdftexconfig.tex contains only = lines + % so can now be read using the (emulated) primitives + % This needs to be global so set \globaldefs for the rest of the group + \globaldefs=1 % + \input{pdftexconfig}% + % Pick up on a request for DVI mode and apply it whilst \pdfoutput is + % still defined + \ifx\dvimode\relax + \pdfoutput=0 % + \fi + \let\dvimode\undefined +\endgroup