diff options
author | Karl Berry <karl@freefriends.org> | 2023-04-15 20:49:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-04-15 20:49:53 +0000 |
commit | 4583b191492ae8aec38ca7300e4acf99b14b65a9 (patch) | |
tree | 658371ef462deec96b6baf0615297e7a1fe77294 /Master/texmf-dist/tex/luatex | |
parent | 79935d2b00a2ab825d106d08f997fc4b62ea11dc (diff) |
evangelion-jfm (15apr23)
git-svn-id: svn://tug.org/texlive/trunk@66857 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 | 128 |
1 files changed, 95 insertions, 33 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 970cbc851ca..02d45ed4aa5 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.0 (b) +---- Current Version: 1.0.2 (h) ---- Dev URL: https://github.com/RadioNoiseE/Evangelion-JFM ----- © Copyright 2023, RadioNoiseE +---- Copyright 2023, RadioNoiseE © -- 初始化 -local lang_jp, lang_tc, lang_sc, dir_vt, font_extd, punc_lg, punc_hg, std_nil +local lang_jp, lang_tc, lang_sc, dir_vt, font_extd, punc_lg, punc_hg, std_nil, al_hw, al_fw if luatexja.jfont.jfm_feature then lang_jp = luatexja.jfont.jfm_feature.jp @@ -16,6 +16,8 @@ if luatexja.jfont.jfm_feature then punc_lg = luatexja.jfont.jfm_feature.lgp punc_hg = luatexja.jfont.jfm_feature.hgp std_nil = luatexja.jfont.jfm_feature.nstd + al_hw = luatexja.jfont.jfm_feature.hwid + al_fw = luatexja.jfont.jfm_feature.fwid end -- 預處理及容錯 @@ -29,6 +31,10 @@ if punc_lg == true and dir_vt == false then 'For now I\'ll ignore it.') end +if al_hw == true and al_fw == true then + tex.error('JFM feature "hwid" cannot be used with "fwid".') +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 @@ -38,6 +44,14 @@ if not ((lang_jp and not (lang_tc or lang_sc)) or 'For now I\'ll use "lang_jp" for japanese by default.') end +-- 壓縮比例設定 +if font_extd == true then + local extd_ratio = (type(font_extd) == 'string') and tonumber(font_extd) or 1.25 +end + +-- 行間標點字間距補足 +local lgp_kanjiskip = {kanjiskip_natural = 0, kanjiskip_stretch = 1, kanjiskip_shrink = 1} + -- 定義函數宏 local function logic_anif(f1, f2, r1, r2) local rta = f1 and (f2 and r1) or r2 @@ -50,12 +64,12 @@ local function logic_if(f1, r1, r2) end local function context_height() - local rth = dir_vt and (font_extd and 0.625 or 0.5) or 0.88 + local rth = dir_vt and (font_extd and extd_ratio/2 or 0.5) or 0.88 return rth end local function context_depth() - local rtd = dir_vt and (font_extd and 0.625 or 0.5) or 0.12 + local rtd = dir_vt and (font_extd and extd_ratio/2 or 0.5) or 0.12 return rtd end @@ -64,9 +78,9 @@ local eva = { version = 3, dir = logic_if(dir_vt, 'tate', 'yoko'), zw = 1, - zh = logic_anif(dir_vt, font_extd, 1.25, 1), + zh = logic_anif(dir_vt, font_extd, extd_ratio, 1), kanjiskip = {0, 0.25, 0}, - xkanjiskip = {0.25, 0.25, 0.125}, + xkanjiskip = {0.25, 0.125, 0.125}, [0] = { -- 缺省類 width = 1, @@ -77,9 +91,9 @@ local eva = { down = 0, align = 'middle', glue = { - [1] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = logic_if(std_nil, {-1, 0}, {-1, -2})}, {}), - [2] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = logic_if(std_nil, {-1, -2}, {-1, 0})}, {}), - [3] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {-1, -1}}, {priority = {0, -1}})), + [1] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = logic_if(std_nil, {-1, 0}, {-1, -2})}, {priority = logic_if(std_nil, {-1, 0}, {-1, -2})}), + [2] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = logic_if(std_nil, {-1, -2}, {-1, 0})}, {priority = logic_if(std_nil, {-1, -2}, {-1, 0})}), + [3] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {-1, -1}}, {priority = {-1, -1}})), [7] = {0.5, 0, 0.25, ratio = 1, priority = {-1, -2}}, [9] = {0.25, 0, 0.125, ratio = 1, priority = {-1, -1}} }, @@ -98,7 +112,7 @@ local eva = { glue = { [0] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = logic_if(std_nil, {-1, 0}, {-1, -2})}, {0.5, 0, 0.25, ratio = 0, priority = logic_if(std_nil, {-1, 0}, {-1, -2})}), [1] = logic_if(lang_tc, {0.5, 0, 0.25}, {0.5, 0, 0.25}), - [2] = logic_if(lang_tc, {0.5, 0, 0.5}, {0.5, 0, 0.25}), + [2] = logic_if(lang_tc, {0.5, 0, 0.25}, {0.5, 0, 0.25}), [3] = logic_if(dir_vt, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, priority = {0, -1}}), logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), [4] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = logic_if(std_nil, {0, 0}, {0, -2})}, {0.5, 0, 0.25, ratio = 0, priority = logic_if(std_nil, {0, 0}, {0, -2})}), [5] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = logic_if(std_nil, {0, 0}, {0, -2})}, {0.5, 0, 0.25, ratio = 0, priority = logic_if(std_nil, {0, 0}, {0, -2})}), @@ -107,7 +121,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}, {0, 0})) + end_adjust = logic_if(lang_tc, {0.25, 0}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) }, [101] = { -- 読点類(行間a) @@ -118,7 +132,10 @@ local eva = { italic = 0, left = 0.38, down = -0.34, - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [102] = { -- 読点類(行間b) @@ -129,7 +146,10 @@ local eva = { italic = 0, left = logic_if(lang_tc, 0.62, 0.40), down = logic_if(lang_tc, -0.58, -0.26), - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [2] = { -- 句點類 @@ -153,7 +173,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}, {0, 0})) + end_adjust = logic_if(lang_tc, {0.25, 0}, logic_if(punc_hg, {-0.5, 0.5, 0}, {0, 0})) }, [201] = { -- 句點類(行間a) @@ -164,7 +184,10 @@ local eva = { italic = 0, left = logic_if(lang_tc, 0.68, 0.34), down = logic_if(lang_tc, -0.58, -0.28), - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [202] = { -- 句點類(行間b) @@ -175,7 +198,10 @@ local eva = { italic = 0, left = 0.42, down = -0.35, - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [3] = { -- 兩點類 @@ -188,14 +214,14 @@ local eva = { down = 0, align = logic_if(lang_tc, 'middle', 'left'), glue = { - [0] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), + [0] = logic_if(dir_vt, {priority = {-1, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), [1] = logic_if(dir_vt, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}, {priority = {0, -1}}), logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), [2] = logic_if(dir_vt, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}, {priority = {0, -1}}), logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), - [3] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), - [4] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), - [5] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), - [6] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), - [7] = logic_if(dir_vt, {}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), + [3] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), + [4] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), + [5] = logic_if(dir_vt, {priority = {0, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}})), + [6] = logic_if(dir_vt, {priority = {-1, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), + [7] = logic_if(dir_vt, {priority = {-1, -1}}, logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {-1, -1}})), [8] = logic_if(lang_tc, {0.25, 0, 0.125, ratio = 0, priority = {0, -1}}, {0.5, 0, 0.25, ratio = 0, priority = {0, -1}}), [9] = logic_if(lang_tc, {0.5, 0, 0.25, priority = {0, -1}}, {0.75, 0, 0.25, ratio = 1/3, priority = {0, -1}}) } @@ -209,7 +235,10 @@ local eva = { italic = 0, left = logic_if(lang_tc, 0.94, 0.72), down = logic_if(lang_tc, -0.58, -0.34), - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [302] = { -- 兩點類(行間b) @@ -220,7 +249,10 @@ local eva = { italic = 0, left = logic_if(lang_tc, 0.96, 0.78), down = logic_if(lang_tc, -0.58, -0.34), - align = 'left' + align = 'left', + glue = { + [0] = lgp_kanjiskip + } }, [4] = { -- 小書きの仮名類 @@ -319,7 +351,7 @@ local eva = { [0] = {0.5, 0, 0.25, ratio = 0, priority = {-1, -2}}, [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(lang_sc, {}, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}), + [3] = logic_if(lang_sc, {priority = {0, -1}}, {0.25, 0, 0.125, ratio = 1, priority = {0, -1}}), [4] = {0.5, 0, 0.25, ratio = 0, priority = {0, -2}}, [5] = {0.5, 0, 0.25, ratio = 0, priority = {0, -2}}, [6] = {0.5, 0, 0.25, ratio = 0, priroity = {-1, -2}}, @@ -349,19 +381,49 @@ local eva = { [7] = {0.25, 0, 0.125, ratio = 0, priority = {-1, -1}}, [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} }, - [10] = { -- 行頭 - chars = {'boxbdd', 'parbdd'}, + [10] = { -- 西文 + chars = {}, + width = 0, + height = context_height(), + depth = context_depth(), + italic = 0, + left = 0, + down = 0, + align = 'middle', + glue = {} + }, + + [11] = { -- 行頭 + chars = {'parbdd', 'boxbdd'}, glue = { [7] = {0, 0, 0} } - }, - - [11] = { -- 伸縮膠 - chars = {'glue'} } } +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', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'} + eva[10].glue = table.fastcopy(eva[0].glue) + eva[10].glue[0] = {0.25, 0.125, 0.125, ratio = 0, priority = {0, -1}} + eva[0].glue[10] = {0.25, 0.125, 0.125, ratio = 1, priority = {0, -1}} + for _, catnum in ipairs({1, 2, 3, 5, 8, 9}) do + eva[catnum].glue[10] = table.fastcopy(eva[catnum].glue[0]) + end +end + +if al_hw == true and al_fw == false then + eva[10].width = 0.5 +end + +if al_fw == false and al_fw == true then + eva[10].width = 1 +end + luatexja.jfont.define_jfm(eva) |