• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: コミット

ソースコードの管理場所


コミットメタ情報

リビジョンcde2981db1536119901824da56b78766f122266d (tree)
日時2020-04-19 09:10:18
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
コミッターHironori Kitagawa

ログメッセージ

More use or token.scan_argument()

変更サマリ

差分

--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -449,9 +449,10 @@ do
449449 otfl_fdr= luatexbase.remove_from_callback('define_font', 'luaotfload.define_font')
450450 luatexbase.add_to_callback('define_font',luatexja.font_callback,"luatexja.font_callback", 1)
451451
452- local match, sp = string.match, tex.sp
453- local function load_jfmonly(spec, dir)
454- local spec, size = match(spec,'(.+)%s+at%s*([%.%w]*)')
452+ local match, sp, scan_arg = string.match, tex.sp, token.scan_argument
453+ local function load_jfmonly()
454+ local spec, size = match(scan_arg(), '(.+)%s+at%s*([%.%w]*)')
455+ local dir = scan_arg()
455456 size = sp(size); extract_metric(spec)
456457 jfm_dir = dir
457458 local i = load_jfont_metric()
@@ -485,10 +486,12 @@ do
485486 end
486487
487488 local kfam_list, Nkfam_list = {}, {}
488- function luatexja.jfont.add_kfam(fam)
489- kfam_list[fam]=true
489+ function luatexja.jfont.add_kfam()
490+ kfam_list[scan_arg()]=true
490491 end
491- function luatexja.jfont.search_kfam(fam, use_fd)
492+ function luatexja.jfont.search_kfam()
493+ local fam = scan_arg()
494+ local use_fd = (scan_arg() =='true')
492495 if kfam_list[fam] then
493496 tex.sprint(cat_lp, '\\let\\ifin@\\iftrue '); return
494497 elseif Nkfam_list[fam] then
@@ -510,11 +513,11 @@ do
510513 end
511514 end
512515 local ffam_list, Nffam_list = {}, {}
513- function luatexja.jfont.is_ffam(fam)
514- tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (ffam_list[fam] or 'false '))
516+ function luatexja.jfont.is_ffam()
517+ tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (ffam_list[scan_arg()] or 'false '))
515518 end
516- function luatexja.jfont.add_ffam(fam)
517- ffam_list[fam]='true '
519+ function luatexja.jfont.add_ffam()
520+ ffam_list[scan_arg()]='true '
518521 end
519522 function luatexja.jfont.search_ffam_declared()
520523 local s = ''
@@ -523,7 +526,8 @@ do
523526 end
524527 tex.sprint(cat_lp, s)
525528 end
526- function luatexja.jfont.search_ffam_fd(fam)
529+ function luatexja.jfont.search_ffam_fd()
530+ local fam = scan_arg()
527531 if Nffam_list[fam] then
528532 tex.sprint(cat_lp, '\\let\\ifin@\\iffalse '); return
529533 else
@@ -645,11 +649,12 @@ end
645649
646650 -- ここから先は 新 \selectfont の内部でしか実行されない
647651 do
652+ local scan_arg = token.scan_argument
648653 local alt_font_base, alt_font_base_num
649654 local aftl_base
650655 -- EXT
651- function luatexja.jfont.does_alt_set(bbase)
652- aftl_base = alt_font_table_latex[bbase]
656+ function luatexja.jfont.does_alt_set()
657+ aftl_base = alt_font_table_latex[scan_arg()]
653658 tex.sprint(cat_lp, aftl_base and '\\@firstofone' or '\\@gobble')
654659 end
655660 -- EXT
--- a/src/patches/lltjfont.sty
+++ b/src/patches/lltjfont.sty
@@ -91,6 +91,9 @@
9191 \newluafunction\ltj@@is@kyenc@@inner
9292 \newluafunction\ltj@@is@ktenc@@inner
9393 \newluafunction\ltj@@is@kenc@@inner
94+\newluafunction\ltj@@is@ffam@@inner
95+\newluafunction\ltj@@add@ffam@@inner
96+\newluafunction\ltj@@add@kfam@@inner
9497 \directlua{%
9598 local lf = lua.get_functions_table()
9699 lf[\the\ltj@@add@fenc@@inner] = luatexja.jfont.add_fenc_list
@@ -99,6 +102,9 @@
99102 lf[\the\ltj@@is@kyenc@@inner] = luatexja.jfont.is_kyenc
100103 lf[\the\ltj@@is@ktenc@@inner] = luatexja.jfont.is_ktenc
101104 lf[\the\ltj@@is@kenc@@inner] = luatexja.jfont.is_kenc
105+ lf[\the\ltj@@is@ffam@@inner] = luatexja.jfont.is_ffam
106+ lf[\the\ltj@@add@ffam@@inner] = luatexja.jfont.add_ffam
107+ lf[\the\ltj@@add@kfam@@inner] = luatexja.jfont.add_kfam
102108 }
103109 \luadef\ltj@@add@fenc \ltj@@add@fenc@@inner
104110 \luadef\ltj@@add@kyenc\ltj@@add@kyenc@@inner
@@ -106,6 +112,9 @@
106112 \luadef\ltj@@is@kyenc \ltj@@is@kyenc@@inner
107113 \luadef\ltj@@is@ktenc \ltj@@is@ktenc@@inner
108114 \luadef\ltj@@is@kenc \ltj@@is@kenc@@inner
115+\luadef\ltj@@is@ffam \ltj@@is@ffam@@inner
116+\luadef\ltj@@add@ffam \ltj@@add@ffam@@inner
117+\luadef\ltj@@add@kfam \ltj@@add@kfam@@inner
109118
110119 {\def\cdp@elt#1#2#3#4{\ltj@@add@fenc{#1}}\cdp@list}
111120
@@ -210,7 +219,7 @@
210219 \@empty
211220 \else \reserved@a
212221 \fi
213- \directlua{luatexja.jfont.add_ffam('\luatexluaescapestring{#2}')}%
222+ \ltj@@add@ffam{#2}%
214223 }%
215224 }
216225 \def\DeclareKanjiFamily#1#2#3{%
@@ -223,7 +232,7 @@
223232 \@empty
224233 \else \reserved@a
225234 \fi
226- \directlua{luatexja.jfont.add_kfam('\luatexluaescapestring{#2}')}%
235+ \ltj@@add@kfam{#2}%
227236 }%
228237 }
229238 \def\DeclareKanjiSubstitution#1#2#3#4{%
@@ -578,27 +587,28 @@
578587 \DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}}
579588 \DeclareRobustCommand\fontfamily[1]{%
580589 \@notkfamfalse\@notffamfalse
581- \edef\tmp@item{'\luatexluaescapestring{#1}'}%
582590 %
583- \directlua{luatexja.jfont.search_kfam(\tmp@item, \@ltj@use@fd)}%
591+ \directlua{luatexja.jfont.search_kfam()}{#1}{\@ltj@use@fd}%
584592 \ifin@\edef\k@family{#1}\else\@notkfamtrue\fi
585593 %
586594 % alphabetic fonts part
587- \directlua{luatexja.jfont.is_ffam(\tmp@item)}%
595+ \ltj@@is@ffam{#1}%
588596 \ifin@\edef\f@family{#1}\else
589597 % checking is_stored_ffam is not sufficient,
590598 % since LuaTeX-ja doesn't know whats fonts are defined before LuaTeX-ja is loaded.
591599 \ifcsname \f@encoding+#1\endcsname % easy case
592- \directlua{luatexja.jfont.add_ffam(\tmp@item)}\edef\f@family{#1}%
600+ \ltj@@add@ffam{#1}\edef\f@family{#1}%
593601 \else
594602 \@tempswafalse
595- \def\cdp@elt##1{\ifcsname ##1+#1\endcsname\@tempswatrue\fi}%
596- \directlua{luatexja.jfont.search_ffam_declared()}%
603+ \def\cdp@elt##1{\ifcsname ##1+#1\endcsname%
604+ \@tempswatrue\def\cdp@elt####1\relax{}%
605+ \fi}%
606+ \directlua{luatexja.jfont.search_ffam_declared()}\relax%
597607 \if@tempswz
598- \directlua{luatexja.jfont.add_ffam(\tmp@item)}\edef\f@family{#1}%
608+ \ltj@@add@ffam{#1}\edef\f@family{#1}%
599609 \else
600610 % now we search Nffam_list and font definition files.
601- \directlua{luatexja.jfont.search_ffam_fd(\tmp@item)}%
611+ \directlua{luatexja.jfont.search_ffam_fd()}{#1}%
602612 \ifin@\edef\f@family{#1}\else\@notffamtrue\fi
603613 \fi
604614 \fi
@@ -1026,19 +1036,22 @@
10261036 \expandafter\globaltfont\font@name\external@font\relax\font@name
10271037 \csname \f@encoding+\f@family\endcsname
10281038 \csname\curr@fontshape\endcsname}
1039+
1040+\newluafunction\ltj@@jfont@@jfmonly@@inner
1041+\directlua{%
1042+ local lf = lua.get_functions_table()
1043+ lf[\the\ltj@@jfont@@jfmonly@@inner] = luatexja.jfont.load_jfmonly
1044+}
1045+\luadef\ltj@@jfont@@jfmonly \ltj@@jfont@@jfmonly@@inner
10291046 \def\extract@jfont@onlyjfm{%
10301047 \get@external@font
10311048 \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
1032- \directlua{%
1033- luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'yoko')
1034- }%
1049+ \ltj@@jfont@@jfmonly{\external@font}{yoko}%
10351050 }}
10361051 \def\extract@tfont@onlyjfm{%
10371052 \get@external@font
10381053 \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
1039- \directlua{%
1040- luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'tate')
1041- }%
1054+ \ltj@@jfont@@jfmonly{\external@font}{tate}%
10421055 }}
10431056
10441057 \let\ltj@@al@do@subst@correction=\do@subst@correction
@@ -1129,6 +1142,12 @@
11291142
11301143 %%%% \ClearAlternateKanjiFont<Benc><Bfam><Bser><Bshape>
11311144 % いつも global
1145+\newluafunction\ltj@@does@alt@set@@inner
1146+\directlua{%
1147+ local lf = lua.get_functions_table()
1148+ lf[\the\ltj@@does@alt@set@@inner] = luatexja.jfont.does_alt_set
1149+}
1150+\def\ltj@@does@alt@set#1#2{\luafunction\ltj@@does@alt@set@@inner{#1}{#2}}
11321151 \def\ClearAlternateKanjiFont#1#2#3#4{%
11331152 \directlua{luatexja.jfont.clear_alt_font_latex('\luatexluaescapestring{#1/#2/#3/#4}')}}
11341153
@@ -1143,9 +1162,6 @@
11431162 \directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
11441163 }
11451164
1146-\def\ltj@@does@alt@set#1#2{%
1147- \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}{#2}}
1148-
11491165 %%%% patch \@text@composite because of {y,t}albaselineshift
11501166
11511167 % %% \pltx@isletter from plfonts.dtx
旧リポジトリブラウザで表示