From 21a58c30431c4e45b1b0bc9f94f4e696bab9a217 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 25 Aug 2018 20:56:18 +0000 Subject: luatexja (25aug18) git-svn-id: svn://tug.org/texlive/trunk@48483 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/luatex/luatexja/addons/luatexja-adjust.sty | 25 +- .../tex/luatex/luatexja/addons/luatexja-preset.sty | 2 + .../texmf-dist/tex/luatex/luatexja/ltj-adjust.lua | 95 ++++++- .../tex/luatex/luatexja/ltj-adjust_85.lua | 291 --------------------- .../tex/luatex/luatexja/ltj-direction.lua | 40 +-- .../texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua | 16 +- .../texmf-dist/tex/luatex/luatexja/ltj-jfont.lua | 5 +- .../texmf-dist/tex/luatex/luatexja/ltj-latex.sty | 90 +++---- .../tex/luatex/luatexja/ltj-lineskip.lua | 116 ++++++++ Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua | 1 + .../tex/luatex/luatexja/luatexja-core.sty | 4 +- Master/texmf-dist/tex/luatex/luatexja/luatexja.lua | 3 +- Master/texmf-dist/tex/luatex/luatexja/luatexja.sty | 4 +- .../luatexja/patches/lltjp-fontspec-immediate.sty | 131 ---------- .../tex/luatex/luatexja/patches/lltjp-fontspec.sty | 137 +++++++++- .../tex/luatex/luatexja/patches/lltjp-listings.sty | 10 +- .../tex/luatex/luatexja/patches/lltjp-siunitx.sty | 20 +- .../tex/luatex/luatexja/patches/lltjp-stfloats.sty | 3 +- .../luatex/luatexja/patches/lltjp-unicode-math.sty | 58 ++-- 19 files changed, 449 insertions(+), 602 deletions(-) delete mode 100644 Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua create mode 100644 Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua delete mode 100644 Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty (limited to 'Master/texmf-dist/tex/luatex') 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 % % 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]dmax then dmax=d end + if h>hmax then hmax=h end + if (bw-h-d) 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 -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 % %%%% 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 -- cgit v1.2.3