summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/src
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/luatexja/src')
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty26
-rw-r--r--macros/luatex/generic/luatexja/src/jfm-propw.lua9
-rw-r--r--macros/luatex/generic/luatexja/src/jfm-ujis.lua72
-rw-r--r--macros/luatex/generic/luatexja/src/jfm-ujisv.lua1
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-jfont.lua54
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-latex.sty3
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-setwidth.lua14
-rw-r--r--macros/luatex/generic/luatexja/src/luatexja.sty2
-rw-r--r--macros/luatex/generic/luatexja/src/patches/lltjfont.sty56
-rw-r--r--macros/luatex/generic/luatexja/src/patches/lltjp-collcell.sty37
10 files changed, 209 insertions, 65 deletions
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty
index b64f7887ef..58a585768a 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/03/27 Japanese font presets]
+\ProvidesPackage{luatexja-preset}[2020-05-15 Japanese font presets]
\RequirePackage{expl3,l3keys2e}
\RequirePackage{luatexja}
@@ -278,7 +278,7 @@
gt-b = Source~Han~Sans~Bold,
gt-u = Source~Han~Sans~Medium,
gt-eb = Source~Han~Sans~Heavy,
- mg-m = Source~Han~Sans~Heavy,
+ mg-m = Source~Han~Sans~Medium,
mc-l = Source~Han~Serif~Light,
__custom = false, __office = false, __noembed = false,
}
@@ -289,7 +289,7 @@
gt-b = Source~Han~Sans~JP~Bold,
gt-u = Source~Han~Sans~JP~Medium,
gt-eb = Source~Han~Sans~JP~Heavy,
- mg-m = Source~Han~Sans~JP~Heavy,
+ mg-m = Source~Han~Sans~JP~Medium,
mc-l = Source~Han~Serif~JP~Light,
__custom = false, __office = false, __noembed = false,
}
@@ -300,7 +300,7 @@
gt-b = Noto~Sans~CJK~Bold,
gt-u = Noto~Sans~CJK~Medium,
gt-eb = Noto~Sans~CJK~Black,
- mg-m = Noto~Sans~CJK~Black,
+ mg-m = Noto~Sans~CJK~Medium,
mc-l = Noto~Serif~CJK~Light,
__custom = false, __office = false, __noembed = false,
}
@@ -311,7 +311,7 @@
gt-b = Noto~Sans~CJK~JP~Bold,
gt-u = Noto~Sans~CJK~JP~Medium,
gt-eb = Noto~Sans~CJK~JP~Black,
- mg-m = Noto~Sans~CJK~JP~Black,
+ mg-m = Noto~Sans~CJK~JP~Medium,
mc-l = Noto~Serif~CJK~JP~Light,
__custom = false, __office = false, __noembed = false,
}
@@ -324,7 +324,7 @@
gt-b = HaranoAjiGothic-Bold.otf,
gt-u = HaranoAjiGothic-Medium.otf,
gt-eb = HaranoAjiGothic-Heavy.otf,
- mg-m = HaranoAjiGothic-Heavy.otf,
+ mg-m = HaranoAjiGothic-Medium.otf,
mc-l = HaranoAjiMincho-Light.otf,
__custom = false, __office = false, __noembed = false,
}
@@ -463,16 +463,16 @@
\cs_new:Nn \__ltjpreset_substitute:nnnn {
\group_begin:
\suppressfontnotfounderror=1
- \cs_if_exist:cT {ltjpreset_font_#1_#2:} {
- \__ltjpreset_wrap_fontname:e { \cs:w ltjpreset_font_#1_#2: \cs_end: }
- \font \g__ltjpreset_font_test: = \l__preset_font_name:\relax
+ \cs_if_exist:cTF { __ltjpreset_font_#1_#2: } {
+ \__ltjpreset_wrap_fontname:e { \cs:w __ltjpreset_font_#1_#2: \cs_end: }
+ \font \g__ltjpreset_font_test: = \l__ltjpreset_font_name:\relax
\ifx \g__ltjpreset_font_test: \nullfont
\msg_warning:nnxxxx { luatexja-preset }{ no-font }
- { \cs:w ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 }
- { \cs:w ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 }
- \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: }
+ { \cs:w __ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 }
+ { \cs:w __ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 }
+ \cs_gset_eq:cc { __ltjpreset_font_#1_#2: } { __ltjpreset_font_#3_#4: }
\fi
- } { \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: } }
+ } { \cs_gset_eq:cc { __ltjpreset_font_#1_#2: } { __ltjpreset_font_#3_#4: } }
\group_end:
}
diff --git a/macros/luatex/generic/luatexja/src/jfm-propw.lua b/macros/luatex/generic/luatexja/src/jfm-propw.lua
new file mode 100644
index 0000000000..71dc1ae694
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/jfm-propw.lua
@@ -0,0 +1,9 @@
+luatexja.jfont.define_jfm {
+ dir = 'yoko',
+ zw = 1.0, zh = 1.0,
+
+ [0] = {
+ align = 'left', left = 0.0, down = 0.0,
+ width = 'prop', height = 0.88, depth = 0.12, italic=0.0,
+ }
+}
diff --git a/macros/luatex/generic/luatexja/src/jfm-ujis.lua b/macros/luatex/generic/luatexja/src/jfm-ujis.lua
index 10b44d8103..5df1986ea6 100644
--- a/macros/luatex/generic/luatexja/src/jfm-ujis.lua
+++ b/macros/luatex/generic/luatexja/src/jfm-ujis.lua
@@ -28,6 +28,7 @@ local t = {
[8] = { 0, 0, 0, kanjiskip_shrink=1 },
},
kern = { [307] = 0 },
+ round_threshold = 0.01,
},
[1] = { -- 開き括弧類
@@ -46,6 +47,9 @@ local t = {
[4] = { 0, 0, 0, kanjiskip_shrink=1 },
[5] = { 0, 0, 0, kanjiskip_shrink=1 },
[105] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [205] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [305] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [405] = { 0, 0, 0, kanjiskip_shrink=1 },
[6] = { 0, 0, 0, kanjiskip_shrink=1 },
[007] = { 0, 0, 0, kanjiskip_shrink=1 },
[107] = { 0, 0, 0, kanjiskip_shrink=1 },
@@ -70,6 +74,9 @@ local t = {
[4] = { 0, 0, 0, kanjiskip_shrink=1 },
[5] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[105] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [205] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [305] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [405] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[6] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[007] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[107] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
@@ -92,6 +99,9 @@ local t = {
[4] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
[5] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
[105] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [205] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [305] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [405] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
[6] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
[007] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
[107] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
@@ -111,6 +121,9 @@ local t = {
[3] = { 0.75, 0.0, 0.25, priority=1, ratio=1./3, kanjiskip_stretch=1 },
[5] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[105] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [205] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [305] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+ [405] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[6] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[007] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
[107] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
@@ -120,7 +133,7 @@ local t = {
},
[5] = { -- 分離禁止文字
- chars = { '—', '―', '‥', '…', '〳', '〴', '〵', },
+ chars = { '―', '‥', '…', '〳', '〴', '〵', },
align = 'left', left = 0.0, down = 0.0,
width = 1.0, height = 0.88, depth = 0.12, italic=0.0,
glue = {
@@ -131,8 +144,7 @@ local t = {
[6] = { 0, 0, 0, kanjiskip_shrink=1 },
},
kern = {
- [5] = 0.0,
- [105] = 0.0
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
}
},
@@ -148,8 +160,53 @@ local t = {
[6] = { 0, 0, 0, kanjiskip_shrink=1 },
},
kern = {
- [5] = 0.0,
- [105] = 0.0
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
+ }
+ },
+
+ [205] = { -- em-dash
+ chars = { 0x2014 },
+ align = 'middle', left = 0.0, down = 0.0,
+ width = 1, height = 0.88, depth = 0.12, italic=0.0,
+ glue = {
+ [1] = { 0.5 , 0.0, 0.5, ratio=1, kanjiskip_stretch=1 },
+ [2] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [3] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [4] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [6] = { 0, 0, 0, kanjiskip_shrink=1 },
+ },
+ kern = {
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
+ }
+ },
+ [305] = { -- two-em dash
+ chars = { 0x2E3A },
+ align = 'middle', left = 0.0, down = 0.0,
+ width = 2, height = 0.88, depth = 0.12, italic=0.0,
+ glue = {
+ [1] = { 0.5 , 0.0, 0.5, ratio=1, kanjiskip_stretch=1 },
+ [2] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [3] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [4] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [6] = { 0, 0, 0, kanjiskip_shrink=1 },
+ },
+ kern = {
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
+ }
+ },
+ [405] = { -- three-em dash
+ chars = { 0x2E3B },
+ align = 'middle', left = 0.0, down = 0.0,
+ width = 3, height = 0.88, depth = 0.12, italic=0.0,
+ glue = {
+ [1] = { 0.5 , 0.0, 0.5, ratio=1, kanjiskip_stretch=1 },
+ [2] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [3] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
+ [4] = { 0, 0, 0, kanjiskip_shrink=1 },
+ [6] = { 0, 0, 0, kanjiskip_shrink=1 },
+ },
+ kern = {
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
}
},
@@ -170,8 +227,7 @@ local t = {
[8] = { 0, 0, 0, kanjiskip_shrink=1 },
},
kern = {
- [5] = 0.0,
- [105] = 0.0
+ [5] = 0.0, [105] = 0.0, [205] = 0.0, [305] = 0.0, [405] = 0.0,
}
},
@@ -228,7 +284,7 @@ local t = {
}
},
- [307] = { -- 1/4 角
+ [307] = { -- 合成用(半)濁点
chars = { 0x3099, 0x309A },
align = 'right', left = 0.0, down = 0.0,
width = 0, height = 0.88, depth = 0.12, italic=0.0,
diff --git a/macros/luatex/generic/luatexja/src/jfm-ujisv.lua b/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
index ccae212f88..b2044bde5a 100644
--- a/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
+++ b/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
@@ -28,6 +28,7 @@ local t = {
[8] = { 0, 0, 0, kanjiskip_shrink=1 },
},
kern = { [307] = 0 },
+ round_threshold = 0.01,
},
[1] = { -- 開き括弧類
diff --git a/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua
index bb5d99561a..cecb8d6625 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-04-01',
+ date = '2020-05-17',
description = 'Loader for Japanese fonts',
})
@@ -108,6 +108,8 @@ function luatexja.jfont.define_jfm(to)
if type(v.down)~='number' then
v.down = 0.0
end
+ v.round_threshold = ((t.version>=3)and(i==0)and(type(v.round_threshold)=='number'))
+ and v.round_threshold or nil
if t.version>=2 then
if v.end_stretch then defjfm_res= nil; return end
if v.end_shrink then defjfm_res= nil; return end
@@ -184,13 +186,17 @@ local update_jfm_cache
do
local floor = math.floor
local function myround(a) return floor(a+0.5) end
+ local mult_ignore_key = {
+ round_threshold=true, kanjiskip_natural=true, kanjiskip_stretch=true, kanjiskip_shrink=true,
+ raio=true, priority=true
+ }
local function mult_table(old,scale) -- modified from table.fastcopy
if old then
local new = { }
for k,v in next, old do
if type(v) == "table" then
new[k] = mult_table(v,scale)
- elseif type(v) == "number" then
+ elseif type(v) == "number" and not mult_ignore_key[k] then
new[k] = myround(v*scale)
else
new[k] = v
@@ -213,12 +219,13 @@ do
for k,w in pairs(v.glue) do
v[k] = {
nil,
- ratio=w.ratio/sz,
- priority=FROM_JFM + w.priority/sz,
+ ratio=w.ratio,
+ priority=FROM_JFM + w.priority,
width = w[1], stretch = w[2], shrink = w[3],
- kanjiskip_natural = w.kanjiskip_natural and w.kanjiskip_natural/sz,
- kanjiskip_stretch = w.kanjiskip_stretch and w.kanjiskip_stretch/sz,
- kanjiskip_shrink = w.kanjiskip_shrink and w.kanjiskip_shrink/sz,
+ kanjiskip_natural = w.kanjiskip_natural,
+ kanjiskip_stretch = w.kanjiskip_stretch,
+ kanjiskip_shrink = w.kanjiskip_shrink,
+ round_threshold = w.round_threshold,
}
end
for k,w in pairs(v.kern) do
@@ -331,7 +338,7 @@ do
local fmtable = { jfm = j, size = f.size, var = jfm_var,
with_kanjiskip = jfm_ksp,
zw = sz.zw, zh = sz.zh,
- chars = sz.chars, char_type = sz.char_type,
+ chars = sz.chars, char_type = sz.char_type,
kanjiskip = sz.kanjiskip, xkanjiskip = sz.xkanjiskip,
chars_cbcache = {},
vert_activated = vert_activated,
@@ -449,9 +456,10 @@ do
otfl_fdr= luatexbase.remove_from_callback('define_font', 'luaotfload.define_font')
luatexbase.add_to_callback('define_font',luatexja.font_callback,"luatexja.font_callback", 1)
- local match, sp = string.match, tex.sp
- local function load_jfmonly(spec, dir)
- local spec, size = match(spec,'(.+)%s+at%s*([%.%w]*)')
+ local match, sp, scan_arg = string.match, tex.sp, token.scan_argument
+ local function load_jfmonly()
+ local spec, size = match(scan_arg(), '(.+)%s+at%s*([%.%w]*)')
+ local dir = scan_arg()
size = sp(size); extract_metric(spec)
jfm_dir = dir
local i = load_jfont_metric()
@@ -485,10 +493,12 @@ do
end
local kfam_list, Nkfam_list = {}, {}
- function luatexja.jfont.add_kfam(fam)
- kfam_list[fam]=true
+ function luatexja.jfont.add_kfam()
+ kfam_list[scan_arg()]=true
end
- function luatexja.jfont.search_kfam(fam, use_fd)
+ function luatexja.jfont.search_kfam()
+ local fam = scan_arg()
+ local use_fd = (scan_arg() =='true')
if kfam_list[fam] then
tex.sprint(cat_lp, '\\let\\ifin@\\iftrue '); return
elseif Nkfam_list[fam] then
@@ -510,11 +520,11 @@ do
end
end
local ffam_list, Nffam_list = {}, {}
- function luatexja.jfont.is_ffam(fam)
- tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (ffam_list[fam] or 'false '))
+ function luatexja.jfont.is_ffam()
+ tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (ffam_list[scan_arg()] or 'false '))
end
- function luatexja.jfont.add_ffam(fam)
- ffam_list[fam]='true '
+ function luatexja.jfont.add_ffam()
+ ffam_list[scan_arg()]='true '
end
function luatexja.jfont.search_ffam_declared()
local s = ''
@@ -523,7 +533,8 @@ do
end
tex.sprint(cat_lp, s)
end
- function luatexja.jfont.search_ffam_fd(fam)
+ function luatexja.jfont.search_ffam_fd()
+ local fam = scan_arg()
if Nffam_list[fam] then
tex.sprint(cat_lp, '\\let\\ifin@\\iffalse '); return
else
@@ -645,11 +656,12 @@ end
-- ここから先は 新 \selectfont の内部でしか実行されない
do
+ local scan_arg = token.scan_argument
local alt_font_base, alt_font_base_num
local aftl_base
-- EXT
- function luatexja.jfont.does_alt_set(bbase)
- aftl_base = alt_font_table_latex[bbase]
+ function luatexja.jfont.does_alt_set()
+ aftl_base = alt_font_table_latex[scan_arg()]
tex.sprint(cat_lp, aftl_base and '\\@firstofone' or '\\@gobble')
end
-- EXT
diff --git a/macros/luatex/generic/luatexja/src/ltj-latex.sty b/macros/luatex/generic/luatexja/src/ltj-latex.sty
index ff6a72bab7..8af066eee6 100644
--- a/macros/luatex/generic/luatexja/src/ltj-latex.sty
+++ b/macros/luatex/generic/luatexja/src/ltj-latex.sty
@@ -12,7 +12,7 @@
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2019/09/26 LaTeX support of LuaTeX-ja]
+\ProvidesPackage{ltj-latex}[2020-05-17 LaTeX support of LuaTeX-ja]
% cleanup at end of the document
%\let\ltj@@orig@end=\@@end
@@ -79,6 +79,7 @@
\ltj@pkgpatch{preview} %% at \begin{document}
% (preview package has delayed option)
\ltj@pkgpatch{array} %% at \begin{document}
+\ltj@pkgpatch{collcell} %% at \begin{document}
\ltj@pkgpatch@im{unicode-math}
\ltj@pkgpatch@im{siunitx}
\ltj@pkgpatch@im{microtype}
diff --git a/macros/luatex/generic/luatexja/src/ltj-setwidth.lua b/macros/luatex/generic/luatexja/src/ltj-setwidth.lua
index f21c0059c8..964d49e063 100644
--- a/macros/luatex/generic/luatexja/src/ltj-setwidth.lua
+++ b/macros/luatex/generic/luatexja/src/ltj-setwidth.lua
@@ -87,7 +87,7 @@ local call_callback = luatexbase.call_callback
local fshift = { down = 0, left = 0 }
-local min, max = math.min, math.max
+local min, max, floor, abs = math.min, math.max, math.floor, math.abs
local rule_subtype = (status.luatex_version>=85) and 3 or 0
@@ -129,6 +129,13 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir)
local q
head, q = node_remove(head, p)
+ if pwidth > fwidth then
+ if char_data.round_threshold then
+ local frac = pwidth / fwidth
+ local quot = floor(frac+0.5)
+ if abs(frac-quot) <char_data.round_threshold then fwidth = fwidth * quot end
+ end
+ end
local xo, yo = getoffsets(p)
setoffsets(p, xo + char_data.align*(fwidth-pwidth) - fshift.left,
yo - fshift.down);
@@ -191,6 +198,11 @@ local function capsule_glyph_tate(p, met, char_data, head, dir)
pwidth, ascender = feir.vheight[pc]*met.size, feir.vorigin[pc]*met.size
end
fwidth = fwidth or pwidth
+ if pwidth>fwidth and char_data.round_threshold then
+ local frac = pwidth / fwidth
+ local quot = floor(frac+0.5)
+ if abs(frac-quot) <char_data.round_threshold then fwidth = fwidth * quot end
+ end
fshift.down = char_data.down; fshift.left = char_data.left
fshift = call_callback("luatexja.set_width", fshift, met, char_data)
local fheight = char_data.height or 0
diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty
index c2c8c45147..68b11f7d87 100644
--- a/macros/luatex/generic/luatexja/src/luatexja.sty
+++ b/macros/luatex/generic/luatexja/src/luatexja.sty
@@ -41,7 +41,7 @@
\ProcessOptions\relax
\fi %</LaTeX>
%%%% VERSION
-\def\LuaTeXjaversion{20200412.0}
+\def\LuaTeXjaversion{20200517.0}
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
diff --git a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty
index e5f79a8c44..9be20e440c 100644
--- a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty
+++ b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty
@@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjfont}[2020-04-12 Patch to NFSS2 for LuaTeX-ja]
+\ProvidesPackage{lltjfont}[2020-05-17 Patch to NFSS2 for LuaTeX-ja]
%% patching \DeclareTextComposite
\def\ltj@chardef@text@cmd#1{%
@@ -91,6 +91,9 @@
\newluafunction\ltj@@is@kyenc@@inner
\newluafunction\ltj@@is@ktenc@@inner
\newluafunction\ltj@@is@kenc@@inner
+\newluafunction\ltj@@is@ffam@@inner
+\newluafunction\ltj@@add@ffam@@inner
+\newluafunction\ltj@@add@kfam@@inner
\directlua{%
local lf = lua.get_functions_table()
lf[\the\ltj@@add@fenc@@inner] = luatexja.jfont.add_fenc_list
@@ -99,6 +102,9 @@
lf[\the\ltj@@is@kyenc@@inner] = luatexja.jfont.is_kyenc
lf[\the\ltj@@is@ktenc@@inner] = luatexja.jfont.is_ktenc
lf[\the\ltj@@is@kenc@@inner] = luatexja.jfont.is_kenc
+ lf[\the\ltj@@is@ffam@@inner] = luatexja.jfont.is_ffam
+ lf[\the\ltj@@add@ffam@@inner] = luatexja.jfont.add_ffam
+ lf[\the\ltj@@add@kfam@@inner] = luatexja.jfont.add_kfam
}
\luadef\ltj@@add@fenc \ltj@@add@fenc@@inner
\luadef\ltj@@add@kyenc\ltj@@add@kyenc@@inner
@@ -106,6 +112,9 @@
\luadef\ltj@@is@kyenc \ltj@@is@kyenc@@inner
\luadef\ltj@@is@ktenc \ltj@@is@ktenc@@inner
\luadef\ltj@@is@kenc \ltj@@is@kenc@@inner
+\luadef\ltj@@is@ffam \ltj@@is@ffam@@inner
+\luadef\ltj@@add@ffam \ltj@@add@ffam@@inner
+\luadef\ltj@@add@kfam \ltj@@add@kfam@@inner
{\def\cdp@elt#1#2#3#4{\ltj@@add@fenc{#1}}\cdp@list}
@@ -210,7 +219,7 @@
\@empty
\else \reserved@a
\fi
- \directlua{luatexja.jfont.add_ffam('\luatexluaescapestring{#2}')}%
+ \ltj@@add@ffam{#2}%
}%
}
\def\DeclareKanjiFamily#1#2#3{%
@@ -223,7 +232,7 @@
\@empty
\else \reserved@a
\fi
- \directlua{luatexja.jfont.add_kfam('\luatexluaescapestring{#2}')}%
+ \ltj@@add@kfam{#2}%
}%
}
\def\DeclareKanjiSubstitution#1#2#3#4{%
@@ -578,27 +587,28 @@
\DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}}
\DeclareRobustCommand\fontfamily[1]{%
\@notkfamfalse\@notffamfalse
- \edef\tmp@item{'\luatexluaescapestring{#1}'}%
%
- \directlua{luatexja.jfont.search_kfam(\tmp@item, \@ltj@use@fd)}%
+ \directlua{luatexja.jfont.search_kfam()}{#1}{\@ltj@use@fd}%
\ifin@\edef\k@family{#1}\else\@notkfamtrue\fi
%
% alphabetic fonts part
- \directlua{luatexja.jfont.is_ffam(\tmp@item)}%
+ \ltj@@is@ffam{#1}%
\ifin@\edef\f@family{#1}\else
% checking is_stored_ffam is not sufficient,
% since LuaTeX-ja doesn't know whats fonts are defined before LuaTeX-ja is loaded.
\ifcsname \f@encoding+#1\endcsname % easy case
- \directlua{luatexja.jfont.add_ffam(\tmp@item)}\edef\f@family{#1}%
+ \ltj@@add@ffam{#1}\edef\f@family{#1}%
\else
\@tempswafalse
- \def\cdp@elt##1{\ifcsname ##1+#1\endcsname\@tempswatrue\fi}%
- \directlua{luatexja.jfont.search_ffam_declared()}%
+ \def\cdp@elt##1{\ifcsname ##1+#1\endcsname%
+ \@tempswatrue\def\cdp@elt####1\relax{}%
+ \fi}%
+ \directlua{luatexja.jfont.search_ffam_declared()}\relax%
\if@tempswz
- \directlua{luatexja.jfont.add_ffam(\tmp@item)}\edef\f@family{#1}%
+ \ltj@@add@ffam{#1}\edef\f@family{#1}%
\else
% now we search Nffam_list and font definition files.
- \directlua{luatexja.jfont.search_ffam_fd(\tmp@item)}%
+ \directlua{luatexja.jfont.search_ffam_fd()}{#1}%
\ifin@\edef\f@family{#1}\else\@notffamtrue\fi
\fi
\fi
@@ -1026,19 +1036,22 @@
\expandafter\globaltfont\font@name\external@font\relax\font@name
\csname \f@encoding+\f@family\endcsname
\csname\curr@fontshape\endcsname}
+
+\newluafunction\ltj@@jfont@@jfmonly@@inner
+\directlua{%
+ local lf = lua.get_functions_table()
+ lf[\the\ltj@@jfont@@jfmonly@@inner] = luatexja.jfont.load_jfmonly
+}
+\luadef\ltj@@jfont@@jfmonly \ltj@@jfont@@jfmonly@@inner
\def\extract@jfont@onlyjfm{%
\get@external@font
\csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
- \directlua{%
- luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'yoko')
- }%
+ \ltj@@jfont@@jfmonly{\external@font}{yoko}%
}}
\def\extract@tfont@onlyjfm{%
\get@external@font
\csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
- \directlua{%
- luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'tate')
- }%
+ \ltj@@jfont@@jfmonly{\external@font}{tate}%
}}
\let\ltj@@al@do@subst@correction=\do@subst@correction
@@ -1129,6 +1142,12 @@
%%%% \ClearAlternateKanjiFont<Benc><Bfam><Bser><Bshape>
% いつも global
+\newluafunction\ltj@@does@alt@set@@inner
+\directlua{%
+ local lf = lua.get_functions_table()
+ lf[\the\ltj@@does@alt@set@@inner] = luatexja.jfont.does_alt_set
+}
+\def\ltj@@does@alt@set#1#2{\luafunction\ltj@@does@alt@set@@inner{#1}{#2}}
\def\ClearAlternateKanjiFont#1#2#3#4{%
\directlua{luatexja.jfont.clear_alt_font_latex('\luatexluaescapestring{#1/#2/#3/#4}')}}
@@ -1143,9 +1162,6 @@
\directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
}
-\def\ltj@@does@alt@set#1#2{%
- \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}{#2}}
-
%%%% patch \@text@composite because of {y,t}albaselineshift
% %% \pltx@isletter from plfonts.dtx
diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-collcell.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-collcell.sty
new file mode 100644
index 0000000000..4386442927
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/patches/lltjp-collcell.sty
@@ -0,0 +1,37 @@
+%
+% lltjp-collcell.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lltjp-collcell}[2020/05/06 Patch to collcell for LuaTeX-ja]
+
+\RequirePackage{etoolbox,collcell}
+
+\def\collcell@beforeuser{\ltjfakeboxbdd\ignorespaces}
+\def\collcell@afteruser{\unskip\ltjfakeboxbdd}
+
+\def\collectcell#1#2\relax\pltx@next@inhibitglue\ltjfakeboxbdd\ignorespaces{%
+ \begingroup
+ \collect@cell@count\z@
+ \collect@cell@toks{}%
+ \let\collect@cell@spaces\empty
+ \def\collect@cell@end{%
+ \expandafter\endgroup
+ \expandafter\collcell@beforeuser
+ \expandafter\ccell@swap\expandafter{\the\collect@cell@toks}{#1}%
+ \collcell@afteruser
+ }%
+ \collect@cell@look#2%
+}
+\patchcmd\collect@cell@arg{%
+ \cci{%
+ \collect@cell@look
+ }%
+}{
+ \cci{%
+ \collect@cell@look
+ }%
+ \ltjfakeboxbdd{\collect@cell@look}
+}{}{}
+
+\endinput