- [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)
- 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] = function (lp)
+ Np.first, Np.nuc = (Np.first or lp), lp;
+ Np.id = (getfont(lp) == (has_attr(lp, attr_curjfnt) or -1))
+ and id_jglyph or id_glyph
+ return true, check_next_ickern(node_next(lp));
+ end,
+ [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;
+ Np.id = (flag or getfield(op, 'shift')~=0) and id_box_like or id_hlist
+ 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); ihb_flag = true
+ 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)
+ lp = node_end_of_math(lp)
+ set_attr(lp, attr_icflag, PROCESSED)
+ Np.last, Np.id = lp, id_math;
+ return true, node_next(lp);
+ end,
+ discglue = 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_kern] = function(lp)
+ Np.first = Np.first or lp
+ if getsubtype(lp)==2 then
+ 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); lp = node_next(lp)
+ set_attr(lp, attr_icflag, PROCESSED); Np.nuc = lp
+ Np.id = (getfont(lp) == (has_attr(lp, attr_curjfnt) or -1)) and id_jglyph or id_glyph
+ return true, check_next_ickern(node_next(lp));
+ else
+ 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,