From d3b06b2254431c03e127876a07ae654091314c72 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 20 Mar 2021 03:01:11 +0000
Subject: CTAN sync 202103200301

---
 .../generic/luatexja/src/patches/lltjcore.sty      | 118 ++++++++-------------
 1 file changed, 44 insertions(+), 74 deletions(-)

(limited to 'macros/luatex/generic/luatexja/src/patches/lltjcore.sty')

diff --git a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty
index 2af25035a5..19fe320fad 100644
--- a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty
+++ b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjcore}[2020-09-28 Patch to LaTeX2e Kernel for LuaTeX-ja]
+\ProvidesPackage{lltjcore}[2021-03-19 Patch to LaTeX2e Kernel for LuaTeX-ja]
 \RequirePackage{etoolbox}
 
 %%% expl3
@@ -72,7 +72,10 @@
   \fi\fi}
 
 \patchcmd\@vtryfc{\global\setbox\@outputbox\vbox{}}
-  {\global\setbox\@outputbox\vbox{\unless\ifnum\ltjgetparameter{direction}=4\hskip\z@\fi}}{}{}
+  {\global\setbox\@outputbox\vbox{%
+     \unless\ifnum\ltjgetparameter{direction}=4
+       \primitive\everypar{}\hskip\z@\fi
+  }}{}{}
 
 \newif\iftombow \tombowfalse
 \newif\iftombowdate \tombowdatetrue
@@ -86,7 +89,7 @@
 \newbox\@BR\newbox\@Br
 \newbox\@CL
 \newbox\@CR
-\font\@bannerfont=cmtt9
+\font\@bannerfont=file:lmmono9-regular.otf % cmtt9 in pLaTeX
 \newtoks\@bannertoken
 \@bannertoken{}
 \def\maketombowbox{%
@@ -134,23 +137,23 @@
 }
 \def\@outputtombow{%
   \iftombow
-  \vbox to\z@{\kern-\dimexpr 10mm+\@tombowbleed\relax
+  \vbox to\z@{\kern\dimexpr-10mm-\@tombowbleed\relax
     \boxmaxdepth\maxdimen
       \moveleft\@tombowbleed\vbox to\@@paperheight{%
 	  \color@begingroup
 	  \@tombowcolor
       \hbox to\@@paperwidth{\hskip\@tombowbleed\relax
          \copy\@TL\hfill\copy\@TC\hfill\copy\@TR\hskip\@tombowbleed}%
-      \kern-10mm
+      \kern-10mm%
       \hbox to\@@paperwidth{\copy\@Tl\hfill\copy\@Tr}%
       \vfill
       \hbox to\@@paperwidth{\copy\@CL\hfill\copy\@CR}%
       \vfill
       \hbox to\@@paperwidth{\copy\@Bl\hfill\copy\@Br}%
-      \kern-10mm
+      \kern-10mm%
       \hbox to\@@paperwidth{\hskip\@tombowbleed\relax
          \copy\@BL\hfill\copy\@BC\hfill\copy\@BR\hskip\@tombowbleed}%
-	\color@endgroup
+      \color@endgroup
     }\vss
   }%
   \fi
@@ -158,80 +161,45 @@
 \def\@tombowcolor{\normalcolor}
 \def\@tombowbleed{3mm}
 \def\@tombowreset@@paper{%
-     \@@topmargin\topmargin
-     \iftombow
-       \@@paperwidth\paperwidth
-	   \advance\@@paperwidth 2\dimexpr\@tombowbleed\relax
-       \@@paperheight\paperheight\advance\@@paperheight 10mm\relax
-	   \advance\@@paperheight 2\dimexpr\@tombowbleed\relax
-       \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax
-     \fi
+   \@@topmargin \topmargin % only for compatibility
+   \iftombow
+     \@@paperwidth\dimexpr\paperwidth+2\dimexpr\@tombowbleed\relax
+     \@@paperheight\dimexpr\paperheight+10mm+2\dimexpr\@tombowbleed\relax
+     \advance\@@topmargin 1in\relax \advance\@themargin 1in\relax
+   \fi
 }
 \newdimen\@@paperheight
 \newdimen\@@paperwidth
-\newdimen\@@topmargin
-\def\@outputpage{%
-\begingroup % the \endgroup is put in by \aftergroup
+\newdimen\@@topmargin % not used by LuaTeX-ja; only to avoid existing codes
+\patchcmd\@outputpage{\begingroup\let\protect\noexpand}{% tate direction
+\begingroup
   \ifnum\ltjgetparameter{direction}=4\else
     \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
   \fi
   \let \protect \noexpand
-  \language\document@default@language %LaTeX2e 2017/05/01
-  \@resetactivechars
-  \global\let\@@if@newlist\if@newlist
-  \global\@newlistfalse
-  \@parboxrestore
-  \shipout\vbox{\yoko
+}{}{}
+\patchcmd\@outputpage{% supply \yoko
     \set@typeset@protect
-    \aftergroup\endgroup
-    \aftergroup\set@typeset@protect
-     \if@specialpage
-       \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
-     \fi
-     \if@twoside
-       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
-          \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
-          \else\let\@themargin\oddsidemargin\fi
-       \else \let\@thehead\@evenhead
-          \let\@thefoot\@evenfoot
-           \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
-           \else\let\@themargin\evensidemargin\fi
-     \fi\fi
-     \@tombowreset@@paper
-     \reset@font
-     \normalsize
-     \normalsfcodes
-     \let\label\@gobble
-     \let\index\@gobble
-     \let\glossary\@gobble
-     \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
-    \@begindvi
-    \@outputtombow
-    \vskip \@@topmargin
-    \moveright\@themargin\vbox{%
-      \setbox\@tempboxa \vbox to\headheight{%
-        \vfil
-        \color@hbox
-          \normalcolor
-          \hb@xt@\textwidth{\@thehead}%
-        \color@endbox
-      }%                        %% 22 Feb 87
-      \dp\@tempboxa \z@
-      \box\@tempboxa
-      \vskip \headsep
-      \box\@outputbox
-      \baselineskip \footskip
-      \color@hbox
-        \normalcolor
-        \hb@xt@\textwidth{\@thefoot}%
-      \color@endbox
-    }%
-  }%
-  \global\let\if@newlist\@@if@newlist
-  \global \@colht \textheight
-  \stepcounter{page}%
-  \let\firstmark\botmark
-}
+    \aftergroup \endgroup
+}{%
+    \yoko \set@typeset@protect
+    \aftergroup \endgroup
+}{}{}
+\patchcmd\@outputpage{\let\@thefoot\@oddfoot\let\@themargin\oddsidemargin}{% tate direction
+  \let\@thefoot\@oddfoot
+  \ifnum\ltjgetparameter{direction}=3 \let\@themargin\evensidemargin
+  \else\let\@themargin\oddsidemargin\fi
+}{}{}
+\patchcmd\@outputpage{\let\@thefoot\@evenfoot\let\@themargin\evensidemargin}{% tate direction
+  \let\@thefoot\@evenfoot
+  \ifnum\ltjgetparameter{direction}=3 \let\@themargin\oddsidemargin
+  \else\let\@themargin\evensidemargin\fi
+}{}{}
+
+% 将来は shipout hook で書き直したい
+\patchcmd\@outputpage{\vskip\topmargin}{\vskip\topmargin\iftombow\vskip1in\fi}{}{}
+\patchcmd\@outputpage{\reset@font}{\@tombowreset@@paper\reset@font}{}{}
+\patchcmd\@outputpage{\@begindvi}{\@begindvi\@outputtombow}{}{}
 
 %%% Remove extra xkanjiskip
 \renewcommand\@makefnmark{%
@@ -327,7 +295,9 @@
        \@texttop
        \dimen@ \dp\@outputbox
        \unvbox \@outputbox
-       \unless\ifnum\ltjgetparameter{direction}=4\vbox{\hskip\z@}\fi %%% LuaTeX-ja
+       \unless\ifnum\ltjgetparameter{direction}=4
+         \vbox{\primitive\everypar{}\hskip\z@}%
+       \fi %%% LuaTeX-ja
        \vskip -\dimen@
        \ifltj@ftn@unvboxed\iffnfixbottom\else\@textbottom\fi\else\@textbottom\fi
        }%
-- 
cgit v1.2.3

