- [id_glyph] = function()
- Np.first = lp
- if lp.font == has_attr(lp, attr_curjfnt) then
- Np.id = id_jglyph
- else
- Np.id = id_glyph
- end
- Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp)
- lp = node_next(lp); check_next_ickern(); return true
- end,
- [id_hlist] = function()
- Np.first = lp; Np.last = lp; Np.nuc = lp;
- set_attr_icflag_processed(lp)
- if lp.shift~=0 then
- Np.id = id_box_like
- else
- Np.id = id_hlist
- end
- lp = node_next(lp); return true
- end,
- [id_vlist] = function()
- Np.first = lp; Np.nuc = lp; Np.last = lp;
- Np.id = id_box_like; set_attr_icflag_processed(lp);
- lp = node_next(lp); return true
- end,
- [id_rule] = function()
- Np.first = lp; Np.nuc = lp; Np.last = lp;
- Np.id = id_box_like; set_attr_icflag_processed(lp);
- lp = node_next(lp); return true
- end,
- [id_ins] = function()
- set_attr_icflag_processed(lp); lp = node_next(lp)
- return false
- end,
- [id_mark] = function()
- set_attr_icflag_processed(lp); lp = node_next(lp)
- return false
- end,
- [id_adjust] = function()
- set_attr_icflag_processed(lp); lp = node_next(lp)
- return false
- end,
- [id_disc] = function()
- Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp);
- Np.last = lp; Np.id = id_disc; lp = node_next(lp); return true
- end,
- [id_whatsit] = function()
- if lp.subtype==sid_user then
- if lp.user_id==30111 then
- local lq = node_next(lp)
- head = node_remove(head, lp); node_free(lp); lp = lq; ihb_flag = true
- else
- set_attr_icflag_processed(lp)
- luatexbase.call_callback("luatexja.jfmglue.whatsit_getinfo"
- , Np, lp, Nq, box_stack_level)
- lp = node_next(lp)
- if Np.nuc then
- Np.id = id_pbox_w; Np.first = Np.nuc; Np.last = Np.nuc; return true
- end
- end
- else
- set_attr_icflag_processed(lp); lp = node_next(lp)
- end
- return false
- end,
- [id_math] = function()
- Np.first = lp; Np.nuc = lp;
- set_attr_icflag_processed(lp); lp = node_next(lp)
- while lp.id~=id_math do
- set_attr_icflag_processed(lp); lp = node_next(lp)
- end
- set_attr_icflag_processed(lp);
- Np.last = lp; Np.id = id_math; lp = node_next(lp);
- return true
- end,
- [id_glue] = function()
- Np.first = lp; Np.nuc = lp; set_attr_icflag_processed(lp);
- Np.last = lp; Np.id = id_glue; lp = node_next(lp); return true
- end,
- [id_kern] = function()
- Np.first = lp
- if lp.subtype==2 then
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); lp = node_next(lp)
- set_attr_icflag_processed(lp); Np.nuc = lp
- if lp.font == has_attr(lp, attr_curjfnt) then
- Np.id = id_jglyph
- else
- Np.id = id_glyph
- end
- lp = node_next(lp); check_next_ickern();
- else
- Np.id = id_kern; set_attr_icflag_processed(lp);
- Np.last = lp; lp = node_next(lp)
- end
- return true
- end,
- [id_penalty] = function()
- Bp[#Bp+1] = lp; set_attr_icflag_processed(lp);
- lp = node_next(lp); return false
- end,
- [13] = function()
- Np.first = lp; Np.nuc = lp; Np.last = lp;
- Np.id = id_box_like; set_attr_icflag_processed(lp);
- lp = node_next(lp); return true
- end,
+ [id_glyph] = calc_np_aux_glyph_common,
+ [id_hlist] = function(lp)
+ local op, flag
+ head, lp, op, flag = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm hlist')
+ set_attr(op, attr_icflag, PROCESSED)
+ Np.first = Np.first or op; Np.last = op; Np.nuc = op;
+ if (flag or getfield(op, 'shift')~=0) then
+ Np.id = id_box_like
+ else
+ Np.id = id_hlist
+ Np.last_char = check_box_high(Np, getlist(op), nil)
+ end
+ return true, lp
+ end,
+ [id_vlist] = function(lp)
+ local op
+ head, lp, op = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm:' .. getid(lp))
+ Np.first = Np.first or op; Np.last = op; Np.nuc = op;
+ Np.id = id_box_like;
+ return true, lp
+ end,
+ box_like = function(lp)
+ Np.first = Np.first or lp; Np.last = lp; Np.nuc = lp;
+ Np.id = id_box_like;
+ return true, node_next(lp)
+ end,
+ skip = function(lp)
+ set_attr(lp, attr_icflag, PROCESSED)
+ return false, node_next(lp)
+ end,
+ [id_whatsit] = function(lp)
+ local lps = getsubtype(lp)
+ if lps==sid_user then
+ if getfield(lp, 'user_id')==luatexja.userid_table.IHB then
+ local lq = node_next(lp);
+ head = node_remove(head, lp); node_free(lp); non_ihb_flag = false
+ return false, lq;
+ else
+ set_attr(lp, attr_icflag, PROCESSED)
+ luatexbase.call_callback("luatexja.jfmglue.whatsit_getinfo",
+ Np, lp, Nq)
+ if Np.nuc then
+ Np.id = id_pbox_w; Np.first = Np.nuc; Np.last = Np.nuc;
+ return true, node_next(lp)
+ else
+ return false, node_next(lp)
+ end
+ end
+ else
+ -- we do special treatment for these whatsit nodes.
+ if lps == sid_start_link or lps == sid_start_thread then
+ Np.first = lp
+ elseif lps == sid_end_link or lps == sid_end_thread then
+ Np.first, Nq.last = nil, lp;
+ end
+ set_attr(lp, attr_icflag, PROCESSED)
+ return false, node_next(lp)
+ end
+ end,
+ [id_math] = function(lp)
+ Np.first, Np.nuc = (Np.first or lp), lp;
+ set_attr(lp, attr_icflag, PROCESSED)
+ set_np_xspc_alchar(Np, -1, lp)
+ local end_math = node_end_of_math(lp)
+ ltjw_apply_ashift_math(lp, end_math, attr_ablshift)
+ set_attr(end_math, attr_icflag, PROCESSED)
+ Np.last, Np.id = end_math, id_math;
+ return true, node_next(end_math);
+ end,
+ [id_glue] = function(lp)
+ Np.first, Np.nuc, Np.last = (Np.first or lp), lp, lp;
+ Np.id = getid(lp); set_attr(lp, attr_icflag, PROCESSED)
+ return true, node_next(lp)
+ end,
+ [id_disc] = function(lp)
+ Np.first, Np.nuc, Np.last = (Np.first or lp), lp, lp;
+ Np.id = getid(lp); set_attr(lp, attr_icflag, PROCESSED)
+ ltjw_apply_ashift_disc(lp, (list_dir==dir_tate), tex_dir)
+ Np.last_char = check_box_high(Np, getfield(lp, 'replace'), nil)
+ return true, node_next(lp)
+ end,
+ [id_kern] = function(lp)
+ if getsubtype(lp)==2 then
+ Np.first = Np.first or lp
+ set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
+ if getid(lp)==id_glyph then -- アクセント本体
+ setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0))
+ else -- アクセントは上下にシフトされている
+ setfield(lp, 'shift', getfield(lp, 'shift') + (has_attr(lp,attr_ablshift) or 0))
+ end
+ set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
+ set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
+ set_attr(lp, attr_icflag, PROCESSED);
+ return calc_np_aux_glyph_common(lp)
+ else
+ Np.first = Np.first or lp
+ Np.id = id_kern; set_attr(lp, attr_icflag, PROCESSED)
+ Np.last = lp; return true, node_next(lp)
+ end
+ end,
+ [id_penalty] = function(lp)
+ Bp[#Bp+1] = lp; set_attr(lp, attr_icflag, PROCESSED)
+ return false, node_next(lp)
+ end,