summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-08-25 20:56:18 +0000
committerKarl Berry <karl@freefriends.org>2018-08-25 20:56:18 +0000
commit21a58c30431c4e45b1b0bc9f94f4e696bab9a217 (patch)
tree6f66df0c8d0bc0893a4dc129d740b7a709ab61d3 /Master/texmf-dist/tex/luatex/luatexja
parent07d445bda7b2504536050450a2f1cc433ed3899e (diff)
luatexja (25aug18)
git-svn-id: svn://tug.org/texlive/trunk@48483 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty25
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua95
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua291
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua40
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua16
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua5
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty90
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua116
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua1
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty4
-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-fontspec-immediate.sty131
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty137
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty10
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty20
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty3
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty58
19 files changed, 449 insertions, 602 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
index 0416a3ebd77..57d9835caf5 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
@@ -64,7 +64,7 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-adjust}[2017/05/05]
+ \ProvidesPackage{luatexja-adjust}[2018/07/24]
\fi %</LaTeX>
% Load core module if not yet.
@@ -85,26 +85,31 @@
%%------------------
%! Main part of luatexja-adjust
-\ifnum\luatexversion>90
- \RequireLuaTeXjaSubmodule{adjust}
-\else
- \RequireLuaTeXjaSubmodule{adjust_85}
-\fi
-
+\RequireLuaTeXjaSubmodule{adjust}
\newcount\ltjadj@status@le
+\newcount\ltjadj@status@lp
\newcount\ltjadj@status@pr
+\newcount\ltjadj@status@ls
\let\ltj@adjust@temp=\relax
\define@choicekey[ltj]{adjust}{lineend}[\@@temp\ltj@adjust@temp]%
{false,true,extended}[true]{%
\ifnum\ltj@adjust@temp=-1 \else\ltjadj@status@le=\ltj@adjust@temp\fi\relax}
\define@boolkey[ltj]{adjust}{priority}[true]{%
\ltjadj@status@pr=\ifltj@adjust@priority1\else0\fi\relax}
+\define@boolkey[ltj]{adjust}{profile}[true]{%
+ \ltjadj@status@lp=\ifltj@adjust@profile1\else0\fi\relax}
+\define@boolkey[ltj]{adjust}{linestep}[true]{%
+ \ltjadj@status@ls=\ifltj@adjust@linestep1\else0\fi\relax}
+
\protected\def\@@ltjenableadjust[#1]{%
\setkeys[ltj]{adjust}{#1}%
- \directlua{luatexja.adjust.enable_cb(\the\ltjadj@status@le, \the\ltjadj@status@pr)}\ignorespaces
+ \directlua{luatexja.adjust.enable_cb(
+ \the\ltjadj@status@le, \the\ltjadj@status@pr,
+ \the\ltjadj@status@lp, \the\ltjadj@status@ls)}\ignorespaces
}
-\protected\def\ltjdisableadjust{\ltjenableadjust[lineend=false,priority=false]}
+\protected\def\ltjdisableadjust{%
+ \ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false]}
\protected\def\ltjenableadjust{%
\ltx@ifnextchar[{\@@ltjenableadjust}{\@@ltjenableadjust[lineend,priority]}}%]
@@ -127,6 +132,8 @@
stretch_priority={kanjiskip=-35, xkanjiskip=-25, others=50},
shrink_priority={kanjiskip=-35, xkanjiskip=-25, others=50},
}
+\define@key[ltj]{japaram}{linestep_factor}{%
+ \directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax}
%%------------------ all done
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
index b2eabb12fb4..4e577aad5ea 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
@@ -88,7 +88,9 @@
% 漢字字形
\tl_new:N \l_ltjpreset_kanji_shape_tl
\ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
+\ltjpreset_declare_option:nn{jis90}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
\ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
+\ltjpreset_declare_option:nn{2004jis}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
% font preset
\prop_new:N \g_ltjpreset_font_prop
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
index 7131bbc7b77..d9bd77a3ea8 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
@@ -1,10 +1,12 @@
--
-- ltj-adjust.lua
--
+luatexja.load_module('base'); local ltjb = luatexja.base
luatexja.load_module('jfont'); local ltjf = luatexja.jfont
luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue
luatexja.load_module('stack'); local ltjs = luatexja.stack
luatexja.load_module('direction'); local ltjd = luatexja.direction
+luatexja.load_module('lineskip'); local ltjl = luatexja.lineskip
luatexja.adjust = luatexja.adjust or {}
local to_node = node.direct.tonode
@@ -401,10 +403,11 @@ do
return to_node(head)
end
local is_reg = false
- function enable_cb(status_le, status_pr)
+ function enable_cb(status_le, status_pr, status_lp, status_ls)
if (status_le>0 or status_pr>0) and (not is_reg) then
- luatexbase.add_to_callback('post_linebreak_filter',
- adjust_width, 'Adjust width', 100)
+ ltjb.add_to_callback('post_linebreak_filter',
+ adjust_width, 'Adjust width',
+ luatexbase.priority_in_callback('post_linebreak_filter', 'ltj.lineskip')-1)
is_reg = true
elseif is_reg and (status_le==0 and status_pr==0) then
luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width')
@@ -412,7 +415,7 @@ do
end
if status_le==2 then
if not luatexbase.in_callback('luatexja.adjust_jfmglue', 'luatexja.adjust') then
- luatexbase.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust')
+ ltjb.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust')
end
myaw_step1, myaw_step1_last = dummy, aw_step1_last
else
@@ -426,9 +429,13 @@ do
end
end
myaw_step2 = (status_pr>0) and aw_step2 or aw_step2_dummy
+ luatexja.lineskip.setting(
+ status_lp>0 and 'profile' or 'dummy',
+ status_ls>0 and 'step' or 'dummy'
+ )
end
function disable_cb() -- only for compatibility
- enable_cs(0)
+ enable_cs(0,0,0,0)
end
luatexja.adjust.enable_cb=enable_cb
luatexja.adjust.disable_cb=disable_cb
@@ -437,3 +444,81 @@ end
luatexja.unary_pars.adjust = function(t)
return is_reg and 1 or 0
end
+
+-- -----------------------------------
+luatexja.adjust.step_factor = 0.5
+do
+ local insert = table.insert
+ local rangedimensions, max = node.direct.rangedimensions, math.max
+ function ltjl.p_profile(before, after, mirrored, bw)
+ local t = {}
+ do
+ local w_acc, d_before = 0, 0
+ local x = getlist(before); local xn = node_next(x)
+ while x do
+ local w, d
+ if xn then w, _, d= rangedimensions(before,x,xn)
+ else w, _, d= rangedimensions(before,x) end
+ if d~=d_before then
+ d_before = d; t[w_acc] = t[w_acc] or {}
+ if t[w_acc][1] then t[w_acc][1]=max(t[w_acc][1],d)
+ else t[w_acc][1]=d end
+ end
+ w_acc = w_acc + w
+ x = xn; if x then xn = node_next(x) end
+ end
+ end
+ do
+ local w_acc, h_before = 0, 0
+ local x = getlist(after); local xn = node_next(x)
+ while x do
+ local w, h, d
+ if xn then w, h, d = rangedimensions(after,x,xn)
+ else w, h,d = rangedimensions(after,x) end
+ if mirrored then h=d end
+ if h~=h_before then
+ h_before = h; t[w_acc] = t[w_acc] or {}
+ if t[w_acc][2] then t[w_acc][2]=max(t[w_acc][2],h)
+ else t[w_acc][2]=h end
+ end
+ w_acc = w_acc + w
+ x = xn; if x then xn = node_next(x) end
+ end
+ end
+ local t2 = {}
+ for i,v in pairs(t) do insert(t2, { i, v[1], v[2] } ) end
+ table.sort(t2, function(a,b) return a[1]<b[1] end)
+ do
+ local dmax, d, hmax, h, lmin = 0, 0, 0, 0, 1/0
+ for i,v in ipairs(t2) do
+ d, h = (v[2] or d), (v[3] or h)
+ if d>dmax then dmax=d end
+ if h>hmax then hmax=h end
+ if (bw-h-d)<lmin then lmin=bw-h-d end
+ end
+ if lmin==1/0 then lmin = bw end
+ return lmin,
+ bw - lmin - getfield(before, 'depth')
+ - getfield(after, mirrored and 'depth' or 'height')
+ end
+ end
+end
+
+do
+ local ltja = luatexja.adjust
+ local copy_glue = ltjl.copy_glue
+ local floor, max = math.floor, math.max
+ function ltjl.l_step(dist, g, adj, normal, bw, loc)
+ if loc=='alignment' then
+ return ltjl.l_dummy(dist, g, adj, normal, bw, loc)
+ 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))
+ else
+ copy_glue(g, tex.baselineskip, 2, normal)
+ end
+ end
+end
+
+
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua
deleted file mode 100644
index db85d8f3260..00000000000
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua
+++ /dev/null
@@ -1,291 +0,0 @@
---
--- luatexja/otf.lua
---
-luatexja.load_module('jfont'); local ltjf = luatexja.jfont
-luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue
-luatexja.load_module('stack'); local ltjs = luatexja.stack
-luatexja.load_module('direction'); local ltjd = luatexja.direction
-
-local to_node = node.direct.tonode
-local to_direct = node.direct.todirect
-
-local setfield = node.direct.setfield
-local setglue = luatexja.setglue
-local getfield = node.direct.getfield
-local is_zero_glue = node.direct.is_zero_glue or
- function(g)
- return (getfield(g,'width')==0)and (getfield(g,'stretch')==0)and(getfield(g,'shrink')==0)
- end
-local getlist = node.direct.getlist
-local getid = node.direct.getid
-local getfont = node.direct.getfont
-local getsubtype = node.direct.getsubtype
-
-local node_traverse_id = node.direct.traverse_id
-local node_new = node.direct.new
-local node_copy = node.direct.copy
-local node_hpack = node.direct.hpack
-local node_next = node.direct.getnext
-local node_free = node.direct.free
-local node_prev = node.direct.getprev
-local node_tail = node.direct.tail
-local has_attr = node.direct.has_attribute
-local set_attr = node.direct.set_attribute
-local insert_after = node.direct.insert_after
-
-local id_glyph = node.id('glyph')
-local id_kern = node.id('kern')
-local id_hlist = node.id('hlist')
-local id_glue = node.id('glue')
-local id_whatsit = node.id('whatsit')
-local attr_icflag = luatexbase.attributes['ltj@icflag']
-local attr_jchar_class = luatexbase.attributes['ltj@charclass']
-local lang_ja = luatexja.lang_ja
-
-local ltjf_font_metric_table = ltjf.font_metric_table
-local round, pairs = tex.round, pairs
-
-local PACKED = luatexja.icflag_table.PACKED
-local FROM_JFM = luatexja.icflag_table.FROM_JFM
-local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP
-local KANJI_SKIP_JFM = luatexja.icflag_table.KANJI_SKIP_JFM
-local XKANJI_SKIP = luatexja.icflag_table.XKANJI_SKIP
-local XKANJI_SKIP_JFM = luatexja.icflag_table.XKANJI_SKIP_JFM
-
-local priority_table = {
- FROM_JFM + 2,
- FROM_JFM + 1,
- FROM_JFM,
- FROM_JFM - 1,
- FROM_JFM - 2,
- XKANJI_SKIP,
- KANJI_SKIP
-}
-
-local get_attr_icflag
-do
- local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG
- get_attr_icflag = function(p)
- return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG
- end
-end
-
--- box 内で伸縮された glue の合計値を計算
-
-local function get_stretched(q, go, gs)
- if gs == 1 then -- stretching
- if getfield(q, 'stretch_order') == go then
- return getfield(q, 'stretch')
- else return 0
- end
- else -- shrinking
- if getfield(q, 'shrink_order') == go then
- return getfield(q, 'shrink')
- else return 0
- end
- end
-end
-
-local res = {}
-local gs_used_line = {}
-local function get_total_stretched(p, line)
- local go, gf, gs
- = getfield(p, 'glue_order'), getfield(p, 'glue_set'), getfield(p, 'glue_sign')
- if go ~= 0 then return nil end
- res[0], res.glue_set, res.name = 0, gf, (gs==1) and 'stretch' or 'shrink'
- for i=1,#priority_table do res[priority_table[i]]=0 end
- if gs ~= 1 and gs ~= 2 then return res, 0 end
- local total = 0
- for q in node_traverse_id(id_glue, getlist(p)) do
- local a, ic = get_stretched(q, go, gs), get_attr_icflag(q)
- if ic == KANJI_SKIP_JFM then ic = KANJI_SKIP
- elseif ic == XKANJI_SKIP_JFM then ic = XKANJI_SKIP
- end
- if type(res[ic]) == 'number' then
- -- kanjiskip, xkanjiskip は段落内で spec を共有しているが,
- -- それはここでは望ましくないので,各 glue ごとに異なる spec を使う.
- -- 本当は各行ごとに glue_spec を共有させたかったが,安直にやると
- -- ref_count が 0 なので Double-free が発生する.どうする?
- -- JFM グルーはそれぞれ異なる glue_spec を用いているので,問題ない.
- if (ic == KANJI_SKIP or ic == XKANJI_SKIP) and getsubtype(q)==0 then
- local qs = getfield(q, 'spec')
- if is_zero_glue(q) then
- if (gs_used_line[qs] or 0)<line then
- setfield(q, 'spec', node_copy(qs))
- local f = node_new(id_glue); setfield(f, 'spec', qs); node_free(f)
- -- decrese qs's reference count
- else
- gs_used_line[qs] = line
- end
- end
- end
- res[ic], total = res[ic] + a, total + a
- else
- res[0], total = res[0] + a, total + a
- end
- end
- return res, total
-end
-
-local function clear_stretch(p, ic, name)
- for q in node_traverse_id(id_glue, getlist(p)) do
- local f = get_attr_icflag(q)
- if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM))
- or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then
- local qs = getfield(q, 'spec')
- if getfield(qs, 'writable') then
- setfield(qs, name..'_order', 0)
- setfield(qs, name, 0)
- end
- end
- end
-end
-
-local set_stretch_table = {}
-local function set_stretch(p, after, before, ic, name)
- if before > 0 then
- local ratio = after/before
- for i,_ in pairs(set_stretch_table) do
- set_stretch_table[i] = nil
- end
- for q in node_traverse_id(id_glue, getlist(p)) do
- local f = get_attr_icflag(q)
- if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM))
- or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then
- local qs, do_flag = getfield(q, 'spec'), true
- for i=1,#set_stretch_table do
- if set_stretch_table[i]==qs then do_flag = false end
- end
- if getfield(qs, 'writable') and getfield(qs, name..'_order')==0 and do_flag then
- setfield(q, name, getfield(qs, name)*ratio)
- set_stretch_table[#set_stretch_table+1] = qs
- end
- end
- end
- end
-end
-
--- step 1: 行末に kern を挿入(句読点,中点用)
-local ltjd_glyph_from_packed = ltjd.glyph_from_packed
-local function aw_step1(p, res, total)
- local head = getlist(p)
- local x = node_tail(head); if not x then return false end
- -- x: \rightskip
- x = node_prev(x); if not x then return false end
- local xi, xc = getid(x)
- if xi == id_glue and getsubtype(x) == 15 then
- -- 段落最終行のときは,\penalty10000 \parfillskip が入るので,
- -- その前の node が本来の末尾文字となる
- x = node_prev(node_prev(x)); xi = getid(x)
- end
- -- local xi = getid(x)
- -- while (get_attr_icflag(x) == PACKED)
- -- and ((xi == id_penalty) or (xi == id_kern) or (xi == id_kern)) do
- -- x = node_prev(x); xi = getid(x)
- -- end
- if xi == id_glyph and getfield(x, 'lang')==lang_ja then
- -- 和文文字
- xc = x
- elseif xi == id_hlist and get_attr_icflag(x) == PACKED then
- -- packed JAchar
- xc = ltjd_glyph_from_packed(x)
- while getid(xc) == id_whatsit do xc = node_next(xc) end -- これはなんのために?
- else
- return false-- それ以外は対象外.
- end
- local xk = ltjf_font_metric_table[getfont(xc)]
- .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0
-
- if xk>0 and total>=xk then
- total = total - xk
- local kn = node_new(id_kern)
- setfield(kn, 'kern', (res.name=='shrink' and -1 or 1) * xk)
- set_attr(kn, attr_icflag, FROM_JFM)
- insert_after(head, x, kn)
- return true
- else return false
- end
-end
-
--- step 2: 行中の glue を変える
-local function aw_step2(p, res, total, added_flag)
- if total == 0 then -- もともと伸縮の必要なし
- if added_flag then -- 行末に kern 追加したので,それによる補正
- local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly')
- setfield(f, 'head', nil)
- setfield(p, 'glue_set', getfield(f, 'glue_set'))
- setfield(p, 'glue_order', getfield(f, 'glue_order'))
- setfield(p, 'glue_sign', getfield(f, 'glue_sign'))
- node_free(f)
- return
- end
- elseif total <= res[0] then -- 和文処理グルー以外で足りる
- for _,v in pairs(priority_table) do clear_stretch(p, v, res.name) end
- local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly')
- setfield(f, 'head', nil)
- setfield(p, 'glue_set', getfield(f, 'glue_set'))
- setfield(p, 'glue_order', getfield(f, 'glue_order'))
- setfield(p, 'glue_sign', getfield(f, 'glue_sign'))
- node_free(f)
- else
- total = total - res[0]
- for i = 1, #priority_table do
- local v = priority_table[i]
- if total <= res[v] then
- for j = i+1,#priority_table do
- clear_stretch(p, priority_table[j], res.name)
- end
- set_stretch(p, total, res[v], v, res.name); break
- end
- total = total - res[v]
- end
- local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly')
- setfield(f, 'head', nil)
- setfield(p, 'glue_set', getfield(f, 'glue_set'))
- setfield(p, 'glue_order', getfield(f, 'glue_order'))
- setfield(p, 'glue_sign', getfield(f, 'glue_sign'))
- node_free(f)
- end
-end
-
-
-local ltjs_fast_get_stack_skip = ltjs.fast_get_stack_skip
-local function adjust_width(head)
- if not head then return head end
- local line = 1
- for p in node_traverse_id(id_hlist, to_direct(head)) do
- line = line + 1
- local res, total = get_total_stretched(p, line)
- -- this is the same table as the table which is def'd in l. 92
- if res and res.glue_set<1 then
- total = round(total * res.glue_set)
- aw_step2(p, res, total, aw_step1(p, res, total))
- end
- end
- for i,_ in pairs(gs_used_line) do
- gs_used_line[i] = nil
- end
- return to_node(head)
-end
-
-do
- luatexja.adjust = luatexja.adjust or {}
- local is_reg = false
- function luatexja.adjust.enable_cb()
- if not is_reg then
- luatexbase.add_to_callback('post_linebreak_filter',
- adjust_width, 'Adjust width', 100)
- is_reg = true
- end
- end
- function luatexja.adjust.disable_cb()
- if is_reg then
- luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width')
- is_reg = false
- end
- end
-end
-
-luatexja.unary_pars.adjust = function(t)
- return is_reg and 1 or 0
-end
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
index aa97c7028b2..107d27a897a 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
@@ -1059,45 +1059,7 @@ do
end
end
--- append_to_vlist filter
-do
- local id_glue = node.id('glue')
- local getglue = node.direct.getglue or
- function(g)
- return getfield(g,'width'), getfield(g,'stretch'), getfield(g,'shrink'),
- getfield(g,'stretch_order'), getfield(g,'shrink_order')
- end
-local setglue = luatexja.setglue
- local function copy_glue (new_glue, old_glue, subtype, new_w)
- setfield(new_glue, 'subtype', subtype)
- local w,st,sp,sto,spo = getglue(to_direct(old_glue))
- setglue(new_glue, new_w or w, st, sp, sto, spo)
- end
- local node_write = node.direct.write
- local function dir_adjust_append_vlist(b, loc, prev, mirrored)
- local old_b = to_direct(b)
- 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 d = tex.baselineskip.width - prev
- - getfield(new_b, mirrored and 'depth' or 'height')
- local g = node_new(id_glue)
- if d < tex.lineskiplimit then
- copy_glue(g, tex.lineskip, 1)
- else
- copy_glue(g, tex.baselineskip, 2, d);
- end
- node_write(g)
- end
- node_write(new_b)
- tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth')
- return nil -- do nothing on tex side
- end
- ltjb.add_to_callback('append_to_vlist_filter',
- dir_adjust_append_vlist,
- 'ltj.direction', 10000)
-end
+-- append_to_vlist filter: done in ltj-lineskip.lua
-- finalize (executed just before \shipout)
-- we supply correct pdfsavematrix nodes etc. inside dir_node
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
index 895cf9ca496..9c051701557 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 = '2018/02/18',
+ date = '2018/08/11',
description = 'Insertion process of JFM glues, [x]kanjiskip and others',
})
luatexja.jfmglue = luatexja.jfmglue or {}
@@ -280,17 +280,19 @@ local function check_next_ickern(lp)
end
local function calc_np_pbox(lp, last)
- local first, lpa, nc = (not Np.first), KINSOKU, nil
+ local first, nc = (not Np.first), nil
+ --local lpa = get_attr_icflag(lp)==PACKED and PACKED or KINSOKU -- KINSOKU: dummy
+ local lpa = get_attr_icflag(lp)
Np.first = Np.first or lp; Np.id = id_pbox
set_attr(lp, attr_icflag, get_attr_icflag(lp));
while lp ~=last and (lpa>=PACKED) and (lpa<BOXBDD) do
local lpi = getid(lp)
- if lpi==id_hlist or lpi==id_vlist then
+ if lpa==PACKED then
+ if lpi==id_rule then lp = node_next(lp) end
+ nc, lp = lp, node_next(lp)
+ elseif lpi==id_hlist or lpi==id_vlist then
head, lp, nc = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm pbox')
Np.first = first and nc or Np.first
- elseif (lpi==id_rule) and (lpa==PACKED) then
- lp = node_next(lp)
- nc, lp = lp, node_next(lp)
else
nc, lp = lp, node_next(lp)
end
@@ -722,7 +724,7 @@ local function new_jfm_glue(mc, bc, ac)
return node_copy(g[1]), g.ratio, false, false, false
else
local f = node_new(id_glue)
- set_attr(f, attr_icflag, g.priority)
+ 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
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
index a4aa4cd26c1..ad29ad432a2 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
@@ -55,7 +55,9 @@ local function norm_val(a)
end
end
-function luatexja.jfont.define_jfm(t)
+local fastcopy=table.fastcopy
+function luatexja.jfont.define_jfm(to)
+ local t = fastcopy(to)
local real_char -- Does current character class have the 'real' character?
if t.dir~=jfm_dir then
defjfm_res= nil; return
@@ -1188,3 +1190,4 @@ luatexja.jfont.metrics = metrics
luatexja.jfont.font_metric_table = font_metric_table
luatexja.jfont.find_char_class = find_char_class
+luatexja.jfont.update_jfm_cache = update_jfm_cache
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
index 26258bad3cf..6b8fa81b904 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
@@ -12,38 +12,13 @@
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2018/06/15 LaTeX support of LuaTeX-ja]
-
-% LaTeX2e 2017/05/01 で行われる対策
-% 本 sty からは 2018/05/01 削除予定
-\ifx\document@default@language \@undefined
- \let\document@default@language\m@ne
-\fi
-\ifx\l@nohyphenation \@undefined
- \newlanguage\l@nohyphenation
-\fi
+\ProvidesPackage{ltj-latex}[2018/08/24 LaTeX support of LuaTeX-ja]
% cleanup at end of the document
%\let\ltj@@orig@end=\@@end
%\protected\def\@@end{%
% \directlua{luatexja.ext_cleanup()}\ltj@@orig@end}
-% Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro)
-\long\def\ltj@g@addto@macro#1#2{%
- \begingroup
- \def\ltj@tmpa{#2}
- \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1}
- \xdef#1{\the\toks@}
- \endgroup}
-
-\def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook}
-
-\def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}}
-
-% similar to \ltj@pkgpatch, but this is used .sty which
-% can be reloaded inside the document by \input.
-\def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}}
-
\endlinechar=13
%%% patch for LaTeX
@@ -51,6 +26,33 @@
\usepackage{lltjdefs}
\usepackage{lltjcore}
+%%% patching commands
+\RequirePackage{filehook}
+
+\def\ltj@pkgpatch@im#1{%
+ \@ifnextchar[{\ltj@pkgpatch@im@{#1}}{\ltj@pkgpatch@im@{#1}[lltjp-#1]}}%]
+\def\ltj@pkgpatch@im@#1[#2]{%
+ \AtEndOfPackageFile*{#1}{%
+ \@ifpackageloaded{#2}{}{%
+ \@namedef{ver@#2.\@pkgextension}{0000/00/00}%dummy
+ \if\catcode`@=11\let\ltj@temp\relax\else
+ \edef\ltj@temp{\noexpand\catcode`@=\the\catcode`@\relax}\makeatletter
+ \fi
+ \@@input{#2.\@pkgextension}\ltj@temp
+ }%
+ }%
+}
+
+\def\ltj@pkgpatch#1{%
+ \@ifnextchar[{\ltj@pkgpatch@@{#1}}{\ltj@pkgpatch@@{#1}[lltjp-#1]}}%]
+\def\ltj@pkgpatch@@#1[#2]{%
+ \gpreto\@begindocumenthook{%
+ \@ifpackageloaded{#1}{%
+ \@ifpackageloaded{#2}{}{\RequirePackage{#2}}%
+ }{}%
+ }%
+}
+
%%% default parameters
\directlua{
local s = kpse.find_file('ltj-kinsoku.lua', 'tex')
@@ -67,34 +69,20 @@
\expandafter\let\csname JY3/mc/m/n/10\endcsname\relax
%%% patch for packages
-\ltj@pkgpatch{listings}
-\ltj@pkgpatch{unicode-math}
-\ltj@pkgpatch{xunicode}
-\ltj@pkgpatch{fontspec}
-\ltj@pkgpatch{footmisc}
+\ltj@pkgpatch@im{listings}
+\ltj@pkgpatch{xunicode} %% at \begin{document}
+\ltj@pkgpatch@im{fontspec}
+\ltj@pkgpatch{footmisc} %% at \begin{document}
\ltj@pkgpatch{tascmac}
-\ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{%
- \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}%
- \makeatletter\input{lltjp-tascmac.sty}%
- \ltj@asc@temp\let\ltj@asc@temp=\relax
-}{}}% ascmac
-\ltj@pkgpatch{stfloats}
-\ltj@pkgpatch{preview}
-\ltj@pkgpatch{array}
+\ltj@pkgpatch{ascmac}[lltjp-tascmac]
+\ltj@pkgpatch@im{stfloats}
+\ltj@pkgpatch{preview} %% at \begin{document}
+ % (preview package has delayed option)
+\ltj@pkgpatch{array} %% at \begin{document}
+\ltj@pkgpatch@im{unicode-math}
+\ltj@pkgpatch@im{siunitx}
\RequirePackage{lltjp-geometry}
-\RequirePackage{filehook}
-\AtEndOfPackageFile*{fontspec}{%
- \input{lltjp-fontspec-immediate.sty}
- % \RequirePackage だと fontspec にオプション指定したときにエラー出る
-}
-
-\@ifpackageloaded{siunitx}{%
- \chardef\ltj@patch@siunitx@execute\z@\input{lltjp-siunitx.sty}%
-}{%
- \AtBeginOfPackageFile*{siunitx}{\input{lltjp-siunitx.sty}}%
-}
-\AtEndOfPackageFile*{siunitx}{\csname __ltj_siunitx_patch:\endcsname}
%%------------------ all done
\ltj@latex@AtEnd
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua
new file mode 100644
index 00000000000..f5c439e559d
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua
@@ -0,0 +1,116 @@
+--
+-- ltj-lineskip.lua
+--
+luatexja.load_module('base'); local ltjb = luatexja.base
+luatexja.load_module('direction'); local ltjd = luatexja.direction
+luatexja.lineskip = luatexja.lineskip or {}
+
+local to_direct = node.direct.todirect
+local ltjl = luatexja.lineskip
+local id_glue = node.id('glue')
+local id_penalty = node.id('penalty')
+local id_hlist = node.id('hlist')
+local setfield = node.direct.setfield
+local getfield = node.direct.getfield
+local getlist = node.direct.getlist
+local node_new = node.direct.new
+local node_prev = node.direct.getprev
+local node_next = node.direct.getnext
+local getid = node.direct.getid
+local getsubtype = node.direct.getsubtype
+
+local node_getglue = node.getglue
+local setglue = node.direct.setglue
+local function copy_glue (new_glue, old_glue, subtype, new_w)
+ setfield(new_glue, 'subtype', subtype)
+ local w,st,sp,sto,spo = node_getglue(old_glue)
+ setglue(new_glue, new_w or w, st, sp, sto, spo)
+end
+ltjl.copy_glue = copy_glue
+
+function ltjl.p_dummy(before, after)
+ return nil, 0
+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)
+ else
+ copy_glue(g, tex.baselineskip, 2, normal)
+ end
+end
+
+local ltj_profiler, ltj_skip = ltjl.p_dummy, ltjl.l_dummy
+function ltjl.setting(profiler, skip_method)
+ ltj_profiler = ltjl['p_'..tostring(profiler)] or ltjl.p_dummy
+ ltj_skip = ltjl['l_'..tostring(skip_method)] or ltjl.l_dummy
+end
+
+do
+ local traverse_id = node.direct.traverse_id
+ local function adjust_glue(nh)
+ local h = to_direct(nh)
+ local bw = tex.baselineskip.width
+ for x in traverse_id(id_glue, h) do
+ local xs = getsubtype(x)
+ if (xs==1) or (xs==2) then
+ local p, n = node_prev(x), node_next(x)
+ if p then
+ local pid = getid(p)
+ while (id_glue<=pid) and (pid<=id_penalty) and node_prev(p) do
+ p = node_prev(p); pid = getid(p)
+ end
+ if pid==id_hlist and getid(n)==id_hlist then
+ local normal = bw - getfield(p, 'depth') - getfield(n, 'height')
+ local lmin, adj = ltj_profiler(p, n, false, bw)
+ ltj_skip(lmin or normal, x, adj, normal, bw)
+ end
+ end
+ end
+ end
+ return true
+ end
+ ltjb.add_to_callback('post_linebreak_filter',
+ adjust_glue, 'ltj.lineskip', 10000)
+end
+
+do
+ local p_dummy = ltjl.p_dummy
+ local make_dir_whatsit = luatexja.direction.make_dir_whatsit
+ local get_dir_count = luatexja.direction.get_dir_count
+ local node_write = node.direct.write
+
+ local function dir_adjust_append_vlist(b, loc, prev, mirrored)
+ local old_b = to_direct(b)
+ 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 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)
+ if p_dummy~=ltj_profiler then
+ while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do
+ tail = node_prev(tail)
+ end
+ end
+ if tail then
+ if getid(tail)==id_hlist and getid(new_b)==id_hlist then
+ if getfield(tail, 'depth')==prev then
+ lmin, adj = ltj_profiler(tail, new_b, mirrored, bw)
+ end
+ end
+ end
+ local g = node_new(id_glue)
+ ltj_skip(lmin or normal, g, adj, normal, bw, loc)
+ node_write(g)
+ end
+ node_write(new_b)
+ tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth')
+ return nil -- do nothing on tex side
+ end
+ ltjb.add_to_callback('append_to_vlist_filter',
+ dir_adjust_append_vlist,
+ 'ltj.lineskip', 10000)
+end
+
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
index 22c7b85e2e3..b1688235ab8 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
@@ -252,6 +252,7 @@ local function texiface_low(rst, rtlr, rtlp)
setfield(w, 'value', to_node(wv))
setfield(wv, 'type', 100)
setfield(wv, 'value', floor(#rtlr))
+ setfield(wv, 'user_id', RUBY_PRE) -- dummy
set_attr(wv, attr_ruby, rst.rubyzw)
set_attr(wv, attr_ruby_maxmargin, rst.maxmargin)
set_attr(wv, attr_ruby_maxprep, rst.pre)
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
index 51adc9bed85..e57739d0c21 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
@@ -101,10 +101,10 @@
\expandafter\endinput\fi\relax
%% Check LuaTeX version.
-\ifnum\luatexversion<85
+\ifnum\luatexversion<100
\@PackageError{luatexja-core}
{This LuaTeX engine is too old for this package;\MessageBreak
- at least beta-0.85.0 is needed}
+ at least 1.0.0 is needed}
{Package loading is aborted now.\MessageBreak}
\expandafter\endinput\fi\relax
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
index 2fc116003f3..59204dfdef0 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
@@ -102,13 +102,14 @@ if luatexja_debug then load_module('debug') end
load_module('charrange'); local ltjc = luatexja.charrange
load_module('stack'); local ltjs = luatexja.stack
load_module('direction'); local ltjd = luatexja.direction -- +1 hlist +1 attr_list
+load_module('lineskip'); local ltjl = luatexja.lineskip -- +1 hlist +1 attr_list
load_module('jfont'); local ltjf = luatexja.jfont
load_module('inputbuf'); local ltji = luatexja.inputbuf
load_module('pretreat'); local ltjp = luatexja.pretreat
load_module('setwidth'); local ltjw = luatexja.setwidth
load_module('jfmglue'); local ltjj = luatexja.jfmglue -- +1 glue +1 gs +1 attr_list
load_module('math'); local ltjm = luatexja.math
-load_module('base'); local ltjb = luatexja.base
+load_module('base'); local ltjb = luatexja.base
local attr_jchar_class = luatexbase.attributes['ltj@charclass']
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
index d3c77f3708c..acaa035fd59 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
@@ -34,10 +34,10 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja}[2018/07/28 Japanese Typesetting with Lua(La)TeX]
+ \ProvidesPackage{luatexja}[2018/08/25 Japanese Typesetting with Lua(La)TeX]
\fi %</LaTeX>
%%%% VERSION
-\def\LuaTeXjaversion{20180803.0}
+\def\LuaTeXjaversion{20180825.0}
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty
deleted file mode 100644
index a0ee7b6dba4..00000000000
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty
+++ /dev/null
@@ -1,131 +0,0 @@
-%
-% lltjp-fontspec-immediate.sty
-%
-
-\NeedsTeXFormat{LaTeX2e}
-%%% \ProvidesPackage{lltjp-fontspec-immediate}[2017/08/07 Patch to fontspec for LuaTeX-ja]
-
-\RequirePackage{fontspec,luatexja}
-\ExplSyntaxOn
-
-% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl
-\ifdefined \g__fontspec_nfss_enc_tl \else
- \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl }
-\fi
-
-%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont
-\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later
-\cs_set:Nn \__fontspec_main_setmainfont:nn
- {
- \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2}
- \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl
- \use:x
- {
- \exp_not:n { \DeclareRobustCommand \rmfamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\rmdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \__fontspec_setmainfont_hook:nn {#1} {#2}
- \normalfont
- }
-\cs_set:Nn \__fontspec_main_setsansfont:nn
- {
- \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2}
- \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl
- \use:x
- {
- \exp_not:n { \DeclareRobustCommand \sffamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\sfdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \__fontspec_setsansfont_hook:nn {#1} {#2}
- \normalfont
- }
-\cs_set:Nn \__fontspec_main_setmonofont:nn
- {
- \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2}
- \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl
- \use:x
- {
- \exp_not:n { \DeclareRobustCommand \ttfamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\ttdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \__fontspec_setmonofont_hook:nn {#1} {#2}
- \normalfont
- }
-}{ %% <= 2.6g
-\DeclareDocumentCommand \setmainfont { O{} m O{} }
- {
- \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2}
- \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family
- \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \g__fontspec_rmfamily_family }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\rmdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \normalfont
- \ignorespaces
- }
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
- {
- \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2}
- \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family
- \use:x { \exp_not:n { \DeclareRobustCommand \sffamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \g__fontspec_sffamily_family }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\sfdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \normalfont
- \ignorespaces
- }
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
- {
- \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2}
- \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family
- \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily }
- {
- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
- \exp_not:N \fontfamily { \g__fontspec_ttfamily_family }
- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%%
- \exp_not:N \selectfont
- }
- }
- \str_if_eq_x:nnT {\familydefault} {\ttdefault}
- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
- \normalfont
- \ignorespaces
- }
-}
-\ExplSyntaxOff
-\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
-\endinput
-
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty
index 4db2ffe8a4c..32e4ef0b8ab 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty
@@ -1,28 +1,137 @@
%
-% lltjp-fontspec.sty
+% lltjp-fontspec.sty 2018-08-24
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-fontspec}[2017/08/07 Patch to fontspec for LuaTeX-ja]
\RequirePackage{fontspec,luatexja}
\ExplSyntaxOn
-\@ifpackagelater{fontspec}{2017/01/01}{
- \cs_set:Nn \fontspec_visible_space:
+% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl
+\ifdefined \g__fontspec_nfss_enc_tl \else
+ \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl }
+\fi
+
+%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont
+\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later
+\cs_set:Nn \__fontspec_main_setmainfont:nn
+ {
+ \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2}
+ \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl
+ \use:x
+ {
+ \exp_not:n { \DeclareRobustCommand \rmfamily }
+ {
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
+ }
+ }
+ \str_if_eq_x:nnT {\familydefault} {\rmdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \__fontspec_setmainfont_hook:nn {#1} {#2}
+ \normalfont
+ }
+\cs_set:Nn \__fontspec_main_setsansfont:nn
+ {
+ \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2}
+ \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl
+ \use:x
+ {
+ \exp_not:n { \DeclareRobustCommand \sffamily }
+ {
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
+ }
+ }
+ \str_if_eq_x:nnT {\familydefault} {\sfdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \__fontspec_setsansfont_hook:nn {#1} {#2}
+ \normalfont
+ }
+\cs_set:Nn \__fontspec_main_setmonofont:nn
+ {
+ \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2}
+ \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl
+ \use:x
+ {
+ \exp_not:n { \DeclareRobustCommand \ttfamily }
+ {
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
+ }
+ }
+ \str_if_eq_x:nnT {\familydefault} {\ttdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \__fontspec_setmonofont_hook:nn {#1} {#2}
+ \normalfont
+ }
+}{ %% <= 2.6g
+\DeclareDocumentCommand \setmainfont { O{} m O{} }
+ {
+ \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2}
+ \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family
+ \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily }
+ {
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \g__fontspec_rmfamily_family }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
+ }
+ }
+ \str_if_eq_x:nnT {\familydefault} {\rmdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \normalfont
+ \ignorespaces
+ }
+\DeclareDocumentCommand \setsansfont { O{} m O{} }
+ {
+ \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2}
+ \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family
+ \use:x { \exp_not:n { \DeclareRobustCommand \sffamily }
{
- \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423}
- { \ltjalchar"2423\scan_stop: }
- { \fontspec_visible_space_fallback: }
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \g__fontspec_sffamily_family }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
}
-}{
- \cs_set:Nn \fontspec_visible_space:
+ }
+ \str_if_eq_x:nnT {\familydefault} {\sfdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \normalfont
+ \ignorespaces
+ }
+\DeclareDocumentCommand \setmonofont { O{} m O{} }
+ {
+ \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2}
+ \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family
+ \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily }
{
- \font_glyph_if_exist:NnTF \font {"2423}
- { \ltjalchar"2423\scan_stop: }
- { \fontspec_visible_space_fallback: }
+ \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
+ \exp_not:N \fontfamily { \g__fontspec_ttfamily_family }
+ \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%%
+ \exp_not:N \selectfont
}
+ }
+ \str_if_eq_x:nnT {\familydefault} {\ttdefault}
+ { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
+ \normalfont
+ \ignorespaces
+ }
}
+
+\cs_set:Nn \fontspec_visible_space:
+ {
+ \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423}
+ { \ltjalchar"2423\scan_stop: }
+ { \fontspec_visible_space_fallback: }
+ }
+
\def\verb
{
\relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore
@@ -32,11 +141,11 @@
\@ifstar\__fontspecsverb\@verb
}
-
-%%%%%%%% shapes in \em
\cs_set:Npn \emshape { \gtfamily \itshape }
\cs_set:Npn \eminnershape { \mcfamily \upshape }
\ExplSyntaxOff
\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
+
\endinput
+
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
index e0470a2cbee..abcf05b9e79 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
@@ -1,9 +1,8 @@
%
-% lltjp-listings.sty
+% lltjp-listings.sty 2018-08-25
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2017/05/05 Patch to listings for LuaTeX-ja]
\RequirePackage{listings,luatexbase-cctb}
%%%%%%%%%%%%%%%% Japanese support
@@ -387,6 +386,13 @@
\fi}}
\endgroup
+%%%%%%%%%%%%%%%% texcl
+\lst@AddToHook{AfterBeginComment}
+ {\ifnum\lst@mode=\lst@TeXLmode
+ \catcode`\^^M=13\relax
+ \catcode\ltjlineendcomment=9\relax
+ \fi}
+
%%%%%%%%%%%%%%%%
\lstloadaspects{writefile}
\begingroup \catcode`\^^I=11
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty
index 738760c1bba..d629fd3cb1e 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty
@@ -1,5 +1,5 @@
%
-% lltjp-siunitx.sty
+% lltjp-siunitx.sty 2018-08-24
%
\NeedsTeXFormat{LaTeX2e}
@@ -18,17 +18,13 @@
\__ltj_siunix_patch_inner:n { l__siunitx_#1_math }
\__ltj_siunix_patch_inner:n { l__siunitx_#1_text }
}
-\cs_new:Nn \__ltj_siunitx_patch: {
- \AtBeginDocument {
- \__ltj_siunix_patch_inner:n { c__siunitx_minus }
- \__ltj_siunix_patch_inner:n { c__siunitx_mu }
- \__ltj_siunix_patch_inner_math:n { angstrom }
- \__ltj_siunix_patch_inner_math:n { arcminute }
- \__ltj_siunix_patch_inner_math:n { arcsecond }
- \__ltj_siunix_patch_inner_math:n { ohm }
- }
+\AtBeginDocument {
+ \__ltj_siunix_patch_inner:n { c__siunitx_minus }
+ \__ltj_siunix_patch_inner:n { c__siunitx_mu }
+ \__ltj_siunix_patch_inner_math:n { angstrom }
+ \__ltj_siunix_patch_inner_math:n { arcminute }
+ \__ltj_siunix_patch_inner_math:n { arcsecond }
+ \__ltj_siunix_patch_inner_math:n { ohm }
}
-\ifdefined\ltj@patch@siunitx@executed\__ltj_siunitx_patch:\fi
-
\ExplSyntaxOff
\endinput
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty
index 34228479510..6f7590c2a4d 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty
@@ -1,9 +1,8 @@
%
-% lltjp-stfloats.sty
+% lltjp-stfloats.sty 2017-05-05
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-stfloats}[2017/05/05 Patch to stfloats for LuaTeX-ja]
\RequirePackage{stfloats,luatexja}
\RequirePackage{etoolbox}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty
index acca226a7f0..9c8bbfca9f9 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty
@@ -1,49 +1,41 @@
%
-% lltjp-unicode-math.sty
+% lltjp-unicode-math.sty 2018-08-24
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-unicode-math}[2018/01/14 Patch to unicode-math for LuaTeX-ja]
\RequirePackage{unicode-math,luatexja,etoolbox}
\ExplSyntaxOn
-\group_begin:
- \bool_new:N \__lltjp_um_patch_mathgroup_bool
- \bool_set_true:N \__lltjp_um_patch_mathgroup_bool
- \cs_gset:Nn \__um_define_math_chars: {
- \group_begin:
- \cs_set:Npn \__um_sym:nnn ##1##2##3
- {
- \tl_if_in:nnT
- { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence }
- {##3}
- {
- \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} }
- \ltjsetmathletter{ ##1 }
- }
- }
- \__um_input_math_symbol_table:
- \group_end:
- }
-
-\bool_if:NT \__lltjp_um_patch_mathgroup_bool {
- \cs_gset:Npn \use@mathgroup #1 #2
- {
- %\typeout{UM <#1><#2>}
- \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not!
+\cs_set:Nn \__um_define_math_chars: {
+ \group_begin:
+ \cs_set:Npn \__um_sym:nnn ##1##2##3
{
- \math@bgroup
- \cs_if_eq:cNF {M@\f@encoding} #1 {#1}
- \__um_switchto_literal:
- \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
- \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi
- \math@egroup
+ \ltjsetmathletter{ ##1 }
+ \tl_if_in:nnT
+ { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence }
+ {##3}
+ {
+ \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} }
+ }
}
+ \__um_input_math_symbol_table:
+ \group_end:
+}
+\cs_set:Npn \use@mathgroup #1 #2
+{
+ %\typeout{UM <#1><#2>}
+ \mode_if_math:T % <- not sure
+ {
+ \math@bgroup
+ \cs_if_eq:cNF {M@\f@encoding} #1 {#1}
+ \__um_switchto_literal:
+ \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
+ \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi
+ \math@egroup
}
}
-\group_end:
\ifcsname jsc@mag@xrealtrue \endcsname \else
\expandafter\expandafter\expandafter \ExplSyntaxOff \expandafter \endinput