From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/generic/tex-ini-files/README.md | 56 +++++++++++++ macros/generic/tex-ini-files/dvilualatex.ini | 4 + macros/generic/tex-ini-files/dviluatex.ini | 4 + macros/generic/tex-ini-files/lualatex.ini | 19 +++++ macros/generic/tex-ini-files/luatex.ini | 12 +++ macros/generic/tex-ini-files/luatexconfig.tex | 69 ++++++++++++++++ macros/generic/tex-ini-files/pdftexconfig.tex | 21 +++++ macros/generic/tex-ini-files/xelatex.ini | 17 ++++ macros/generic/tex-ini-files/xetex.ini | 109 ++++++++++++++++++++++++++ 9 files changed, 311 insertions(+) create mode 100644 macros/generic/tex-ini-files/README.md create mode 100644 macros/generic/tex-ini-files/dvilualatex.ini create mode 100644 macros/generic/tex-ini-files/dviluatex.ini create mode 100644 macros/generic/tex-ini-files/lualatex.ini create mode 100644 macros/generic/tex-ini-files/luatex.ini create mode 100644 macros/generic/tex-ini-files/luatexconfig.tex create mode 100644 macros/generic/tex-ini-files/pdftexconfig.tex create mode 100644 macros/generic/tex-ini-files/xelatex.ini create mode 100644 macros/generic/tex-ini-files/xetex.ini (limited to 'macros/generic/tex-ini-files') diff --git a/macros/generic/tex-ini-files/README.md b/macros/generic/tex-ini-files/README.md new file mode 100644 index 0000000000..3a7b94b0bd --- /dev/null +++ b/macros/generic/tex-ini-files/README.md @@ -0,0 +1,56 @@ +# Model TeX format creation files + +This bundle provides a collection of model `.ini` files for +creating TeX formats. These files are commonly used to introduced +distribution-dependent variations in formats. They are also used +to allow existing format source files to be used with newer +engines, for example to adapt the plain e-TeX source file to +work with XeTeX and LuaTeX. + +## Shared configuration + +The file `pdftexconfig.tex` contains common settings for pdfTeX +and LuaTeX, most of which are concerned with direct PDF output. +This file is designed to be loaded directly by pdfTeX and can +be parsed by the `luatexconfig.tex` to allow the same settings +to be used by LuaTeX directly. The format of the file +`pdftexconfig.tex` is strictly + + = + +for all non-comment non-blank lines. + +The LuaTeX loader recognise the marker control sequence `\dvimode`. +If this is defined, the loaders will set the format to produce +DVI file, and otherwise will select direct PDF output. The loader +will then undefine `\dvimode`. + +## History + +The use of `.ini` files for building formats has developed over +some time. The initial versions of the files collected here were +taken from TeX Live 2015, and thus carry forward long-standing +behaviours from this system. Initial modifications were made +to allow for significant changes in LuaTeX primitive support +between TeX Live 2015 and TeX Live 2016. + +The files provided here are designed to work with other support +files and engines available from late 2015 onward, in particular: +- pdfTeX v1.40+ +- LuaTeX v0.80+ +- XeTeX v0.99992+ +- LaTeX2e 2015-01-01 onward +- unicode-data v1.0+ + +Major changes: +- 2016-02-27 First version of bundle +- 2016-04-14 Do not assume e-TeX availability in `pdftexconfig.tex` +- 2016-04-15 New approach to loading shared pdfTeX/LuaTeX data + +A full history of this bundle is available from +https://github.com/josephwright/tex-ini-files + +## Legal + +The files provided here were originally written by various +authors and are all marked as public domain. diff --git a/macros/generic/tex-ini-files/dvilualatex.ini b/macros/generic/tex-ini-files/dvilualatex.ini new file mode 100644 index 0000000000..476ee45f45 --- /dev/null +++ b/macros/generic/tex-ini-files/dvilualatex.ini @@ -0,0 +1,4 @@ +% tex-ini-files 2016-04-15: dvilualatex.ini + +\let\dvimode\relax +\input lualatex.ini diff --git a/macros/generic/tex-ini-files/dviluatex.ini b/macros/generic/tex-ini-files/dviluatex.ini new file mode 100644 index 0000000000..abe93aa343 --- /dev/null +++ b/macros/generic/tex-ini-files/dviluatex.ini @@ -0,0 +1,4 @@ +% tex-ini-files 2016-04-15: dvilualatex.ini + +\let\dvimode\relax +\input luatex.ini diff --git a/macros/generic/tex-ini-files/lualatex.ini b/macros/generic/tex-ini-files/lualatex.ini new file mode 100644 index 0000000000..1f7a49813a --- /dev/null +++ b/macros/generic/tex-ini-files/lualatex.ini @@ -0,0 +1,19 @@ +% tex-ini-files 2016-04-15: lualatex.ini + +% Originally written 2008 by Karl Berry. Public domain. + +\input luatexconfig.tex + +\begingroup + \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")}} +\endgroup + +\input latex.ltx diff --git a/macros/generic/tex-ini-files/luatex.ini b/macros/generic/tex-ini-files/luatex.ini new file mode 100644 index 0000000000..1a592cf15d --- /dev/null +++ b/macros/generic/tex-ini-files/luatex.ini @@ -0,0 +1,12 @@ +% tex-ini-files 2016-04-15: luatex.ini + +% Karl Berry, originally written 2008. Public domain. +% PDF output by default. + +% Must be done first (as needs to 'tidy up') +\input luatexconfig.tex +% Activate primitives +\input luatexiniconfig.tex +\input load-unicode-data.tex +\input etex.src +\dump 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 = 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 diff --git a/macros/generic/tex-ini-files/pdftexconfig.tex b/macros/generic/tex-ini-files/pdftexconfig.tex new file mode 100644 index 0000000000..44c25abcbd --- /dev/null +++ b/macros/generic/tex-ini-files/pdftexconfig.tex @@ -0,0 +1,21 @@ +% tex-ini-files 2016-04-15: pdftexconfig.tex + +% Load shared (PDF) settings in pdfTeX + +% Enable PDF output +\pdfoutput = 1 + +% Paper size: dimensions given in absolute terms +\pdfpageheight = 297 true mm +\pdfpagewidth = 210 true mm + +% Enable PDF 1.5 output and thus more compression +\pdfminorversion = 5 +\pdfobjcompresslevel = 2 + +% Low-level settings unlikely ever to need to change +\pdfcompresslevel = 9 +\pdfdecimaldigits = 3 +\pdfpkresolution = 600 +\pdfhorigin = 1 true in +\pdfvorigin = 1 true in diff --git a/macros/generic/tex-ini-files/xelatex.ini b/macros/generic/tex-ini-files/xelatex.ini new file mode 100644 index 0000000000..ef0432c241 --- /dev/null +++ b/macros/generic/tex-ini-files/xelatex.ini @@ -0,0 +1,17 @@ +% tex-ini-files 2016-04-15: xelatex.ini + +% Public domain. Originally by Jonathan Kew. + +% Primitives in pdftex and luatex, we'll just use macros here. +% Since we are generating a whatsit, not 100% compatible, +% but hopefully close enough. +% +\begingroup + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \csname protected\endcsname\gdef\pdfmapfile#1{\special{pdf:mapfile #1}}% + \csname protected\endcsname\gdef\pdfmapline#1{\special{pdf:mapline #1}}% +\endgroup + +\input latex.ltx diff --git a/macros/generic/tex-ini-files/xetex.ini b/macros/generic/tex-ini-files/xetex.ini new file mode 100644 index 0000000000..717589b469 --- /dev/null +++ b/macros/generic/tex-ini-files/xetex.ini @@ -0,0 +1,109 @@ +% tex-ini-files 2016-04-15: xetex.ini + +% Public domain. Originally by Jonathan Kew. + +%% Disable the \font\preloaded=... entries from plain.tex +%% as XeTeX is primarily intended for use with other fonts +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 \catcode`\^=7 \catcode`\@=11 + +\scrollmode + +% General Unicode set up +\input load-unicode-data.tex % + +% Classes that have always been defined by the XeTeX format +\input load-unicode-xetex-classes.tex % + +% Let etex.src handle things if eTeX is not enabled! +\ifx\XeTeXinterchartoks\undefined +\else + % basic line-breaking support for CJK etc; override for more sophisticated spacing, + % automatic font changes, etc. + + \gdef\xtxHanGlue{\hskip0pt plus 0.1em\relax} % between ideographs + \gdef\xtxHanSpace{\hskip0.2em plus 0.2em minus 0.1em\relax} % before/after runs of CJK + + \global\XeTeXinterchartoks 0 1 = {\xtxHanSpace} + \global\XeTeXinterchartoks 0 2 = {\xtxHanSpace} + \global\XeTeXinterchartoks 0 3 = {\nobreak\xtxHanSpace} + + \global\XeTeXinterchartoks 1 0 = {\xtxHanSpace} + \global\XeTeXinterchartoks 2 0 = {\nobreak\xtxHanSpace} + \global\XeTeXinterchartoks 3 0 = {\xtxHanSpace} + + \global\XeTeXinterchartoks 1 1 = {\xtxHanGlue} + \global\XeTeXinterchartoks 1 2 = {\xtxHanGlue} + \global\XeTeXinterchartoks 1 3 = {\nobreak\xtxHanGlue} + + \global\XeTeXinterchartoks 2 1 = {\nobreak\xtxHanGlue} + \global\XeTeXinterchartoks 2 2 = {\nobreak\xtxHanGlue} + \global\XeTeXinterchartoks 2 3 = {\xtxHanGlue} + + \global\XeTeXinterchartoks 3 1 = {\xtxHanGlue} + \global\XeTeXinterchartoks 3 2 = {\xtxHanGlue} + \global\XeTeXinterchartoks 3 3 = {\nobreak\xtxHanGlue} +\fi + +\let\s@vef@nt=\font +\let\preloaded=2 +\def\font{\futurelet\next\d@ntpreload} +\def\d@ntpreload{\ifx\next\preloaded + \let\next\sk@pf@nt + \begingroup \catcode`\%=12 \catcode13=12 + \else + \let\next\s@vef@nt + \fi \next} +\lccode1=13 +\lowercase{\def\sk@pf@nt\preloaded=#1^^A{\endgroup}} + +\input etex.src + +% Restore the \font command and undefine other stuff +\catcode`\@=11 +\let\font=\s@vef@nt +\let\d@ntpreload=\und@fined +\let\sk@pf@nt=\und@fined +\let\s@vef@nt=\und@fined + +% +% Allocator for \XeTeXintercharclass values, from Enrico Gregorio +% +\newcount\xe@alloc@intercharclass % allocates intercharclass +\xe@alloc@intercharclass=\thr@@ % from 4 (1,2 and 3 are used by CJK, AFAIK) +\def\xe@alloc@#1#2#3#4#5{\global\advance#1\@ne + \xe@ch@ck#1#4#2% make sure there's still room + \allocationnumber#1% + \global#3#5\allocationnumber + \wlog{\string#5=\string#2\the\allocationnumber}} +\def\xe@ch@ck#1#2#3{% + \ifnum#1<#2\else + \errmessage{No room for a new #3}% + \fi} +\def\newXeTeXintercharclass{% + \xe@alloc@\xe@alloc@intercharclass\XeTeXcharclass\chardef\xe@charclass@boundary} + +% The limit for character class has been enlarged from 256 to 4096 since XeTeX 0.99994. +% So the boundary of character class is changed from 255 to 4095. +% Primitive \XeTeXinterwordspaceshaping is introduced by XeTeX 0.99994. +% We can use it as a flag. +\ifx\XeTeXinterwordspaceshaping\und@fined + \chardef\xe@charclass@boundary=\@cclv +\else + \chardef\xe@charclass@boundary=4095 % +\fi + +% Primitives in pdfTeX and LuaTeX, we'll just use macros here. +% Since we are generating a whatsit, not 100% compatible, +% but hopefully close enough. +\protected\def\pdfmapfile#1{\special{pdf:mapfile #1}} +\protected\def\pdfmapline#1{\special{pdf:mapline #1}} + +\catcode`\@=12 + +\XeTeXuseglyphmetrics=1 +\XeTeXdashbreakstate=1 + +\errorstopmode + +\dump +\endinput -- cgit v1.2.3