diff options
author | Norbert Preining <norbert@preining.info> | 2022-08-08 03:05:28 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-08-08 03:05:28 +0000 |
commit | f1e79c3669f68804c471699badc56a4a33a23246 (patch) | |
tree | 5e6feae427931b2043e96c6c0867e02ab647c9da /macros/luatex/generic/luatexja/src | |
parent | e56ef8f972de679101fb97ad8e180614d3fd4267 (diff) |
CTAN sync 202208080305
Diffstat (limited to 'macros/luatex/generic/luatexja/src')
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-adjust.lua | 6 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-base.sty | 2 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-compat.lua | 4 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-direction.lua | 45 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-jfmglue.lua | 12 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-jfont.lua | 5 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/ltj-lineskip.lua | 13 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/luatexja.lua | 3 | ||||
-rw-r--r-- | macros/luatex/generic/luatexja/src/luatexja.sty | 2 |
9 files changed, 40 insertions, 52 deletions
diff --git a/macros/luatex/generic/luatexja/src/ltj-adjust.lua b/macros/luatex/generic/luatexja/src/ltj-adjust.lua index 71584d8b5c..053b63ab1a 100644 --- a/macros/luatex/generic/luatexja/src/ltj-adjust.lua +++ b/macros/luatex/generic/luatexja/src/ltj-adjust.lua @@ -514,7 +514,7 @@ do end function ltjl.p_profile(before, after, mirrored, bw) local range, tls - = init_range(), luatexja.adjust.profile_hgap_factor*tex.lineskip.width + = init_range(), luatexja.adjust.profile_hgap_factor*tex.get('lineskip', false) profile_inner(before, range, 3, true, tls) profile_inner(after, range, 4, mirrored, tls) range = range:flatten() @@ -544,9 +544,9 @@ do end if dist < tex.lineskiplimit then local f = max(1, bw*ltja.step_factor) - copy_glue(g, tex.baselineskip, 1, normal - f * floor((dist-tex.lineskip.width)/f)) + copy_glue(g, 'baselineskip', 1, normal - f * floor((dist-tex.get('lineskip', false))/f)) else - copy_glue(g, tex.baselineskip, 2, normal) + copy_glue(g, 'baselineskip', 2, normal) end end end diff --git a/macros/luatex/generic/luatexja/src/ltj-base.sty b/macros/luatex/generic/luatexja/src/ltj-base.sty index 2ce01d71b1..d46b54a1fa 100644 --- a/macros/luatex/generic/luatexja/src/ltj-base.sty +++ b/macros/luatex/generic/luatexja/src/ltj-base.sty @@ -103,7 +103,7 @@ %% \ltj@gobble@glue <glue> %! 次に続くグルー値を(2 回展開で)読み捨てる. \def\ltj@gobble@glue{ - \directlua{token.scan_glue()} + \directlua{node.free(token.scan_glue())} } %% \ltj@gobble@dimen <dimen> diff --git a/macros/luatex/generic/luatexja/src/ltj-compat.lua b/macros/luatex/generic/luatexja/src/ltj-compat.lua index d660915a31..dfb19ee2d0 100644 --- a/macros/luatex/generic/luatexja/src/ltj-compat.lua +++ b/macros/luatex/generic/luatexja/src/ltj-compat.lua @@ -25,12 +25,12 @@ local function to_kansuji(num) num = -num; tex.write '-' end local s = "" - while num~=0 do + repeat s = utfchar( ltjs.get_stack_table(luatexja.stack_table_index.KSJ + num%10, '', tex.getcount 'ltj@@stack')) .. s num=math.floor(num/10) - end + until num==0 tex.write(s) end diff --git a/macros/luatex/generic/luatexja/src/ltj-direction.lua b/macros/luatex/generic/luatexja/src/ltj-direction.lua index db320509d1..565190be2d 100644 --- a/macros/luatex/generic/luatexja/src/ltj-direction.lua +++ b/macros/luatex/generic/luatexja/src/ltj-direction.lua @@ -92,11 +92,12 @@ end local get_dir_count, get_adjust_dir_count do + local node_attr = node.has_attribute local function get_dir_count_inner(h) if h then if h.id==id_whatsit and h.subtype==sid_user and h.user_id==DIR then - return ((node.has_attribute(h, attr_icflag) or 0)<PROCESSED_BEGIN_FLAG) - and (node.has_attribute(h,attr_dir)%dir_node_auto) or 0 + return ((node_attr(h, attr_icflag) or 0)<PROCESSED_BEGIN_FLAG) + and (node_attr(h,attr_dir)%dir_node_auto) or 0 else return 0 end @@ -263,13 +264,12 @@ local function create_dir_whatsit(hd, gc, new_dir) return hd else local w = dir_pool[new_dir]() - setfield(w, 'next', hd) set_attr(w, attr_icflag, PROCESSED_BEGIN_FLAG) set_attr(hd, attr_icflag, get_attr_icflag(hd) + PROCESSED_BEGIN_FLAG) ensure_tex_attr(attr_icflag, 0) ensure_tex_attr(attr_dir, 0) - return w + return insert_before(hd, hd, w) end end @@ -329,11 +329,12 @@ do end end if hd==wh[1] then - ltjs.list_dir =has_attr(hd,attr_dir) + ltjs.list_dir = has_attr(hd, attr_dir) local x = node_next(hd) while x and getid(x)==id_glue and getsubtype(x)==3 do node_remove(hd,x); node_free(x); x = node_next(hd) end + if #wh==1 then wh[1]=nil else wh[#wh], wh[1]=nil, wh[#wh] end end for i=1,#wh do hd = node_remove(hd, wh[i]); node_free(wh[i]); wh[i] = nil @@ -344,17 +345,13 @@ do ensure_tex_attr(attr_icflag, 0) end return hd - else + elseif gc=='vtop' then local n = node_next(hd) - if gc=='vtop' then - local w = create_dir_whatsit(hd, gc, ltjs.list_dir) - -- move dir whatsit after hd - setfield(hd, 'next', w); setfield(w, 'next', n) - return hd - else - hd = create_dir_whatsit(hd, gc, ltjs.list_dir) - return hd - end + local w = create_dir_whatsit(hd, gc, ltjs.list_dir) + -- move dir whatsit after hd + setfield(hd, 'next', w); setfield(w, 'next', n); + return hd + else return create_dir_whatsit(hd, gc, ltjs.list_dir) end end end @@ -548,7 +545,7 @@ do and getfield(hd, 'user_id')==DIR then local d = hd nh, hd = node_remove(nh, hd) - if is_copy and (not dir_backup) then + if is_copy==true and (not dir_backup) then dir_backup = d; setfield(dir_backup, 'next', nil) else node_free(d) @@ -729,7 +726,7 @@ do end local _, wh = get_box_dir(b, 0) -- clean dir_node attached to the box if wh then - node.direct.flush_list(getfield('value', wh)) + node.direct.flush_list(getfield(wh, 'value')) setfield(wh, 'value', nil) end end @@ -1036,23 +1033,11 @@ do end do - -- supply direction whatsit to the main vertical list "of the next page" local function dir_adjust_pre_output(h, gc) return to_node(create_dir_whatsit_vbox(to_direct(h), gc)) end - ltjb.add_to_callback('pre_output_filter', - dir_adjust_pre_output, + ltjb.add_to_callback('pre_output_filter', dir_adjust_pre_output, 'ltj.direction', 10000) - - function luatexja.direction.remove_end_whatsit() - local h=tex.lists.page_head - if h and (not h.next) and - h.id==id_whatsit and h.subtype==sid_user and - h.user_id == DIR then - tex.lists.page_head = nil - node.free(h) - end - end end -- append_to_vlist filter: done in ltj-lineskip.lua diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua index 61c21b9094..3d046f0c01 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua @@ -746,12 +746,14 @@ local function new_jfm_glue(mc, bc, ac) local g = mc[bc][ac] if g then if g[1] then - return node_copy(g[1]), g.ratio, false, false, false + local k = node_new(id_kern, 1); setfield(k, 'kern', g[1]) + set_attr(k, attr_icflag, FROM_JFM) + return k, g.ratio, false, false, false else - local f = node_new(id_glue) - set_attr(f, attr_icflag, g.priority) - setglue(f, g.width, g.stretch, g.shrink) - return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink + local f = node_new(id_glue) + set_attr(f, attr_icflag, g.priority) + setglue(f, g.width, g.stretch, g.shrink) + return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink end end return false, 0 diff --git a/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua index 64cb1a0da9..70557c08a8 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfont.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfont.lua @@ -229,10 +229,7 @@ do } end for k,w in pairs(v.kern) do - local g = node_new(id_kern, 1) - setfield(g, 'kern', w[1]) - set_attr(g, attr_icflag, FROM_JFM) - v[k] = {g, ratio=w[2]/sz} + v[k] = {w[1], ratio=w[2]/sz} end end v.glue, v.kern = nil, nil diff --git a/macros/luatex/generic/luatexja/src/ltj-lineskip.lua b/macros/luatex/generic/luatexja/src/ltj-lineskip.lua index 1fc6f7b2d3..f8b97c144b 100644 --- a/macros/luatex/generic/luatexja/src/ltj-lineskip.lua +++ b/macros/luatex/generic/luatexja/src/ltj-lineskip.lua @@ -18,12 +18,13 @@ local node_prev = node.direct.getprev local node_next = node.direct.getnext local getid = node.direct.getid local getsubtype = node.direct.getsubtype +local texget = tex.get local node_getglue = node.getglue local setglue = node.direct.setglue -local function copy_glue (new_glue, old_glue, subtype, new_w) +local function copy_glue (new_glue, old_glue_name, subtype, new_w) setfield(new_glue, 'subtype', subtype) - local w,st,sp,sto,spo = node_getglue(old_glue) + local w,st,sp,sto,spo = texget(old_glue_name, true) setglue(new_glue, new_w or w, st, sp, sto, spo) end ltjl.copy_glue = copy_glue @@ -33,9 +34,9 @@ function ltjl.p_dummy(before, after) end function ltjl.l_dummy(dist, g, adj, normal, bw, loc) if dist < tex.lineskiplimit then - copy_glue(g, tex.lineskip, 1, tex.lineskip.width + adj) + copy_glue(g, 'lineskip', 1, texget('lineskip', false) + adj) else - copy_glue(g, tex.baselineskip, 2, normal) + copy_glue(g, 'baselineskip', 2, normal) end end @@ -49,7 +50,7 @@ do local traverse_id = node.direct.traverse_id local function adjust_glue(nh) local h = to_direct(nh) - local bw = tex.baselineskip.width + local bw = texget('baselineskip',false) for x in traverse_id(id_glue, h) do local xs = getsubtype(x) if (xs==1) or (xs==2) then @@ -83,7 +84,7 @@ local function dir_adjust_append_vlist(b, loc, prev, mirrored) local new_b = loc=='box' and make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b if prev > -65536000 then - local bw = tex.baselineskip.width + local bw = texget('baselineskip', false) local normal = bw - prev - getfield(new_b, mirrored and 'depth' or 'height') local lmin, adj = nil, 0 local tail = to_direct(tex.nest[tex.nest.ptr].tail) diff --git a/macros/luatex/generic/luatexja/src/luatexja.lua b/macros/luatex/generic/luatexja/src/luatexja.lua index f7957a116d..8da4251882 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.lua +++ b/macros/luatex/generic/luatexja/src/luatexja.lua @@ -583,6 +583,9 @@ local function debug_show_node_X(p,print_fn, limit, inner_depth) debug_show_node_X(q, print_fn, limit, inner_depth) end end + elseif pt == 'attribute' then + s = base .. ' [' .. p.number .. '] = ' .. p.value + print_fn(s) else print_fn(base) end diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty index aa3d1f5463..5eab1c4e35 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.sty +++ b/macros/luatex/generic/luatexja/src/luatexja.sty @@ -27,7 +27,7 @@ \newif\ifltj@disablejfam %%%% VERSION -\def\LuaTeXjaversion{20220703.0} +\def\LuaTeXjaversion{20220807.0} %% Check if LaTeX is used. \begingroup\expandafter\expandafter\expandafter\endgroup |