end,
[id_whatsit] = function(lp)
if lp.subtype==sid_user then
- if lp.user_id==30111 then
+ if 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;
return cleanup(mode, last)
end
--- \inhibitglue
-
-function create_inhibitglue_node()
- local tn = node_new(id_whatsit, sid_user)
- tn.user_id=30111; tn.type=100; tn.value=1
- node.write(tn)
-end
-
--- Node for indicating beginning of a paragraph
--- (for ltjsclasses)
-function create_beginpar_node()
- local tn = node_new(id_whatsit, sid_user)
- tn.user_id=30114; tn.type=100; tn.value=1
- node.write(tn)
-end
-
do
+ local IHB = luatexja.userid_table.IHB
+ local BPAR = luatexja.userid_table.BPAR
+
+ -- \inhibitglue
+ function create_inhibitglue_node()
+ local tn = node_new(id_whatsit, sid_user)
+ tn.user_id=IHB; tn.type=100; tn.value=1
+ node.write(tn)
+ end
-local function whatsit_callback(Np, lp, Nq)
- if Np and Np.nuc then return Np
- elseif Np and lp.user_id == 30114 then
- Np.first = lp; Np.nuc = lp; Np.last = lp
- Np.char = 'parbdd'
- Np.met = nil
- Np.pre = 0; Np.post = 0
- Np.xspc = 0
- Np.auto_xspc = false
- return Np
+ -- Node for indicating beginning of a paragraph
+ -- (for ltjsclasses)
+ function create_beginpar_node()
+ local tn = node_new(id_whatsit, sid_user)
+ tn.user_id=BPAR; tn.type=100; tn.value=1
+ node.write(tn)
end
-end
+ local function whatsit_callback(Np, lp, Nq)
+ if Np and Np.nuc then return Np
+ elseif Np and lp.user_id == BPAR then
+ Np.first = lp; Np.nuc = lp; Np.last = lp
+ Np.char = 'parbdd'
+ Np.met = nil
+ Np.pre = 0; Np.post = 0
+ Np.xspc = 0
+ Np.auto_xspc = false
+ return Np
+ end
+ end
-local function whatsit_after_callback(s, Nq, Np)
- if not s and Nq.nuc.user_id == 30114 then
- local x, y = node.prev(Nq.nuc), Nq.nuc
- Nq.first, Nq.nuc, Nq.last = x, x, x
- head = node.remove(head, y)
+ local function whatsit_after_callback(s, Nq, Np)
+ if not s and Nq.nuc.user_id == BPAR then
+ local x, y = node.prev(Nq.nuc), Nq.nuc
+ Nq.first, Nq.nuc, Nq.last = x, x, x
+ head = node.remove(head, y)
+ end
+ return s
end
- return s
-end
-luatexbase.add_to_callback("luatexja.jfmglue.whatsit_getinfo", whatsit_callback,
- "luatexja.beginpar.np_info", 1)
-luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback,
- "luatexja.beginpar.np_info_after", 1)
+ luatexbase.add_to_callback("luatexja.jfmglue.whatsit_getinfo", whatsit_callback,
+ "luatexja.beginpar.np_info", 1)
+ luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback,
+ "luatexja.beginpar.np_info_after", 1)
end
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_find_char_class = ltjf.find_char_class
+local OTF = luatexja.userid_table.OTF
-- Append a whatsit node to the list.
-- This whatsit node will be extracted to a glyph_node
function append_jglyph(char)
local p = node_new(id_whatsit,sid_user)
local v = tex.attribute[attr_curjfnt]
- p.user_id=30113; p.type=100; p.value=char
+ p.user_id=OTF; p.type=100; p.value=char
set_attr(p, attr_yablshift, tex.attribute[attr_ykblshift])
node.write(p)
end
local v
while p do
if p.id==id_whatsit then
- if p.subtype==sid_user and p.user_id==30113 then
+ if p.subtype==sid_user and p.user_id==OTF then
local g = node_new(id_glyph)
g.subtype = 0; g.char = p.value
v = has_attr(p, attr_curjfnt); g.font = v
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjc_is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char
local attr_orig_char = luatexbase.attributes['ltj@origchar']
+local STCK = luatexja.userid_table.STCK
------------------------------------------------------------------------
-- MAIN PROCESS STEP 1: replace fonts
elseif pid == id_math then
p = node_next(p) -- skip math on
while p and p.id~=id_math do p = node_next(p) end
- elseif pid == id_whatsit and p.subtype==sid_user and p.user_id==30112 then
+ elseif pid == id_whatsit and p.subtype==sid_user and p.user_id==STCK then
wt[#wt+1] = p; head = node_remove(head, p)
end
p = node_next(p)