From: Hironori Kitagawa Date: Sun, 29 Jun 2014 05:24:29 +0000 (+0900) Subject: luatexja-core.sty: stopped to use \ltj@dir@count in \everyhbox and \everyvbox hooks. X-Git-Tag: 20150420.0~175 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=69ea4d0581c7595200c29a002f81d4b6ac1b6738;hp=-c;p=luatex-ja%2Fluatexja.git luatexja-core.sty: stopped to use \ltj@dir@count in \everyhbox and \everyvbox hooks. --- 69ea4d0581c7595200c29a002f81d4b6ac1b6738 diff --git a/src/ltj-direction.lua b/src/ltj-direction.lua index e0d16cd..c23f5ab 100644 --- a/src/ltj-direction.lua +++ b/src/ltj-direction.lua @@ -107,7 +107,6 @@ do local cs_true, cs_false = '\\iftrue', '\\iffalse' luatexja.direction.dir_conditional = function(v) local d = get_dir_count() - print(d,v) tex.sprint(cat_lp, (d==v) and cs_true or cs_false ) end end @@ -118,27 +117,17 @@ do local node_set_attr = node.set_attribute local function set_list_direction(v, name) local lv, w = tex_nest.ptr, tex.lists.page_head - if lv==0 and w then - if (not w.next) and - w.id==id_whatsit and w.subtype==sid_user and w.user_id==DIR then - node_set_attr(w, attr_dir, v); page_direction = v - else - ltjb.package_error( - 'luatexja', - "Use `\\" .. name .. "' at top of list", - 'Direction change command by LuaTeX-ja is available\n' - .. 'only when the current list is null.') - end - elseif tex.currentgrouptype==6 then + if not v then v,name = get_dir_count(), nil end + if tex.currentgrouptype==6 then ltjb.package_error( 'luatexja', "You can't use `\\" .. name .. "' in an align", "To change direction in an align, \n" .. "you shold use \\hbox or \\vbox.") else - print(v, name, tex_nest[lv].head.next) - local w = tex_nest[lv].head.next + local w = (lv==0) and tex.lists.page_head or tex_nest[lv].head.next if w then + luatexja.ext_show_node_list(w, 'set_dir', print) if (not w.next) and w.id==id_whatsit and w.subtype==sid_user and w.user_id==DIR then node_set_attr(w, attr_dir, v) @@ -156,6 +145,7 @@ do setfield(w, 'type', 110) set_attr(w, attr_dir, v) Dnode.write(w) + if lv==0 then page_direction = v end end tex_set_attr('global', attr_icflag, 0) end diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index 5346a7d..9e88e7d 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -564,11 +564,11 @@ %%%% hbox, vbox, vtop \everyhbox{% - \ifcase\ltj@dir@count\or\dtou\or\or\tate\or\yoko\fi + \directlua{luatexja.direction.set_list_direction()}% \aftergroup\ltj@@reset@badness } \everyvbox{% - \ifcase\ltj@dir@count\or\dtou\or\or\tate\or\yoko\fi + \directlua{luatexja.direction.set_list_direction()}% \aftergroup\ltj@@reset@badness } \protected\def\ltj@@reset@badness{%