OSDN Git Service

better fix or #37164
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 12 Nov 2017 12:43:16 +0000 (21:43 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 12 Nov 2017 12:43:16 +0000 (21:43 +0900)
src/ltj-direction.lua
src/patches/lltjp-preview.sty

index 133e3e8..97f2678 100644 (file)
@@ -1110,8 +1110,9 @@ do
       local dn_h = getfield(db, 'height')
       local dn_d = getfield(db, 'depth')
       local db_head, db_tail
-      for _,v in ipairs(dir_node_aux
-                       [get_box_dir(b, dir_yoko)%dir_math_mod][new_dir][getid(b)]) do
+      local t = dir_node_aux[get_box_dir(b, dir_yoko)%dir_math_mod][new_dir]
+      t = t and t[getid(b)]; if not t then return end
+      for _,v in ipairs(t) do
          local cmd, arg, nn = v[1], v[2]
          if cmd=='kern' then
             nn = node_new(id_kern, 1)
index f8a90ef..a4eebc1 100644 (file)
@@ -3,14 +3,20 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-preview}[2017/05/08 Patch to preview for LuaTeX-ja]
+\ProvidesPackage{lltjp-preview}[2017/11/12 Patch to preview for LuaTeX-ja]
 
 \RequirePackage{etoolbox,preview,luatexja}
+\newbox\ltj@preview@box
 
 \patchcmd\pr@endbox{%
    \pr@ship@end
 }{%
-   \setbox\pr@box\hbox{\yoko\box\pr@box}\pr@ship@end
+   \setbox\ltj@preview@box=\box\AtBeginShipoutBox
+   \setbox\AtBeginShipoutBox=\hbox{\yoko\box\pr@box}%
+   \directlua{luatexja.direction.finalize()}%
+   \setbox\pr@box=\box\AtBeginShipoutBox
+   \setbox\AtBeginShipoutBox=\box\ltj@preview@box
+   \pr@ship@end
 }{}{}
 
 \endinput