summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/src/ltj-jfont.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-01 03:04:13 +0000
committerNorbert Preining <norbert@preining.info>2020-10-01 03:04:13 +0000
commitd2a6bb90e56a2836bb59477b8f27248aab9149f5 (patch)
tree5d6be29a531495452688a3c8456355fa58d485f2 /macros/luatex/generic/luatexja/src/ltj-jfont.lua
parent36f406d8d1fc994af516d837e6a87c68839cdb2d (diff)
CTAN sync 202010010304
Diffstat (limited to 'macros/luatex/generic/luatexja/src/ltj-jfont.lua')
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-jfont.lua31
1 files changed, 21 insertions, 10 deletions
diff --git a/macros/luatex/generic/luatexja/src/ltj-jfont.lua b/macros/luatex/generic/luatexja/src/ltj-jfont.lua
index d95b34a511..6b7667a0d1 100644
--- a/macros/luatex/generic/luatexja/src/ltj-jfont.lua
+++ b/macros/luatex/generic/luatexja/src/ltj-jfont.lua
@@ -280,6 +280,7 @@ end
------------------------------------------------------------------------
local load_jfont_metric, check_callback_order
+local font_extra_info = {} -- defined later
do
local cstemp
local global_flag -- true if \globaljfont, false if \jfont
@@ -314,6 +315,7 @@ do
luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end)
-- EXT
+ local fastcopy=table.fastcopy
function luatexja.jfont.jfontdefY()
local j = load_jfont_metric(jfm_dir)
local fn = font.id(cstemp)
@@ -337,9 +339,13 @@ do
kanjiskip = sz.kanjiskip, xkanjiskip = sz.xkanjiskip,
chars_cbcache = {},
vert_activated = vert_activated,
+ rotation = fastcopy(font_extra_info[fn].rotation),
}
if auto_enable_vrt2 then
- ltju.enable_feature(fn, ltju.exist_feature(fn, 'vrt2') and 'vrt2' or 'vert')
+ local vert_name = ltju.exist_feature(fn, 'vrt2') and 'vrt2' or 'vert'
+ local rot = fmtable.rotation
+ ltju.enable_feature(fn, vert_name)
+ ltju.loop_over_feat(f, {[vert_name]=true}, function (i,k) rot[i] = nil end)
end
fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn)
@@ -775,8 +781,7 @@ end
------------------------------------------------------------------------
-- 追加のフォント情報
------------------------------------------------------------------------
-local font_extra_info = {}
-luatexja.jfont.font_extra_info= font_extra_info -- key: fontnumber
+luatexja.jfont.font_extra_info = font_extra_info -- key: fontnumber
local font_extra_basename = {} -- key: basename
local list_rotate_glyphs
@@ -794,7 +799,6 @@ do
end
return lo%2==1
end
- local vert_vrt2 = { vert=true, vrt2 = true }
local function list_rorate_dup (i, v, dest)
local f = dest[i]
if not f then
@@ -807,7 +811,6 @@ do
for i,_ in pairs(tfmdata.characters) do
if rotate_in_uax50(i) then rot[i] = true end
end
- ltju.loop_over_feat(tfmdata, vert_vrt2, function (i,k) rot[i] = nil end)
-- ↓「TeX Live 2019のLuaLaTeXで縦書きの三点リーダーが横書きになる」
-- (https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2722) により無効化
-- -- 同じグリフが複数の Unicode ポイントを持っている場合.
@@ -829,7 +832,7 @@ do
end
do
- local cache_ver = 22
+ local cache_ver = 23
local nameonly, lower = file.nameonly, string.lower
local lfs = require"lfs"
local file_attributes = lfs.attributes
@@ -870,12 +873,23 @@ do
return bname
end
end
+ local dummytable = { } -- dummy
+ local dtvo, dtvh = {}, {}
+ setmetatable(dtvo, {__index = function () return 0.88 end } )
+ setmetatable(dtvh, {__index = function () return 1 end } )
+ ltjr.vert_addfunc = function(id, s)
+ if not dummytable.rotation then
+ dummytable = list_rotate_glyphs(s, dummytable)
+ dummytable.vorigin, dummytable.vheight = dtvo, dtvh
+ end
+ end
+
local function prepare_extra_data_font(id, res)
if type(res)=='table' and (res.psname or res.filename) then
local bname = res.psname or nameonly(res.filename)
local t = font_extra_basename[bname]
if not t then bname = prepare_extra_data_base(res) end
- font_extra_info[id] = t or font_extra_basename[bname]
+ font_extra_info[id] = bname and (t or font_extra_basename[bname]) or dummytable
end
end
luatexbase.add_to_callback(
@@ -892,9 +906,6 @@ do
end,
'ltj.prepare_extra_data', 1)
- local nulltable = {} -- dummy
- ltjr.vert_addfunc = function (n) font_extra_info[n] = nulltable end
-
for i=1,font.nextid()-1 do
local t = font.getfont(i)
if t then