flag = 0; break
end
end
- if flag==1 then -- move dir_whatsit w
- return 1,w -- TODO
+ if flag==1 then -- dir_whatsit already exists
+ return 1,w
else
return flag
end
end
end
+ function luatexja.direction.set_list_direction_hook(v)
+ local lv = tex_nest.ptr -- must be >= 1
+ if not v then
+ v = get_dir_count()
+ if abs(tex_nest[lv-1].mode) == ltjs.mmode and v == dir_tate then
+ v = dir_utod
+ end
+ elseif v=='adj' then
+ v = get_adjust_dir_count()
+ end
+ local h = to_direct(tex_nest[lv].head)
+ local w = node_new(id_whatsit, sid_user)
+ setfield(w, 'next', nil)
+ setfield(w, 'user_id', DIR)
+ setfield(w, 'type', 110)
+ set_attr(w, attr_dir, v)
+ insert_after(h, h, w)
+ tex_nest[lv].tail = to_node(node_tail(w))
+ tex_set_attr('global', attr_icflag, 0)
+ tex_set_attr('global', attr_dir, 0)
+ end
+
local function set_list_direction(v, name)
local lv = tex_nest.ptr
if not v then
for line in traverse_id(id_hlist, hd) do
local nh = getlist(line)
setfield(line, 'head', create_dir_whatsit(nh, gc, new_dir) )
- set_attr(line, attr_dir, new_dir)
+ --set_attr(line, attr_dir, new_dir)
end
tex_set_attr('global', attr_dir, 0)
return h
end
end
Dnode.flush_list(getfield(dn, 'value'))
+ setfield(dn, 'value', nil)
db = db or create_dir_node(b, box_dir, new_dir, false)
local w = getfield(b, 'width')
local h = getfield(b, 'height')
if box_dir%dir_math_mod ~= list_dir then
setbox(
'ltj@afbox',
- to_node(
- copy_list(make_dir_whatsit(sd, sd, list_dir, 'box_move'))
- -- without copy_list, we get a segfault
- )
+ to_node(copy_list(make_dir_whatsit(sd, sd, list_dir, 'box_move')))
+ -- copy_list しないとリストの整合性が崩れる……?
)
end
end
do
local function glyph_from_packed(h)
local b = getlist(h)
- return (getid(b)==id_kern)
- and node_next(node_next(node_next(node_next(b)))) or b
+ return (getid(b)==id_kern or (getid(b)==id_whatsit and getsubtype(b)==sid_save) )
+ and node_next(node_next(node_next(b))) or b
end
luatexja.direction.glyph_from_packed = glyph_from_packed
end
else
finalize_inner(n)
end
- end
+ end
end
end
local getbox = tex.getbox