-function set_box_stack_level(head, mode)
- local box_set = false
- local p = head
- local cl = tex.currentgrouplevel + 1
- for p in node.traverse_id(id_whatsit, head) do
- if p.subtype==sid_user and p.user_id==30112 then
- local g = p
- if mode and g.value==cl then box_set = true end
- head, p = node_remove(head, g); node_free(g); break
+local ltjs_report_stack_level = ltjs.report_stack_level
+local ltjf_font_metric_table = ltjf.font_metric_table
+local font_getfont = font.getfont
+local function set_box_stack_level(head, mode)
+ local box_set, cl = 0, tex.currentgrouplevel + 1
+ if mode then
+ for _,p in pairs(wt) do
+ if getfield(p, 'value')==cl then box_set = 1 end; node_free(p)
+ end
+ else
+ for _,p in pairs(wt) do node_free(p) end
+ end
+ ltjs_report_stack_level(tex_getcount('ltj@@stack') + box_set)
+ for _,p in pairs(wtd) do
+ node_free(p)
+ end
+ if ltjs.list_dir == dir_tate then
+ for p in node.direct.traverse_id(id_glyph,to_direct(head)) do
+ if has_attr(p, attr_icflag, 0) and getlang(p)==lang_ja then
+ local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , ltjs_orig_char_table[p])
+ setfont(p, nf)
+ if ltjf_font_metric_table[nf].vert_activated then
+ local pc = getchar(p)
+ pc = ltjf_font_metric_table[nf].vform[pc]
+ end
+ end