summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty36
1 files changed, 27 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
index 213f2f71094..6517262f56c 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
@@ -12,19 +12,11 @@
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2020-12-29 LaTeX support of LuaTeX-ja]
-
-% cleanup at end of the document
-%\let\ltj@@orig@end=\@@end
-%\protected\def\@@end{%
-% \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
+\ProvidesPackage{ltj-latex}[2021-03-18 LaTeX support of LuaTeX-ja]
\endlinechar=13
%%% LaTeX version detection
-\ifcsname tex_shipout:D\endcsname
- \expandafter\let\csname tex_shipout:D\endcsname\ltj@shipout
-\fi
\newif\ifltj@ltfilehook@avail
\@ifl@t@r\fmtversion{2020-10-01}{%
\@ifl@t@r\fmtversion{2020-10-02}%
@@ -34,6 +26,32 @@
\else\ltj@ltfilehook@availtrue\fi
}%
}{}
+\@ifl@t@r\fmtversion{2021-05-01}{\count@=1 }{\count@=0 }
+\ifnum \count@<1
+%%%% \shipout
+ \newluafunction\ltj@@lua@shipout@inner
+ \directlua{
+ local t = lua.get_functions_table()
+ local getbox, setbox = tex.getbox, tex.setbox
+ local shipout_lthook = luatexja.direction.shipout_lthook
+ t[\the\ltj@@lua@shipout@inner]=function ()
+ local a = shipout_lthook(getbox(\the\ltj@afbox))
+ if a then setbox(\the\ltj@afbox, a) end
+ end
+ }
+ \protected\luadef\ltj@@lua@shipout\ltj@@lua@shipout@inner
+ \def\ltj@shipout@{\ltj@@lua@shipout\primitive\shipout\box\ltj@afbox}%
+ \protected\def\ltj@shipout{\ltj@afterbox\ltj@shipout@}
+ \ifprimitive\shipout\let\shipout\ltj@shipout\fi
+ \ifcsname tex_shipout:D\endcsname
+ \expandafter\let\csname tex_shipout:D\endcsname\ltj@shipout
+ \fi
+ \directlua{luatexja.direction.shipout_lthook = nil}
+\else
+ \directlua{%
+ luatexbase.add_to_callback('pre_shipout_filter',luatexja.direction.shipout_lthook, 'ltj.direction', 1)
+ }
+\fi
%%% patch for LaTeX
\usepackage{lltjfont}