summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/src
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /macros/luatex/generic/luatexja/src
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'macros/luatex/generic/luatexja/src')
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty4
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty9
-rw-r--r--macros/luatex/generic/luatexja/src/lltjext.sty2
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-jfont.lua144
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-kinsoku.tex3
-rw-r--r--macros/luatex/generic/luatexja/src/luatexja.lua2
-rw-r--r--macros/luatex/generic/luatexja/src/luatexja.sty4
-rw-r--r--macros/luatex/generic/luatexja/src/patches/lltjcore.sty6
-rw-r--r--macros/luatex/generic/luatexja/src/patches/lltjp-atbegshi.sty12
-rw-r--r--macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty3
10 files changed, 114 insertions, 75 deletions
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty
index 60c4c75a31..19d9952fef 100644
--- a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty
index 279ebb09b7..b0ce39bf5d 100644
--- a/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/lltjext.sty b/macros/luatex/generic/luatexja/src/lltjext.sty
index d19db9ab61..fa3d0720b0 100644
--- a/macros/luatex/generic/luatexja/src/lltjext.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua
index d1751af465..d95b34a511 100644
--- a/macros/luatex/generic/luatexja/src/ltj-jfont.lua
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/ltj-kinsoku.tex b/macros/luatex/generic/luatexja/src/ltj-kinsoku.tex
index d5b9c183b7..a0fd69a864 100644
--- a/macros/luatex/generic/luatexja/src/ltj-kinsoku.tex
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/luatexja.lua b/macros/luatex/generic/luatexja/src/luatexja.lua
index 074d050276..be2b285880 100644
--- a/macros/luatex/generic/luatexja/src/luatexja.lua
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty
index 0f16a8c190..2bb9f0db4f 100644
--- a/macros/luatex/generic/luatexja/src/luatexja.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/patches/lltjcore.sty b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty
index a6b71f3b6a..e858a8a957 100644
--- a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/patches/lltjp-atbegshi.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-atbegshi.sty
index 8512023874..a4b340136a 100644
--- a/macros/luatex/generic/luatexja/src/patches/lltjp-atbegshi.sty
+++ b/macros/luatex/generic/luatexja/src/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/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty
index eba249fa5e..161029bd05 100644
--- a/macros/luatex/generic/luatexja/src/patches/lltjp-geometry.sty
+++ b/macros/luatex/generic/luatexja/src/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
}