summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty14
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua9
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua3
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua146
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua89
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty15
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja.lua3
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja.sty4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty4
14 files changed, 244 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
index 149dd03de7c..90dfece2b9c 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
@@ -4,7 +4,7 @@
% LaTeX only!
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-ruby}[2020-10-30 v0.4]
+\ProvidesPackage{luatexja-ruby}[2020-12-24 v0.5]
\RequirePackage{luatexja}
%%------------------
@@ -18,9 +18,9 @@
%% 引数:ルビ全角を単位とした実数
%% この文字への pre-, post-intrusion の許容量
\define@key[ltj]{japaram}{rubypreintrusion}{%
- \ltj@@set@stack@real{RIPRE}{0}{0x7FFFFFFF}#1 }
+ \ltj@@set@stack@real{RIPRE}{-0x7FFFFFFF}{0x7FFFFFFF}#1 }
\define@key[ltj]{japaram}{rubypostintrusion}{%
- \ltj@@set@stack@real{RIPOST}{0}{0x7FFFFFFF}#1 }
+ \ltj@@set@stack@real{RIPOST}{-0x7FFFFFFF}{0x7FFFFFFF}#1 }
\def\ltj@@set@stack@real#1#2#3{%
\directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1,
#2, #3, token.scan_word)}}
@@ -226,15 +226,15 @@
\advance\count@1\repeat
%% 開き括弧・閉じ括弧
\@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do
- {\ltjsetparameter{rubypreintrusion={\@tmp,1}}}
+ {\ltjsetparameter{rubypreintrusion={\@tmp,-1}}}
\@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do
- {\ltjsetparameter{rubypostintrusion={\@tmp,1}}}
+ {\ltjsetparameter{rubypostintrusion={\@tmp,-1}}}
%% 中点類
\@for\@tmp:=`\・,`\:,`\;,`\―,`\‥,`\…,`〳,`\〴,`\〵,"2014 \do
{\ltjsetparameter{rubypreintrusion={\@tmp,0.5},rubypostintrusion={\@tmp,0.5}}}
%% 読点・句点
\@for\@tmp:=`\、,`\,,`\。,`\. \do
- {\ltjsetparameter{rubypostintrusion={\@tmp,1}}}
+ {\ltjsetparameter{rubypostintrusion={\@tmp,-1}}}
%% 段落インデント部分
\ltjsetparameter{rubypreintrusion={-1,1}}
@@ -243,7 +243,7 @@
stretchruby={1}{2}{1}, stretch = {1}{2}{1},
stretchbol={0}{1}{1}, stretcheol={1}{1}{0},
maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
- kenten=\ltjalchar`•, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
+ kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip
}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua
index 07c51b554f2..08f567d20ab 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua
@@ -356,6 +356,15 @@ for i,v in pairs(t) do
if v.kern and v.kern[0] then v.kern[100] = v.kern[0] end
end
end
+t[200]=table.fastcopy(t[0])
+t[200].chars={ 0x3031,0x3032 }
+t[200].height=1.38; t[200].depth=0.62
+for i,v in pairs(t) do
+ if type(i)=='number' and type(v)=='table' then
+ if v.glue and v.glue[0] then v.glue[200] = v.glue[0] end
+ if v.kern and v.kern[0] then v.kern[200] = v.kern[0] end
+ end
+end
local jf = luatexja.jfont.jfm_feature
if jf and jf.beginpar_middledot_zw==true then
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
index c7d145d2f67..56effa3c57a 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
@@ -287,7 +287,10 @@ local aw_step2, aw_step2_dummy
do
local node_hpack = node.direct.hpack
local function repack(p)
+ local orig_of, orig_hfuzz, orig_hbad = tex.overfullrule, tex.hfuzz, tex.hbadness
+ tex.overfullrule=0; tex.hfuzz=1073741823; tex.hbadness=10000
local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly')
+ tex.overfullrule=orig_of; tex.hfuzz=orig_hfuzz; tex.hbadness=orig_hbad
setfield(f, 'head', nil)
setfield(p, 'glue_set', getfield(f, 'glue_set'))
setfield(p, 'glue_order', getfield(f, 'glue_order'))
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
index 7775e4720da..019e24ae2ec 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
@@ -3,7 +3,7 @@
--
luatexbase.provides_module({
name = 'luatexja.jfmglue',
- date = '2020-10-22',
+ date = '2020-12-22',
description = 'Insertion process of JFM glues, [x]kanjiskip and others',
})
luatexja.jfmglue = luatexja.jfmglue or {}
@@ -78,6 +78,7 @@ local FROM_JFM = luatexja.icflag_table.FROM_JFM
local PROCESSED = luatexja.icflag_table.PROCESSED
local IC_PROCESSED = luatexja.icflag_table.IC_PROCESSED
local BOXBDD = luatexja.icflag_table.BOXBDD
+local SPECIAL_JAGLUE = luatexja.icflag_table.SPECIAL_JAGLUE
local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG
local attr_icflag = luatexbase.attributes['ltj@icflag']
@@ -459,7 +460,7 @@ calc_np_auxtable = {
if lps==sid_user then
if getfield(lp, 'user_id')==luatexja.userid_table.IHB then
local lq = node_next(lp);
- head = node_remove(head, lp); node_free(lp); non_ihb_flag = false
+ head = node_remove(head, lp); node_free(lp); non_ihb_flag = getfield(lp, 'value')~=1
return false, lq;
elseif getfield(lp, 'user_id')==luatexja.userid_table.JA_AL_BDD then
local lq = node_next(lp);
@@ -499,7 +500,11 @@ calc_np_auxtable = {
end,
[id_glue] = function(lp)
Np.first, Np.nuc, Np.last = (Np.first or lp), lp, lp;
- Np.id = getid(lp); set_attr(lp, attr_icflag, PROCESSED)
+ Np.id = getid(lp);
+ local f = luatexbase.call_callback("luatexja.jfmglue.special_jaglue", lp)
+ if f then
+ set_attr(lp, attr_icflag, PROCESSED)
+ end
return true, node_next(lp)
end,
[id_disc] = function(lp)
@@ -562,7 +567,7 @@ function calc_np(last, lp)
while lp ~= last do
local lpa = has_attr(lp, attr_icflag) or 0
-- unbox 由来ノードの検出
- if lpa>=PACKED then
+ if (lpa>=PACKED) and (lpa%PROCESSED_BEGIN_FLAG<=BOXBDD) then
if lpa%PROCESSED_BEGIN_FLAG == BOXBDD then
local lq = node_next(lp)
head = node_remove(head, lp); node_free(lp); lp = lq
@@ -1095,13 +1100,15 @@ local adjust_nq
do
local adjust_nq_aux = {
[id_glyph] = function() after_alchar(Nq) end, -- after_alchar(Nq)
- [id_hlist] = function() after_hlist(Nq) end,
+ [id_hlist] = function() after_hlist(Nq) end,
[id_pbox] = function() after_hlist(Nq) end,
[id_disc] = function() after_hlist(Nq) end,
- [id_pbox_w] = function()
- luatexbase.call_callback("luatexja.jfmglue.whatsit_after",
- false, Nq, Np)
- end,
+ [id_glue] = function()
+ luatexbase.call_callback("luatexja.jfmglue.special_jaglue_after", Nq.nuc)
+ end,
+ [id_pbox_w]= function()
+ luatexbase.call_callback("luatexja.jfmglue.whatsit_after", false, Nq, Np)
+ end,
}
adjust_nq = function()
@@ -1265,14 +1272,20 @@ do
local node_prev = node.direct.getprev
local node_write = node.direct.write
- -- \inhibitglue
- function luatexja.jfmglue.create_inhibitglue_node()
+ -- \inhibitglue, \disinhibitglue
+ local function ihb_node(v)
local tn = node_new(id_whatsit, sid_user)
setfield(tn, 'user_id', IHB)
setfield(tn, 'type', 100)
- setfield(tn, 'value', 1)
+ setfield(tn, 'value', v)
node_write(tn)
end
+ function luatexja.jfmglue.create_inhibitglue_node()
+ ihb_node(1)
+ end
+ function luatexja.jfmglue.create_disinhibitglue_node()
+ ihb_node(0)
+ end
-- Node for indicating beginning of a paragraph
-- (for ltjsclasses)
@@ -1346,8 +1359,117 @@ do
"luatexja.beginpar.np_info", 1)
luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback,
"luatexja.beginpar.np_info_after", 1)
+end
+do
+ local node_prev = node.direct.getprev
+ local node_write = node.direct.write
+ local XKANJI_SKIP = luatexja.icflag_table.XKANJI_SKIP
+ local XKANJI_SKIP_JFM = luatexja.icflag_table.XKANJI_SKIP_JFM
+ local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP
+ local KANJI_SKIP_JFM = luatexja.icflag_table.KANJI_SKIP_JFM
+ local XSK = luatexja.stack_table_index.XSK
+ local KSK = luatexja.stack_table_index.KSK
+ local attr_yablshift = luatexbase.attributes['ltj@yablshift']
+ local attr_tablshift = luatexbase.attributes['ltj@tablshift']
+ local getcount, abs, scan_keyword = tex.getcount, math.abs, token.scan_keyword
+ local get_current_jfont
+ do
+ local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
+ local attr_curtfnt = luatexbase.attributes['ltj@curtfnt']
+ local dir_tate = luatexja.dir_table.dir_tate
+ local get_dir_count = ltjd.get_dir_count
+ function get_current_jfont()
+ return tex.getattribute((get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt)
+ end
+ end
+ -- \insertxkanjiskip
+ -- SPECIAL_JAGLUE のノード:
+ -- * (X)KANJI_SKIP(_JFM): その場で値が決まっている
+ -- * PROCESSED_BEGIN_FLAG + (X)KANJI_SKIP: 段落終了時に決める
+ local function insert_k_skip_common(ind, name, ica, icb)
+ if abs(tex.nest[tex.nest.ptr].mode) ~= ltjs.hmode then return end
+ 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 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)
+ set_attr(g, attr_yablshift, ica)
+ else
+ set_attr(g, attr_yablshift, PROCESSED_BEGIN_FLAG + ica)
+ set_attr(g, attr_tablshift, get_current_jfont())
+ end
+ node_write(g)
+ end
+ function luatexja.jfmglue.insert_xk_skip()
+ insert_k_skip_common(XSK, "xkanjiskip", XKANJI_SKIP, XKANJI_SKIP_JFM)
+ end
+ function luatexja.jfmglue.insert_k_skip()
+ insert_k_skip_common(KSK, "kanjiskip", KANJI_SKIP, KANJI_SKIP_JFM)
+ end
+ -- callback
+ local getglue = luatexja.getglue
+ local function special_jaglue(lx)
+ local lxi = get_attr_icflag(lx)
+ if lxi==SPECIAL_JAGLUE then
+ non_ihb_flag = false; return false
+ else
+ return lx
+ end
+ end
+ local function special_jaglue_after(lx)
+ if get_attr_icflag(lx)==SPECIAL_JAGLUE then
+ lxi=has_attr(lx, attr_yablshift)
+ if lxi>=PROCESSED_BEGIN_FLAG then
+ lxi = lxi%PROCESSED_BEGIN_FLAG
+ if lxi == KANJI_SKIP then
+ local w, st, sh, sto, sho = getglue(kanji_skip)
+ if w~=1073741823 then
+ setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, KANJI_SKIP)
+ else
+ local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)]
+ local bk = m.kanjiskip or null_skip_table
+ setglue(lx, bk[1], bk[2], bk[3], 0, 0)
+ set_attr(lx, attr_icflag, KANJI_SKIP_JFM)
+ end
+ elseif lxi == XKANJI_SKIP then
+ local w, st, sh, sto, sho = getglue(xkanji_skip)
+ if w~=1073741823 then
+ setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, XKANJI_SKIP)
+ else
+ local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)]
+ local bk = m.xkanjiskip or null_skip_table
+ setglue(lx, bk[1], bk[2], bk[3], 0, 0)
+ set_attr(lx, attr_icflag, XKANJI_SKIP_JFM)
+ end
+ end
+ else
+ set_attr(lx, attr_icflag, lxi)
+ end
+ Np.first = lx
+ if node_prev(lx) then
+ local lxp = node_prev(lx)
+ if lxp and getid(lxp)==id_penalty and get_attr_icflag(lxp)==KINSOKU then
+ Bp[#Bp+1]=lxp
+ end
+ end
+ non_ihb_flag = false; return false
+ end
+ return true
+ end
+ luatexbase.create_callback("luatexja.jfmglue.special_jaglue", "list",
+ special_jaglue)
+ luatexbase.create_callback("luatexja.jfmglue.special_jaglue_after", "list",
+ special_jaglue_after)
end
+
luatexja.jfmglue.after_hlist = after_hlist
luatexja.jfmglue.check_box_high = check_box_high
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
index 685e19bb0b6..34cdc8c7fc7 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
@@ -52,6 +52,9 @@ local attr_ruby = luatexbase.attributes['ltj@rubyattr']
-- * (whatsit).value node ではルビ全角の値(sp単位)
-- * 行分割で whatsit の前後に並ぶノードでは,「何番目のルビ関連ノード」か
-- * (whatsit).value に続く整形済み vbox たちでは post_intrusion の値
+local attr_ruby_post_jfmgk = luatexbase.attributes['ltj@kcat3']
+-- JAglue 処理時に,2つ前のクラスタもルビであれば,そのルビが直後の和文処理グルーへ
+-- 正の進入をしたか否か(した:1,しなかった:0)
local cat_lp = luatexbase.catcodetables['latex-package']
local round, floor = tex.round, math.floor
@@ -341,16 +344,24 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
setfield(p, 'width', rwidth)
local ps = getlist(p)
setfield(ps, 'width', getfield(ps, 'width') - pre_intrusion)
- local orig_post_intrusion = post_intrusion
- if no_end then orig_post_intrusion = max(orig_post_intrusion - tmp_tbl.after_jfmgk, 0) end
- return r, p, orig_post_intrusion
+ local orig_post_intrusion, post_jfmgk = post_intrusion, false
+ if no_end then
+ if orig_post_intrusion > tmp_tbl.after_jfmgk then
+ orig_post_intrusion = orig_post_intrusion - tmp_tbl.after_jfmgk
+ post_jfmgk = (tmp_tbl.after_jfmgk > 0)
+ else
+ orig_post_intrusion = 0
+ post_jfmgk = (post_intrusion > 0)
+ end
+ end
+ return r, p, orig_post_intrusion, post_jfmgk
end
-- ルビボックスの生成(単一グループ)
-- returned value: <new box>, <ruby width>, <post_intrusion>
local max_margin
local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
- local post_intrusion = 0
+ local post_intrusion, post_jfmgk = 0, false
local imode
local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost
local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost
@@ -360,7 +371,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
imode = (imode-rpost)/8; rmid = imode%8;
imode = (imode-rmid)/8; rpre = imode%8
if getfield(r, 'width') > getfield(p, 'width') then -- change the width of p
- r, p, post_intrusion = enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
+ r, p, post_intrusion, post_jfmgk = enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
elseif getfield(r, 'width') < getfield(p, 'width') then -- change the width of r
r = enlarge(r, getfield(p, 'width'), rpre, rmid, rpost, 0, 0)
post_intrusion = 0
@@ -390,6 +401,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
if tmp_tbl.baseheight >= 0 then setfield(p, 'height', tmp_tbl.baseheight) end
a = node.direct.vpack(r); setfield(a, 'shift', 0)
set_attr(a, attr_ruby, post_intrusion)
+ set_attr(a, attr_ruby_post_jfmgk, post_jfmgk and 1 or 0)
if rsmash or getfield(a, 'height')<getfield(p, 'height') then
local k = node_new(id_kern, 1)
setfield(k, 'kern', -getfield(a, 'height')+getfield(p, 'height'))
@@ -397,12 +409,12 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
setfield(a, 'height', getfield(p, 'height'))
end
- return a, getfield(r, 'width'), post_intrusion
+ return a, getfield(r, 'width'), post_intrusion, post_jfmgk
end
-- High-level routine in pre_linebreak_filter
-local post_intrusion_backup
+local post_intrusion_backup, post_jfmgk_backup
local max_allow_pre, max_allow_post
@@ -425,7 +437,7 @@ local function pre_low_cal_box(w, cmp)
local nt, nta, ntb = wv, nil, nil -- nt*: node temp
rst.ppre, rst.pmid, rst.ppost = rtb[6], rtb[5], rtb[4]
rst.mapre, rst.mapost = max_allow_pre, 0
- for i = 1, cmp do
+ for i = 1, cmp do
nt = node_next(nt); rb[i] = nt; nta = concat(nta, node_copy(nt))
nt = node_next(nt); pb[i] = nt; ntb = concat(ntb, node_copy(nt))
coef[i] = {}
@@ -455,7 +467,7 @@ local function pre_low_cal_box(w, cmp)
for j = 1, 2*cmp+1 do coef[2*cmp+1][j] = 1 end
rst.ppre, rst.pmid, rst.ppost = rtb[3], rtb[2], rtb[1]
rst.mapre, rst.mapost = max_allow_pre, max_allow_post
- kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup
+ kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup, post_jfmgk_backup
= new_ruby_box(nta, ntb, rst, true, true)
-- w.value の node list 更新.
@@ -517,7 +529,7 @@ end
local function pre_high(ahead)
if not ahead then return ahead end
local head = to_direct(ahead)
- post_intrusion_backup = 0
+ post_intrusion_backup, post_jfmgk_backup = 0, false
local n = first_whatsit(head)
while n do
if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then
@@ -526,17 +538,22 @@ local function pre_high(ahead)
max_allow_pre = rst.pre or 0
local atr = has_attr(n, attr_ruby) or 0
if max_allow_pre < 0 then
- if atr>0 then
- -- 直前のルビで intrusion がおこる可能性あり.
- -- 前 run のデータが残っていればそれを使用,
- -- そうでなければ行中形のデータを利用する
- local op = old_break_info[atr] or post_intrusion_backup
- max_allow_pre = max(0, -max_allow_pre - op)
- else
- max_allow_pre = -max_allow_pre
- end
+ -- 直前のルビで intrusion がおこる可能性あり.
+ -- 前 run のデータが残っていればそれを使用,
+ -- そうでなければ行中形のデータを利用する
+ local op = (atr>0) and (old_break_info[atr] or post_intrusion_backup) or 0
+ max_allow_pre = max(0, -max_allow_pre - op)
+ end
+ if rst.exclude_pre_from_prev_ruby and ((atr>0) and (old_break_info[-atr]>0) or post_jfmgk_backup) then
+ -- 「直前のルビが JFM グルーに進入→現在のルビの前文字進入はなし」という状況
+ max_allow_pre = 0; rst.exclude_pre_from_prev_ruby=false
end
- post_intrusion_backup = 0
+ if rst.exclude_pre_jfmgk_from_prev_ruby
+ and (atr>0) and ((old_break_info[atr] or post_intrusion_backup) > 0) then
+ -- 「直前のルビが文字に進入→現在のルビの和文処理グルーへの進入はなし」という状況
+ rst.before_jfmgk = 0
+ end
+ post_intrusion_backup, post_jfmgk_backup = 0, false
max_allow_post = rst.post or 0
max_margin = rst.maxmargin or 0
local coef = pre_low_cal_box(n, rst.count)
@@ -558,11 +575,11 @@ luatexbase.add_to_callback('hpack_filter', pre_high, 'ltj.ruby.pre', 100)
----------------------------------------------------------------
local post_lown
do
- local function write_aux(wv, num)
+ local function write_aux(wv, num, bool)
local id = has_attr(wv, attr_ruby_id)
if id>0 and cache_handle then
cache_handle:write(
- 'lrob[' .. tostring(id) .. ']=' .. num .. '\n')
+ 'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n')
end
end
@@ -578,7 +595,7 @@ do
node_remove(wv, hn)
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
- write_aux(wv, has_attr(hn, attr_ruby))-- 行中形
+ write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))-- 行中形
else
local deg, hn = (fn-1)/2, wv
for i = 1, deg do hn = node_next(hn) end;
@@ -586,7 +603,7 @@ do
setfield(hn, 'next', nil)
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
- write_aux(wv, has_attr(hn, attr_ruby))
+ write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))
end
else
local deg, hn = max((hn-1)/2,2), wv
@@ -597,7 +614,7 @@ do
insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
if fn == 2*cmp-1 then
- write_aux(wv, has_attr(hn, attr_ruby))
+ write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))
end
end
for i = 1,#rs do
@@ -682,6 +699,8 @@ luatexbase.add_to_callback('hpack_filter', post_high_hbox, 'ltj.ruby.post_hbox',
----------------------------------------------------------------
do
local RIPRE = luatexja.stack_table_index.RIPRE
+ local RIPOST = luatexja.stack_table_index.RIPOST
+ local abs = math.abs
local function whatsit_callback(Np, lp, Nq)
if Np.nuc then return Np
elseif getfield(lp, 'user_id') == RUBY_PRE then
@@ -694,25 +713,27 @@ do
if type(Nq.char)=='number' then
-- Nq is a JAchar
if rst.pre < 0 then -- auto
- local p = round((ltjs.table_current_stack[RIPRE + Nq.char] or 0)
- *rst.rubyzw)
+ local s = ltjs.table_current_stack[RIPRE + Nq.char] or 0
+ local p = round(abs(s)*rst.rubyzw)
if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
- rst.pre = -p
+ rst.pre = -p; rst.exclude_pre_from_prev_ruby = (s<0);
+ rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST +Nq.char] or 0)<0;
end
if Nq.prev_ruby then
set_attr(lp, attr_ruby, Nq.prev_ruby)
end
elseif rst.pre < 0 then -- auto
if Nq.char == 'parbdd' then
- local p = round((ltjs.table_current_stack[RIPRE-1] or 0)
- *rst.rubyzw)
+ local s = ltjs.table_current_stack[RIPRE - 1] or 0
+ local p = round(abs(s)*rst.rubyzw)
p = min(p, Nq.width)
- if rst.mode%2 == 0 then -- intrusion 無効
+ if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
- rst.pre = p
+ rst.pre = p; rst.exclude_pre_from_prev_ruby = (s<0);
+ rst.exclude_pre_jfmgk_from_prev_ruby = (ltjs.table_current_stack[RIPOST -1] or 0)<0;
else
rst.pre = 0
end
@@ -741,6 +762,7 @@ do
end
end
local RIPOST = luatexja.stack_table_index.RIPOST
+ local abs = math.abs
local function whatsit_after_callback(s, Nq, Np)
if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then
if Np then
@@ -764,8 +786,7 @@ do
if Np and Np.id ~=id_pbox_w and type(Np.char)=='number' then
-- Np is a JAchar
if rst.post < 0 then -- auto
- local p = round((ltjs.table_current_stack[RIPOST + Np.char] or 0)
- *rst.rubyzw)
+ local p = round(abs(ltjs.table_current_stack[RIPOST + Np.char] or 0)*rst.rubyzw)
if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
index d8c4634397a..bef8aac8512 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
@@ -38,7 +38,7 @@
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ltjsarticle}
- [2020/05/30 ltjsclasses ]
+ [2020/12/23 ltjsclasses ]
\def\jsc@clsname{ltjsarticle}
\def\Cjascale{0.924715}
\RequirePackage{luatexja}
@@ -1030,11 +1030,11 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}%
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{\theenumi.}
-\newcommand{\labelenumii}{\inhibitglue(\theenumii)\inhibitglue}
+\newcommand{\labelenumii}{\inhibitglue (\theenumii)\inhibitglue}
\newcommand{\labelenumiii}{\theenumiii.}
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
-\renewcommand{\p@enumiii}{\theenumi\inhibitglue(\theenumii)}
+\renewcommand{\p@enumiii}{\theenumi\inhibitglue (\theenumii)}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
index 5c8a3f2c76f..94bdb8223dd 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
@@ -38,7 +38,7 @@
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ltjsbook}
- [2020/05/30 ltjsclasses ]
+ [2020/12/23 ltjsclasses ]
\def\jsc@clsname{ltjsbook}
\def\Cjascale{0.924715}
\RequirePackage{luatexja}
@@ -1140,11 +1140,11 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}%
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{\theenumi.}
-\newcommand{\labelenumii}{\inhibitglue(\theenumii)\inhibitglue}
+\newcommand{\labelenumii}{\inhibitglue (\theenumii)\inhibitglue}
\newcommand{\labelenumiii}{\theenumiii.}
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
-\renewcommand{\p@enumiii}{\theenumi\inhibitglue(\theenumii)}
+\renewcommand{\p@enumiii}{\theenumi\inhibitglue (\theenumii)}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
index 89d302864f9..621167c2c07 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
@@ -38,7 +38,7 @@
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ltjskiyou}
- [2020/05/30 ltjsclasses ]
+ [2020/12/23 ltjsclasses ]
\def\jsc@clsname{ltjskiyou}
\def\Cjascale{0.924715}
\RequirePackage{luatexja}
@@ -991,11 +991,11 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}%
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{\theenumi.}
-\newcommand{\labelenumii}{\inhibitglue(\theenumii)\inhibitglue}
+\newcommand{\labelenumii}{\inhibitglue (\theenumii)\inhibitglue}
\newcommand{\labelenumiii}{\theenumiii.}
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
-\renewcommand{\p@enumiii}{\theenumi\inhibitglue(\theenumii)}
+\renewcommand{\p@enumiii}{\theenumi\inhibitglue (\theenumii)}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
index d79d1b93305..237c9f86c6a 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
@@ -38,7 +38,7 @@
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ltjspf}
- [2020/05/30 ltjsclasses ]
+ [2020/12/23 ltjsclasses ]
\def\jsc@clsname{ltjspf}
\def\Cjascale{0.903375}
\RequirePackage{luatexja}
@@ -919,11 +919,11 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}%
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{\theenumi.}
-\newcommand{\labelenumii}{\inhibitglue(\theenumii)\inhibitglue}
+\newcommand{\labelenumii}{\inhibitglue (\theenumii)\inhibitglue}
\newcommand{\labelenumiii}{\theenumiii.}
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
-\renewcommand{\p@enumiii}{\theenumi\inhibitglue(\theenumii)}
+\renewcommand{\p@enumiii}{\theenumi\inhibitglue (\theenumii)}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
index 1771f91a936..d9ee6d23465 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
@@ -38,7 +38,7 @@
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ltjsreport}
- [2020/05/30 ltjsclasses ]
+ [2020/12/23 ltjsclasses ]
\def\jsc@clsname{ltjsreport}
\def\Cjascale{0.924715}
\RequirePackage{luatexja}
@@ -1092,11 +1092,11 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}%
\renewcommand{\theenumiii}{\@roman\c@enumiii}
\renewcommand{\theenumiv}{\@Alph\c@enumiv}
\newcommand{\labelenumi}{\theenumi.}
-\newcommand{\labelenumii}{\inhibitglue(\theenumii)\inhibitglue}
+\newcommand{\labelenumii}{\inhibitglue (\theenumii)\inhibitglue}
\newcommand{\labelenumiii}{\theenumiii.}
\newcommand{\labelenumiv}{\theenumiv.}
\renewcommand{\p@enumii}{\theenumi}
-\renewcommand{\p@enumiii}{\theenumi\inhibitglue(\theenumii)}
+\renewcommand{\p@enumiii}{\theenumi\inhibitglue (\theenumii)}
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
index 5cbf4e8da91..3ad56574322 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
@@ -65,7 +65,7 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-core}[2020-09-27 Core of LuaTeX-ja]
+ \ProvidesPackage{luatexja-core}[2020-12-22 Core of LuaTeX-ja]
\fi %</LaTeX>
%% Load prerequisite packages.
@@ -151,6 +151,10 @@
\ltj@charclass\z@
\ltj@curjfnt\m@ne
\ltj@curtfnt\m@ne
+\ltj@yablshift\z@
+\ltj@ykblshift\z@
+\ltj@tablshift\z@
+\ltj@tkblshift\z@
%%%%%%%% Attributes for character ranges
\newcount\ltj@tempcnta
@@ -249,24 +253,33 @@
%%%%%%%% \inhibitglue
\newluafunction\ltj@reset@globaldefs@inner
\newluafunction\ltj@restore@globaldefs@inner
+\newluafunction\ltj@@disihb@inner
\newluafunction\ltj@@ihb@inner
\newluafunction\ltj@@fakeparbegin@inner
\newluafunction\ltj@@fakeboxbdd@inner
+\newluafunction\ltj@@ins@xk@inner
+\newluafunction\ltj@@ins@k@inner
\directlua{
local t = lua.get_functions_table()
t[\the\ltj@reset@globaldefs@inner]
= function() luatexja.global_temp = tex.globaldefs; tex.globaldefs = 0 end
t[\the\ltj@restore@globaldefs@inner]
= function() tex.globaldefs = luatexja.global_temp end
+ t[\the\ltj@@disihb@inner] = luatexja.jfmglue.create_disinhibitglue_node
t[\the\ltj@@ihb@inner] = luatexja.jfmglue.create_inhibitglue_node
t[\the\ltj@@fakeparbegin@inner] = luatexja.jfmglue.create_beginpar_node
t[\the\ltj@@fakeboxbdd@inner] = luatexja.jfmglue.create_boxbdd_node
+ t[\the\ltj@@ins@xk@inner] = luatexja.jfmglue.insert_xk_skip
+ t[\the\ltj@@ins@k@inner] = luatexja.jfmglue.insert_k_skip
}
\protected\luadef\ltj@reset@globaldefs \ltj@reset@globaldefs@inner
\protected\luadef\ltj@restore@globaldefs\ltj@restore@globaldefs@inner
+\protected\def\disinhibitglue{\ifhmode\relax\luafunction\ltj@@disihb@inner\fi}
\protected\def\inhibitglue{\ifhmode\relax\luafunction\ltj@@ihb@inner\fi}
\protected\def\ltjfakeparbegin{\ifhmode\relax\luafunction\ltj@@fakeparbegin@inner\fi}
\protected\def\ltjfakeboxbdd{\ifhmode\relax\luafunction\ltj@@fakeboxbdd@inner\fi}
+\protected\luadef\insertxkanjiskip \ltj@@ins@xk@inner
+\protected\luadef\insertkanjiskip \ltj@@ins@k@inner
%%%%%%%% \ltjdefcharrange<name>{100-200,3000-,5000,...}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
index 1c039a7d9fa..b4e2e68efb6 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
@@ -42,6 +42,9 @@ icflag_table.LINEEND = 72
icflag_table.PROCESSED = 73
icflag_table.IC_PROCESSED = 74
icflag_table.BOXBDD = 75
+icflag_table.SPECIAL_JAGLUE = 76
+-- 段落組版中のノードリストでは通常のノード (not whatsit) だが
+-- 和文処理グルー挿入プロセスで長さが決定されるもの
icflag_table.PROCESSED_BEGIN_FLAG = 4096 -- sufficiently large power of 2
local stack_ind = {}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
index f70120dd1f2..4d749c40efc 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
@@ -35,13 +35,13 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja}[2020-10-30 Japanese Typesetting with Lua(La)TeX]
+ \ProvidesPackage{luatexja}[2020-12-24 Japanese Typesetting with Lua(La)TeX]
\DeclareOption{disablejfam}{\ltj@disablejfamtrue}
\DeclareOption*{}
\ProcessOptions\relax
\fi %</LaTeX>
%%%% VERSION
-\def\LuaTeXjaversion{20201030.0}
+\def\LuaTeXjaversion{20201224.0}
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty
index d0ac424701a..4d2d3505531 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty
@@ -7,7 +7,7 @@
% \dimen...=\ybaselineshift ==> \dimen...=\ltj@yablshift sp
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-tascmac}[2017/12/23 Patch to (t)ascmac for LuaTeX-ja]
+\ProvidesPackage{lltjp-tascmac}[2020/12/24 Patch to (t)ascmac for LuaTeX-ja]
\RequirePackage{tascmac}
@@ -37,7 +37,7 @@
\@whiledim \wd\@nbox<\hsize \do{
\setbox\@nbox=\hbox{\@ascgrp\unhbox\@nbox \hss a\hss b}}
\setbox\@nbox=\hbox to\hsize{\@ascgrp\unhbox\@nbox \hss a\hss b%
- \vrule width1.08pt depth35pt}
+ \vrule width1.08pt depth35pt}%
\@bw=\wd\@nbox\advance\@bw -40pt
\begin{lrbox}{\@nbody}\begin{minipage}{\@bw}% (KN:1998/02/27)
\ltj@yablshift\@saveybaselineshift \ltj@tablshift\@savetbaselineshift}%