diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-19 20:58:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-19 20:58:37 +0000 |
commit | d29e710bd3e04a6a582ee01db8244868a2159e0d (patch) | |
tree | c0b4a1fb3a85b9c875639794624f5ecf19bc8c2f /Master/texmf-dist/tex/luatex/luatexja | |
parent | d35bc7427c810ecdce6b3d17b964a0c11a6de3ed (diff) |
luatexja (18sep20)
git-svn-id: svn://tug.org/texlive/trunk@56381 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja')
10 files changed, 114 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty index 60c4c75a312..19d9952fef6 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec}[2020-04-01 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec}[2020-09-14 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e,luatexja} \ExplSyntaxOn @@ -23,7 +23,7 @@ pass .code:n = \PassOptionsToPackage{#1} {fontspec}, % 互換性のために残したオプション scale .code:n = \gdef\Cjascale{#1}, - unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } {fontspec}, + unknown .code:n = \PassOptionsToPackage { \l_keys_key_str } {fontspec}, } \ProcessKeysOptions{ luatexja-fontspec } 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 279ebb09b70..b0ce39bf5d8 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty @@ -1,5 +1,5 @@ % luatexja-preset.sty -\ProvidesPackage{luatexja-preset}[2020-06-14 Japanese font presets] +\ProvidesPackage{luatexja-preset}[2020-09-14 Japanese font presets] \RequirePackage{expl3,l3keys2e} \RequirePackage{luatexja} @@ -34,12 +34,9 @@ \keys_define:nn { luatexja-preset }{ unknown .code:n = - \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl - \tl_if_empty:NT \l_tmpa_tl { - \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec } - }, + \PassOptionsToPackage { \l_keys_key_str } { luatexja-fontspec }, scale .code:n = \gdef\Cjascale{#1}, - match .code: n = + match .code:n = \renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue \PassOptionsToPackage { match } { luatexja-fontspec }, match .value_forbidden:n = true, diff --git a/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty b/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty index d19db9ab61a..fa3d0720b04 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty @@ -692,7 +692,7 @@ \everypar{}}% }% }% - \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<z>}} + \def\@tabarray{\@ifnextchar<\p@tabarray{\p@tabarray<Z>}} \def\p@array<##1>[##2]##3{% \let\box@dir\relax \if ##1z\relax diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index d1751af4651..d95b34a5115 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2020-07-30', + date = '2020-09-16', description = 'Loader for Japanese fonts', }) @@ -42,7 +42,7 @@ local font_metric_table = ltju.font_metric_table -- [font number] -> jfm_name, j luatexbase.create_callback("luatexja.load_jfm", "data", function (ft, jn) return ft end) -local jfm_file_name, jfm_var, jfm_ksp +local jfm_spec, jfm_name, jfm_var, jfm_ksp local defjfm_res local jfm_dir, is_def_jfont, vert_activated, auto_enable_vrt2 @@ -177,7 +177,7 @@ function luatexja.jfont.define_jfm(to) t.chars.nox_alchar = t.chars.jcharbdd t.chars.glue = t.chars.jcharbdd end - t = luatexbase.call_callback("luatexja.load_jfm", t, jfm_file_name) + t = luatexbase.call_callback("luatexja.load_jfm", t, jfm_spec, luatexja.jfont.jfm_feature) t.size_cache = {} defjfm_res = t end @@ -279,25 +279,21 @@ end -- LOADING JAPANESE FONTS ------------------------------------------------------------------------ -local load_jfont_metric +local load_jfont_metric, check_callback_order do local cstemp local global_flag -- true if \globaljfont, false if \jfont load_jfont_metric = function() - if jfm_file_name=='' then - ltjb.package_error('luatexja', - 'no JFM specified', + if jfm_name=='' then + ltjb.package_error('luatexja', 'no JFM specified', 'To load and define a Japanese font, a JFM must be specified.'.. "The JFM 'ujis' will be used for now.") - jfm_file_name = 'ujis' + jfm_name, jfm_spec = 'ujis', 'ujis' end - for j,v in ipairs(metrics) do - if v.name==jfm_file_name then return j end - end - luatexja.load_lua('jfm-' .. jfm_file_name .. '.lua') + for j,v in ipairs(metrics) do if v.name==jfm_spec then return j end end + luatexja.load_lua('jfm-' .. jfm_name .. '.lua') if defjfm_res then - defjfm_res.name = jfm_file_name - table.insert(metrics, defjfm_res) + defjfm_res.name = jfm_spec; table.insert(metrics, defjfm_res) return #metrics else return nil @@ -323,8 +319,7 @@ do local fn = font.id(cstemp) local f = font_getfont(fn) if not j then - ltjb.package_error('luatexja', - "bad JFM `" .. jfm_file_name .. "'", + ltjb.package_error('luatexja', "bad JFM `" .. jfm_name .. "'", 'The JFM file you specified is not valid JFM file.\n'.. 'So defining Japanese font is cancelled.') tex.sprint(cat_lp, global_flag, '\\expandafter\\let\\csname ', @@ -333,7 +328,7 @@ do return end if not f then return end - update_jfm_cache(j, f.size) + update_jfm_cache(j, f.size); check_callback_order() local sz = metrics[j].size_cache[f.size] local fmtable = { jfm = j, size = f.size, var = jfm_var, with_kanjiskip = jfm_ksp, @@ -352,11 +347,30 @@ do tex.sprint(cat_lp, global_flag, '\\protected\\expandafter\\def\\csname ', (cstemp==' ') and '\\space' or cstemp, '\\endcsname{\\ltj@cur'.. (jfm_dir == 'yoko' and 'j' or 't') .. 'fnt', fn, '\\relax}') - jfm_file_name = nil + jfm_spec = nil end end do + local ltb = luatexbase + local to_be_checked = { 'pre_linebreak_filter', 'hpack_filter' } + check_callback_order = function() + for i,n in pairs(to_be_checked) do + local lotf_cb = ltb.priority_in_callback(n, 'luaotfload.letterspace') + local ltj_cb = ltb.priority_in_callback(n, 'ltj.main') + if lotf_cb then + to_be_checked[i]=nil + if ltj_cb<lotf_cb then + local f = ltb.remove_from_callback(n,'luaotfload.letterspace') + ltb.add_to_callback(n, f, 'luaotfload.letterspace', + ltb.priority_in_callback(n, 'luaotfload.node_processor') + 1) + end + end + end + end +end + +do local get_dir_count = ltjd.get_dir_count local dir_tate = luatexja.dir_table.dir_tate local tex_get_attr = tex.getattribute @@ -374,54 +388,78 @@ do end do - local gmatch = string.gmatch - -- extract jfm_file_name and jfm_var + local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V + local lpegmatch = lpeg.match + local C, Cc, Cf, Ct, Cg = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Ct, lpeg.Cg + local Cs, B = lpeg.Cs, lpeg.B + local spacing = S" \t\v" + local ws = spacing^0 + local slash = P'/' + local semicolon = P';' + local comma = P',' + local equals = P'=' + local jf_field_char = 1 - S'/{};,=' + local jf_field = C(jf_field_char^1) + local jf_assignment = jf_field * equals * jf_field + local jf_switch = P'-' * jf_field * Cc(false) + P'+'^-1 * jf_field * Cc(true) + local jf_feature_expr = Cg(jf_assignment + jf_switch) * comma^0 + local jf_feature_list = P'{' * jf_feature_expr^0 * P'}' + jf_feature_expr^0 + local jf_list = C((1-slash)^1) * (slash * Cf(Ct'' * jf_feature_list, rawset))^-1 + local jf_value = (1 - semicolon)^1 + local function rem(name,value) + if name=='jfm' then + local flag, t; jfm_name, t = lpegmatch(jf_list, value) + if type(t)=='table' then + for i,v in pairs(t) do + flag=true + if v=='true' then t[i]=true elseif v=='false' then t[i]=false end + end + end + luatexja.jfont.jfm_feature = flag and t + elseif name=='jfmvar' then jfm_var = value end + return '' + end + local jf_remainder = Cs( ( ( B(S':;') * + C(P'jfm' * P'var'^-1) * ws * equals * ws * C(jf_value) * semicolon^-1 ) / rem +1 )^0 ) + + local parser=luaotfload.parsers.font_request + function is_feature_specified(s,fname) + local t = lpegmatch(parser,s); return t and t.features and t.features[fname] + end + -- extract jfm_name, jfm_spec and jfm_var -- normalize position of 'jfm=' and 'jfmvar=' keys - local function extract_metric(name) + local function extract_jfm_spec(name) name = (name:match '^{(.*)}$') or (name:match '^"(.*)"$') or name - jfm_file_name = ''; jfm_var = ''; jfm_ksp = true + jfm_spec, jfm_var = '', '' local tmp, index = name:sub(1, 5), 1 if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then index = 6 end - local p = name:find(":", index); index = p and (p+1) or index - while index do - local l = name:len()+1 - local q = name:find(";", index) or l - if name:sub(index, index+3)=='jfm=' and q>index+4 then - jfm_file_name = name:sub(index+4, q-1) - if l~=q then - name = name:sub(1,index-1) .. name:sub(q+1) - else - name = name:sub(1,index-1); index = nil - end - elseif name:sub(index, index+6)=='jfmvar=' and q>index+6 then - jfm_var = name:sub(index+7, q-1) - if l~=q then - name = name:sub(1,index-1) .. name:sub(q+1) - else - name = name:sub(1,index-1); index = nil + name = lpegmatch(jf_remainder, name) + if jfm_name~='' then + if luatexja.jfont.jfm_feature then + local l, t2 = name:sub(-1), {} + for i,v in pairs(luatexja.jfont.jfm_feature) do + -- print(i,type(v),v) + t2[#t2+1] = (v==true) and i + or ((v==false) and ('-'..i) or (i..'='..tostring(v))) end + table.sort(t2); jfm_spec = jfm_name .. '/{' .. table.concat(t2, ',') .. '}' else - index = (l~=q) and (q+1) or nil + jfm_spec = jfm_name end - end - if jfm_file_name~='' then - local l = name:sub(-1) - name = name - .. ((l==':' or l==';') and '' or ';') - .. 'jfm=' .. jfm_file_name + l = name:sub(-1) + name = name .. ((l==':' or l==';') and '' or ';') .. 'jfm=' .. jfm_spec if jfm_var~='' then name = name .. ';jfmvar=' .. jfm_var end + -- print('NN>', name) end - for x in gmatch (name, "[:;]([+%%-]?)ltjks") do - jfm_ksp = not (x=='-') - end + jfm_ksp = (is_feature_specified(name,'ltjksp')~=false) if jfm_dir == 'tate' then - vert_activated = (not name:match '[:;]%-vert') and (not name:match '[:;]%-vrt2') + vert_activated = (is_feature_specified(name,'vert')~=false) and (is_feature_specified(name,'vrt2')~=false) auto_enable_vrt2 - = (not name:match '[:;][+%-]?vert') and (not name:match '[:;][+%-]?vrt2') + = (is_feature_specified(name,'vert')==nil) and (is_feature_specified(name,'vrt2')==nil) else vert_activated, auto_enable_vrt2 = nil, nil end @@ -432,7 +470,7 @@ do local otfl_fdr local ltjr_font_callback = ltjr.font_callback function luatexja.font_callback(name, size, id) - local new_name = is_def_jfont and extract_metric(name) or name + local new_name = is_def_jfont and extract_jfm_spec(name) or name is_def_jfont = false local res = ltjr_font_callback(new_name, size, id, otfl_fdr) luatexbase.call_callback('luatexja.define_font', res, new_name, size, id) @@ -447,7 +485,7 @@ do local function load_jfmonly() local spec, size = match(scan_arg(), '(.+)%s+at%s*([%.%w]*)') local dir = scan_arg() - size = sp(size); extract_metric(spec) + size = sp(size); extract_jfm_spec(spec) jfm_dir = dir local i = load_jfont_metric() local j = -update_jfm_cache(i, size) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex b/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex index d5b9c183b75..a0fd69a864f 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex @@ -366,6 +366,7 @@ \ltjsetparameter{jaxspmode={`.,postonly}} \ltjsetparameter{jaxspmode={`;,postonly}} \ltjsetparameter{jaxspmode={`?,postonly}} +\ltjsetparameter{jaxspmode={`!,postonly}} \ltjsetparameter{jaxspmode={`),postonly}} \ltjsetparameter{jaxspmode={`(,preonly}} \ltjsetparameter{jaxspmode={`],postonly}} @@ -464,5 +465,5 @@ \directlua{% local s = table.copy(luatexja.stack.charprop_stack_table[0]) - luatexja.base.save_cache('ltj-kinsoku_default', {s, version=1}) + luatexja.base.save_cache('ltj-kinsoku_default', {s, version=2}) } diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 074d0502768..be2b2858807 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -348,7 +348,7 @@ do end do - local cache_ver = 1 -- must be same as ltj-kinsoku.tex + local cache_ver = 2 -- must be same as ltj-kinsoku.tex local cache_outdate_fn = function (t) return t.version~=cache_ver end local t = ltjs.charprop_stack_table function luatexja.load_kinsoku() diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty index 0f16a8c1901..2bb9f0db4f4 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-08-08 Japanese Typesetting with Lua(La)TeX] + \ProvidesPackage{luatexja}[2020-09-19 Japanese Typesetting with Lua(La)TeX] \DeclareOption{disablejfam}{\ltj@disablejfamtrue} \DeclareOption*{} \ProcessOptions\relax \fi %</LaTeX> %%%% VERSION -\def\LuaTeXjaversion{20200808.0} +\def\LuaTeXjaversion{20200919.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty index a6b71f3b6aa..e858a8a957c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjcore}[2019/09/26 Patch to LaTeX2e Kernel for LuaTeX-ja] +\ProvidesPackage{lltjcore}[2020-09-13 Patch to LaTeX2e Kernel for LuaTeX-ja] \RequirePackage{etoolbox} \def\cleardoublepage{\clearpage\if@twoside @@ -239,11 +239,13 @@ \ifmmode\@@underline{#1}% \else \leavevmode\null$\@@underline{\hbox{#1}}\m@th$\null\relax\fi} -%%% AtBeginDvi +%%% AtBeginDvi: NOT needed to patch in LaTeX 2020-10-01 pre-release 9 or later +\unless\ifltj@ltshipout@avail \DeclareRobustCommand \AtBeginDvi [1]{% \global \setbox \@begindvibox \vbox{\yoko\unvbox \@begindvibox #1}% } +\fi \newif\iffnfixbottom \newif\ifltj@ftn@unvboxed diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty index 85120238744..a4b340136a3 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty @@ -4,7 +4,7 @@ \newif\ifltj@ltshipout@avail \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-atbegshi}[2020-08-08 Patching \string\shipout\space hooks for LuaTeX-ja] +\ProvidesPackage{lltjp-atbegshi}[2020-09-13 Patching \string\shipout\space hooks for LuaTeX-ja] \@ifl@t@r\fmtversion{2020-10-01}{% \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltshipout@availtrue\fi \else\ltj@ltshipout@availtrue\fi @@ -19,13 +19,14 @@ \RequirePackage{expl3} \ExplSyntaxOn\makeatletter \box_new:N \l__platex_shipout_dummy_box -\pretocmd {\__shipout_execute_cont:} - {\tex_setbox:D \l__platex_shipout_dummy_box \tex_vbox:D \c_group_begin_token \yoko } {} {} -\apptocmd {\__shipout_execute_cont:} {\c_group_end_token} {} {} +\tl_put_left:Nn {\__shipout_execute_cont:} + {\tex_setbox:D \l__platex_shipout_dummy_box \tex_vbox:D \c_group_begin_token \yoko } +\tl_put_right:Nn {\__shipout_execute_cont:} {\c_group_end_token} \ExplSyntaxOff %</ltshipout>----------------------------------- -\else +\expandafter\endinput +\fi \AtBeginShipoutInit %<*atbegshi>------------------------------------- % patching atbegshi.sty @@ -89,5 +90,4 @@ \endgroup %% internal macros are no longer effective %</atbegshi>------------------------------------- -\fi \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty index eba249fa5e6..161029bd051 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-geometry}[2020-08-05 Patch to geometry for LuaTeX-ja with vertical writing mode] +\ProvidesPackage{lltjp-geometry}[2020-09-18 Patch to geometry for LuaTeX-ja with vertical writing mode] \RequirePackage{expl3} \ifdefined\if@ltj@@geometry@tate\expandafter\endinput\fi \newif\if@ltj@@geometry@tate @@ -82,6 +82,7 @@ \if@ltj@@geometry@forceoff \@ltj@@geometry@tatefalse \else + \@ltj@@geometry@tatetrue \let\PackageWarningNoLine\@gobbletwo% 警告抑止 \fi } |