OSDN Git Service

Another approach for #3: cancel profiling in OTR
[luatex-ja/luatexja.git] / src / patches / lltjcore.sty
index 086771a..1c8f9cb 100644 (file)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjcore}[2022-01-17 Patch to LaTeX2e Kernel for LuaTeX-ja]
+\ProvidesPackage{lltjcore}[2023-02-26 Patch to LaTeX2e Kernel for LuaTeX-ja]
 \RequirePackage{etoolbox}
 
 %%% expl3
   \ifnum\ltjgetparameter{direction}=4\else
     \dimen\z@\textwidth \textwidth\textheight \textheight\dimen\z@
   \fi
+  \directlua{luatexja.lineskip.setting_backup()}
   \let \protect \noexpand
 }{}{}
 \patchcmd\@outputpage{% supply \yoko
 \patchcmd\@outputpage{\vskip\topmargin}{\vskip\topmargin\iftombow\vskip1in\fi}{}{}
 \patchcmd\@outputpage{\reset@font}{\@tombowreset@@paper\reset@font}{}{}
 \patchcmd\@outputpage{\@begindvi}{\@begindvi\@outputtombow}{}{}
+\patchcmd\@outputpage{\stepcounter{page}}%
+  {\stepcounter{page}\directlua{luatexja.lineskip.setting_restore()}}{}{}
 
+%
+\pretocmd\@floatboxreset{\pltx@save@float@dir}{}{}
+\patchcmd\@endfloatbox{\outer@nobreak}{\outer@nobreak\pltx@check@float@dir}{}{}
+\def\pltx@save@float@dir{%
+  \edef\pltx@float@dir@first{\ltjgetparameter{direction}}}
+\def\pltx@check@float@dir{%
+  \ifx\pltx@float@dir@first\@undefined\else
+    \ifnum\ltjgetparameter{direction}=\pltx@float@dir@first\else
+      \pltx@err@float@dir
+    \fi
+  \fi}
+\def\pltx@err@float@dir{%
+  \@latex@error{Direction change inside float!?\MessageBreak
+    Use \noexpand\layoutcaption provided in \string\usepackage{lltjext}}\@ehc}
 %%% Remove extra xkanjiskip
 \renewcommand\@makefnmark{%
   \unless\ifnum\ltjgetparameter{direction}=3
   \hskip\@tempskipa\color@endgroup\egroup}
 \pretocmd{\footnote}{\inhibitglue}{}{}
 \pretocmd{\footnotemark}{\inhibitglue}{}{}
-\patchcmd{\@footnotemark}{\@makefnmark}{%
-  \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark%
-  \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi%
-}{}{}
-\let\@parboxto\@empty
+\def\@ltj@process@makefnmark#1{%
+  \unless\ifnum\ltjgetparameter{direction}=3 #1%
+  \else\hbox to\z@{\hskip-.25\zw\raise.9\zh#1\hss}\fi%
+}%
+\ifdefined\@kernel@process@makefnmark %% 2022-06-01 latex-lab?
+  \let\ltj@orig@kernel@process@makefnmark=\@kernel@process@makefnmark
+  \def\@kernel@process@makefnmark#1{\ltj@orig@kernel@process@makefnmark{\@ltj@process@makefnmark#1}}
+\else
+  \patchcmd{\@footnotemark}{\@makefnmark}{\@ltj@process@makefnmark\@makefnmark}{}{}
+\fi
 \long\def\@iiiparbox#1#2[#3]#4#5{%
   \leavevmode
   \@pboxswfalse