local tex_dir
local attr_ablshift
local set_np_xspc_jachar
+local set_np_xspc_jachar_hbox
local attr_icflag = luatexbase.attributes['ltj@icflag']
local ltjs_orig_char_table = ltjs.orig_char_table
local stop_time_measure = ltjb.stop_time_measure
slow_find_char_class = function (c, m, oc)
local cls = ltjf_find_char_class(oc, m)
- if oc~=c and cls==0 then
- return ltjf_find_char_class(-c, m), oc
+ if c and oc~=c and cls==0 then
+ return ltjf_find_char_class(c, m), oc
else
return cls, oc
end
local function calc_np_aux_glyph_common(lp)
Np.nuc = lp
Np.id = npi
- if ltjs_orig_char_table[lp] then
+ if getfield(lp, 'lang') == lang_ja then
Np.id = id_jglyph
set_np_xspc_jachar(Np, lp)
local npi, npf
lp=lx; break
else
local lid = getid(lx)
- if lid==id_glyph and not ltjs_orig_char_table[lx] then
+ if lid==id_glyph and getfield(lx, 'lang') ~= lang_ja then
-- 欧文文字
last_glyph = lx; set_attr(lx, attr_icflag, PROCESSED); Np.last = lx
y_adjust = has_attr(lx,attr_ablshift) or 0
local attr_jchar_class = luatexbase.attributes['ltj@charclass']
local attr_autospc = luatexbase.attributes['ltj@autospc']
local attr_autoxspc = luatexbase.attributes['ltj@autoxspc']
+ --local ltjf_get_vert_glyph = ltjf.get_vert_glyph
function set_np_xspc_jachar_yoko(Nx, x)
local m = ltjf_font_metric_table[getfont(x)]
local cls, c = slow_find_char_class(ltjs_orig_char_table[x], m, getchar(x))
- Nx.met = m; Nx.class = cls
+ Nx.met, Nx.class, Nx.char = m, cls, c;
if cls~=0 then set_attr(x, attr_jchar_class, cls) end
Nx.pre = table_current_stack[PRE + c] or 0
Nx.post = table_current_stack[POST + c] or 0
Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1)
end
function set_np_xspc_jachar_tate(Nx, x)
- local m = ltjf_font_metric_table[getfont(x)]
- local cls, c
- local c1, c2 = getchar(x), ltjs_orig_char_table[x][1]
- c = ltjs_orig_char_table[x][2] or c1 or c2
- cls = ltjf_find_char_class(c, m)
- if cls==0 then cls = slow_find_char_class(c2, m, c1) end
- Nx.met = m; Nx.class = cls;
+ local c, c_glyph = ltjs_orig_char_table[x], getchar(x)
+ local xf = getfont(x)
+ local m = ltjf_font_metric_table[xf]
+ local cls = slow_find_char_class(c, m, c_glyph)
+ --setfield(x, 'char', ltjf_get_vert_glyph(xf, c_glyph) or c_glyph)
+ Nx.met, Nx.class, Nx.char = m, cls, c;
if cls~=0 then set_attr(x, attr_jchar_class, cls) end
Nx.pre = table_current_stack[PRE + c] or 0
Nx.post = table_current_stack[POST + c] or 0
Nx.kcat = table_current_stack[KCAT + c] or 0
Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1)
end
- local function set_np_xspc_jachar_hbox(Nx, x)
+ function set_np_xspc_jachar_hbox(Nx, x)
local m = ltjf_font_metric_table[getfont(x)]
local c = getchar(x)
- Nx.met = m; Nx.class = has_attr(x, attr_jchar_class) or 0;
+ Nx.met, Nx.char = m, c; Nx.class = has_attr(x, attr_jchar_class) or 0;
Nx.pre = table_current_stack[PRE + c] or 0
Nx.post = table_current_stack[POST + c] or 0
Nx.xspc = table_current_stack[XSP + c] or 3
local function handle_np_jachar(mode)
local qid = Nq.id
if qid==id_jglyph or ((qid==id_pbox or qid==id_pbox_w) and Nq.met) then
- local g = non_ihb_flag and calc_ja_ja_glue() or get_kanjiskip() -- M->K
+ local g = non_ihb_flag and calc_ja_ja_glue() or get_kanjiskip() -- M->K
handle_penalty_normal(Nq.post, Np.pre, g); real_insert(g)
elseif Nq.met then -- qid==id_hlist
local g = non_ihb_flag and get_OA_skip() or get_kanjiskip() -- O_A->K
if Np and Np.nuc then return Np
elseif Np and getfield(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
if not s and getfield(Nq.nuc, 'user_id') == BPAR then
local x, y = node_prev(Nq.nuc), Nq.nuc
Nq.first, Nq.nuc, Nq.last = x, x, x
+ if Np then
+ if Np.met then
+ Nq.class = fast_find_char_class('parbdd', Np.met)
+ end
+ Nq.met = Np.met; Nq.pre = 0; Nq.post = 0; Nq.xspc = 0
+ Nq.auto_xspc = false
+ end
head = node_remove(head, y)
node_free(y)
end