diff options
author | Karl Berry <karl@freefriends.org> | 2023-08-25 22:44:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-08-25 22:44:09 +0000 |
commit | e6862850bffc9d0f9226b44c29e09c62cea5a050 (patch) | |
tree | 9210548fb3181443339163fda6f3bbe674b4d53a /Master/texmf-dist/tex/luatex | |
parent | 73010874676f385178cd680faf84844863dfa44c (diff) |
evangelion-jfm (26aug23)
git-svn-id: svn://tug.org/texlive/trunk@68059 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/evangelion-jfm/jfm-eva.lua | 100 |
1 files changed, 81 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/luatex/evangelion-jfm/jfm-eva.lua b/Master/texmf-dist/tex/luatex/evangelion-jfm/jfm-eva.lua index 632b4a85d7c..502295772bd 100644 --- a/Master/texmf-dist/tex/luatex/evangelion-jfm/jfm-eva.lua +++ b/Master/texmf-dist/tex/luatex/evangelion-jfm/jfm-eva.lua @@ -1,11 +1,11 @@ ---- Evangelion Japanese Font Metric for LuaTeX ----- Current Version: 1.0.4 (e) +---- Current Version: 1.0.5 (b) ---- Dev URL: https://github.com/RadioNoiseE/Evangelion-JFM ---- Copyright 2023, RadioNoiseE © -- 初始化 -local lang_jp, lang_tc, lang_sc, dir_vt, font_extd, punc_lg, punc_hg, std_nil, al_hw, al_fw, as_nil +local lang_jp, lang_tc, lang_sc, dir_vt, font_extd, punc_lg, punc_hg, std_nil, al_hw, al_fw, as_nil, fw_prop, fw_xprop if luatexja.jfont.jfm_feature then lang_jp = luatexja.jfont.jfm_feature.jp @@ -19,6 +19,8 @@ if luatexja.jfont.jfm_feature then al_hw = luatexja.jfont.jfm_feature.hwid al_fw = luatexja.jfont.jfm_feature.fwid as_nil = luatexja.jfont.jfm_feature.plain + fw_prop = luatexja.jfont.jfm_feature.prop + fw_xprop = luatexja.jfont.jfm_feature.propw end -- 預處理及容錯 @@ -35,11 +37,19 @@ if punc_lg == true and dir_vt == false then end if al_hw == true and al_fw == true then - tex.error('JFM feature "hwid" cannot be used with "fwid".') + tex.error('JFM feature "hwid" cannot be used with "fwid".\n' .. + 'For now I\'ll ignore both.') luatexja.jfont.jfm_feature["hwid"] = nil luatexja.jfont.jfm_feature["fwid"] = nil end +if fw_prop == true and fw_xprop == true then + tex.error('JFM feature "prop" cannot be used with "propw".\n' .. + 'For now I\'ll ignore both.') + luatexja.jfont.jfm_feature["prop"] = nil + luatexja.jfont.jfm_feature["propw"] = nil +end + if not ((lang_jp and not (lang_tc or lang_sc)) or (lang_tc and not (lang_jp or lang_sc)) or (lang_sc and not (lang_jp or lang_tc))) then @@ -47,7 +57,7 @@ if not ((lang_jp and not (lang_tc or lang_sc)) or '"jp", "trad" or "smpl"\n' .. 'is required.\n' .. 'For now I\'ll use "lang_jp" for japanese by default.') - luatexja.jfont.jfm_feature["hwid"] = nil + luatexja.jfont.jfm_feature["jp"] = "eva_langfeat_defl" end -- 壓縮比例設定 @@ -64,11 +74,21 @@ local function logic_anif(f1, f2, r1, r2) return rta end +local function logic_orif(f1, f2, r1, r2) + local rto = (f1 or f2) and r1 or r2 + return rto +end + local function logic_if(f1, r1, r2) local rti = f1 and r1 or r2 return rti end +local function context_width(regv) + local rtw = (fw_prop or fw_xprop) and 'prop' or (regv) + return rtw +end + local function context_height() local rth = dir_vt and (font_extd and extd_ratio/2 or 0.5) or 0.88 return rth @@ -89,7 +109,7 @@ local eva = { xkanjiskip = {0.25, 0.125, 0.125}, [0] = { -- 缺省類 - width = 1, + width = context_width(1), height = context_height(), depth = context_depth(), italic = 0, @@ -108,7 +128,7 @@ local eva = { [1] = { -- 読点類 chars = logic_anif(dir_vt, punc_lg, {}, {'、', ','}), - width = 0.5, + width = context_width(0.5), height = context_height(), depth = context_depth(), italic = 0, @@ -127,7 +147,7 @@ local eva = { [8] = logic_if(lang_tc, {0.25, 0, 0.125}, {}), [9] = logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.75, 0, 0.25, ratio = 1/3, priority = {0, -1}}) }, - end_adjust = logic_if(lang_tc, {0.25, 0}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) + end_adjust = logic_if(lang_tc, {0.25, 0, 0.25}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) }, [101] = { -- 読点類(行間a) @@ -160,7 +180,7 @@ local eva = { [2] = { -- 句點類 chars = logic_anif(dir_vt, punc_lg, {}, {'.', '。'}), - width = 0.5, + width = context_width(0.5), height = context_height(), depth = context_depth(), italic = 0, @@ -179,7 +199,7 @@ local eva = { [8] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0}, {}), [9] = logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.75, 0, 0.25, ratio = 1/3, priority = {0, -1}}) }, - end_adjust = logic_if(lang_tc, {0.25, 0}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) + end_adjust = logic_if(lang_tc, {0.25, 0, 0.25}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) }, [201] = { -- 句點類(行間a) @@ -212,7 +232,7 @@ local eva = { [3] = { -- 兩點類 chars = logic_if(lang_jp, {}, (logic_anif(dir_vt, punc_lg, {}, {':', ';'}))), - width = logic_if(dir_vt, 1, 0.5), + width = context_width(logic_if(dir_vt, 1, 0.5)), height = context_height(), depth = context_depth(), italic = 0, @@ -268,7 +288,7 @@ local eva = { 'ョ', 'ヮ', 'ヵ', 'ヶ', 'ヽ', 'ヾ', 'ㇰ', 'ㇱ', 'ㇲ', 'ㇳ', 'ㇴ', 'ㇵ', 'ㇶ', 'ㇷ', 'ㇸ', 'ㇹ', 'ㇺ', 'ㇻ', 'ㇼ', 'ㇽ', 'ㇾ', 'ㇿ' }, - width = 1, + width = context_width(1), height = context_height(), depth = context_depth(), italic = 0, @@ -286,7 +306,7 @@ local eva = { [5] = { -- 疑問感嘆類 chars = {'!', '?', '‼︎', '⁉︎', '⁈', '⁇'}, - width = logic_if(dir_vt, 1, logic_if(lang_sc, 0.5, 1)), + width = context_width(logic_if(dir_vt, 1, logic_if(lang_sc, 0.5, 1))), height = context_height(), depth = context_depth(), italic = 0, @@ -307,7 +327,7 @@ local eva = { [6] = { -- 分離禁止類 chars = {'—', '―', '‥', '…', '⋯', '〳', '〴', '〵'}, - width = 1, + width = context_width(1), height = context_height(), depth = context_depth(), italic = 0, @@ -326,9 +346,45 @@ local eva = { } }, + [601] = { -- 二連字 + chars = {'⸺'}, + width = context_width(2), + height = context_height(), + depth = context_depth(), + italic = 0, + left = 0, + down = 0, + align = 'middle', + glue = { + [1] = logic_if(lang_tc, {0.25, 0, 0,125, ratio = 1}, {}), + [2] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1}, {}), + [3] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}, {priority = {0, -1}})), + [7] = {0.5, 0, 0.25, ratio = 1, priority = {-1, -2}}, + [9] = {0.25, 0, 0.125, ratio = 1, priority = {0, -1}} + } + }, + + [602] = { -- 三連字 + chars = {'⸻'}, + width = context_width(3), + height = context_height(), + depth = context_depth(), + italic = 0, + left = 0, + down = 0, + align = 'middle', + glue = { + [1] = logic_if(lang_tc, {0.25, 0, 0,125, ratio = 1}, {}), + [2] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1}, {}), + [3] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}, {priority = {0, -1}})), + [7] = {0.5, 0, 0.25, ratio = 1, priority = {-1, -2}}, + [9] = {0.25, 0, 0.125, ratio = 1, priority = {0, -1}} + } + }, + [7] = { -- 開括號類 chars = {'(', '〔', '[', '{', '〈', '《', '「', '『', '【', '⦅', '〘', '〖', '〝', '‘', '“'}, - width = 0.5, + width = context_width(0.5), height = context_height(), depth = context_depth(), italic = 0, @@ -346,7 +402,7 @@ local eva = { [8] = { -- 閉括號類 chars = {')', '〕', ']', '}', '〉', '》', '」', '』', '】', '⦆', '〙', '〗', '〟', '’', '”'}, - width = 0.5, + width = context_width(0.5), height = context_height(), depth = context_depth(), italic = 0, @@ -369,7 +425,7 @@ local eva = { [9] = { -- 中點類 chars = logic_if(lang_jp, {'・', ':', ';'}, {'・', '·'}), - width = 0.5, + width = context_width(0.5), height = context_height(), depth = context_depth(), italic = 0, @@ -388,7 +444,7 @@ local eva = { [8] = {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, [9] = {0.5, 0, 0.25, priority = {0, -1}} }, - end_adjust = {0.25, 0} + end_adjust = {0.25, 0, 0.25} }, [10] = { -- 西文 @@ -409,7 +465,7 @@ local eva = { [7] = {0, 0, 0} } } -} +} if al_hw == true or al_fw == true then eva[10].chars = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', @@ -428,10 +484,16 @@ if al_hw == true and al_fw == false then eva[10].width = 0.5 end -if al_fw == false and al_fw == true then +if al_fw == false and al_hw == true then eva[10].width = 1 end +if fw_prop == true and fw_xprop == false then + for _, catnum in ipairs({0, 1, 101, 102, 2, 201, 202, 3, 301, 302, 4, 5, 6, 7, 8, 9, 10}) do + eva[catnum].glue = {} + end +end + if sa_nil == true then for _, catnum in ipairs({1, 101, 102, 2, 201, 202, 3, 301, 302, 4, 5, 6, 7, 8, 9, 10, 11}) do eva[catnum] = nil |