local BOXBDD = luatexja.icflag_table.BOXBDD
local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG
-local kanji_skip = node_new(id_glue)
-local xkanji_skip = node_new(id_glue)
-set_attr(kanji_skip, attr_icflag, KANJI_SKIP)
-set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP)
-
+local attr_icflag = luatexbase.attributes['ltj@icflag']
+local kanji_skip
+local xkanji_skip
local table_current_stack
local list_dir
local capsule_glyph
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 function get_attr_icflag(p)
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)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
-- 和文文字間の JFM glue を node 化
local function new_jfm_glue(m, bc, ac)
-- bc, ac: char classes
- local g, d = m.char_type[bc][ac], 0
- local n
+ local g = m.char_type[bc][ac]
if g then
- n,d = node_copy(g[2]), g[3]
if g[1] then
local f = node_new(id_glue)
set_attr(f, attr_icflag, g[4])
- setfield(f, 'spec', n)
- return f, d
+ setfield(f, 'spec', node_copy(g[2]))
+ return f, g[3]
+ else
+ return node_copy(g[2]), g[3]
end
end
- return n, d
+ return nil, 0
end
-- Nq.last (kern w) .... (glue/kern g) Np.first
-- Insert \jcharwidowpenalty
Bp = widow_Bp; Np = widow_Np
if Np.first then
- handle_penalty_normal(0,
- table_current_stack[JWP] or 0)
+ handle_penalty_normal(0, table_current_stack[JWP] or 0)
end
else
-- the current list is the contents of a hbox
capsule_glyph = is_dir_tate and ltjw.capsule_glyph_tate or ltjw.capsule_glyph_yoko
attr_ablshift = is_dir_tate and attr_tablshift or attr_yablshift
+ kanji_skip = node_new(id_glue); set_attr(kanji_skip, attr_icflag, KANJI_SKIP)
setfield(kanji_skip, 'spec', skip_table_to_spec(KSK))
get_kanjiskip = (getfield(getfield(kanji_skip, 'spec'), 'width') == 1073741823)
and get_kanjiskip_jfm or get_kanjiskip_normal
+ xkanji_skip = node_new(id_glue); set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP)
setfield(xkanji_skip, 'spec', skip_table_to_spec(XSK))
get_xkanjiskip = (getfield(getfield(xkanji_skip, 'spec'), 'width') == 1073741823)
and get_xkanjiskip_jfm or get_xkanjiskip_normal
end
end
-local tex_set_attr = tex.setattribute
+local ensure_tex_attr = ltjb.ensure_tex_attr
local function cleanup(mode)
-- adjust attr_icflag for avoiding error
- if tex.getattribute(attr_icflag)~=0 then tex_set_attr('global', attr_icflag, 0) end
- node_free(getfield(kanji_skip, 'spec'))
- node_free(getfield(xkanji_skip, 'spec'))
+ if tex.getattribute(attr_icflag)~=0 then ensure_tex_attr('global', attr_icflag, 0) end
+ node_free(kanji_skip); node_free(xkanji_skip)
if mode then
local h = node_next(head)
if getid(h) == id_penalty and getfield(h, 'penalty') == 10000 then
head = ahead;
local lp, last, par_indented = init_var(mode,dir)
lp = calc_np(last, lp)
- if lp then
+ if Np then
handle_list_head(par_indented)
lp = calc_np(last,lp); while Np do
adjust_nq();