end
-- 文字クラスの決定
-local slow_find_char_class
+local slow_find_char_class, skip_table_to_glue
do
local start_time_measure = ltjb.start_time_measure
local stop_time_measure = ltjb.stop_time_measure
- slow_find_char_class = function (c, m, oc)
+ local fast_get_stack_skip = ltjs.fast_get_stack_skip
+ function slow_find_char_class (c, m, oc)
local cls = ltjf_find_char_class(oc, m)
if oc~=c and c and cls==0 then
return ltjf_find_char_class(c, m)
return cls
end
end
-end
-
-local function skip_table_to_glue(n)
- local g, st = node_new(id_glue), ltjs.fast_get_stack_skip(n)
- setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order)
- return g, (st.width==1073741823)
+ function skip_table_to_glue(n)
+ local g, st = node_new(id_glue), fast_get_stack_skip(n)
+ setglue(g, st[1], st[2], st[3], st[4], st[5])
+ return g, (st[1]==1073741823)
+ end
end
else
local f = node_new(id_glue)
set_attr(f, attr_icflag, g.priority)
- setglue(f, g.width, g.stretch, g.shrink)
+ setglue(f, g[2], g[3], g[4])
return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink
end
end
return tex_getattr((get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
end
end
+ local get_stack_skip = ltjs.get_stack_skip
-- \insertxkanjiskip
-- SPECIAL_JAGLUE のノード:
-- * (X)KANJI_SKIP(_JFM): その場で値が決まっている
local g = node_new(id_glue); set_attr(g, attr_icflag, SPECIAL_JAGLUE)
local is_late = scan_keyword("late")
if not is_late then
- local st = ltjs.get_stack_skip(ind, getcount('ltj@@stack'))
- if st.width==1073741823 then
+ local st = get_stack_skip(ind, getcount('ltj@@stack'))
+ if st[1]==1073741823 then
local bk = ltjf_font_metric_table[get_current_jfont()][name]
if bk then
setglue(g, bk[1] or 0, bk[2] or 0, bk[3] or 0, 0, 0)
end
set_attr(g, attr_yablshift, icb); node_write(g); return
end
- setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order)
+ setglue(g, st[1], st[2], st[3], st[4], st[5])
set_attr(g, attr_yablshift, ica)
else
set_attr(g, attr_yablshift, PROCESSED_BEGIN_FLAG + ica)
if type(i) == 'number' then -- char_type
for k,w in pairs(v.glue) do
v[k] = {
- nil,
+ nil, w[1], w[2], w[3],
ratio=w.ratio,
priority=FROM_JFM + w.priority,
- width = w[1], stretch = w[2], shrink = w[3],
kanjiskip_natural = w.kanjiskip_natural,
kanjiskip_stretch = w.kanjiskip_stretch,
kanjiskip_shrink = w.kanjiskip_shrink,
\directlua{%
local s = table.copy(luatexja.stack.charprop_stack_table[0])
- luatexja.base.save_cache('ltj-kinsoku_default', {s, version=3})
+ luatexja.base.save_cache('ltj-kinsoku_default', {s, version=4})
}
local tex_nest = tex.nest
ltjs.hmode = 0 -- dummy
-local charprop_stack_table={};
-
+local charprop_stack_table={}
ltjs.charprop_stack_table = charprop_stack_table
charprop_stack_table[0]={}
function ltjs.set_stack_skip(m,sp)
local i = get_stack_level()
if not sp then return end
- if not charprop_stack_table[i][m] then
- charprop_stack_table[i][m] = {}
- end
local w,st,sh,sto,sho = getglue(sp)
- local c = charprop_stack_table[i][m]
- c.width, c.stretch, c.shrink, c.stretch_order, c.shrink_order = w, st, sh, sto, sho
+ if charprop_stack_table[i][m] then
+ local c = charprop_stack_table[i][m]
+ c[1], c[2], c[3], c[4], c[5] = w, st, sh, sto, sho
+ else
+ charprop_stack_table[i][m] = { w,st,sh,sto,sho }
+ end
if luatexja.isglobal=='global' then
for j,v in pairs(charprop_stack_table) do
- if not v[m] then v[m] = {} end
+ if not v[m] then v[m] = { true,true,true,true,true } end
local c = v[m]
- c.width, c.stretch, c.shrink, c.stretch_order, c.shrink_order = w, st, sh, sto, sho
+ c[1], c[2], c[3], c[4], c[5] = w, st, sh, sto, sho
end
end
end
ltjs.orig_char_table = orig_char_table
ltjs.list_dir = nil -- dummy
ltjs.table_current_stack = nil -- dummy
-local dummy_skip_table = { width = 0, stretch = 0, shrink = 0, stretch_order = 0, shrink_order = 0 }
+local dummy_skip_table = { 0,0,0,0,0 }
function ltjs.report_stack_level(bsl)
ltjs.table_current_stack = charprop_stack_table[bsl]
return bsl
\define@key[ltj]{japaram}{postbreakpenalty}{\ltj@@set@stack{POST}{-10000}{10000}#1\relax}
\def\ltj@@set@stack#1#2#3{%
\directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1,#2,#3)}}
-%\def\ltj@@set@stack#1,#2:#3#4#5{%
-% \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#3,
-% \ltj@safe@num@or{nil}{#1},\ltj@safe@num@or{nil}{#2},#4,#5)}}
% jatextfont = {<char_code>, <font_cs>}
% only horizontal font is supported
end
local function print_spec(p)
- local out=print_scaled(p.width)..'pt'
- if p.stretch~=0 then
- out=out..' plus '..print_glue(p.stretch,p.stretch_order)
+ local out=print_scaled(p.width or p[1])..'pt'
+ if p.stretch or p[2]~=0 then
+ out=out..' plus '..print_glue(p.stretch or p[2], p.stretch_order or p[4])
end
- if p.shrink~=0 then
- out=out..' minus '..print_glue(p.shrink,p.shrink_order)
+ if p.shrink or p[3]~=0 then
+ out=out..' minus '..print_glue(p.shrink or p[3], p.shrink_order or p[5])
end
return out
end
end
do
- local cache_ver = 3 -- must be same as ltj-kinsoku.tex
+ local cache_ver = 4 -- must be same as ltj-kinsoku.tex
local cache_outdate_fn = function (t) return t.version~=cache_ver end
local t = ltjs.charprop_stack_table
function luatexja.load_kinsoku()
else
t[0] = {}; tex.print(cat_lp, '\\input ltj-kinsoku.tex\\relax')
end
- luatexja.load_kinsoku=nil; ltjs.charprop_stack_table = nil
+ luatexja.load_kinsoku=nil
end
end