end
end
end
- local getbox, shipout = tex.getbox, tex.shipout
- local setbox, copy = node.direct.setbox, node.direct.copy
- local afbox
- function luatexja.direction.shipout()
- start_time_measure 'box_primitive_hook'
- if (not afbox) and luatexja.afbox_number then afbox = luatexja.afbox_number end
- local a = to_direct(getbox 'ltj@afbox')
- local a_dir = get_box_dir(a, dir_yoko)
- if a_dir~=dir_yoko then
- local b = create_dir_node(a, a_dir, dir_yoko, false)
- setfield(b, 'head', a); a = b
- end
- setfield(shipout_temp, 'head', a); finalize_inner(shipout_temp)
- setbox(afbox, copy(getlist(shipout_temp))); setfield(shipout_temp, 'head',nil)
- shipout(afbox)
- stop_time_measure 'box_primitive_hook'
- end
- function luatexja.direction.shipout_lthook(head)
+ local copy = node.direct.copy
+ function luatexja.direction.shipout_lthook (head)
start_time_measure 'box_primitive_hook'
local a = to_direct(head)
local a_dir = get_box_dir(a, dir_yoko)
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2021-03-17 LaTeX support of LuaTeX-ja]
+\ProvidesPackage{ltj-latex}[2021-03-18 LaTeX support of LuaTeX-ja]
\endlinechar=13
}{}
\@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
- \protected\def\ltj@shipout{\ltj@afterbox\ltj@@lua@shipout}
+ \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
%! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
% LuaTeX-ja macros against plain TeX
+%%%%\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
-\protected\def\ltj@shipout{\ltj@afterbox\ltj@@lua@shipout}
-\let\shipout\ltj@shipout
+\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
\directlua{luatexja.direction.shipout_lthook = nil}
\ifdefined\ltj@stdmcfont\else\def\ltj@stdmcfont{file:HaranoAjiMincho-Regular.otf}\fi
\ltj@@lua@raisebox\ltj@@orig@vcenter{\box\ltj@afbox}%
}
-%%%% \shipout
-\newluafunction\ltj@@lua@shipout@inner
-\directlua{
- local t = lua.get_functions_table()
- t[\the\ltj@@lua@shipout@inner]=luatexja.direction.shipout
-}
-
%%%% \unhbox and \unvbox
\newluafunction\ltj@@lua@unboxcheckdir@inner
\directlua{