summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja/src/addons
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/luatexja/src/addons')
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty144
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty844
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-25c.sty357
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-26h.sty412
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty406
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty60
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-otf.sty205
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty706
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty210
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-zhfonts.sty77
10 files changed, 3421 insertions, 0 deletions
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty
new file mode 100644
index 0000000000..c4cc54c2f9
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-adjust.sty
@@ -0,0 +1,144 @@
+%
+% luatexja-adjust.sty
+%
+
+%% Avoid multiple loading.
+\csname\if11luatexjaadjustLoaded\fi\endcsname
+\edef\x{%
+\catcode32=\the\catcode32%
+\catcode33=\the\catcode33%
+\catcode35=\the\catcode35%
+\catcode40=\the\catcode40%
+\catcode41=\the\catcode41%
+\catcode42=\the\catcode42%
+\catcode43=\the\catcode43%
+\catcode44=\the\catcode44%
+\catcode45=\the\catcode45%
+\catcode46=\the\catcode46%
+\catcode58=\the\catcode58%
+\catcode59=\the\catcode59%
+\catcode60=\the\catcode60%
+\catcode61=\the\catcode61%
+\catcode62=\the\catcode62%
+\catcode64=\the\catcode64%
+\catcode91=\the\catcode91%
+\catcode93=\the\catcode93%
+\catcode94=\the\catcode94%
+\catcode95=\the\catcode95%
+\catcode126=\the\catcode126%
+\endlinechar=\the\endlinechar
+\relax}
+\catcode32=10 %< >
+\catcode33=12 %<">
+\catcode35=6 %<#>
+\catcode40=12 %<(>
+\catcode41=12 %<)>
+\catcode42=12 %<*>
+\catcode43=12 %<+>
+\catcode44=12 %<,>
+\catcode45=12 %<->
+\catcode46=12 %<.>
+\catcode58=12 %<:>
+\catcode59=12 %<;>
+\catcode60=12 %<<>
+\catcode61=12 %<=>
+\catcode62=12 %<>>
+\catcode64=11 %<@>
+\catcode91=12 %<[>
+\catcode93=12 %<]>
+\catcode94=7 %<^>
+\catcode95=8 %<_>
+\catcode126=13 %<~>
+\endlinechar=-1 %
+
+\edef\ltj@adjust@AtEnd{\x
+ \noexpand\let\noexpand\ltj@adjust@AtEnd\relax}
+\def\luatexjaadjustLoaded{\endinput}
+
+%% Check if LaTeX is used.
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax %<*!LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iffalse\endcsname
+\else %<*LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iftrue\endcsname
+ \NeedsTeXFormat{LaTeX2e}
+ \ProvidesPackage{luatexja-adjust}[2018/07/24]
+\fi %</LaTeX>
+
+% Load core module if not yet.
+% xkeyval.sty is already required in luatexja.sty.
+\ifx\luatexjacoreLoaded\@undefined
+ \ifltj@in@latex %<*LaTeX>
+ \RequirePackage{luatexja}
+ \else %<*!LaTeX>
+ \input luatexja.sty %
+ \fi %</LaTeX>
+\fi
+
+%% When environment check fails, exit now.
+\ifx\LuaTeXjaAvailable\@undefined
+ \ltj@otf@AtEnd
+\expandafter\endinput\fi\relax
+
+%%------------------
+
+%! Main part of luatexja-adjust
+\RequireLuaTeXjaSubmodule{adjust}
+
+\newcount\ltjadj@status@le
+\newcount\ltjadj@status@lp
+\newcount\ltjadj@status@pr
+\newcount\ltjadj@status@ls
+\let\ltj@adjust@temp=\relax
+\define@choicekey[ltj]{adjust}{lineend}[\@@temp\ltj@adjust@temp]%
+{false,true,extended}[true]{%
+ \ifnum\ltj@adjust@temp=-1 \else\ltjadj@status@le=\ltj@adjust@temp\fi\relax}
+\define@boolkey[ltj]{adjust}{priority}[true]{%
+ \ltjadj@status@pr=\ifltj@adjust@priority1\else0\fi\relax}
+\define@boolkey[ltj]{adjust}{profile}[true]{%
+ \ltjadj@status@lp=\ifltj@adjust@profile1\else0\fi\relax}
+\define@boolkey[ltj]{adjust}{linestep}[true]{%
+ \ltjadj@status@ls=\ifltj@adjust@linestep1\else0\fi\relax}
+
+\protected\def\@@ltjenableadjust[#1]{%
+ \setkeys[ltj]{adjust}{#1}%
+ \directlua{luatexja.adjust.enable_cb(
+ \the\ltjadj@status@le, \the\ltjadj@status@pr,
+ \the\ltjadj@status@lp, \the\ltjadj@status@ls)}\ignorespaces
+}
+\protected\def\ltjdisableadjust{%
+ \ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false]}
+\protected\def\ltjenableadjust{%
+ \ltx@ifnextchar[{\@@ltjenableadjust}{\@@ltjenableadjust[lineend,priority]}}%]
+
+\ltjenableadjust
+
+%%% 優先順位の設定
+\define@key[ltj]{adjpri}{kanjiskip}{%
+ \directlua{luatexja.adjust.priority_table[\the\count@][1] = token.scan_int()}#1\relax}
+\define@key[ltj]{adjpri}{xkanjiskip}{%
+ \directlua{luatexja.adjust.priority_table[\the\count@][2] = token.scan_int()}#1\relax}
+\define@key[ltj]{adjpri}{others}{%
+ \directlua{luatexja.adjust.priority_table[\the\count@][3] = token.scan_int()}#1\relax}
+\define@key[ltj]{japaram}{stretch_priority}{%
+ \begingroup\count@=1 \setkeys[ltj]{adjpri}{#1}\relax
+ \directlua{luatexja.adjust.make_priority_table(1)}\endgroup}
+\define@key[ltj]{japaram}{shrink_priority}{%
+ \begingroup\count@=2 \setkeys[ltj]{adjpri}{#1}\relax
+ \directlua{luatexja.adjust.make_priority_table(2)}\endgroup}
+\ltjsetparameter{%
+ stretch_priority={kanjiskip=-35, xkanjiskip=-25, others=50},
+ shrink_priority={kanjiskip=-35, xkanjiskip=-25, others=50},
+}
+\define@key[ltj]{japaram}{linestep_factor}{%
+ \directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax}
+\define@key[ltj]{japaram}{profile_hgap_factor}{%
+ \directlua{luatexja.adjust.profile_hgap_factor = math.abs(#1)}\relax}
+
+
+%%------------------ all done
+\ltj@adjust@AtEnd
+\endinput
+%% EOF
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty
new file mode 100644
index 0000000000..ca187cc900
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty
@@ -0,0 +1,844 @@
+%
+% luatexja-ajmacros.sty
+%
+% Original:
+% \ProvidesPackage{ajmacros}[2019/04/01 21:00 iNOUE Koich! <inoue@ma.ns.musashi-tech.ac.jp>]
+%
+
+
+%% Avoid multiple loading.
+\csname\if11luatexjaajmacrosLoaded\fi\endcsname
+\edef\x{%
+\catcode32=\the\catcode32%
+\catcode33=\the\catcode33%
+\catcode35=\the\catcode35%
+\catcode40=\the\catcode40%
+\catcode41=\the\catcode41%
+\catcode42=\the\catcode42%
+\catcode43=\the\catcode43%
+\catcode44=\the\catcode44%
+\catcode45=\the\catcode45%
+\catcode46=\the\catcode46%
+\catcode58=\the\catcode58%
+\catcode59=\the\catcode59%
+\catcode60=\the\catcode60%
+\catcode61=\the\catcode61%
+\catcode62=\the\catcode62%
+\catcode64=\the\catcode64%
+\catcode91=\the\catcode91%
+\catcode93=\the\catcode93%
+\catcode94=\the\catcode94%
+\catcode95=\the\catcode95%
+\catcode126=\the\catcode126%
+\endlinechar=\the\endlinechar
+\relax}
+\catcode32=10 %< >
+\catcode33=12 %<">
+\catcode35=6 %<#>
+\catcode40=12 %<(>
+\catcode41=12 %<)>
+\catcode42=12 %<*>
+\catcode43=12 %<+>
+\catcode44=12 %<,>
+\catcode45=12 %<->
+\catcode46=12 %<.>
+\catcode58=12 %<:>
+\catcode59=12 %<;>
+\catcode60=12 %<<>
+\catcode61=12 %<=>
+\catcode62=12 %<>>
+\catcode64=11 %<@>
+\catcode91=12 %<[>
+\catcode93=12 %<]>
+\catcode94=7 %<^>
+\catcode95=8 %<_>
+\catcode126=13 %<~>
+\endlinechar=-1 %
+
+\edef\ltj@ajmacros@AtEnd{\x
+ \noexpand\let\noexpand\ltj@ajmacros@AtEnd\relax}
+\def\luatexjaajmacrosLoaded{\endinput}
+
+%% Check if LaTeX is used.
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax %<*!LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iffalse\endcsname
+\else %<*LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iftrue\endcsname
+ \NeedsTeXFormat{LaTeX2e}
+ \ProvidesPackage{luatexja-ajmacros}[2017/05/05]
+\fi %</LaTeX>
+
+%%------------------
+%! Main part of luatexja-ajmacros
+\newif\if@kana\@kanafalse
+%% for plain TeX
+\newcount\@tempcnta
+\newcount\@tempcntb
+\ifltj@in@latex\else
+ \def\@tw{\char"2}
+ \def\@ifstar#1#2#3{\ifx*#3\expandafter#1\else#2{#3}\fi}
+ \long\def\@gobble#1{}
+\fi
+
+{%
+\gdef\shift@CID#1#2{{\@tempcnta#1\advance\@tempcnta#2\CID{\@tempcnta}}}
+\gdef\ajTsumesuji{\@ifstar{\@@ajTsumesuji}{\@ajTsumesuji}}
+\global\let\ajTumesuji\ajTsumesuji
+\gdef\@ajTsumesuji#1#2{{\@tempcnta\unless\ifnum\ltjgetparameter{direction}=3 \ifcase#1\or780\or247\or9758\or9738\fi
+ \else\ifcase#1\or8736\or8966\or13274\or13254\fi\fi
+ \aj@expand\aj@Tsumesuji#2\@nil}}
+\gdef\@@ajTsumesuji#1{\@ajTsumesuji{\aj@expand\aj@count@toks#14321\@nil}{#1}}
+\gdef\aj@expand#1#2{\expandafter\@aj@expand\number#2!#1}
+\gdef\@aj@expand#1!#2{#2#1}
+\gdef\aj@count@toks#1#2#3#4#5#6\@nil{#5}
+\gdef\aj@Tsumesuji#1{\ifx\@nil#1\else\shift@CID{\@tempcnta}{#1}%
+ \expandafter\aj@Tsumesuji
+ \fi}
+\gdef\ajMaru{\@ifstar{\@aj@Maru}{\aj@Maru}}
+\gdef\aj@Maru#1{\ifnum#1=\z@ \CID{8224}%
+ \else\ifnum#1<21 \shift@CID{#1}{7554}%
+ \else\ifnum#1=21 \CID{8091}%
+ \else\ifnum#1<32 \shift@CID{#1}{8080}%
+ \else\shift@CID{#1}{10212}%
+ \fi\fi\fi\fi}
+\gdef\@aj@Maru#1{\ifnum#1<10 \shift@CID{#1}{10234}%
+ \else\ifnum#1<21 \shift@CID{#1}{7554}%
+ \else\ifnum#1=21 \CID{8091}%
+ \else\ifnum#1<32 \shift@CID{#1}{8080}%
+ \else\shift@CID{#1}{10212}%
+ \fi\fi\fi\fi}
+\gdef\ajKuroMaru{\@ifstar{\@aj@KuroMaru}{\aj@KuroMaru}}
+\gdef\aj@KuroMaru#1{\ifnum#1=\z@ \CID{10503}%
+ \else\ifnum#1<10 \shift@CID{#1}{8285}%
+ \else\shift@CID{#1}{10504}%
+ \fi\fi}
+\gdef\@aj@KuroMaru#1{\shift@CID{#1}{10504}}
+\gdef\ajKaku{\@ifstar{\@aj@Kaku}{\aj@Kaku}}
+\gdef\aj@Kaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{10764}}%
+ \else\shift@CID{#1}{10774}%
+ \fi}
+\gdef\@aj@Kaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{10765}}%
+ \else\shift@CID{#1}{10774}%
+ \fi}
+\gdef\ajKuroKaku{\@ifstar{\@aj@KuroKaku}{\aj@KuroKaku}}
+\gdef\aj@KuroKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11037}}%
+ \else\shift@CID{#1}{11047}%
+ \fi}
+\gdef\@aj@KuroKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11038}}%
+ \else\shift@CID{#1}{11047}%
+ \fi}
+\gdef\ajMaruKaku{\@ifstar{\@aj@MaruKaku}{\aj@MaruKaku}}
+\gdef\aj@MaruKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11307}}%
+ \else\shift@CID{#1}{11317}%
+ \fi}
+\gdef\@aj@MaruKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11308}}%
+ \else\shift@CID{#1}{11317}%
+ \fi}
+\gdef\ajKuroMaruKaku{\@ifstar{\@aj@KuroMaruKaku}{\aj@KuroMaruKaku}}
+\gdef\aj@KuroMaruKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11576}}%
+ \else\shift@CID{#1}{11586}%
+ \fi}
+\gdef\@aj@KuroMaruKaku#1{\ifnum#1<10{\@tempcnta#1\multiply\@tempcnta\tw@
+ \shift@CID{\@tempcnta}{11577}}%
+ \else\shift@CID{#1}{11586}%
+ \fi}
+\gdef\ajKakko{\@ifstar{\@aj@Kakko}{\aj@Kakko}}
+\gdef\aj@Kakko#1{\ifnum#1=\z@ \CID{8227}%
+ \else\ifnum#1<21 \shift@CID{#1}{8070}%
+ \else\shift@CID{#1}{9873}%
+ \fi\fi}
+\gdef\@aj@Kakko#1{\ifnum#1<10 \shift@CID{#1}{9884}%
+ \else\ifnum#1<21 \shift@CID{#1}{8070}%
+ \else\shift@CID{#1}{9873}%
+ \fi\fi}
+\gdef\ajRoman{\@ifstar{\@aj@Roman}{\aj@Roman}}
+\gdef\aj@Roman#1{\ifnum#1<11 \shift@CID{#1}{7574}%
+ \else\ifnum#1<13 \shift@CID{#1}{8214}%
+ \else\shift@CID{#1}{8282}%
+ \fi\fi}
+\gdef\@aj@Roman#1{\ifnum#1=4 \CID{9883}\else\aj@Roman{#1}\fi}
+\gdef\ajroman#1{\ifnum#1<11 \shift@CID{#1}{8091}%
+ \else\shift@CID{#1}{8287}%
+ \fi}
+\gdef\ajPeriod#1{\ifnum#1<10 \shift@CID{#1}{8061}\else\shift@CID{#1}{20577}\fi}%AJ1-6
+\gdef\ajKakkoalph#1{\shift@CID{#1}{8111}}
+\gdef\ajKakkoYobi#1{\shift@CID{#1}{8196}}
+\gdef\ajKakkoroman#1{\shift@CID{#1}{9973}}
+\gdef\ajKakkoRoman#1{\shift@CID{#1}{9988}}
+\gdef\ajKakkoAlph#1{\shift@CID{#1}{10003}}
+\gdef\ajKakkoHira#1{\shift@CID{#1}{10029}}
+\gdef\ajKakkoKata#1{\shift@CID{#1}{10077}}
+\gdef\ajKakkoKansuji#1{\shift@CID{#1}{10125}}
+\gdef\ajMaruKansuji#1{\shift@CID{#1}{10460}}
+\gdef\ajNijuMaru#1{\shift@CID{#1}{16222}}
+\gdef\ajRecycle#1{\shift@CID{#1}{16314}}
+\gdef\ajHasenKakuAlph#1{\shift@CID{#1}{20496}}%AJ1-6
+\gdef\ajCross#1{\shift@CID{#1}{20523}}%AJ1-6
+\gdef\ajSlanted{\@ifstar{\aj@Slanted}{\@aj@Slanted}}%AJ1-6
+\gdef\aj@Slanted#1{\shift@CID{#1}{20589}}%AJ1-6
+\gdef\@aj@Slanted#1{\ifnum#1<10 \shift@CID{#1}{9460}\else\shift@CID{#1}{20589}\fi}%AJ1-6
+\gdef\ajApostrophe#1{\shift@CID{#1}{20649}}%AJ1-6
+\global\let\ajYear\ajApostrophe%AJ1-6
+\gdef\ajSquareMark{\@ifstar{\aj@SquareMark}{\@ifnextchar+{\@aj@SquareMark}{\@ajSquareMark}}}
+\gdef\@ajSquareMark#1{\shift@CID{#1}{12229}}
+\gdef\aj@SquareMark#1{\shift@CID{#1}{12241}}
+\gdef\@aj@SquareMark+#1{\shift@CID{#1}{\ifodd\@tempcnta24459\else24482\fi
+ \divide\@tempcnta\tw@}}
+\gdef\ajHishi#1{\shift@CID{#1}{12256}}
+%
+\let\offsetalph\z@
+\chardef\offsetAlph26
+\chardef\offsetHira26
+\chardef\offsetKata48
+\chardef\offsetYobi48
+\let\offsetMaru\z@
+\chardef\offsetKuroMaru144
+\chardef\offsetKaku122
+\chardef\offsetKuroKaku125
+\chardef\offsetMaruKaku122
+\chardef\offsetKuroMaruKaku121
+\@tempcnta10312
+\def\@aj@sujidef#1{\ifx\@nil#1%
+ \else\advance\@tempcnta\csname offset#1\endcsname
+ \expandafter\xdef\csname aj\@ajsujifam#1\endcsname##1%
+ {\noexpand\shift@CID{##1}{\number\@tempcnta}}%
+ \expandafter\@aj@sujidef\fi}
+\def\@ajsujidef#1{\ifx\@nil#1%
+ \else\advance\@tempcnta\csname offset#1\endcsname
+ \def\@ajsujifam{#1}%
+ \@aj@sujidef{alph}{Alph}{Hira}{Kata}{Yobi}\@nil
+ \expandafter\@ajsujidef\fi}
+\@ajsujidef{Maru}{KuroMaru}{Kaku}{KuroKaku}{MaruKaku}{KuroMaruKaku}\@nil
+\gdef\ajMaruYobi#1{\ifnum#1<8 \shift@CID{#1}{10470}%
+ \else\ifnum#1=8 \CID{10492}%
+ \else\ifnum#1=9 \CID{10487}%
+ \fi\fi\fi}
+%
+\gdef\ajTsumekakko#1{\aj@expand\@ajTsumekakko#1\@nil}
+\global\let\ajTumekakko\ajTsumekakko
+\gdef\@ajTsumekakko#1#2{\ifx\@nil#2\mbox{\unless\ifnum\ltjgetparameter{direction}=3 \rlap{\CID{10233}}\shift@CID{#1}{9872}%
+ \else\CID{13268}\shift@CID{#1}{10185}\CID{13269}\fi}%
+ \expandafter\@gobble
+ \else\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 10152\else10174\fi}%
+ \expandafter\aj@Tsumekakko
+ \fi#2}
+\gdef\aj@Tsumekakko#1#2{\ifx\@nil#2\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 10162\else10196\fi}%
+ \expandafter\@gobble
+ \else\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 247\else10185\fi}%
+ \expandafter\aj@Tsumekakko
+ \fi#2}
+\gdef\ajNenrei#1{\ifcase#1\relax\expandafter\ajTsumekakko\or\expandafter\aj@NenreiTu
+ \or\expandafter\aj@NenreiSai\or\expandafter\aj@Nenrei@Tu
+ \or\expandafter\aj@Nenrei@Sai
+ \fi}
+\gdef\aj@NenreiTu#1{\aj@expand\@aj@NenreiTu#1\@nil}
+\gdef\@aj@NenreiTu#1#2{\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 10152\else10174\fi}%
+ \ifx\@nil#2\CID{\unless\ifnum\ltjgetparameter{direction}=3 10172\else10206\fi}\expandafter\@gobble
+ \else\expandafter\aj@Tsumekakko
+ \fi#2}
+\gdef\aj@NenreiSai#1{\aj@expand\@aj@NenreiSai#1\@nil}
+\gdef\@aj@NenreiSai#1{\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 10152\else10174\fi}\@aj@NenreiSai@}
+\gdef\@aj@NenreiSai@#1{\ifx\@nil#1\CID{\unless\ifnum\ltjgetparameter{direction}=3 10173\else10207\fi}%
+ \else\shift@CID{#1}{\unless\ifnum\ltjgetparameter{direction}=3 247\else10185\fi}%
+ \expandafter\@aj@NenreiSai@\fi}
+\gdef\aj@Nenrei@Tu#1{\ifnum#1<10 \shift@CID{#1}{10174}\CID{10206}%
+ \else\expandafter\@aj@Nenrei@Tu\number#1%
+ \fi}
+\gdef\@aj@Nenrei@Tu#1#2{\ifnum#2=\z@ \shift@CID{#1}{10174}\CID{10196}%
+ \else\ifnum#1<\tw@ \CID{10184}%
+ \else\shift@CID{#1}{10174}\CID{10195}%
+ \fi
+ \shift@CID{#2}{10196}%
+ \fi}
+\gdef\aj@Nenrei@Sai#1{\ifnum#1<10 \shift@CID{#1}{10174}%
+ \else\expandafter\@aj@Nenrei@Sai\number#1%
+ \fi\CID{10207}}
+\gdef\@aj@Nenrei@Sai#1#2{\ifnum#1<\tw@ \CID{10184}%
+ \else\shift@CID{#1}{10174}\CID{10195}%
+ \fi
+ \ifnum#2>\z@ \shift@CID{#2}{10185}%
+ \fi}
+\gdef\ajnenrei#1#2{\hskip\ltjgetparameter{kanjiskip}\hbox{\tate\ifnum#2<10
+ \shift@CID{#2}{10207}\CID{\ifcase#1\or10230\or10232\or10231\or10229\fi}%
+ \else\ifnum#2=10\CID{\ifodd#1 10208\else10217\fi}%
+ \CID{\ifcase#1\or10218\or10232\or10218\or10229\fi}%
+ \else\ifnum#2<20\CID{\ifodd#1 10208\else10217\fi}\shift@CID{#2}{10208}%
+ \else\expandafter\aj@nenrei\number#2{#1}%
+ \fi\fi\fi}}
+\gdef\aj@nenrei#1#2#3{\shift@CID{#1}{10207}%
+ \ifcase#2 \CID{\ifodd#3 10218\else10228\fi}%
+ \else\shift@CID{#2}{10218}%
+ \fi}
+\gdef\ajKosu{\ajnenrei4}
+%
+\gdef\ajLabel#1#2#{\ifx\\#2\\\aj@Label#1\else\@aj@Label#1#2\fi}
+\gdef\aj@Label#1\else#2\fi#3{\fi
+ \expandafter\protect
+ \expandafter#1%
+ \expandafter{\number\csname c@#3\endcsname}}
+\gdef\@aj@Label#1#2\fi#3{\fi
+ \expandafter\protect
+ \expandafter#1%
+ \expandafter#2%
+ \expandafter{\number\csname c@#3\endcsname}}
+%
+%
+\gdef\ajFrac{\@ifstar{\@aj@Frac}{\aj@Frac}}
+\gdef\@ajFrac#1#2{\ifcase#2\or
+ \or\ifcase#1\or9826\fi
+ \or\ifcase#1+9825\or9827\or9828\fi
+ \or\ifcase#1\or9829\or9826\or9830\fi
+ \or\ifcase#1\or9831\or9832\or9833\or9834\fi
+ \or\ifcase#1\or9835\or9827\or9826\or9828\or9836\fi
+ \or\ifcase#1\or9837\or9838\or9839\or9840\or9841\or9842\fi
+ \or\ifcase#1\or9843\or9829\or9844\or9826\or9845\or9830\or9846\fi
+ \or\ifcase#1\or9847\or9848\or9827\or9849\or9850\or9828\or9851\or9852\fi
+ \or\ifcase#1\or9853\or9831\or9854\or9832\or9826\or9833\or9855\or9834\or9856\fi
+ \or\ifcase#1\or9857\or9858\or9859\or9860\or9861\or9862\or9863\or9864\or9865\or9866\fi
+ \or\ifcase#1\or9867\or9835\or9829\or9827\or9868\or9826\or9869\or9828\or9830\or9836
+ \or9870\fi
+ \else\ifnum#2=100 \ifnum#1=1 9871\fi\fi
+ \fi}
+\gdef\@aj@Frac#1#2{\CID{\@ajFrac{#1}{#2}}}
+\gdef\aj@Frac#1#2{{\@tempcnta\@ajFrac{#1}{#2}%
+ \advance\@tempcnta-9825
+ \advance\@tempcnta\ifcase\@tempcnta9780\or8183\or9779\or9779\or8181\else9778\fi\relax
+ \CID{\@tempcnta}}}
+%1/4 161 8880 9604 13120
+%1/2 162 8881 9605 13121
+%3/4 163 8882 9606 13122
+%1/8 9371 12887 9691 13207
+%3/8 9372 12888 9692 13208
+%5/8 9373 12889 9693 13209
+%7/8 9374 12890 9694 13210
+%1/3 9375 12891 9695 13211
+%2/3 9376 12892 9696 13212
+%
+%
+\def\@aj半角def#1{\ifx\@nil#1\else
+ \expandafter\xdef\csname aj半角@#1\endcsname{\noexpand\CID
+ {\noexpand\unless\noexpand\ifnum\noexpand\ltjgetparameter\noexpand{direction\noexpand}=3 \number\@tempcnta\noexpand\else\number\@tempcntb\noexpand\fi}}%
+ \advance\@tempcnta\@ne\advance\@tempcntb\@ne
+ \expandafter\@aj半角def\fi}
+\@tempcnta326
+\@tempcntb9084
+\@aj半角def  。「」、・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゛゜`ヰヱヮヵヶヴガギグゲゴザジズゼゾダヂヅデドバパビピブプベペボポ\@nil
+\@tempcnta516
+\@aj半角def をぁぃぅぇぉゃゅょっあいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわんゐゑゎがぎぐげござじずぜぞだぢづでどばぱびぴぶぷべぺぼぽ\@nil
+\gdef\aj半角#1{\aj@半角#1\@nil}
+\gdef\aj@半角#1{\ifx\@nil#1\else
+ \expandafter\ifx\csname aj半角@#1\endcsname\relax
+ #1\else\csname aj半角@#1\endcsname\fi
+ \expandafter\aj@半角\fi}
+%
+%
+\def\@ajligdef#1#2{\expandafter\xdef\csname ajLig\@ajmojifam#1\endcsname{\noexpand\CID{#2}}}
+\def\@ajligaturedef#1{\ifx\@nil#1\else
+ \@ajligdef{#1}{\number\@tempcnta}\advance\@tempcnta\@ne
+ \expandafter\@ajligaturedef\fi}
+\def\@aj@ligdef#1#2#3{\expandafter\xdef\csname ajLig\@ajmojifam#1\endcsname
+ {\unexpanded{\unless\ifnum\ltjgetparameter{direction}=3 }%
+ \noexpand\CID{#2}\noexpand\else\noexpand\CID{#3}\noexpand\fi}}
+\def\@aj@ligaturedef#1{\ifx\@nil#1\else
+ \@aj@ligdef{#1}{\number\@tempcnta}{\number\@tempcntb}%
+ \advance\@tempcnta\@ne\advance\@tempcntb\@ne
+ \expandafter\@aj@ligaturedef\fi}
+%
+\let\@ajmojifam\@empty
+\@tempcnta12111
+\@ajligaturedef{!!}{!?}{!*}{!!*}{!?*}\@nil
+\@ajligdef{?!}{16279}
+\@ajligdef{??}{16278}
+%
+\let\@ajmojifam\@empty
+\@tempcnta7601
+\@ajligaturedef{mm}{cm}{km}{mg}{kg}{cc}{m2}\@nil
+\@tempcnta7610
+\@ajligaturedef{No.}{K.K.}{TEL}\@nil
+\@tempcnta8020
+\@ajligaturedef{cm2}{km2}{cm3}{m3}{dl}{l}{kl}{ms}{micros}{ns}{ps}{KB}{MB}{GB}{HP}{Hz}{mb}{ml}\@nil
+\@ajligdef{KK.}{8053}
+\@ajligdef{Tel}{8055}
+\@ajligdef{in}{8182}
+\@tempcnta8186
+\@ajligaturedef{mm2}{mm3}{km3}{sec}{min}\@nil
+\@tempcnta8192
+\@ajligaturedef{cal}{kcal}{dB}\@nil
+\@tempcnta8303
+\@ajligaturedef{m}{g}{F}{TB}{FAX}{JIS}\@nil
+\@ajligdef{euro}{9779}
+\@aj@ligdef{euro*}{9354}{12870}
+\@aj@ligdef{ohm*}{9355}{12871}
+\@ajligdef{mho}{16204}
+\@aj@ligdef{mho*}{15515}{16526}
+\@aj@ligdef{No*}{20321}{20965}%AJ1-6
+\@tempcnta11846
+\@ajligaturedef{AM}{KK}{No}{PH}{PM}{PR}{tel}{tm}{VS}{a/c}{a.m.}{c/c}{c.c.}{c/o}{dl*}{hPa}{kl*}{l*}{microg}{microm}{ml*}{m/m}{n/m}{pH}{p.m.}\@nil
+\@ajligdef{JAS}{12088}
+\@tempcnta20919
+\@ajligaturedef{ppb}{ppm}{'S}{H2}{O2}{Ox}{Nx}{Q2}{Jr.}{Dr.}\@nil%AJ1-6
+%
+\let\@ajmojifam\@empty
+\@tempcnta7621
+\@tempcntb12041
+\@aj@ligaturedef{明治}{大正}{昭和}\@nil
+\@tempcnta7585
+\@tempcntb7940
+\@aj@ligaturedef{ミリ}{キロ}{センチ*}{メートル}{グラム*}{トン}{アール*}{ヘクタール}{リットル}{ワット*}{カロリー}{ドル}{セント*}{パーセント}{ミリバール}{ページ*}\@nil
+\@aj@ligdef{センチ}{8038}{8329}
+\@aj@ligdef{キロメートル}{8039}{8330}
+\@aj@ligdef{グラム}{8040}{8339}
+\@aj@ligdef{キログラム}{8041}{8340}
+\@aj@ligdef{アール}{8042}{8338}
+\@aj@ligdef{セント}{8043}{8348}
+\@aj@ligdef{ワット}{8044}{8344}
+\@aj@ligdef{ホーン}{8045}{8347}
+\@aj@ligdef{ヘルツ}{8046}{8343}
+\@aj@ligdef{ページ}{8047}{8349}
+\@aj@ligdef{アパート}{8048}{8350}
+\@aj@ligdef{ビル}{8049}{8358}
+\@aj@ligdef{マンション}{8050}{8357}
+\@aj@ligdef{コーポ}{8051}{8353}
+\@aj@ligdef{ハイツ}{8052}{8356}
+\@aj@ligdef{株式会社}{8054}{8324}
+\@aj@ligdef{インチ}{8183}{8333}
+\@aj@ligdef{有限会社}{8321}{8325}
+\@aj@ligdef{財団法人}{8322}{8326}
+\@aj@ligdef{平成}{8323}{12044}
+\@aj@ligdef{フィート}{8327}{8334}
+\@aj@ligdef{ヤード}{8328}{8337}
+\@aj@ligdef{インチ*}{8331}{8332}
+\@aj@ligdef{ヤード*}{8335}{8336}
+\@aj@ligdef{ヘルツ*}{8341}{8342}
+\@aj@ligdef{ホーン*}{8345}{8346}
+\@aj@ligdef{コーポ*}{8351}{8352}
+\@aj@ligdef{ハイツ*}{8354}{8355}
+\@aj@ligdef{さじ}{11871}{11872}
+\@tempcnta11873
+\@tempcntb11957
+\@aj@ligaturedef{アト}{アルファ}{アンペア}{イニング}{ウォン}{ウルシ}{エーカー}{エクサ}{エスクード}{オーム}{オングストローム}{オンス}{オントロ}{カイリ}%
+{カップ}{カラット}{ガロン}{ガンマ}{ギガ}{ギニー}{キュリー}{ギルダー}{キロリットル}{キロワット}{グスーム}{グラムトン}{クルサード}{クルゼイロ}{クローネ}%
+{ケース}{コルナ}{サイクル}{サンチーム}{シリング}{ダース}{デカ}{デシ}{テラ}{ドラクマ}{ナノ}{ノット}{バーツ}{バーレル}{パスカル}{バレル}{ピアストル}{ピクル}%
+{ピコ}{ファラッド}{ファラド}{フェムト}{ブッシェル}{フラン}{ベータ}{ヘクト}{ヘクトパスカル}{ペセタ}{ペソ}{ペタ}{ペニヒ}{ペンス}{ポイント}{ホール}{ボルト}{ホン}%
+{ポンド}{マイクロ}{マイル}{マッハ}{マルク}{ミクロン}{メガ}{メガトン}{ヤール}{ユアン}{ユーロ}{ラド}{リラ}{ルーブル}{ルクス}{ルピア}{ルピー}{レム}{レントゲン}\@nil
+\@tempcnta12045
+\@tempcntb12054
+\@aj@ligaturedef{医療法人}{学校法人}{共同組合}{協同組合}{合資会社}{合名会社}{社団法人}{宗教法人}{郵便番号}\@nil
+\expandafter\gdef\csname ajLigオングストローム*\endcsname
+ {\mbox{\kern.05zw\ajLig{オントロ}\kern-.1zw\ajLig{グスーム}\kern.05zw}}
+\@tempcnta20929
+\@tempcntb20943
+\@aj@ligaturedef{ガル}{グレイ}{クローナ}{シーベルト}{シェケル}{ジュール}{デシベル}{ドット}{バイト}{ビット}{ベクレル}{ボー}{ランド}{リンギット}\@nil%AJ1-6
+\@ajligdef{より}{12181}
+\@ajligdef{升}{16194}
+\@ajligdef{コト}{16195}
+\@aj@ligdef{令和}{23058}{23059}%AJ1-7
+%
+\def\@ajmojifam{○}
+\@tempcnta7613
+\@ajligaturedef 上中下左右\@nil
+\@ajligdef{〒}{8057}
+\@tempcnta8152
+\@ajligaturedef 夜企医協名宗労学有株社監資財\@nil
+\@ajligdef{印}{8191}
+\@ajligdef{秘}{8223}
+\@tempcnta8317
+\@ajligaturedef 大小優控\@nil
+\@tempcnta10478
+\@ajligaturedef 調注副減標欠基禁項休女男正写祝出適特済増問答例電\@nil%
+\@ajligdef{年}{20553}%AJ1-6
+%
+\def\@ajmojifam#1{(#1)}
+\@ajligdef{株}{7618}
+\@ajligdef{有}{7619}
+\@ajligdef{代}{7620}
+\@tempcnta8138
+\@ajligaturedef 至企協名労社監自資財特学祭呼\@nil
+\@ajligdef{祝}{8204}
+\@ajligdef{休}{8205}
+\@tempcnta10146
+\@ajligaturedef 営合注問答例\@nil
+%
+\def\@ajmojifam{□}
+\@ajligdef{印}{8196}
+\@ajligdef{負}{11030}
+\@ajligdef{勝}{11031}
+\@tempcnta20497
+\@ajligaturedef{:A}{:B}{:C}{:D}{:E}{:F}{:終}\@nil%AJ1-6
+\@tempcnta20505
+\@ajligaturedef{:CL}{:KCL}{:BEL}{:AS}{:AM}{:段}{:ゴ}{:ミ}\@nil%AJ1-6
+%
+\def\@ajmojifam{◇}
+\@tempcnta20554
+\@ajligaturedef {News}天再新映声前後終立交{ほか}劇司解株気二多文手{PV}{MV}双{SS}{S1}{S2}{S3}デ{HV}\@nil%AJ1-6
+%
+\def\@ajmojifam{▽}
+\@ajligdef{〒}{12180}
+\@ajligdef{▽}{12193}
+%
+\def\@ajmojifam{△}
+\@ajligdef{!}{12192}
+%
+\def\@ajmojifam{■}
+\@ajligdef{◇}{12231}
+%
+\expandafter\chardef\csname offset●\endcsname\z@
+\expandafter\mathchardef\csname offset□\endcsname269
+\expandafter\mathchardef\csname offset■\endcsname268
+\expandafter\mathchardef\csname offset◇\endcsname267
+\expandafter\mathchardef\csname offset◆\endcsname266
+\@tempcnta10760
+\def\@ajmojidef#1{\ifx\@nil#1%
+ \else\advance\@tempcnta\csname offset#1\endcsname
+ \def\@ajmojifam{#1}%
+ \@ajligaturedef 問答例\@nil
+ \expandafter\@ajmojidef\fi}
+\@ajmojidef ●□■◇◆\@nil
+%
+\def\@ajkanadef#1#2#3#4#5#6#7{\expandafter\gdef\csname ajLig#1\endcsname
+ {\if@kana\def\reserved@a{ruby}%
+ \ifx\k@family\reserved@a
+ \unless\ifnum\ltjgetparameter{direction}=3 \CID{#6}\else\CID{#7}\fi
+ \else\unless\ifnum\ltjgetparameter{direction}=3 \CID{#4}\else\CID{#5}\fi
+ \fi
+ \else\unless\ifnum\ltjgetparameter{direction}=3 \CID{#2}\else\CID{#3}\fi
+ \fi}}
+\newcount\@tempcntc
+\newcount\@tempcntd
+\newcount\@tempcnte
+\newcount\@tempcntf
+\def\@aj@kanadef#1{\ifx\@nil#1%
+ \else\edef\reserved@b{\noexpand\@ajkanadef{#1}%
+ {\number\@tempcnta}{\number\@tempcntb}{\number\@tempcntc}%
+ {\number\@tempcntd}{\number\@tempcnte}{\number\@tempcntf}}\reserved@b
+ \advance\@tempcnta\@ne\advance\@tempcntb\@ne\advance\@tempcntc\@ne
+ \advance\@tempcntd\@ne\advance\@tempcnte\@ne\advance\@tempcntf\@ne
+ \expandafter\@aj@kanadef\fi}
+\@ajkanadef{う゛}{7958}{7958}{12361}{12544}{12756}{12756}
+\@tempcnta8313
+\@tempcntb8313
+\@tempcntc12452
+\@tempcntd12635
+\@tempcnte16444
+\@tempcntf16444
+\@aj@kanadef{ワ゛}{ヰ゛}{ヱ゛}{ヲ゛}\@nil
+\@tempcnta16209
+\@tempcntb16209
+\@tempcntc16352
+\@tempcntd16382
+\@tempcnte16414
+\@tempcntf16414
+\@aj@kanadef{か゜}{き゜}{く゜}{け゜}{こ゜}{カ゜}{キ゜}{ク゜}{ケ゜}{コ゜}{セ゜}{ツ゜}{ト゜}\@nil
+\@ajkanadef{小か}{7959}{8264}{12285}{12468}{12682}{12762}
+\@ajkanadef{小け}{7960}{8265}{12292}{12475}{12689}{12763}
+\@ajkanadef{小こ}{12269}{12270}{12295}{12478}{16448}{16467}
+\@ajkanadef{小コ}{12271}{12272}{12385}{12568}{16449}{16468}
+\@tempcnta16236
+\@tempcntb16333
+\@tempcntc16365
+\@tempcntd16395
+\@tempcnte16427
+\@tempcntf16450
+\@aj@kanadef{小ク}{小シ}{小ス}{小ト}{小ヌ}{小ハ}{小ヒ}{小フ}{小ヘ}{小ホ}{小プ}{小ム}{小ラ}{小リ}{小ル}{小レ}{小ロ}\@nil
+%
+\def\@aj@numberdef#1#2{\ifx\@nil#2\expandafter\@gobble
+ \else\expandafter\xdef\csname ajnumber#2\endcsname{{#1}{\number\@tempcnta}}%
+ \advance\@tempcnta\@ne
+ \expandafter\@aj@numberdef\fi{#1}}
+\@tempcnta\@ne
+\@aj@numberdef{alph}abcdefghijklmnopqrstuvwxyz\@nil
+\@tempcnta\@ne
+\@aj@numberdef{Alph}ABCDEFGHIJKLMNOPQRSTUVWXYZ\@nil
+\@tempcnta\@ne
+\@aj@numberdef{Hira}あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん\@nil
+\@tempcnta\@ne
+\@aj@numberdef{Kata}アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン\@nil
+\@tempcnta\@ne
+\@aj@numberdef{Yobi}日月火水木金土祝休\@nil
+\gdef\@ajnumber#1{\expandafter\expandafter\expandafter\aj@number\csname ajnumber#1\endcsname}
+\gdef\aj@number#1{\ifx\relax#1\expandafter\@gobbletwo\else\expandafter\@aj@number\fi{#1}}
+\gdef\@aj@number#1#2#3{\csname aj#3#1\endcsname{#2}}
+%
+\def\@aj@kakomidef#1#2{\expandafter\gdef\csname#1\endcsname##1%
+ {\expandafter\ifx\csname ajLig#1##1\endcsname\relax\@ajnumber{##1}{#2}%
+ \else\csname ajLig#1##1\endcsname\fi}}
+\@aj@kakomidef{○}{Maru}
+\@aj@kakomidef{●}{KuroMaru}
+\@aj@kakomidef{□}{Kaku}
+\@aj@kakomidef{■}{KuroKaku}
+\@aj@kakomidef{◇}{MaruKaku}
+\@aj@kakomidef{◆}{KuroMaruKaku}
+\gdef\△#1{\csname ajLig△#1\endcsname}
+\gdef\▽#1{\csname ajLig▽#1\endcsname}
+\gdef\(#1){\expandafter\ifx\csname ajLig(#1)\endcsname\relax\@ajnumber{#1}{Kakko}%
+ \else\csname ajLig(#1)\endcsname\fi}
+\gdef\゛#1{\csname ajLig#1゛\endcsname}
+\gdef\゜#1{\csname ajLig#1゜\endcsname}
+\gdef\!#1{\csname ajLig小#1\endcsname}
+\gdef\ajLig#1{\csname ajLig#1\endcsname}
+%
+%
+\def\@ajPICTdef#1#2{\expandafter\xdef\csname ajPICT#1\endcsname{\noexpand\CID{#2}}}
+\def\@aj@PICTdef#1{\ifx\@nil#1\else
+ \@ajPICTdef{#1}{\number\@tempcnta}\advance\@tempcnta\@ne
+ \expandafter\@aj@PICTdef\fi}
+\@tempcnta8016
+\@aj@PICTdef{Club}{Heart}{Spade}{Diamond}\@nil
+\@ajPICTdef{電話}{8056}
+\@ajPICTdef{〒}{8058}
+\@tempcnta8211
+\@aj@PICTdef{Spade*}{Heart*}{Club*}{Diamond*}\@nil
+\@tempcnta8215
+\@aj@PICTdef 晴曇雨雪→←↑↓\@nil
+\@ajPICTdef{野球}{12097}
+\@ajPICTdef{湯}{12098}
+\@ajPICTdef{花}{12228}
+\@ajPICTdef{花*}{12229}
+\@ajPICTdef{サッカー}{20957}%AJ1-6
+\gdef\ajPICT#1{\csname ajPICT#1\endcsname}
+\global\let\※\ajPICT
+%
+%
+\def\@ajArrowdef#1#2{\expandafter\xdef\csname ajArrow#1\endcsname{\noexpand\CID{#2}}}
+\def\@aj@Arrowdef#1{\ifx\@nil#1\else
+ \@ajArrowdef{#1}{\number\@tempcnta}\advance\@tempcnta\@ne
+ \expandafter\@aj@Arrowdef\fi}
+\@tempcnta8009
+\@aj@Arrowdef{LeftTriangle}{RightTriangle}{DOWN}{UP}{LEFT}{RIGHT}\@nil
+\@tempcnta8206
+\@aj@Arrowdef{RIGHT*}{LEFT*}{UP*}{DOWN*}\@nil
+\@tempcnta8219
+\@aj@Arrowdef{RightHand}{LeftHand}{UpHand}{DownHand}\@nil
+\@tempcnta8309
+\@aj@Arrowdef{Left/Right}{Right/Left}{Up/Down}{Down/Up}\@nil
+\@tempcnta12175
+\@aj@Arrowdef{LeftScissors}{RightScissors}{UpScissors}{DownScissors}\@nil
+\@tempcnta12194
+\@aj@Arrowdef
+{LeftTriangle*}{RightTriangle*}{Left}{Right}{Up}{Down}{LeftDouble}{LeftRight*}{RightDown}{LeftDown}{LeftUp}{RightUp}%
+{Right/Left*}{Left/Right*}{Right/Left+}{Down/Up+}{Left+}{Right+}{Up+}{Down+}{LeftRight+}{UpDown+}\@nil
+\@tempcnta12261
+\@aj@Arrowdef
+{LeftAngle}{RightAngle}{UpAngle}{DownAngle}{LeftAngle*}{RightAngle*}{UpAngle*}{DownAngle*}\@nil
+\@ajArrowdef{RightDouble}{15482}%752 16493
+\@ajArrowdef{LeftRightDouble}{15483}%753 16494
+%\@ajArrowdef{LeftRight}{15511}%12201 16522
+\@ajArrowdef{RightUp*}{16201}
+\@ajArrowdef{RightDown*}{16202}
+%\@ajArrowdef{DOWNLEFT*}{16273}
+\gdef\ajArrow#1{\csname ajArrow#1\endcsname}
+%
+%
+\def\@aj@kuntendef#1{\ifx\@nil#1%
+ \else\expandafter\xdef\csname aj訓点#1\endcsname
+ {\noexpand\CID{\number\@tempcnta}}%
+ \advance\@tempcnta\@ne
+ \expandafter\@aj@kuntendef
+ \fi}
+\@tempcnta16283
+\@aj@kuntendef |レ一二三四上中下甲乙丙丁天地人\@nil
+\gdef\aj@smallReten{{\@tempdimb\f@size pt\@tempskipa\f@baselineskip
+ \@tempdimb.94\@tempdimb
+ \@tempskipa.94\@tempskipa
+ \fontsize{\@tempdimb}{\@tempskipa}\selectfont\aj訓点レ}}
+\gdef\aj訓点一レ{\mbox{\tate\kern-.24zw\aj訓点一\kern-.65zw\raise.15zw\hbox{\aj@smallReten}}}
+\gdef\aj訓点上レ{\mbox{\tate\aj訓点上\kern-.3zw\raise.15zw\hbox{\aj@smallReten}}}
+\gdef\aj訓点甲レ{\mbox{\tate\aj訓点甲\kern-.25zw\raise.15zw\hbox{\aj@smallReten}}}
+\gdef\aj訓点天レ{\mbox{\tate\aj訓点天\kern-.4zw\raise.1zw\hbox{\aj@smallReten}}}
+\def\@ajongofudef#1{\ifx\@nil#1%
+ \else\expandafter\xdef\csname aj訓点#1|\endcsname
+ {\noexpand\mbox{\yoko\expandafter\noexpand\csname aj訓点#1\endcsname
+ \hbox to\z@{\hss\expandafter\noexpand\csname aj訓点|\endcsname\kern-.5zw}}}%
+ \expandafter\@ajongofudef\fi}
+\@ajongofudef 二三四中下乙丙丁地人\@nil
+\expandafter\gdef\csname aj訓点 |\endcsname{\mbox{\yoko{ }\hbox to\z@{\hss\csname aj訓点|\endcsname\kern-.5zw}}}
+\def\@ajkungofudef#1{\ifx\@nil#1%
+ \else\expandafter\xdef\csname aj訓点|#1\endcsname
+ {\noexpand\mbox{\yoko\hbox to\z@{\hss\expandafter\noexpand\csname aj訓点|\endcsname\kern-.5zw}%
+ \expandafter\noexpand\csname aj訓点#1\endcsname}}%
+ \expandafter\@ajkungofudef\fi}
+\@ajkungofudef 二三四中下乙丙丁地人\@nil
+\expandafter\gdef\csname aj訓点| \endcsname{\mbox{\yoko\hbox to\z@{\hss\csname aj訓点|\endcsname\kern-.5zw}{ }}}
+%
+\gdef\ajKunten#1{\csname aj訓点#1\endcsname}
+%
+\newtoks\@temptokenb
+\newtoks\@temptokenc
+\gdef\ajRedefine@KundokuMacros{\ifx\kokana\@undefined
+ \else\let\orig@kokana\kokana
+ \let\orig@retenform\retenform
+ \let\orig@reten\reten
+ \let\orig@retenkana\retenkana
+ \let\orig@kaeriten\kaeriten
+ \def\aj@kokana##1##2{\orig@kokana{\aj@kundokusize\if@kana\rubyfamily\fi##1}%
+ {\aj@kundokusize\ajKunten{##2}}}%
+ \def\aj@retenform{\aj@kundokusize\aj訓点レ}%
+ \def\aj@reten{\orig@kaeriten{\aj@kundokusize\aj訓点レ}}%
+ \def\aj@retenkana##1{\orig@retenkana{\aj@kundokusize\if@kana\rubyfamily\fi##1}}%
+ \def\aj@kaeriten##1{\orig@kaeriten{\aj@kundokusize\ajKunten{##1}}}%
+ \let\aj@kundokusize\tiny
+ \fi
+ \ifx\@k@nd@ku@\@undefined
+ \else{\global\let\orig@k@nd@ku@\@k@nd@ku@
+ \def\get@hbox##1\hbox##2##3\get@hbox
+ {\@temptokena{##1}\@temptokenb{##2}\@temptokenc{##3}}%
+ \expandafter\get@hbox
+ \@k@nd@ku@[##1]{##2}{##3}{##4}{\ajKunten{##5}}[\ajKunten{##6}]<##7>(##8)\get@hbox
+ \def\change@reten##1\def\temptopleft##2\def\tempbottomleft##3##4\change@reten
+ {\@temptokenb{##1\def\temptopleft{####6}\def\tempbottomleft{####5}##4}}%
+ \expandafter\change@reten\the\@temptokenb\change@reten
+ \edef\redefine@k@nd@ku@##1{\gdef\noexpand\aj@k@nd@ku@##1%
+ {\the\@temptokena\hbox{\the\@temptokenb}\the\@temptokenc}}%
+ \redefine@k@nd@ku@{[##1]##2##3##4##5[##6]<##7>(##8)}}%
+ \let\aj@kundokusize\kundokusize
+ \fi}
+\ifltj@in@latex
+ \@onlypreamble\ajRedefine@KundokuMacros
+ \AtBeginDocument{\ajRedefine@KundokuMacros}
+\fi
+\gdef\DeclareOriginalKundokuStyle{\@ifnextchar[%]
+ {\Declare@OriginalKundokuStyle}%
+ {\Declare@OriginalKundokuStyle[\aj@kundokusize]}}
+\gdef\Declare@OriginalKundokuStyle[#1]{\let\aj@kundokusize#1%
+ \ifx\orig@k@nd@ku@\@undefined
+ \else\let\@k@nd@ku@\orig@k@nd@ku@
+ \let\kundokusize\aj@kundokusize
+ \fi
+ \ifx\orig@kokana\@undefined
+ \else
+ \let\kokana\orig@kokana
+ \let\retenform\orig@retenform
+ \let\reten\orig@reten
+ \let\retenkana\orig@retenkana
+ \let\kaeriten\orig@kaeriten
+ \fi}
+\gdef\DeclareAJKundokuStyle{\@ifnextchar[%]
+ {\Declare@AJKundokuStyle}%
+ {\Declare@AJKundokuStyle[\aj@kundokusize]}}
+\gdef\Declare@AJKundokuStyle[#1]{\let\aj@kundokusize#1%
+ \ifx\aj@k@nd@ku@\@undefined
+ \else\let\@k@nd@ku@\aj@k@nd@ku@
+ \def\kundokusize{\aj@kundokusize\if@kana\rubyfamily\fi}%
+ \fi
+ \ifx\aj@kokana\@undefined
+ \else
+ \let\kokana\aj@kokana
+ \let\retenform\aj@retenform
+ \let\reten\aj@reten
+ \let\retenkana\aj@retenkana
+ \let\kaeriten\aj@kaeriten
+ \fi}
+%
+%
+\gdef\ajCIDVarDef{\aj@VarDef\CID}
+\gdef\ajUTFVarDef{\aj@VarDef\UTF}
+\gdef\aj@VarDef#1#2#3{\expandafter\xdef\csname ajVar#2\endcsname{\noexpand#1{#3}}}
+\gdef\ajCIDVarList#1{{\@ajCIDVarList#1\relax}}
+\gdef\@ajCIDVarList#1{\ifx\relax#1\else\def\reserved@a{#1}\expandafter\aj@CIDVarList\fi}
+\gdef\aj@CIDVarList{\afterassignment\@aj@CIDVarList\@tempcnta}
+\gdef\@aj@CIDVarList{\aj@VarDef\CID\reserved@a{\number\@tempcnta}\@ajCIDVarList}
+\gdef\ajUTFVarList#1{{\@ajUTFVarList#1 \relax}}
+\gdef\@ajUTFVarList#1{\ifx\relax#1\else\def\reserved@a{#1}\expandafter\aj@UTFVarList\fi}
+\gdef\aj@UTFVarList#1#2{\ifx=#1\expandafter\@aj@UTFVarList\else\expandafter\@aj@UTFVarList\expandafter#1\fi#2}
+\gdef\@aj@UTFVarList#1 {\aj@VarDef\UTF\reserved@a{#1}\@ajUTFVarList}
+\gdef\ajVar#1{\csname ajVar#1\endcsname}
+\ifltj@in@latex
+ \@onlypreamble\ajCIDVarDef
+ \@onlypreamble\ajUTFVarDef
+ \@onlypreamble\ajCIDVarList
+ \@onlypreamble\ajUTFVarList
+\fi
+%\ajCIDVarList{吉=13706 教=8471 高=8705 鴎=7646 崎=14290 碕=17009 第=13910 角=13682 浜=8531}
+\gdef\ajHashigoTaka{\CID{8705}}
+\gdef\ajTsuchiYoshi{\CID{13706}}
+\gdef\ajTatsuSaki{\CID{14290}}
+\gdef\ajMayuHama{\CID{8531}}
+%
+%
+%\gdef\ajRedefine@ajVar{\@ifpackageloaded{hyperref}{%
+% \let\aj@Var\ajVar
+% \def\ajVar##1{\ifHy@pdfstring
+% \expandafter\expandafter
+% \expandafter\check@UTF\csname ajVar##1\endcsname{##1}%
+% \else\aj@Var{##1}\fi}
+% \def\check@UTF##1##2##3{\ifx\UTF##1\0x##2\else##3\fi}}{}}
+\gdef\ajRedefine@ajCommands{\@ifpackageloaded{hyperref}{%
+ \let\hyperref@ajLabel\ajLabel
+ \def\ajLabel##1##{\ifHy@pdfstring\Hy@ReturnAfterElseFi\hyperref@ajLabel\@arabic\else\ltx@ReturnAfterFi\hyperref@ajLabel##1\fi}%
+ \ajRedefine@ajCommand\△{Lig△}\▽{Lig▽}\!{Lig小}\ajLig{Lig}\ajPICT{PICT}\※{PICT}\ajVar{Var}\@nil\@nil
+ \aj@Redefine@ajCommand○{Maru}●{KuroMaru}□{Kaku}■{KuroKaku}◇{MaruKaku}◆{KuroMaruKaku}\@nil\@nil
+ \def\(##1){\ifHy@pdfstring(##1)\else\expandafter\ifx\csname ajLig(##1)\endcsname\relax\@ajnumber{##1}{Kakko}%
+ \else\csname ajLig(##1)\endcsname\fi\fi}%
+ \def\゛##1{\ifHy@pdfstring##1゛\else\csname ajLig##1゛\endcsname\fi}%
+ \def\゜##1{\ifHy@pdfstring##1゜\else\csname ajLig##1゜\endcsname\fi}%
+ }{}}
+\gdef\ajRedefine@ajCommand#1#2{\ifx\@nil#1\else\def#1##1{\ifHy@pdfstring##1\else\csname aj#2##1\endcsname\fi}%
+ \expandafter\ajRedefine@ajCommand\fi}
+\gdef\aj@Redefine@ajCommand#1#2{\ifx\@nil#1\else\expandafter\def\csname#1\endcsname##1%
+ {\ifHy@pdfstring##1\else\expandafter\ifx\csname ajLig#1##1\endcsname\relax\@ajnumber{##1}{#2}\else
+ \csname ajLig#1##1\endcsname\fi\fi}%
+ \expandafter\aj@Redefine@ajCommand\fi}
+\ifltj@in@latex
+ \AtBeginDocument{\ajRedefine@ajCommands}
+\fi
+%
+%
+\gdef\ajLeader{\@ifnextchar[{\aj@Leader}{\aj@Leader[\z@ plus1fill]}}
+\gdef\aj@Leader[#1]#2{{\@tempcnta#2\multiply\@tempcnta\tw@
+ \advance\@tempcnta1221\ifhmode\unless\ifnum\ltjgetparameter{direction}=3 4\else5\fi\else\unless\ifnum\ltjgetparameter{direction}=3 5\else4\fi\fi
+ \leaders\hbox{\CID{\@tempcnta}}\ifhmode\hskip\else\vskip\fi#1}}
+%
+%
+\endlinechar=13
+\toks0{}\toks1{}\toks2{}\toks3{}
+\def\ajQuotedef#1 #2 #3 #4 {\ifx*#1\else
+ \toks0\expandafter{\the\toks0 \or#1}%
+ \toks1\expandafter{\the\toks1 \or#2}%
+ \toks2\expandafter{\the\toks2 \or#3}%
+ \toks3\expandafter{\the\toks3 \or#4}%
+ \expandafter\ajQuotedef\fi}
+\ajQuotedef
+670 671 12173 12174
+672 673 7956 7957
+674 675 7899 7900
+676 677 7901 7902
+678 679 7903 7904
+680 681 7905 7906
+682 683 7907 7908
+684 685 7909 7910
+686 687 7911 7912
+688 689 7913 7914
+690 691 7915 7916
+7608 7609 7956 7957
+12125 12126 12135 12136
+12127 12128 12137 12138
+12129 12130 12139 12140
+12131 12132 12141 12142
+12171 12172 12173 12174
+16197 16198 16329 16330
+* * * *
+\def\@removetop#1{\toks#1\expandafter\expandafter\expandafter{\expandafter\@gobble\the\toks#1}}
+\@removetop0\@removetop1\@removetop2\@removetop3
+\xdef\ajQuote#1#2{\noexpand\CID{\noexpand\unless\noexpand\ifnum\noexpand\ltjgetparameter\noexpand{direction\noexpand}=3 \noexpand\ifcase#1 \the\toks0
+ \noexpand\fi\noexpand\else\noexpand\ifcase#1 \the\toks2
+ \noexpand\fi\noexpand\fi}#2\inhibitglue\noexpand\CID{\noexpand\unless\noexpand\ifnum\noexpand\ltjgetparameter\noexpand{direction\noexpand}=3 \noexpand\ifcase#1 \the\toks1
+ \noexpand\fi\noexpand\else\noexpand\ifcase#1 \the\toks3
+ \noexpand\fi\noexpand\fi}}
+}
+\ifltj@in@latex\else
+ \ajRedefine@KundokuMacros
+\fi
+%%------------------ all done
+\ltj@ajmacros@AtEnd
+\endinput
+%% EOF
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-25c.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-25c.sty
new file mode 100644
index 0000000000..9c67b70358
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-25c.sty
@@ -0,0 +1,357 @@
+%
+% luatexja-fontspec-25c.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-fontspec-25c}[2019/05/14 fontspec support of LuaTeX-ja]
+\RequirePackage{l3keys2e}
+\ExplSyntaxOn
+
+%%%%%%%% Change Japanese font family by \rmfamily or not
+\cs_new:Npn \ltj_fontspec_match_cmd {
+ \renewcommand\jttdefault{\gtdefault}
+ \@ltj@match@familytrue
+ \DeclareDocumentCommand \setmonojfont { O{} m O{} } {
+ \ltj_fontspec_set_family:Nnn \jttdefault {##1,##3}{##2}
+ \normalfont
+ }
+}
+\bool_if:NT \__ltj_fontspec_match_bool \ltj_fontspec_match_cmd
+
+%%%%%%%% Messages
+\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored}
+{
+ \string\addjfontfeature (s)~ ignored;\\
+ it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec.
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified).
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified).
+}
+
+\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx}
+
+%%%%%%%% Internal control sequences
+%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec.
+\cs_new:Nn \ltj_fontspec_define_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec} {#1} {#2}
+}
+\cs_new:Nn \ltj_fontspec_define_preparse_external:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {#1} {#2}
+}
+\cs_new:Nn \ltj_fontspec_define_altfont_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-ltjaltfont} {#1} {#2}
+}
+
+%% Alternate Fonts
+%% Spec: AltFont = {
+%% ...
+%% { Range = <range>, <font features> },
+%% { Range = <range>, Font = <font name>, <font features> },
+%% { Range = <range>, Font = <font name> },
+%% ...
+%% }
+\tl_new:N \l_ltj_fontspec_altname_tl
+\tl_new:N \l_ltj_fontspec_altrange_tl
+\clist_new:N \l_ltj_fontspec_altfont_clist
+\clist_new:N \l_ltj_fontspec_altfont_leftover_clist
+\int_new:N \g_ltj_fontspec_altnumber_int
+
+\ltj_fontspec_define_altfont_option:nn {Range} {
+ \tl_set:Nn \l_ltj_fontspec_altrange_tl {#1}
+}
+\ltj_fontspec_define_altfont_option:nn {Font} {
+ \fontspec_complete_fontname:Nn \l_ltj_fontspec_altname_tl {#1}
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {AltFont} {
+ \clist_put_right:Nn \l_ltj_fontspec_altfont_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {YokoFeatures} {
+ \clist_put_right:Nn \l_ltj_fontspec_fontfeat_yoko_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFeatures} {
+ \clist_put_right:Nn \l_ltj_fontspec_fontfeat_tate_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFont} {
+ \tl_if_empty:nF {#1} {
+ \fontspec_complete_fontname:Nn \l_ltj_fontspec_fontname_tate_tl {#1}
+ }
+}
+%%
+\clist_new:N \l_ltj_fontspec_fontfeat_yoko_clist
+\clist_new:N \l_ltj_fontspec_fontfeat_tate_clist
+\tl_new:N \l_ltj_fontspec_fontname_tate_tl
+
+\cs_new:Npn \ltj_fontspec_DeclareFontFamily #1 #2 #3 {
+ \DeclareKanjiFamily {JY3} {#2} {#3}
+ \DeclareKanjiFamily {JT3} {#2} {#3}
+}
+
+\cs_set_eq:NN \__ltj_orig_fontspec_select_font_family:nn \__fontspec_select_font_family:nn
+\cs_new_protected:Nn \ltj_fontspec_select_font_family:nn {
+ \group_begin:
+ \ltj_fontspec_define_option:nn {NoEmbed} {}
+ \ltj_fontspec_define_option:nn {AltFont} {
+ \clist_put_right:Nn \l_ltj_fontspec_altfont_clist { ##1 }
+ }
+ \ltj_fontspec_define_option:nn {CID} {
+ \__fontspec_update_featstr:n {cid=##1}
+ }
+ \ltj_fontspec_define_option:nn {Kanjiskip} {
+ \str_if_eq_x:nnTF {false} { \str_lower_case:n { ##1 } }{
+ \__fontspec_update_featstr:n {-ltjksp}
+ } {
+ \__fontspec_update_featstr:n {+ltjksp}
+ }
+ }
+ \ltj_fontspec_define_option:nn {JFM} {
+ \__fontspec_update_featstr:n {jfm=##1}
+ }
+ % vary by shape
+ \ltj_fontspec_define_option:nn {YokoFeatures} {
+ \clist_put_right:Nn \l_ltj_fontspec_fontfeat_yoko_clist { ##1 }
+ }
+ \ltj_fontspec_define_option:nn {TateFeatures} {
+ \clist_put_right:Nn \l_ltj_fontspec_fontfeat_tate_clist { ##1 }
+ }
+ \ltj_fontspec_define_option:nn {TateFont}
+ {
+ \tl_if_empty:nF {##1} {
+ \fontspec_complete_fontname:Nn \l_ltj_fontspec_fontname_tate_tl {##1}
+ }
+ }
+ \ltj_fontspec_define_option:nn {JFM-var} {
+ \__fontspec_update_featstr:n {jfmvar=##1}
+ }
+ \ltj_fontspec_define_preparse_external:nn {NoEmbed} {
+ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 {psft:##1}
+ }
+
+ %% Omit the warning message
+ %% "OpenType feature 'Kerning=Off' (-kern) not available ..."
+ \keys_define:nn {fontspec-opentype} {
+ Kerning/Off.code:n=\__fontspec_update_featstr:n {-kern}
+ }
+ \clist_set:Nx \g__fontspec_default_fontopts_clist {
+ YokoFeatures = { JFM=\ltj@stdyokojfm }, TateFeatures = { JFM=\ltj@stdtatejfm },
+ Scale=\Cjascale, Kerning=Off, Script=CJK,
+ \g__ltj_fontspec_default_fontopts_clist
+ }
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \cs_set_eq:NN \__fontspec_make_font_shapes:Nnnnn \ltj_fontspec_make_font_shapes:Nnnnn
+ \cs_set_eq:NN \DeclareFontFamily \ltj_fontspec_DeclareFontFamily
+ \tl_set:Nn \g_fontspec_encoding_tl {JY3}
+ \__ltj_orig_fontspec_select_font_family:nn{#1}{#2}
+ \group_end:
+}
+
+%% declare_shape
+
+\cs_new:Nn \ltj_fontspec_declare_shape_yoko:nnnn {
+ \ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JY3 } { \l_ltj_fontspec_fontfeat_yoko_clist }
+}
+\cs_new:Nn \ltj_fontspec_declare_shape_tate:nnnn {
+ \ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JT3 } { \l_ltj_fontspec_fontfeat_tate_clist }
+}
+\cs_new:Nn \ltj_fontspec_declare_shape:nnnn {
+ \ltj_fontspec_declare_shape_yoko:nnnn {#1} {#2} {#3} {#4}
+ \ltj_fontspec_declare_shape_tate:nnnn {#1} {#2} {#3} {#4}
+}
+\cs_generate_variant:Nn \ltj_fontspec_declare_shape:nnnn {nnxx}
+\cs_generate_variant:Nn \ltj_fontspec_declare_shape_yoko:nnnn {nnxx}
+\cs_generate_variant:Nn \ltj_fontspec_declare_shape_tate:nnnn {nnxx}
+
+\cs_new:Nn \ltj_fontspec_declare_shape_aux:nnnnnn
+ {
+ \tl_clear:N \l__fontspec_nfss_tl
+ \tl_clear:N \l__fontspec_nfss_sc_tl
+ \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl
+
+ \tl_set:Nn \g_fontspec_encoding_tl {#5}
+ \tl_set:Nn \l__fontspec_nfss_enc_tl {#5}
+ \exp_args:Nx \clist_map_inline:nn {#4}
+ {
+ \tl_clear:N \l__fontspec_size_tl
+ \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed
+
+ \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 }
+ \l__fontspec_sizing_leftover_clist
+ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} }
+
+ \str_if_eq:nnTF { #5 } { JY3 } {
+ % "normal"
+ \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl}
+ } {
+ \tl_if_empty:NTF \l_ltj_fontspec_fontname_tate_tl
+ { \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} }
+ { \__fontspec_load_fontname:n {\l_ltj_fontspec_fontname_tate_tl} }
+ }
+ \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#3} {#6} {}
+ }
+ \bool_set_true:N \l__fontspec_nosc_bool
+ \__fontspec_declare_shapes_normal:nn {#1} {#2}
+ \__fontspec_declare_shape_slanted:nn {#1} {#2}
+ }
+
+\cs_new:Nn \ltj_fontspec_set_family:Nnn {
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \ltj_fontspec_select_font_family:nn
+ \__ltj_orig_fontspec_set_family:Nnn #1 {#2} {#3}
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_orig_fontspec_select_font_family:nn
+}
+\cs_set_eq:NN \__ltj_orig_fontspec_set_family:Nnn \fontspec_set_family:Nnn
+\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:Nnnnn \__fontspec_make_font_shapes:Nnnnn
+\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape
+
+\cs_new:Nn \ltj_fontspec_make_font_shapes:Nnnnn {
+ \group_begin:
+ %% 基底フォント
+ \cs_set_eq:NN \__fontspec_font_set:Nnn \use_none:nnn
+ \cs_set_eq:NN \__fontspec_font_if_null:NT \use_none:nn
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \ltj_fontspec_declare_shape:nnxx
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn {#1} {#2} {#3} {#4} {#5}
+ %%
+ \ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l_ltj_fontspec_fontfeat_yoko_clist}{#5} {JY3 }
+ \ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l_ltj_fontspec_fontfeat_tate_clist}{#5} {JT3}
+ \group_end:
+ }
+
+%%% Altfont 内部処理部
+\cs_new:Nn \ltj_fontspec_make_font_shapes_alt:Nnnnnn {
+ \group_begin:
+ \str_if_eq:nnTF { #6 } { JY3 } {
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \ltj_fontspec_declare_shape_yoko:nnxx
+ }{
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \ltj_fontspec_declare_shape_tate:nnxx
+ }
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { #4 }
+ \clist_if_empty:NF \l_ltj_fontspec_altfont_clist {
+ \int_gzero:N \g_ltj_fontspec_altnumber_int
+ \clist_map_inline:Nn \l_ltj_fontspec_altfont_clist {
+ \tl_clear:N \l_ltj_fontspec_altrange_tl
+ \tl_set:Nn \l_ltj_fontspec_altname_tl { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+
+ \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 }
+ \l_ltj_fontspec_altfont_leftover_clist
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { \exp_after:wN \use:n ##1 }
+
+ \tl_if_empty:NT \l_ltj_fontspec_altrange_tl {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 }
+ } {
+ \bool_if:nTF {
+ \tl_if_eq_p:NN \l_ltj_fontspec_altname_tl \l_tmpa_tl
+ &&
+ \tl_if_empty_p:N \l_ltj_fontspec_altfont_leftover_clist
+ } {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 }
+ } {
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn
+ { \l_ltj_fontspec_altname_tl } {#2}
+ {#3 _ alt \int_use:N \g_ltj_fontspec_altnumber_int }
+ {#4, \l_ltj_fontspec_altfont_leftover_clist }
+ {#5}
+ \DeclareAlternateKanjiFont
+ { #6 }{ \l_fontspec_family_tl }{#2}{#3}%
+ { #6 }{ \l_fontspec_family_tl }{#2}
+ { #3 _alt \int_use:N \g_ltj_fontspec_altnumber_int }
+ { \l_ltj_fontspec_altrange_tl }
+ \int_gincr:N \g_ltj_fontspec_altnumber_int
+ }
+ }
+ }
+ }
+ \group_end:
+}
+
+
+%%%%%%%% User commands
+\DeclareDocumentCommand \jfontspec { O{} m O{} } {
+ \ltj_fontspec_set_family:Nnn \k@family {#1,#3}{#2}
+ \selectfont
+ \ignorespaces
+}
+
+\DeclareDocumentCommand \setmainjfont { O{} m O{} } {
+ \ltj_fontspec_set_family:Nnn \mcdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareSymbolFont{mincho}{JY3}{\l_fontspec_family_tl}{\mddefault}{n}
+ \SetSymbolFont{mincho}{bold}{JY3}{\l_fontspec_family_tl}{\bfdefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \setsansjfont { O{} m O{} } {
+ \ltj_fontspec_set_family:Nnn \gtdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareMathAlphabet{\mathgt}{JY3}{\l_fontspec_family_tl}{\mddefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \newjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \ltj_fontspec_set_family:Nnn
+ \newfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+
+\DeclareDocumentCommand \newjfontface { m O{} m O{} } {
+ \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+}
+
+\clist_new:N \g__ltj_fontspec_default_fontopts_clist
+\prop_new:N \g__ltj_fontspec_fontopts_prop
+\DeclareDocumentCommand \defaultjfontfeatures { t+ o m }
+ {
+ \IfNoValueTF {#2}
+ { \__ltj_fontspec_set_default_features:nn {#1} {#3} }
+ { \__ltj_fontspec_set_font_default_features:nnn {#1} {#2} {#3} }
+ \ignorespaces
+ }
+\cs_new:Nn \__ltj_fontspec_set_default_features:nn
+ {
+ \clist_set_eq:NN \l__ltj_fontspec_tmp_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_default_fontopts_clist
+ \__fontspec_set_default_features:nn {#1} {#2}
+ \clist_set_eq:NN \g__ltj_fontspec_default_fontopts_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \l__ltj_fontspec_tmp_clist
+ }
+\cs_new:Nn \__ltj_fontspec_set_font_default_features:nnn
+ {
+ \prop_set_eq:NN \l__ltj_fontspec_tmp_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \__fontspec_set_font_default_features:nnn {#1} {#2} {#3}
+ \prop_set_eq:NN \g__ltj_fontspec_fontopts_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \l__ltj_fontspec_tmp_prop
+ }
+
+\DeclareDocumentCommand \addjfontfeatures {m} {
+ \ltj_fontspec_if_fontspec_font:TF
+ {
+ \group_begin:
+ \tl_set_eq:NN \f@family \k@family
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \ltj_fontspec_select_font_family:nn
+ \addfontfeatures {#1}
+ \group_end:
+ \fontfamily\l_fontspec_family_tl\selectfont
+ }{
+ \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored}
+ }
+ \ignorespaces
+}
+
+\cs_set_eq:NN \addjfontfeature \addjfontfeatures
+
+\prg_new_conditional:Nnn \ltj_fontspec_if_fontspec_font: {TF,T,F}
+{
+ \cs_if_exist:cTF {g__fontspec_ \k@family _prop} \prg_return_true: \prg_return_false:
+}
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-26h.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-26h.sty
new file mode 100644
index 0000000000..1472633bb0
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-26h.sty
@@ -0,0 +1,412 @@
+%
+% luatexja-fontspec-26h.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-fontspec-26h}[2019/05/14 fontspec support of LuaTeX-ja]
+\RequirePackage{l3keys2e}
+\ExplSyntaxOn
+
+%%%%%%%% Change Japanese font family by \rmfamily or not
+\cs_new:Npn \__ltj_fontspec_match_cmd {
+ \renewcommand\jttdefault{\gtdefault}
+ \@ltj@match@familytrue
+ \DeclareDocumentCommand \setmonojfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \jttdefault {##1,##3}{##2}
+ \normalfont
+ }
+}
+\bool_if:NT \__ltj_fontspec_match_bool \__ltj_fontspec_match_cmd
+
+%%%%%%%% Messages
+\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored}
+{
+ \string\addjfontfeature (s)~ ignored;\\
+ it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec.
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified).
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified).
+}
+
+\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx}
+
+%%%%%%%% Internal control sequences
+%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec.
+\cs_new:Nn \__ltj_fontspec_define_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec} {#1} {#2}
+}
+\cs_new:Nn \__ltj_fontspec_define_preparse_external:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {#1} {#2}
+}
+\cs_new:Nn \__ltj_fontspec_define_altfont_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-ltjaltfont} {#1} {#2}
+}
+
+%% Alternate Fonts
+%% Spec: AltFont = {
+%% ...
+%% { Range = <range>, <font features> },
+%% { Range = <range>, Font = <font name>, <font features> },
+%% { Range = <range>, Font = <font name> },
+%% ...
+%% }
+\tl_new:N \l__ltj_fontspec_altname_tl
+\tl_new:N \l__ltj_fontspec_altrange_tl
+\clist_new:N \l__ltj_fontspec_altfont_clist
+\clist_new:N \l__ltj_fontspec_altfont_leftover_clist
+\int_new:N \g__ltj_fontspec_altnumber_int
+
+\__ltj_fontspec_define_altfont_option:nn {Range} {
+ \tl_set:Nn \l__ltj_fontspec_altrange_tl {#1}
+}
+\__ltj_fontspec_define_altfont_option:nn {Font} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_altname_tl {#1}
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {AltFont} {
+ \clist_put_right:Nn \l__ltj_fontspec_altfont_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {YokoFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_yoko_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_tate_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFont} {
+ \tl_if_empty:nF {#1} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_fontname_tate_tl {#1}
+ }
+}
+%%
+\clist_new:N \l__ltj_fontspec_fontfeat_yoko_clist
+\clist_new:N \l__ltj_fontspec_fontfeat_tate_clist
+\tl_new:N \l__ltj_fontspec_fontname_tate_tl
+
+\cs_new:Npn \__ltj_fontspec_DeclareFontFamily #1 #2 #3 {
+ \DeclareKanjiFamily {JY3} {#2} {#3}
+ \DeclareKanjiFamily {JT3} {#2} {#3}
+}
+
+%% save and restore global variable
+\tl_new:N \g__ltj_fontspec_kanji_nfss_family_tl
+\tl_new:N \g__ltj_fontspec_orig_nfss_family_tl
+\seq_new:N \g__ltj_fontspec_kanji_bf_series_seq
+\seq_new:N \g__ltj_fontspec_orig_bf_series_seq
+\clist_new:N \g__ltj_fontspec_kanji_default_fontopts_clist
+\clist_new:N \g__ltj_fontspec_orig_default_fontopts_clist
+
+\cs_new:Nn \__ltj_set_global_variable_for_kanji: {
+ \tl_gset_eq:NN \g__ltj_fontspec_orig_nfss_family_tl \g__fontspec_nfss_family_tl
+ \tl_gset_eq:NN \g__fontspec_nfss_family_tl \g__ltj_fontspec_kanji_nfss_family_tl
+ \seq_gset_eq:NN \g__ltj_fontspec_orig_bf_series_seq \g__fontspec_bf_series_seq
+ \seq_gset_eq:NN \g__fontspec_bf_series_seq \g__ltj_fontspec_kanji_bf_series_seq
+ %\seq_gclear:N \g__fontspec_bf_series_seq
+ \clist_set_eq:NN \g__ltj_fontspec_orig_default_fontopts_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_kanji_default_fontopts_clist
+}
+
+\cs_new:Nn \__ltj_restore_global_variable: {
+ \tl_gset_eq:NN \g__ltj_fontspec_kanji_nfss_family_tl \g__fontspec_nfss_family_tl
+ \tl_gset_eq:NN \g__fontspec_nfss_family_tl \g__ltj_fontspec_orig_nfss_family_tl
+ \seq_gset_eq:NN \g__ltj_fontspec_kanji_bf_series_seq \g__fontspec_bf_series_seq
+ \seq_gset_eq:NN \g__fontspec_bf_series_seq \g__ltj_fontspec_orig_bf_series_seq
+ \clist_set_eq:NN \g__ltj_fontspec_kanji_default_fontopts_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_orig_default_fontopts_clist
+}
+
+\cs_set_eq:NN \__ltj_orig_fontspec_select_font_family:nn \__fontspec_select_font_family:nn
+\cs_new_protected:Nn \__ltj_fontspec_select_font_family:nn {
+ \group_begin:
+ \__ltj_fontspec_define_option:nn {NoEmbed} {}
+ \__ltj_fontspec_define_option:nn {AltFont} {
+ \clist_put_right:Nn \l__ltj_fontspec_altfont_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {CID} {
+ \__fontspec_update_featstr:n {cid=##1}
+ }
+ \__ltj_fontspec_define_option:nn {Kanjiskip} {
+ \str_if_eq_x:nnTF {false} { \str_lower_case:n { ##1 } }{
+ \__fontspec_update_featstr:n {-ltjksp}
+ } {
+ \__fontspec_update_featstr:n {+ltjksp}
+ }
+ }
+ \__ltj_fontspec_define_option:nn {JFM} {
+ \__fontspec_update_featstr:n {jfm=##1}
+ }
+ % vary by shape
+ \__ltj_fontspec_define_option:nn {YokoFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_yoko_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {TateFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_tate_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {TateFont}
+ {
+ \tl_if_empty:nF {##1} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_fontname_tate_tl {##1}
+ }
+ }
+ \__ltj_fontspec_define_option:nn {JFM-var} {
+ \__fontspec_update_featstr:n {jfmvar=##1}
+ }
+ \__ltj_fontspec_define_preparse_external:nn {NoEmbed} {
+ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 {psft:##1}
+ }
+
+ %% Omit the warning message
+ %% "OpenType feature 'Kerning=Off' (-kern) not available ..."
+ \keys_define:nn {fontspec-opentype} {
+ Kerning/Off.code:n=\__fontspec_update_featstr:n {-kern}
+ }
+ \clist_set:Nx \g__fontspec_default_fontopts_clist {
+ YokoFeatures = { JFM=\ltj@stdyokojfm }, TateFeatures = { JFM=\ltj@stdtatejfm },
+ Scale=\Cjascale, Kerning=Off, Script=CJK,
+ \g__ltj_fontspec_kanji_default_fontopts_clist
+ }
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \cs_set_eq:NN \__fontspec_make_font_shapes:Nnnnn \__ltj_fontspec_make_font_shapes:Nnnnn
+ \cs_set_eq:NN \DeclareFontFamily \__ltj_fontspec_DeclareFontFamily
+ \tl_set:Nn \g_fontspec_encoding_tl {JY3}
+ \__ltj_orig_fontspec_select_font_family:nn{#1}{#2}
+
+ \cs_gset:Npx \__ltj_fontspec_aftergroup {
+ \exp_not:N \tl_set:Nn \exp_not:N \l_fontspec_family_tl { \l_fontspec_family_tl }
+ }
+ \aftergroup \__ltj_fontspec_aftergroup
+ \group_end:
+}
+
+%% declare_shape
+
+\cs_new:Nn \__ltj_fontspec_declare_shape_yoko:nnnn {
+ \__ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JY3 } { \l__ltj_fontspec_fontfeat_yoko_clist }
+}
+\cs_new:Nn \__ltj_fontspec_declare_shape_tate:nnnn {
+ \__ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JT3 } { \l__ltj_fontspec_fontfeat_tate_clist }
+}
+\cs_new:Nn \__ltj_fontspec_declare_shape:nnnn {
+ \__ltj_fontspec_declare_shape_yoko:nnnn {#1} {#2} {#3} {#4}
+ \__ltj_fontspec_declare_shape_tate:nnnn {#1} {#2} {#3} {#4}
+}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape:nnnn {nnxx}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape_yoko:nnnn {nnxx}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape_tate:nnnn {nnxx}
+
+\cs_new:Nn \__ltj_fontspec_declare_shape_aux:nnnnnn
+ {
+ \tl_clear:N \l__fontspec_nfss_tl
+ \tl_clear:N \l__fontspec_nfss_sc_tl
+ \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl
+
+ \tl_set:Nn \g_fontspec_encoding_tl {#5}
+ \tl_set:Nn \g__fontspec_nfss_enc_tl {#5}
+ \exp_args:Nx \clist_map_inline:nn {#4}
+ {
+ \tl_clear:N \l__fontspec_size_tl
+ \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed
+
+ \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 }
+ \l__fontspec_sizing_leftover_clist
+ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} }
+
+ \cs_if_exist:NTF \__fontspec_load_fontname:Nn
+ { %% >= v2.7
+ \str_if_eq:nnTF { #5 } { JY3 } {
+ % "normal"
+ \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl}
+ } {
+ \tl_if_empty:NTF \l__ltj_fontspec_fontname_tate_tl
+ { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} }
+ { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__ltj_fontspec_fontname_tate_tl} }
+ }
+ } { %% < v2.7
+ \str_if_eq:nnTF { #5 } { JY3 } {
+ % "normal"
+ \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl}
+ } {
+ \tl_if_empty:NTF \l__ltj_fontspec_fontname_tate_tl
+ { \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} }
+ { \__fontspec_load_fontname:n {\l__ltj_fontspec_fontname_tate_tl} }
+ }
+ }
+ \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#3} {#6} {}
+ }
+ \bool_set_true:N \l__fontspec_nosc_bool
+ \__fontspec_declare_shapes_normal:nn {#1} {#2}
+ \__fontspec_declare_shape_slanted:nn {#1} {#2}
+ }
+
+\cs_new:Nn \__ltj_fontspec_set_family:Nnn {
+ \__ltj_set_global_variable_for_kanji:
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_fontspec_select_font_family:nn
+ \__ltj_orig_fontspec_set_family:Nnn #1 {#2} {#3}
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_orig_fontspec_select_font_family:nn
+ \__ltj_restore_global_variable:
+}
+\cs_set_eq:NN \__ltj_orig_fontspec_set_family:Nnn \fontspec_set_family:Nnn
+\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:Nnnnn \__fontspec_make_font_shapes:Nnnnn
+\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape
+
+\cs_new:Nn \__ltj_fontspec_make_font_shapes:Nnnnn {
+ \group_begin:
+ %% 基底フォント
+ \cs_set_eq:NN \__fontspec_font_set:Nnn \use_none:nnn
+ \cs_set_eq:NN \__fontspec_font_if_null:NT \use_none:nn
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape:nnxx
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn {#1} {#2} {#3} {#4} {#5}
+ %%
+ \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l__ltj_fontspec_fontfeat_yoko_clist}{#5} {JY3 }
+ \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l__ltj_fontspec_fontfeat_tate_clist}{#5} {JT3}
+ \group_end:
+ }
+
+%%% Altfont 内部処理部
+\cs_new:Nn \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {
+ \group_begin:
+ \str_if_eq:nnTF { #6 } { JY3 } {
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape_yoko:nnxx
+ }{
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape_tate:nnxx
+ }
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { #4 }
+ \clist_if_empty:NF \l__ltj_fontspec_altfont_clist {
+ \int_gzero:N \g__ltj_fontspec_altnumber_int
+ \clist_map_inline:Nn \l__ltj_fontspec_altfont_clist {
+ \tl_clear:N \l__ltj_fontspec_altrange_tl
+ \tl_set:Nn \l__ltj_fontspec_altname_tl { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+
+ \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 }
+ \l__ltj_fontspec_altfont_leftover_clist
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { \exp_after:wN \use:n ##1 }
+
+ \tl_if_empty:NT \l__ltj_fontspec_altrange_tl {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 }
+ } {
+ \bool_if:nTF {
+ \tl_if_eq_p:NN \l__ltj_fontspec_altname_tl \l_tmpa_tl
+ &&
+ \tl_if_empty_p:N \l__ltj_fontspec_altfont_leftover_clist
+ } {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 }
+ } {
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn
+ { \l__ltj_fontspec_altname_tl } {#2}
+ {#3 _ alt \int_use:N \g__ltj_fontspec_altnumber_int }
+ {#4, \l__ltj_fontspec_altfont_leftover_clist }
+ {#5}
+ \DeclareAlternateKanjiFont
+ { #6 }{ \g__fontspec_nfss_family_tl }{#2}{#3}%
+ { #6 }{ \g__fontspec_nfss_family_tl }{#2}
+ { #3 _alt \int_use:N \g__ltj_fontspec_altnumber_int }
+ { \l__ltj_fontspec_altrange_tl }
+ \int_gincr:N \g__ltj_fontspec_altnumber_int
+ }
+ }
+ }
+ }
+ \group_end:
+}
+
+
+%%%%%%%% User commands
+\DeclareDocumentCommand \jfontspec { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \k@family {#1,#3}{#2}
+ \selectfont
+ \ignorespaces
+}
+
+\DeclareDocumentCommand \setmainjfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \mcdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareSymbolFont{mincho}{JY3}{\mcdefault}{\mddefault}{n}
+ \SetSymbolFont{mincho}{bold}{JY3}{\mcdefault}{\bfdefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \setsansjfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \gtdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareMathAlphabet{\mathgt}{JY3}{\gtdefault}{\mddefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \newjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \newfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+\DeclareDocumentCommand \renewjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \renewfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+\DeclareDocumentCommand \setjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \setfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+
+\DeclareDocumentCommand \newjfontface { m O{} m O{} } {
+ \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+}
+
+\prop_new:N \g__ltj_fontspec_fontopts_prop
+\DeclareDocumentCommand \defaultjfontfeatures { t+ o m }
+ {
+ \IfNoValueTF {#2}
+ { \__ltj_fontspec_set_default_features:nn {#1} {#3} }
+ { \__ltj_fontspec_set_font_default_features:nnn {#1} {#2} {#3} }
+ \ignorespaces
+ }
+\cs_new:Nn \__ltj_fontspec_set_default_features:nn
+ {
+ \__ltj_set_global_variable_for_kanji:
+ \__fontspec_set_default_features:nn {#1} {#2}
+ \__ltj_restore_global_variable:
+ }
+\cs_new:Nn \__ltj_fontspec_set_font_default_features:nnn
+ {
+ \prop_set_eq:NN \l__ltj_fontspec_tmp_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \__fontspec_set_font_default_features:nnn {#1} {#2} {#3}
+ \prop_set_eq:NN \g__ltj_fontspec_fontopts_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \l__ltj_fontspec_tmp_prop
+ }
+
+\DeclareDocumentCommand \addjfontfeatures {m} {
+ \__ltj_fontspec_if_fontspec_font:TF
+ {
+ \__ltj_set_global_variable_for_kanji:
+ \group_begin:
+ \tl_set_eq:NN \f@family \k@family
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_fontspec_select_font_family:nn
+ \addfontfeatures {#1}
+ \group_end:
+ \kanjifamily\g__fontspec_nfss_family_tl\selectfont
+ \__ltj_restore_global_variable:
+ }{
+ \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored}
+ }
+ \ignorespaces
+}
+
+\cs_set_eq:NN \addjfontfeature \addjfontfeatures
+
+\prg_new_conditional:Nnn \__ltj_fontspec_if_fontspec_font: {TF,T,F}
+{
+ \cs_if_exist:cTF {g__fontspec_fontinfo_ \k@family _prop} \prg_return_true: \prg_return_false:
+}
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty
new file mode 100644
index 0000000000..88d6b37b58
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty
@@ -0,0 +1,406 @@
+%
+% luatexja-fontspec-27c.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-fontspec-27c}[2019/05/14 fontspec support of LuaTeX-ja]
+\RequirePackage{l3keys2e}
+\ExplSyntaxOn
+
+%%%%%%%% Change Japanese font family by \rmfamily or not
+\cs_new:Npn \__ltj_fontspec_match_cmd {
+ \renewcommand\jttdefault{\gtdefault}
+ \@ltj@match@familytrue
+ \DeclareDocumentCommand \setmonojfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \jttdefault {##1,##3}{##2}
+ \normalfont
+ }
+}
+\bool_if:NT \__ltj_fontspec_match_bool \__ltj_fontspec_match_cmd
+
+%%%%%%%% Messages
+\msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored}
+{
+ \string\addjfontfeature (s)~ ignored;\\
+ it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ luatexja-fontspec.
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-norange}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (no~ range~ is~ specified).
+}
+
+\msg_new:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly}
+{
+ ignored~ sublist~ `#1'~ in~ AltFont~ (only~ range~ is~ specified).
+}
+
+\cs_generate_variant:Nn \prg_new_conditional:Nnn {Nnx}
+
+%%%%%%%% Internal control sequences
+%% Each CS is ltj_fontspec version that corresponds to original CS of fontspec.
+\cs_new:Nn \__ltj_fontspec_define_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec} {#1} {#2}
+}
+\cs_new:Nn \__ltj_fontspec_define_preparse_external:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {#1} {#2}
+}
+\cs_new:Nn \__ltj_fontspec_define_altfont_option:nn {
+ \__fontspec_keys_define_code:nnn {fontspec-ltjaltfont} {#1} {#2}
+}
+
+%% Alternate Fonts
+%% Spec: AltFont = {
+%% ...
+%% { Range = <range>, <font features> },
+%% { Range = <range>, Font = <font name>, <font features> },
+%% { Range = <range>, Font = <font name> },
+%% ...
+%% }
+\tl_new:N \l__ltj_fontspec_altname_tl
+\tl_new:N \l__ltj_fontspec_altrange_tl
+\clist_new:N \l__ltj_fontspec_altfont_clist
+\clist_new:N \l__ltj_fontspec_altfont_leftover_clist
+\int_new:N \g__ltj_fontspec_altnumber_int
+
+\__ltj_fontspec_define_altfont_option:nn {Range} {
+ \tl_set:Nn \l__ltj_fontspec_altrange_tl {#1}
+}
+\__ltj_fontspec_define_altfont_option:nn {Font} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_altname_tl {#1}
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {AltFont} {
+ \clist_put_right:Nn \l__ltj_fontspec_altfont_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {YokoFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_yoko_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_tate_clist { #1 }
+}
+\__fontspec_keys_define_code:nnn {fontspec-ltjaltfont-reparse} {TateFont} {
+ \tl_if_empty:nF {#1} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_fontname_tate_tl {#1}
+ }
+}
+%%
+\clist_new:N \l__ltj_fontspec_fontfeat_yoko_clist
+\clist_new:N \l__ltj_fontspec_fontfeat_tate_clist
+\tl_new:N \l__ltj_fontspec_fontname_tate_tl
+
+\cs_new:Npn \__ltj_fontspec_DeclareFontFamily #1 #2 #3 {
+ \DeclareKanjiFamily {JY3} {#2} {#3}
+ \DeclareKanjiFamily {JT3} {#2} {#3}
+}
+
+%% save and restore global variable
+\tl_new:N \g__ltj_fontspec_kanji_nfss_family_tl
+\tl_new:N \g__ltj_fontspec_orig_nfss_family_tl
+\seq_new:N \g__ltj_fontspec_kanji_bf_series_seq
+\seq_new:N \g__ltj_fontspec_orig_bf_series_seq
+\clist_new:N \g__ltj_fontspec_kanji_default_fontopts_clist
+\clist_new:N \g__ltj_fontspec_orig_default_fontopts_clist
+
+\cs_new:Nn \__ltj_set_global_variable_for_kanji: {
+ \tl_gset_eq:NN \g__ltj_fontspec_orig_nfss_family_tl \g__fontspec_nfss_family_tl
+ \tl_gset_eq:NN \g__fontspec_nfss_family_tl \g__ltj_fontspec_kanji_nfss_family_tl
+ \seq_gset_eq:NN \g__ltj_fontspec_orig_bf_series_seq \g__fontspec_bf_series_seq
+ \seq_gset_eq:NN \g__fontspec_bf_series_seq \g__ltj_fontspec_kanji_bf_series_seq
+ %\seq_gclear:N \g__fontspec_bf_series_seq
+ \clist_set_eq:NN \g__ltj_fontspec_orig_default_fontopts_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_kanji_default_fontopts_clist
+}
+
+\cs_new:Nn \__ltj_restore_global_variable: {
+ \tl_gset_eq:NN \g__ltj_fontspec_kanji_nfss_family_tl \g__fontspec_nfss_family_tl
+ \tl_gset_eq:NN \g__fontspec_nfss_family_tl \g__ltj_fontspec_orig_nfss_family_tl
+ \seq_gset_eq:NN \g__ltj_fontspec_kanji_bf_series_seq \g__fontspec_bf_series_seq
+ \seq_gset_eq:NN \g__fontspec_bf_series_seq \g__ltj_fontspec_orig_bf_series_seq
+ \clist_set_eq:NN \g__ltj_fontspec_kanji_default_fontopts_clist \g__fontspec_default_fontopts_clist
+ \clist_set_eq:NN \g__fontspec_default_fontopts_clist \g__ltj_fontspec_orig_default_fontopts_clist
+}
+
+\cs_set_eq:NN \__ltj_orig_fontspec_select_font_family:nn \__fontspec_select_font_family:nn
+\cs_new_protected:Nn \__ltj_fontspec_select_font_family:nn {
+ \group_begin:
+ \__ltj_fontspec_define_option:nn {NoEmbed} {}
+ \__ltj_fontspec_define_option:nn {AltFont} {
+ \clist_put_right:Nn \l__ltj_fontspec_altfont_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {CID} {
+ \__fontspec_update_featstr:n {cid=##1}
+ }
+ \__ltj_fontspec_define_option:nn {Kanjiskip} {
+ \str_if_eq_x:nnTF {false} { \str_lower_case:n { ##1 } }{
+ \__fontspec_update_featstr:n {-ltjksp}
+ } {
+ \__fontspec_update_featstr:n {+ltjksp}
+ }
+ }
+ \__ltj_fontspec_define_option:nn {JFM} {
+ \__fontspec_update_featstr:n {jfm=##1}
+ }
+ % vary by shape
+ \__ltj_fontspec_define_option:nn {YokoFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_yoko_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {TateFeatures} {
+ \clist_put_right:Nn \l__ltj_fontspec_fontfeat_tate_clist { ##1 }
+ }
+ \__ltj_fontspec_define_option:nn {TateFont}
+ {
+ \tl_if_empty:nF {##1} {
+ \fontspec_complete_fontname:Nn \l__ltj_fontspec_fontname_tate_tl {##1}
+ }
+ }
+ \__ltj_fontspec_define_option:nn {JFM-var} {
+ \__fontspec_update_featstr:n {jfmvar=##1}
+ }
+ \__ltj_fontspec_define_preparse_external:nn {NoEmbed} {
+ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 {psft:##1}
+ }
+
+ %% Omit the warning message
+ %% "OpenType feature 'Kerning=Off' (-kern) not available ..."
+ \keys_define:nn {fontspec-opentype} {
+ Kerning/Off.code:n=\__fontspec_update_featstr:n {-kern}
+ }
+ \clist_set:Nx \g__fontspec_default_fontopts_clist {
+ YokoFeatures = { JFM=\ltj@stdyokojfm }, TateFeatures = { JFM=\ltj@stdtatejfm },
+ Scale=\Cjascale, Kerning=Off, Script=CJK,
+ \g__ltj_fontspec_kanji_default_fontopts_clist
+ }
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \cs_set_eq:NN \__fontspec_make_font_shapes:Nnnnn \__ltj_fontspec_make_font_shapes:Nnnnn
+ \cs_set_eq:NN \DeclareFontFamily \__ltj_fontspec_DeclareFontFamily
+ \tl_set:Nn \g_fontspec_encoding_tl {JY3}
+ \__ltj_orig_fontspec_select_font_family:nn{#1}{#2}
+
+ \cs_gset:Npx \__ltj_fontspec_aftergroup {
+ \exp_not:N \tl_set:Nn \exp_not:N \l_fontspec_family_tl { \l_fontspec_family_tl }
+ }
+ \aftergroup \__ltj_fontspec_aftergroup
+ \group_end:
+}
+
+%% declare_shape
+
+\cs_new:Nn \__ltj_fontspec_declare_shape_yoko:nnnn {
+ \__ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JY3 } { \l__ltj_fontspec_fontfeat_yoko_clist }
+}
+\cs_new:Nn \__ltj_fontspec_declare_shape_tate:nnnn {
+ \__ltj_fontspec_declare_shape_aux:nnnnnn {#1} {#2} {#3} {#4} { JT3 } { \l__ltj_fontspec_fontfeat_tate_clist }
+}
+\cs_new:Nn \__ltj_fontspec_declare_shape:nnnn {
+ \__ltj_fontspec_declare_shape_yoko:nnnn {#1} {#2} {#3} {#4}
+ \__ltj_fontspec_declare_shape_tate:nnnn {#1} {#2} {#3} {#4}
+}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape:nnnn {nnxx}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape_yoko:nnnn {nnxx}
+\cs_generate_variant:Nn \__ltj_fontspec_declare_shape_tate:nnnn {nnxx}
+
+\cs_new:Nn \__ltj_fontspec_declare_shape_aux:nnnnnn
+{
+ \tl_build_begin:N \l__fontspec_nfss_tl
+ \tl_build_begin:N \l__fontspec_nfss_sc_tl
+ \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl
+
+ \tl_set:Nn \g_fontspec_encoding_tl {#5}
+ \tl_set:Nn \g__fontspec_nfss_enc_tl {#5}
+ \exp_args:Nx \clist_map_inline:nn {#4}
+ { \__ltj_fontspec_setup_single_size:nnn {#3} {#6} {##1} }
+ \tl_build_end:N \l__fontspec_nfss_tl
+ \tl_build_end:N \l__fontspec_nfss_sc_tl
+
+ \bool_set_true:N \l__fontspec_nosc_bool
+ \__fontspec_declare_shapes_normal:nn {#1} {#2}
+ \__fontspec_declare_shape_slanted:nn {#1} {#2}
+}
+
+\cs_new:Nn \__ltj_fontspec_setup_single_size:nnn
+{
+ \tl_clear:N \l__fontspec_size_tl
+ \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed
+
+ \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n #3 }
+ \l__fontspec_sizing_leftover_clist
+ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} }
+
+ \str_if_eq:nnTF { \g__fontspec_nfss_enc_tl } { JY3 } {
+ % "normal"
+ \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl}
+ } {
+ \tl_if_empty:NTF \l__ltj_fontspec_fontname_tate_tl
+ { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} }
+ { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__ltj_fontspec_fontname_tate_tl} }
+ }
+ \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {#2} {}
+}
+
+\cs_new:Nn \__ltj_fontspec_set_family:Nnn {
+ \__ltj_set_global_variable_for_kanji:
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_fontspec_select_font_family:nn
+ \__ltj_orig_fontspec_set_family:Nnn #1 {#2} {#3}
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_orig_fontspec_select_font_family:nn
+ \__ltj_restore_global_variable:
+}
+\cs_set_eq:NN \__ltj_orig_fontspec_set_family:Nnn \fontspec_set_family:Nnn
+\cs_set_eq:NN \__ltj_orig_fontspec_make_font_shapes:Nnnnn \__fontspec_make_font_shapes:Nnnnn
+\cs_set_eq:NN \__ltj_fontspec_orig_DeclareFontShape \DeclareFontShape
+
+\cs_new:Nn \__ltj_fontspec_make_font_shapes:Nnnnn {
+ \group_begin:
+ %% 基底フォント
+ \cs_set_eq:NN \__fontspec_font_set:Nnn \use_none:nnn
+ \cs_set_eq:NN \__fontspec_font_if_null:NT \use_none:nn
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape:nnxx
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn {#1} {#2} {#3} {#4} {#5}
+ %%
+ \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l__ltj_fontspec_fontfeat_yoko_clist}{#5} {JY3 }
+ \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {#1}{#2}{#3}
+ {#4, \l__ltj_fontspec_fontfeat_tate_clist}{#5} {JT3}
+ \group_end:
+ }
+
+%%% Altfont 内部処理部
+\cs_new:Nn \__ltj_fontspec_make_font_shapes_alt:Nnnnnn {
+ \group_begin:
+ \str_if_eq:nnTF { #6 } { JY3 } {
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape_yoko:nnxx
+ }{
+ \cs_set_eq:NN \__fontspec_declare_shape:nnxx \__ltj_fontspec_declare_shape_tate:nnxx
+ }
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { #4 }
+ \clist_if_empty:NF \l__ltj_fontspec_altfont_clist {
+ \int_gzero:N \g__ltj_fontspec_altnumber_int
+ \clist_map_inline:Nn \l__ltj_fontspec_altfont_clist {
+ \tl_clear:N \l__ltj_fontspec_altrange_tl
+ \tl_set:Nn \l__ltj_fontspec_altname_tl { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+
+ \keys_set_known:nxN {fontspec-ltjaltfont} { \exp_after:wN \use:n ##1 }
+ \l__ltj_fontspec_altfont_leftover_clist
+ \keys_set_known:nn {fontspec-ltjaltfont-reparse} { \exp_after:wN \use:n ##1 }
+
+ \tl_if_empty:NT \l__ltj_fontspec_altrange_tl {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-norange} { ##1 }
+ } {
+ \bool_if:nTF {
+ \tl_if_eq_p:NN \l__ltj_fontspec_altname_tl \l_tmpa_tl
+ &&
+ \tl_if_empty_p:N \l__ltj_fontspec_altfont_leftover_clist
+ } {
+ \msg_warning:nnn {luatexja-fontspec} {altfont-ignored-by-rangeonly} { ##1 }
+ } {
+ \__ltj_orig_fontspec_make_font_shapes:Nnnnn
+ { \l__ltj_fontspec_altname_tl } {#2}
+ {#3 _ alt \int_use:N \g__ltj_fontspec_altnumber_int }
+ {#4, \l__ltj_fontspec_altfont_leftover_clist }
+ {#5}
+ \DeclareAlternateKanjiFont
+ { #6 }{ \g__fontspec_nfss_family_tl }{#2}{#3}%
+ { #6 }{ \g__fontspec_nfss_family_tl }{#2}
+ { #3 _alt \int_use:N \g__ltj_fontspec_altnumber_int }
+ { \l__ltj_fontspec_altrange_tl }
+ \int_gincr:N \g__ltj_fontspec_altnumber_int
+ }
+ }
+ }
+ }
+ \group_end:
+}
+
+
+%%%%%%%% User commands
+\DeclareDocumentCommand \jfontspec { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \k@family {#1,#3}{#2}
+ \selectfont
+ \ignorespaces
+}
+
+\DeclareDocumentCommand \setmainjfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \mcdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareSymbolFont{mincho}{JY3}{\mcdefault}{\mddefault}{n}
+ \SetSymbolFont{mincho}{bold}{JY3}{\mcdefault}{\bfdefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \setsansjfont { O{} m O{} } {
+ \__ltj_fontspec_set_family:Nnn \gtdefault {#1,#3}{#2}
+ \unless\ifltj@disablejfam
+ \DeclareMathAlphabet{\mathgt}{JY3}{\gtdefault}{\mddefault}{n}
+ \fi
+ \normalfont
+}
+
+\DeclareDocumentCommand \newjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \newfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+\DeclareDocumentCommand \renewjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \renewfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+\DeclareDocumentCommand \setjfontfamily { m O{} m O{} } {
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn
+ \setfontfamily #1 [#2,#4] {#3}
+ \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_orig_fontspec_set_family:Nnn
+}
+
+\DeclareDocumentCommand \newjfontface { m O{} m O{} } {
+ \newjfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+}
+
+\prop_new:N \g__ltj_fontspec_fontopts_prop
+\DeclareDocumentCommand \defaultjfontfeatures { t+ o m }
+ {
+ \IfNoValueTF {#2}
+ { \__ltj_fontspec_set_default_features:nn {#1} {#3} }
+ { \__ltj_fontspec_set_font_default_features:nnn {#1} {#2} {#3} }
+ \ignorespaces
+ }
+\cs_new:Nn \__ltj_fontspec_set_default_features:nn
+ {
+ \__ltj_set_global_variable_for_kanji:
+ \__fontspec_set_default_features:nn {#1} {#2}
+ \__ltj_restore_global_variable:
+ }
+\cs_new:Nn \__ltj_fontspec_set_font_default_features:nnn
+ {
+ \prop_set_eq:NN \l__ltj_fontspec_tmp_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \g__ltj_fontspec_fontopts_prop
+ \__fontspec_set_font_default_features:nnn {#1} {#2} {#3}
+ \prop_set_eq:NN \g__ltj_fontspec_fontopts_prop \g__fontspec_fontopts_prop
+ \prop_set_eq:NN \g__fontspec_fontopts_prop \l__ltj_fontspec_tmp_prop
+ }
+
+\DeclareDocumentCommand \addjfontfeatures {m} {
+ \__ltj_fontspec_if_fontspec_font:TF
+ {
+ \__ltj_set_global_variable_for_kanji:
+ \group_begin:
+ \tl_set_eq:NN \f@family \k@family
+ \cs_set_eq:NN \__fontspec_select_font_family:nn \__ltj_fontspec_select_font_family:nn
+ \addfontfeatures {#1}
+ \group_end:
+ \kanjifamily\g__fontspec_nfss_family_tl\selectfont
+ \__ltj_restore_global_variable:
+ }{
+ \msg_warning:nn {luatexja-fontspec} {addjfontfeatures-ignored}
+ }
+ \ignorespaces
+}
+
+\cs_set_eq:NN \addjfontfeature \addjfontfeatures
+
+\prg_new_conditional:Nnn \__ltj_fontspec_if_fontspec_font: {TF,T,F}
+{
+ \cs_if_exist:cTF {g__fontspec_fontinfo_ \k@family _prop} \prg_return_true: \prg_return_false:
+}
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty
new file mode 100644
index 0000000000..e98fbc7b95
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec.sty
@@ -0,0 +1,60 @@
+%
+% luatexja-fontspec.sty
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-fontspec}[2019/03/20 fontspec support of LuaTeX-ja]
+\RequirePackage{l3keys2e,luatexja}
+\ExplSyntaxOn
+
+\cs_if_exist:NF \Cjascale {
+ %% Default scale value for jfont.
+ \group_begin:
+ \fontsize{16}{16}\selectfont
+ \cs_gset:Npx \Cjascale { \fp_to_decimal:n {\zw / 16} }
+ \group_end:
+}
+
+\bool_new:N \__ltj_fontspec_match_bool
+\keys_define:nn { luatexja-fontspec }
+ {
+ match .bool_set:N = \__ltj_fontspec_match_bool,
+ match .default:n = true,
+ pass .code:n = \PassOptionsToPackage{#1} {fontspec},
+ % 互換性のために残したオプション
+ scale .code:n = \gdef\Cjascale{#1},
+ unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } {fontspec},
+ }
+\ProcessKeysOptions{ luatexja-fontspec }
+
+\RequirePackage{fontspec}[2017/01/01]% v2.5c
+\@ifpackagelater{fontspec}{2018/07/29}%
+ {\@ifpackagelater{fontspec}{2019/03/15}%
+ {\RequirePackage{luatexja-fontspec-27c}} % v2.7c
+ {\RequirePackage{luatexja-fontspec-26h}}}% v2.6h
+ {\RequirePackage{luatexja-fontspec-25c}} % v2.5c
+
+\ExplSyntaxOff
+%%%%%%%% Now we completely ignore kanjifont definition file.
+\def\@ltj@use@fd{false}
+
+% We must redefine \try@load@fontshape to ignore kanjifont definitions at all.
+\def\try@load@fontshape{%
+ \expandafter
+ \ifx\csname \f@encoding+\f@family\endcsname\relax
+ \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{\f@encoding}')}%
+\ifin@\else % Alphabetic font
+ \@font@info{Try loading font information for \f@encoding+\f@family}%
+ \global\expandafter\let
+ \csname\f@encoding+\f@family\endcsname\@empty
+ \nfss@catcodes
+ \let\nfss@catcodes\relax
+ \edef\reserved@a{%
+ \lowercase{%
+ \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
+ \reserved@a\relax
+ {\@input@{\f@encoding\f@family.fd}}%
+\fi
+ \fi}
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-otf.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-otf.sty
new file mode 100644
index 0000000000..082468b97b
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-otf.sty
@@ -0,0 +1,205 @@
+%
+% luatexja-otf.sty
+%
+
+%% Avoid multiple loading.
+\csname\if11luatexjaotfLoaded\fi\endcsname
+\edef\x{%
+\catcode32=\the\catcode32%
+\catcode33=\the\catcode33%
+\catcode35=\the\catcode35%
+\catcode40=\the\catcode40%
+\catcode41=\the\catcode41%
+\catcode42=\the\catcode42%
+\catcode43=\the\catcode43%
+\catcode44=\the\catcode44%
+\catcode45=\the\catcode45%
+\catcode46=\the\catcode46%
+\catcode58=\the\catcode58%
+\catcode59=\the\catcode59%
+\catcode60=\the\catcode60%
+\catcode61=\the\catcode61%
+\catcode62=\the\catcode62%
+\catcode64=\the\catcode64%
+\catcode91=\the\catcode91%
+\catcode93=\the\catcode93%
+\catcode94=\the\catcode94%
+\catcode95=\the\catcode95%
+\catcode126=\the\catcode126%
+\endlinechar=\the\endlinechar
+\relax}
+\catcode32=10 %< >
+\catcode33=12 %<">
+\catcode35=6 %<#>
+\catcode40=12 %<(>
+\catcode41=12 %<)>
+\catcode42=12 %<*>
+\catcode43=12 %<+>
+\catcode44=12 %<,>
+\catcode45=12 %<->
+\catcode46=12 %<.>
+\catcode58=12 %<:>
+\catcode59=12 %<;>
+\catcode60=12 %<<>
+\catcode61=12 %<=>
+\catcode62=12 %<>>
+\catcode64=11 %<@>
+\catcode91=12 %<[>
+\catcode93=12 %<]>
+\catcode94=7 %<^>
+\catcode95=8 %<_>
+\catcode126=13 %<~>
+\endlinechar=-1 %
+
+\edef\ltj@otf@AtEnd{\x
+ \noexpand\let\noexpand\ltj@otf@AtEnd\relax}
+\def\luatexjaotfLoaded{\endinput}
+
+%% Check if LaTeX is used.
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax %<*!LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iffalse\endcsname
+\else %<*LaTeX>
+ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
+ \csname iftrue\endcsname
+ \NeedsTeXFormat{LaTeX2e}
+ \ProvidesPackage{luatexja-otf}[2017/05/20]
+\fi %</LaTeX>
+
+% Load core module if not yet.
+\ifx\luatexjacoreLoaded\@undefined
+ \ifltj@in@latex %<*LaTeX>
+ \RequirePackage{luatexja}
+ \else %<*!LaTeX>
+ \input luatexja.sty %
+ \fi %</LaTeX>
+\fi
+
+%% When environment check fails, exit now.
+\ifx\LuaTeXjaAvailable\@undefined
+ \ltj@otf@AtEnd
+\expandafter\endinput\fi\relax
+
+%%------------------
+%! Main part of luatexja-otf
+\RequireLuaTeXjaSubmodule{otf}
+
+\newcount\ltj@tempcnta
+
+\protected\def\CID#1{\ifvmode\leavevmode\fi\ltj@tempcnta#1\relax\directlua{luatexja.otf.cid(\the\ltj@tempcnta)}\relax}
+
+%% \UTF compatible with the OTF package for pLaTeX
+\protected\def\UTF#1{\ifvmode\leavevmode\fi\directlua{luatexja.otf.utf(0x#1)}}
+
+%% Load ajmacros
+\ifltj@in@latex %<*LaTeX>
+ \RequirePackage{luatexja-ajmacros}
+\else %<*!LaTeX>
+ \input luatexja-ajmacros.sty %
+ % \bou is defined in lltjext, \mbox is defined in LaTeX kernel
+ \def\boutenchar{\char\euc"A1A2}%"
+ \def\bou#1{\ifvmode\leavevmode\fi\@bou#1\end}
+ \def\@bou#1{%
+ \ifx#1\end \let\ltj@@next=\relax
+ \else
+ \ifnum\ltjgetparameter{direction}=3\relax
+ \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
+ \vss\moveleft0.2\zw\hbox{\yoko\boutenchar}\nointerlineskip
+ \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
+ \else
+ \hbox to\z@{\vbox to\z@{\boxmaxdepth\maxdimen
+ \vss\moveleft-0.2\zw\hbox{\boutenchar}\nointerlineskip
+ \hbox{\char\euc"A1A1}}\hss}\nobreak#1\relax
+ \fi
+ \let\ltj@@next=\@bou
+ \fi\ltj@@next}
+ \long\def\mbox#1{\leavevmode\hbox{#1}}
+\fi %</LaTeX>
+
+% macros from otf.sty
+%for literature
+\protected\def\ajKunoji{%
+ \ifnum\ltjgetparameter{direction}=3 \mbox{\UTF{3033}\UTF{3035}}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajKunojiwithBou{%
+ \ifnum\ltjgetparameter{direction}=3 \mbox{\bou{\mbox{\UTF{3033}}}\bou{\mbox{\UTF{3035}}}}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajDKunoji{%
+ \ifnum\ltjgetparameter{direction}=3 \mbox{\UTF{3034}\UTF{3035}}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajDKunojiwithBou{%
+ \ifnum\ltjgetparameter{direction}=3 \mbox{\bou{\mbox{\UTF{3034}}}\bou{\mbox{\UTF{3035}}}}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajNinoji{\CID{12106}}
+\protected\def\ajvarNinoji{%
+ \ifnum\ltjgetparameter{direction}=3 \CID{12107}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajYusuriten{%
+ \ifnum\ltjgetparameter{direction}=3 \CID{16193}\else
+ \@PackageError{luatexja-otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
+ \fi}
+\protected\def\ajMasu{\UTF{303c}}
+\protected\def\ajYori{\UTF{309f}}
+\protected\def\ajKoto{\UTF{30ff}}
+\protected\def\ajUta{\UTF{303d}}
+%dingbats
+\protected\def\ajCommandKey{\UTF{2318}}
+\protected\def\ajReturnKey{\UTF{23ce}}
+\protected\def\ajCheckmark{\UTF{2713}}
+\protected\def\ajVisibleSpace{\UTF{2423}}
+\protected\def\ajSenteMark{\UTF{2617}}
+\protected\def\ajGoteMark{\UTF{2616}}
+\protected\def\ajClub{\UTF{2663}}
+\protected\def\ajHeart{\UTF{2661}}
+\protected\def\ajSpade{\UTF{2660}}
+\protected\def\ajDiamond{\UTF{2662}}
+\protected\def\ajvarClub{\UTF{2667}}
+\protected\def\ajvarHeart{\UTF{2665}}
+\protected\def\ajvarSpade{\UTF{2664}}
+\protected\def\ajvarDiamond{\UTF{2666}}
+\protected\def\ajPhone{\UTF{260e}}
+\protected\def\ajPostal{\UTF{3020}}
+\protected\def\ajvarPostal{\UTF{3036}}
+\protected\def\ajSun{\UTF{2600}}
+\protected\def\ajCloud{\UTF{2601}}
+\protected\def\ajUmbrella{\UTF{2602}}
+\protected\def\ajSnowman{\UTF{2603}}
+\protected\def\ajJIS{\UTF{3004}}
+\protected\def\ajJAS{\CID{12088}}
+\protected\def\ajBall{\CID{12097}}
+\protected\def\ajHotSpring{\UTF{2668}}
+\protected\def\ajWhiteSesame{\UTF{fe46}}
+\protected\def\ajBlackSesame{\UTF{fe45}}
+\protected\def\ajWhiteFlorette{\UTF{2740}}
+\protected\def\ajBlackFlorette{\UTF{273f}}
+\protected\def\ajRightBArrow{\CID{8206}}
+\protected\def\ajLeftBArrow{\CID{8207}}
+\protected\def\ajUpBArrow{\CID{8208}}
+\protected\def\ajDownBArrow{\CID{8209}}
+\protected\def\ajRightHand{\CID{8219}}
+\protected\def\ajLeftHand{\CID{8220}}
+\protected\def\ajUpHand{\CID{8221}}
+\protected\def\ajDownHand{\CID{8222}}
+\protected\def\ajRightScissors{\CID{12176}}
+\protected\def\ajLeftScissors{\CID{12175}}
+\protected\def\ajUpScissors{\CID{12177}}
+\protected\def\ajDownScissors{\CID{12178}}
+\protected\def\ajRightWArrow{\CID{12197}}
+\protected\def\ajLeftWArrow{\CID{12196}}
+\protected\def\ajUpWArrow{\CID{12198}}
+\protected\def\ajDownWArrow{\CID{12199}}
+\protected\def\ajRightDownArrow{\CID{12202}}
+\protected\def\ajLeftDownArrow{\CID{12203}}
+\protected\def\ajLeftUpArrow{\CID{12204}}
+\protected\def\ajRightUpArrow{\CID{12205}}
+
+%%------------------ all done
+\ltj@otf@AtEnd
+\endinput
+%% EOF
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty
new file mode 100644
index 0000000000..2eb38c8384
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty
@@ -0,0 +1,706 @@
+% luatexja-preset.sty
+\ProvidesPackage{luatexja-preset}[2019/03/26 Japanese font presets]
+
+\RequirePackage{expl3,l3keys2e}
+\RequirePackage{luatexja}
+\ExplSyntaxOn
+
+%% messages
+\msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
+ The~ luatexja-fontspec~ package~ is~ loaded~ already.~
+ Hence~ we~ ignore~ `nfssonly'~option.
+}
+\msg_new:nnn { luatexja-preset }{ no-font }{
+ Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it.
+}
+\msg_new:nnn { luatexja-preset }{ scale }{
+ Japanese~fonts~will~be~scaled~by~#1.
+}
+
+\msg_new:nnn { luatexja-preset }{ exist-preset-nooverwrite }{
+ The~ preset~ `#1'~ is~ already~ defined.~
+ To~ redefine~ this~ preset,~ use~ \str_use:N \c_backslash_str ltjnewpreset*~ instead.
+}
+\msg_new:nnn { luatexja-preset }{ exist-preset-overwrite }{
+ The~ preset~ `#1'~ is~ redefined.
+}
+
+\msg_new:nnn { luatexja-preset }{ illegal-preset-name }{
+ The~ preset~ `#1'~ cannot~ be~ defined,~
+ since~ the~ luatexja-preset~ package~ an~ option~ with~ the~ same~ name.
+}
+
+\seq_new:N \g__ltjpreset_presets_seq
+
+\keys_define:nn { luatexja-preset }{
+ unknown .code:n =
+ \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl
+ \tl_if_empty:NT \l_tmpa_tl {
+ \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec }
+ },
+ scale .code:n = \gdef\Cjascale{#1},
+ match .code: n =
+ \renewcommand\jttdefault{\gtdefault}\@ltj@match@familytrue
+ \PassOptionsToPackage { match } { luatexja-fontspec },
+ match .value_forbidden:n = true,
+ __custom .bool_set:N = \g__ltjpreset_custom_bool, __custom .groups:n = { preset },
+ __office .bool_set:N = \g__ltjpreset_office_bool, __office .groups:n = { preset },
+ __noembed .bool_set:N = \g__ltjpreset_noembed_bool, __noembed .groups:n = { preset },
+}
+\cs_new:Nn \__ltjpreset_declare_option:nn {
+ \keys_define:nn { luatexja-preset }{
+ #1 .code:n = { #2 },
+ #1 .value_forbidden:n = true
+ }
+}
+\cs_new:Nn \ltjpreset_declare_preset:nn {
+ \keys_define:nn { luatexja-preset }{
+ #1 .meta:n = { #2 },
+ #1 .value_forbidden:n = true, #1 .groups:n = { preset },
+ }
+ \seq_put_right:Nn \g__ltjpreset_presets_seq { #1 }
+}
+\cs_generate_variant:Nn \ltjpreset_declare_preset:nn {nx}
+\cs_new:Nn \__ltjpreset_declare_bool_option:nn {
+ \bool_new:c { g__ltjpreset_#1_bool }
+ \bool_set_false:c { g__ltjpreset_#1_bool }
+ \keys_define:nn { luatexja-preset }{
+ #1 .bool_set:c = { g__ltjpreset_#1_bool },
+ #2 .bool_set_inverse:c = { g__ltjpreset_#1_bool },
+ #1 .default:n = true, #2 .default:n = true,
+ }
+}
+
+%%%%%%%% bool options
+\__ltjpreset_declare_bool_option:nn { nfssonly }{ fontspec }
+\__ltjpreset_declare_bool_option:nn { bold }{ nobold }
+\__ltjpreset_declare_bool_option:nn { expert }{ noexpert }
+\__ltjpreset_declare_bool_option:nn { deluxe }{ nodeluxe }
+
+% JFM
+\tl_new:N \__ltjpreset_use_jfm_yoko_tl % 使用する JFM(横)
+\tl_set:Nn \__ltjpreset_use_jfm_yoko_tl {\ltj@stdyokojfm}
+\tl_new:N \__ltjpreset_use_jfm_tate_tl % 使用する JFM(縦)
+\tl_set:Nn \__ltjpreset_use_jfm_tate_tl {\ltj@stdtatejfm}
+\__ltjpreset_declare_option:nn{jis}{\tl_set:Nn \__ltjpreset_use_jfm_yoko_tl {jis}} % jis
+\__ltjpreset_declare_option:nn{ujis}{\tl_set:Nn \__ltjpreset_use_jfm_yoko_tl {ujis}} % ujis
+
+% 漢字字形
+\tl_new:N \l__ltjpreset_kanji_shape_tl
+\__ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l__ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
+\__ltjpreset_declare_option:nn{jis90}{ \tl_set:Nn \l__ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis
+\__ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l__ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
+\__ltjpreset_declare_option:nn{2004jis}{\tl_set:Nn \l__ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
+
+% font preset
+\prop_new:N \g__ltjpreset_font_prop
+\keys_define:nn { luatexja-preset } {
+ mc .code:n =
+ \prop_put:Nnn \g__ltjpreset_font_prop { mc-l } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { mc-m } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { mc-bx } {#1},
+ mc .groups:n = { preset }, mc .value_required:n = true,
+ gt .code:n =
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-u } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-d } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-bx } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-eb } {#1},
+ gt-m .code:n = % gtfamily , medium series
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-u } {#1}
+ \prop_put:Nnn \g__ltjpreset_font_prop { gt-d } {#1},
+ % gt-d, gt-u は隠し
+ gt .groups:n = { preset }, gt .value_required:n = true,
+ gt-m .groups:n = { preset }, gt-m .value_required:n = true,
+}
+\cs_set:Nn \ltjpreset_define_preset_prop:n {
+ \keys_define:nn { luatexja-preset } {
+ #1 .code:n = \prop_put:Non \g__ltjpreset_font_prop { #1 } { ##1 },
+ #1 .groups:n = { preset }, #1 .value_required:n = true,
+ }
+}
+\ltjpreset_define_preset_prop:n { mc-l }
+\ltjpreset_define_preset_prop:n { mc-m }
+\ltjpreset_define_preset_prop:n { mc-bx }
+\ltjpreset_define_preset_prop:n { gt-u }
+\ltjpreset_define_preset_prop:n { gt-d }
+\ltjpreset_define_preset_prop:n { gt-bx }
+\ltjpreset_define_preset_prop:n { gt-eb}
+\ltjpreset_define_preset_prop:n { mg-m }
+
+\cs_new:Nn \__ltjpreset_set_uni:nn {
+ mc = #1, gt = #2, mc-bx = #2, mg-m = #2,
+ __custom = false, __office = false, __noembed = false,
+}
+\cs_new:Npn \__ltjpreset_set_office:nn #1 #2{
+ mc = #1, mc-bx = HGMinchoE ,
+ gt-d = HGGothicM , gt-bx = HGGothicE ,
+ gt-u = #2 , gt-eb = HGSoeiKakugothicUB ,
+ mg-m = HGMaruGothicMPRO,
+ __custom = false, __office = true, __noembed = false,
+}
+
+%%%%%%%% プリセット達
+
+% カスタム指定
+ \keys_define:nn { luatexja-preset }{
+ custom .meta:n = { #1, __custom = true, },
+ custom .value_required:n = true,
+ jfm_yoko .tl_set:N = \__ltjpreset_use_jfm_yoko_tl,
+ jfm_tate .tl_set:N = \__ltjpreset_use_jfm_tate_tl,
+}
+
+% 小塚 (Adobe)
+%% Pro
+\ltjpreset_declare_preset:nx{kozuka-pro}{
+ mc-m = KozMinPro-Regular, mc-bx = KozMinPro-Bold,
+ gt-d = KozGoPro-Regular, gt-bx = KozGoPro-Bold,
+ gt-u = KozGoPro-Medium, gt-eb = KozGoPro-Heavy,
+ mg-m = KozGoPro-Heavy, mc-l = KozMinPro-Light,
+ __custom = false, __office = false, __noembed = false,
+}
+%% Pr6
+\ltjpreset_declare_preset:nx{kozuka-pr6}{
+ mc-m = KozMinProVI-Regular, mc-bx = KozMinProVI-Bold,
+ gt-d = KozGoProVI-Regular, gt-bx = KozGoProVI-Bold,
+ gt-u = KozGoProVI-Medium, gt-eb = KozGoProVI-Heavy,
+ mg-m = KozGoProVI-Heavy, mc-l = KozMinProVI-Light,
+ __custom = false, __office = false, __noembed = false,
+}
+%% Pr6N
+\ltjpreset_declare_preset:nx{kozuka-pr6n}{
+ mc-m = KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold,
+ gt-d = KozGoPr6N-Regular, gt-bx = KozGoPr6N-Bold,
+ gt-u = KozGoPr6N-Medium, gt-eb = KozGoPr6N-Heavy,
+ mg-m = KozGoPr6N-Heavy, mc-l = KozMinPr6N-Light,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% ヒラギノ (OSX)
+\ltjpreset_declare_preset:nx{hiragino-pro}{
+ mc-m = HiraMinPro-W3, mc-bx = HiraMinPro-W6,
+ gt-d = HiraKakuPro-W3, gt-bx = HiraKakuPro-W6,
+ gt-u = HiraKakuPro-W6, gt-eb = HiraKakuStd-W8,
+ mg-m = HiraMaruPro-W4, mc-l = HiraMinPro-W2,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{hiragino-pron}{
+ mc-m = HiraMinProN-W3, mc-bx = HiraMinProN-W6,
+ gt-d = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6,
+ gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8,
+ mg-m = HiraMaruProN-W4, mc-l = HiraMinProN-W2,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% モリサワ
+\ltjpreset_declare_preset:nx{bizud}{
+ mc = BIZ-UDMinchoM.ttc,
+ gt-d = BIZ-UDGothicR.ttc, gt-bx = BIZ-UDGothicB.ttc,
+ gt-u = BIZ-UDGothicR.ttc, gt-eb = BIZ-UDGothicB.ttc,
+ mg-m = BIZ-UDGothicB.ttc,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{morisawa-pro}{
+ mc = A-OTF-RyuminPro-Light.otf, mc-bx = A-OTF-FutoMinA101Pro-Bold.otf,
+ gt-d = A-OTF-GothicBBBPro-Medium.otf , gt-bx = A-OTF-FutoGoB101Pro-Bold.otf,
+ gt-u = A-OTF-GothicBBBPro-Medium.otf , gt-eb = A-OTF-MidashiGoPro-MB31.otf,
+ mg-m = A-OTF-Jun101Pro-Light.otf,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{morisawa-pr6n}{
+ mc = A-OTF-RyuminPr6N-Light.otf, mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf,
+ gt-d = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = A-OTF-FutoGoB101Pr6N-Bold.otf,
+ gt-u = A-OTF-GothicBBBPr6N-Medium.otf , gt-eb = A-OTF-MidashiGoPr6N-MB31.otf,
+ mg-m = A-OTF-Jun101Pr6N-Light.otf,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% 游明朝/游ゴシック (Win8.1)
+\ltjpreset_declare_preset:nx{yu-win}{
+ mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
+ gt-d = YuGothic-Regular, gt-bx = YuGothic-Bold,
+ gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold,
+ mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
+ __custom = false, __office = false, __noembed = false,
+}
+% Win10
+\ltjpreset_declare_preset:nx{yu-win10}{
+ mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
+ gt-d = YuGothic-Regular, gt-bx = YuGothic-Bold,
+ gt-u = YuGothic-Medium, gt-eb = YuGothic-Bold,
+ mg-m = YuGothic-Bold, mc-l = YuMincho-Light,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% Yu fonts in OSX
+% according to http://support.apple.com/kb/HT5944
+\ltjpreset_declare_preset:nx{yu-osx}{
+ mc = YuMincho~Medium, mc-bx = YuMincho~Demibold,
+ gt-d = YuGothic~Medium, gt-u = YuGothic~Medium,
+ gt-bx = YuGothic~Bold, gt-eb = YuGothic~Bold,
+ mg-m = YuGothic~Bold,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% moga-mobo
+\ltjpreset_declare_preset:nx{moga-mobo}{
+ mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold,
+ gt-d = Moga90Gothic, gt-bx = Moga90Gothic~Bold,
+ gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold,
+ mg-m = Mobo90Gothic,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{moga-mobo-ex}{
+ mc = MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold,
+ gt-d = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold,
+ gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold,
+ mg-m = MoboEx90Gothic,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% Ume fones
+\ltjpreset_declare_preset:nx{ume}{
+ mc = Ume~Mincho,
+ gt-d = Ume~Gothic, gt-bx = Ume~Gothic~O5,
+ gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5,
+ mg-m = Ume~Gothic~O4,
+ __custom = false, __office = false, __noembed = false,
+}
+
+% Source Han {Serif,Sans}
+\ltjpreset_declare_preset:nx{sourcehan}{
+ mc-m = Source~Han~Serif~Regular,
+ mc-bx = Source~Han~Serif~Bold,
+ gt-d = Source~Han~Sans~Regular,
+ gt-bx = Source~Han~Sans~Bold,
+ gt-u = Source~Han~Sans~Medium,
+ gt-eb = Source~Han~Sans~Heavy,
+ mg-m = Source~Han~Sans~Heavy,
+ mc-l = Source~Han~Serif~Light,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{sourcehan-jp}{
+ mc-m = Source~Han~Serif~JP~Regular,
+ mc-bx = Source~Han~Serif~JP~Bold,
+ gt-d = Source~Han~Sans~JP~Regular,
+ gt-bx = 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,
+ mc-l = Source~Han~Serif~JP~Light,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{noto-otc}{
+ mc-m = Noto~Serif~CJK~Regular,
+ mc-bx = Noto~Serif~CJK~Bold,
+ gt-d = Noto~Sans~CJK~Regular,
+ gt-bx = Noto~Sans~CJK~Bold,
+ gt-u = Noto~Sans~CJK~Medium,
+ gt-eb = Noto~Sans~CJK~Black,
+ mg-m = Noto~Sans~CJK~Black,
+ mc-l = Noto~Serif~CJK~Light,
+ __custom = false, __office = false, __noembed = false,
+}
+\ltjpreset_declare_preset:nx{noto-otf}{
+ mc-m = Noto~Serif~CJK~JP~Regular,
+ mc-bx = Noto~Serif~CJK~JP~Bold,
+ gt-d = Noto~Sans~CJK~JP~Regular,
+ gt-bx = 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,
+ mc-l = Noto~Serif~CJK~JP~Light,
+ __custom = false, __office = false, __noembed = false,
+}
+
+
+% ipa, ipaex, ms
+\ltjpreset_declare_preset:nx{ipa}{
+ \__ltjpreset_set_uni:nn { IPAMincho } { IPAGothic }
+}
+\ltjpreset_declare_preset:nx{ipaex}{
+ \__ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic }
+}
+\ltjpreset_declare_preset:nx{ms}{
+ \__ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic }
+}
+
+% {ipa,ipaex,ms}-dx % Office 付属フォントを利用
+\ltjpreset_declare_preset:nx{ipaex-hg}{
+ \__ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }
+}
+\ltjpreset_declare_preset:nx{ipa-hg}{
+ \__ltjpreset_set_office:nn { IPAMincho } { IPAGothic }
+}
+\ltjpreset_declare_preset:nx{ms-hg}{
+ \__ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }
+}
+
+
+% 非埋込
+\ltjpreset_declare_preset:nx{noembed}{
+ \__ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium },
+ __custom = false, __office = false, __noembed = true,
+}
+
+\keys_set:nn {luatexja-preset} { ipaex }
+\ProcessKeysOptions { luatexja-preset }
+\@ifpackageloaded{luatexja-fontspec}{
+ \bool_if:NT \g__ltjpreset_nfssonly_bool
+ { \msg_warning:nn { luatexja-preset }{ ltj-fontspec } }
+ \bool_set_false:N \g__ltjpreset_nfssonly_bool
+}{}
+
+%%%%%%%% main routine
+
+\cs_new:Nn \__ltjpreset_extract_fonts: {
+ %% MogaMincho の場合は 90 をつける/はずす
+ \bool_if:NF \g__ltjpreset_custom_bool {
+ \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
+ \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl {
+ \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \g__ltjpreset_font_prop { mc-m } }
+ \tl_if_in:NnT \l_tmpb_tl { Moga90Mincho } {
+ \prop_clear:N \l_tmpa_prop
+ \prop_map_inline:Nn \g__ltjpreset_font_prop {
+ \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
+ \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
+ }
+ \prop_set_eq:NN \g__ltjpreset_font_prop \l_tmpa_prop
+ }
+ \tl_if_in:NnT \l_tmpb_tl { MogaEx90Mincho } {
+ \prop_clear:N \l_tmpa_prop
+ \prop_map_inline:Nn \g__ltjpreset_font_prop {
+ \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
+ \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
+ }
+ \prop_set_eq:NN \g__ltjpreset_font_prop \l_tmpa_prop
+ }
+ }
+ }
+ %%%% リストからの展開
+ \cs_set:Nx \__ltjpreset_font_mc_l: { \prop_item:Nn \g__ltjpreset_font_prop { mc-l } }
+ \cs_set:Nx \__ltjpreset_font_mc_m: { \prop_item:Nn \g__ltjpreset_font_prop { mc-m } }
+ \cs_set:Nx \__ltjpreset_font_mc_bx: { \prop_item:Nn \g__ltjpreset_font_prop { mc-bx } }
+ \cs_set:Nx \__ltjpreset_font_gt_m: { \prop_item:Nn \g__ltjpreset_font_prop { gt-d } }
+ \cs_set:Nx \__ltjpreset_font_gt_u: { \prop_item:Nn \g__ltjpreset_font_prop { gt-u } }
+ \cs_set:Nx \__ltjpreset_font_gt_bx: { \prop_item:Nn \g__ltjpreset_font_prop { gt-bx } }
+ \cs_set:Nx \__ltjpreset_font_gt_eb: { \prop_item:Nn \g__ltjpreset_font_prop { gt-eb } }
+ \cs_set:Nx \__ltjpreset_font_mg_m: { \prop_item:Nn \g__ltjpreset_font_prop { mg-m } }
+ %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換
+ \bool_if:nT { !\g__ltjpreset_custom_bool && \g__ltjpreset_office_bool } {
+ \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
+ \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl {
+ \cs_set:Nx \__ltjpreset_font_mc_bx: { hgrme04.ttc }
+ \cs_set:Nx \__ltjpreset_font_gt_bx: { hgrge04.ttc }
+ \cs_set:Nx \__ltjpreset_font_gt_eb: { hgrsgu04.ttc }
+ \cs_set:Nx \__ltjpreset_font_mg_m: { hgrsmp04.ttf }
+ \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_u:
+ % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
+ }
+ \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
+ \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl {
+ \cs_set:Nx \__ltjpreset_font_mc_bx: { hgrme.ttc }
+ \cs_set:Nx \__ltjpreset_font_gt_bx: { hgrge.ttc }
+ \cs_set:Nx \__ltjpreset_font_gt_eb: { hgrsgu.ttc }
+ \cs_set:Nx \__ltjpreset_font_mg_m: { hgrsmp.ttf }
+ }
+ }
+ % mc/l
+ \tl_set:Nx \l_tmpa_tl { \__ltjpreset_font_mc_l: }
+ \tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}}
+ \cs_set:Nx \__ltjpreset_font_mc_l: {
+ \tl_if_blank:nTF \l_tmpa_tl { \__ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl }
+ }
+ %% bold オプションの処理
+ \bool_if:NTF \g__ltjpreset_deluxe_bool {
+ \bool_if:NT \g__ltjpreset_bold_bool {
+ \cs_set_eq:NN \__ltjpreset_font_mc_bx: \__ltjpreset_font_gt_bx:
+ }
+ }{
+ \bool_if:NTF \g__ltjpreset_bold_bool
+ { \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_bx: }
+ { \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_u: }
+ \cs_set_eq:NN \__ltjpreset_font_gt_bx: \__ltjpreset_font_gt_m:
+ \cs_set_eq:NN \__ltjpreset_font_mc_bx: \__ltjpreset_font_gt_m:
+ }
+}
+
+%%%%%%%% フォント名を \l__ltjpreset_font_name: に格納
+\clist_new:N \l__ltjpreset_extensions_clist
+\clist_set:Nn \l__ltjpreset_extensions_clist {.otf,.ttf,.OTF,.TTF,.ttc,.TTC}
+\prg_new_conditional:Nnn \__ltjpreset_if_detect_external:n {TF} {
+ \clist_map_inline:Nn \l__ltjpreset_extensions_clist {
+ \bool_set_false:N \l_tmpa_bool
+ \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string}
+ { \bool_set_true:N \l_tmpa_bool \clist_map_break: }
+ }
+ \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false:
+}
+\cs_new:Nn \__ltjpreset_wrap_fontname:n {
+ \__ltjpreset_if_detect_external:nTF { #1 }
+ { \cs_set:Nn \l__ltjpreset_font_name: { [#1] } }
+ { \cs_set:Nn \l__ltjpreset_font_name: { "#1" } }
+}
+\cs_generate_variant:Nn \__ltjpreset_wrap_fontname:n { e }
+
+%%%%%%%% 存在判定
+\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
+ \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: }
+ \fi
+ } { \cs_gset_eq:cc { ltjpreset_font_#1_#2: } { ltjpreset_font_#3_#4: } }
+ \group_end:
+}
+
+%%%%%%%% deluxe (\mgfamily はあとで定義)
+\bool_if:NTF \g__ltjpreset_deluxe_bool {
+ \cs_new:Nn \__ltjpreset_check_deluxe_existence: {
+ \__ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx }
+ \__ltjpreset_substitute:nnnn { mg } { m } { gt } { bx }
+ \__ltjpreset_substitute:nnnn { mc } { l } { mc } { m }
+ }
+ \def\ltdefault{l}
+ \DeclareRobustCommand\ltseries { \not@math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
+ \def\ebdefault{eb}
+ \DeclareRobustCommand\ebseries { \not@math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
+ \DeclareRobustCommand\gtebfamily { \gtfamily\fontseries{\ebdefault}\selectfont }
+} {
+ \cs_set_eq:NN \__ltjpreset_check_deluxe_existence: \prg_do_nothing:
+}
+
+\int_new:N \g__ltjpreset_applycount_int
+
+\bool_if:NTF \g__ltjpreset_nfssonly_bool {
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%% nfss only
+ \cs_if_exist:NF \Cjascale {
+ \group_begin:
+ \fontsize{16}{16}\selectfont
+ \cs_gset:Npx \Cjascale { \fp_to_decimal:n {\zw / 16} }
+ \group_end:
+ }
+
+ \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
+
+ % {1: encoding}{2: family}{3: series}{4: shape}{5: fontname}{6: feature}{7: scale}
+ \cs_new:Nn \__ltjpreset_declare_font_shape:nnnnnnn {
+ \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[#7]
+ \bool_if:NT \g__ltjpreset_noembed_bool {psft:} #5
+ ;-kern \tl_use:N \l__ltjpreset_kanji_shape_tl; #6 } {}
+ }
+ \cs_new:Nn \__ltjpreset_define_family:nnn {
+ \__ltjpreset_wrap_fontname:e { #3 }
+ \__ltjpreset_declare_font_shape:nnnnnnn { JY3 }
+ { ltjp #1 \int_to_arabic:n { \g__ltjpreset_applycount_int }} { #2 } { n }
+ { \l__ltjpreset_font_name: : jfm=\tl_use:N \__ltjpreset_use_jfm_yoko_tl }
+ { script=hani \bool_if:NT \g__ltjpreset_expert_bool { ;+hkna } }
+ { \Cjascale }
+ \__ltjpreset_declare_font_shape:nnnnnnn { JT3 }
+ { ltjp #1 \int_to_arabic:n { \g__ltjpreset_applycount_int }} { #2 } { n }
+ { \l__ltjpreset_font_name: : jfm=\tl_use:N \__ltjpreset_use_jfm_tate_tl }
+ { script=hani \bool_if:NT \g__ltjpreset_expert_bool { ;+vkna } }
+ { \Cjascale }
+ \bool_if:NT \g__ltjpreset_expert_bool {
+ \__ltjpreset_declare_font_shape:nnnnnnn { JY3 }
+ { ltjp #1 \int_to_arabic:n { \g__ltjpreset_applycount_int }} { #2 } { rb }
+ { \l__ltjpreset_font_name: : jfm=\tl_use:N \__ltjpreset_use_jfm_yoko_tl } { script=kana; +ruby }
+ { \Cjascale }
+ \__ltjpreset_declare_font_shape:nnnnnnn { JT3 }
+ { ltjp #1 \int_to_arabic:n { \g__ltjpreset_applycount_int }} { #2 } { rb }
+ { \l__ltjpreset_font_name: : jfm=\tl_use:N \__ltjpreset_use_jfm_tate_tl } { script=kana; +ruby }
+ { \Cjascale }
+ }
+ \cs_if_exist:NT \ltjpreset_define_family_hook_nfssonly:nnn
+ { \ltjpreset_define_family_hook_nfssonly:nnn { #1 } { #2 } { #3 } }
+ }
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ \let\mgfamily\undefined
+ \DeclareRobustCommand\mgfamily {
+ \not@math@alphabet\mgfamily\relax
+ \kanjifamily{ltjpmg \int_to_arabic:n { \g__ltjpreset_applycount_int }}\selectfont
+ }
+ \DeclareTextFontCommand{\textmg}{\mgfamily}
+ }
+ \bool_if:NT \g__ltjpreset_expert_bool {
+ \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont }
+ }
+ %
+ \cs_new:Nn \__ltjpreset_do_fontset: { \group_begin:
+ % ======
+ \xdef\mcdefault{ltjpmc \int_to_arabic:n { \g__ltjpreset_applycount_int }}
+ \xdef\gtdefault{ltjpgt \int_to_arabic:n { \g__ltjpreset_applycount_int }}
+ \DeclareKanjiFamily{JY3}{\mcdefault}{}
+ \DeclareKanjiFamily{JT3}{\mcdefault}{}
+ \DeclareKanjiFamily{JY3}{\gtdefault}{}
+ \DeclareKanjiFamily{JT3}{\gtdefault}{}
+ \unless\ifltj@disablejfam
+ \SetSymbolFont{mincho}{normal}{JY3}{\mcdefault}{m}{n}
+ \SetSymbolFont{mincho}{bold}{JY3}{\mcdefault}{bx}{n}
+ \DeclareMathAlphabet{\mathgt}{JY3}{\gtdefault}{m}{n}
+ \fi
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ \DeclareKanjiFamily{JY3}{ltjpmg \int_to_arabic:n { \g__ltjpreset_applycount_int }}{}
+ \DeclareKanjiFamily{JT3}{ltjpmg \int_to_arabic:n { \g__ltjpreset_applycount_int }}{}
+ }
+ % ======
+ \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
+ \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl {
+ \tl_set:Nn \l__ltjpreset_kanji_shape_tl { ;+jp90 }
+ }
+ \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
+ \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl {
+ \tl_set:Nx \l__ltjpreset_kanji_shape_tl { ;+jp04 }
+ }
+ \__ltjpreset_define_family:nnn {mc} {m} {\__ltjpreset_font_mc_m:}
+ \__ltjpreset_define_family:nnn {mc} {bx} {\__ltjpreset_font_mc_bx:}
+ \__ltjpreset_define_family:nnn {mc} {b} {\__ltjpreset_font_mc_bx:}
+ \__ltjpreset_define_family:nnn {gt} {m} {\__ltjpreset_font_gt_m:}
+ \__ltjpreset_define_family:nnn {gt} {bx} {\__ltjpreset_font_gt_bx:}
+ \__ltjpreset_define_family:nnn {gt} {b} {\__ltjpreset_font_gt_bx:}
+ \normalfont
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ \__ltjpreset_define_family:nnn {mc} {l} {\__ltjpreset_font_mc_l:}
+ \__ltjpreset_define_family:nnn {gt} {eb} {\__ltjpreset_font_gt_eb:}
+ \__ltjpreset_define_family:nnn {mg} {m} {\__ltjpreset_font_mg_m:}
+ }
+ \group_end:
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%% fontspec
+} {
+ \RequirePackage{luatexja-fontspec}
+ % scale
+ \msg_warning:nnx { luatexja-preset }{ scale }{ \Cjascale }
+ \tl_new:N \l__ltjpreset_add_features_tl
+
+ \bool_if:NT \g__ltjpreset_expert_bool {
+ \cs_set:Npn \rubyfamily { \addjfontfeatures {
+ Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna}
+ } }
+ }
+ \addjfontfeature{ Kerning=Off }
+ % 実際の fontspec の呼びだし
+ \cs_new:Nn \__ltjpreset_do_fontset: { \group_begin:
+ \tl_gset:Nx \l__ltjpreset_add_features_tl {
+ \tl_use:N \l__ltjpreset_kanji_shape_tl,
+ YokoFeatures = { JFM = \tl_use:N \__ltjpreset_use_jfm_yoko_tl },
+ TateFeatures = { JFM = \tl_use:N \__ltjpreset_use_jfm_tate_tl },
+ Script=CJK, \bool_if:NT \g__ltjpreset_noembed_bool { , NoEmbed }
+ }
+ \group_end:
+ \bool_if:NT \g__ltjpreset_expert_bool {
+ \tl_put_left:Nn \l__ltjpreset_add_features_tl {
+ , YokoFeatures = {Style = HorizontalKana}, TateFeatures = {Style = VerticalKana}
+ }
+ }
+ \setmainjfont [
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ FontFace={l}{n}{ Font = \__ltjpreset_font_mc_l:,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ \ltjpreset_define_family_hook_fontspec:nnn
+ { mc } { l } { \__ltjpreset_font_mc_l: }
+ }
+ },
+ }
+ BoldFont = \__ltjpreset_font_mc_bx: \tl_use:N \l__ltjpreset_add_features_tl,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ UprightFeatures = { \ltjpreset_define_family_hook_fontspec:nnn
+ { mc } { m } { \__ltjpreset_font_mc_m: } },
+ BoldFeatures = { \ltjpreset_define_family_hook_fontspec:nnn
+ { mc } { bx } { \__ltjpreset_font_mc_bx: } },
+ }
+ ] { \__ltjpreset_font_mc_m: }
+ \setsansjfont [
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ FontFace={eb}{n}{ Font = \__ltjpreset_font_gt_eb:,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ \ltjpreset_define_family_hook_fontspec:nnn
+ { gt } { eb } { \__ltjpreset_font_gt_eb: }
+ }
+ },
+ }
+ BoldFont = \__ltjpreset_font_gt_bx: \tl_use:N \l__ltjpreset_add_features_tl,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ UprightFeatures = { \ltjpreset_define_family_hook_fontspec:nnn
+ { gt } { m } { \__ltjpreset_font_gt_m: } },
+ BoldFeatures = { \ltjpreset_define_family_hook_fontspec:nnn
+ { gt } { bx } { \__ltjpreset_font_gt_bx: } },
+ }
+ ] { \__ltjpreset_font_gt_m: }
+ \bool_if:NT \g__ltjpreset_deluxe_bool {
+ %% mg
+ \bool_if_exist:NTF \setfontfamily {
+ \setjfontfamily \mgfamily [
+ BoldFont = \__ltjpreset_font_mg_m: \tl_use:N \l__ltjpreset_add_features_tl,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ \ltjpreset_define_family_hook_fontspec:nnn
+ { mg } { m } { \__ltjpreset_font_mg_m: },
+ }
+ ] { \__ltjpreset_font_mg_m: }
+ } {
+ \newjfontfamily \mgfamily [
+ BoldFont = \__ltjpreset_font_mg_m: \tl_use:N \l__ltjpreset_add_features_tl,
+ \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn {
+ \ltjpreset_define_family_hook_fontspec:nnn
+ { mg } { m } { \__ltjpreset_font_mg_m: },
+ }
+ ] { \__ltjpreset_font_mg_m: }
+ }
+ \DeclareTextFontCommand{\textmg}{\mgfamily}
+ }
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+}
+
+\def\ltjnewpreset{
+ \@ifstar{\__ltjpreset_new_preset:nnn{ true }}{\__ltjpreset_new_preset:nnn{ false }}}
+\cs_set:Nn \__ltjpreset_new_preset:nnn {
+ \keys_if_exist:nnTF { luatexja-preset } { #2 } {
+ \seq_if_in:NnTF \g__ltjpreset_presets_seq { #2 } {
+ \bool_if:cTF { c_ #1 _bool } {
+ \msg_warning:nnn { luatexja-preset }{ exist-preset-overwrite } { #2 }
+ \keys_define:nn { luatexja-preset } {
+ #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
+ #2 .value_forbidden:n = true, #2 .groups:n = { preset },
+ }
+ } {
+ \msg_error:nnn { luatexja-preset }{ exist-preset-nooverwrite } { #2 }
+ }
+ } {
+ \msg_error:nnn { luatexja-preset }{ illegal-preset-name } { #2 }
+ }
+ } {
+ \keys_define:nn { luatexja-preset } {
+ #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
+ #2 .value_forbidden:n = true, #2 .groups:n = { preset },
+ }
+ \seq_put_right:Nn \g__ltjpreset_presets_seq { #2 }
+ }
+}
+
+
+\cs_set:Npn \ltjapplypreset #1 {
+ \int_gincr:N \g__ltjpreset_applycount_int
+ \keys_set_groups:nnn { luatexja-preset } { preset } { #1 }
+ % \prop_map_inline:Nn \g__ltjpreset_font_prop {\typeout{ [##1] = "##2" } }
+ \__ltjpreset_extract_fonts:
+ \__ltjpreset_check_deluxe_existence:
+ \__ltjpreset_do_fontset:
+ \normalfont
+}
+
+\ltjapplypreset {}
+
+\@onlypreamble\ltjnewpreset
+\@onlypreamble\ltjapplypreset
+
+\ExplSyntaxOff
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty
new file mode 100644
index 0000000000..813ab31a43
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty
@@ -0,0 +1,210 @@
+%
+% luatexja-ruby.sty
+%
+
+% LaTeX only!
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-ruby}[2017/05/05 v0.23]
+\RequirePackage{luatexja}
+
+%%------------------
+\newattribute\ltj@rubyattr
+\ltj@rubyattr=0
+\RequireLuaTeXjaSubmodule{ruby}
+
+% ltjset/getparameter への追加設定
+% これらは段落単位の設定.
+
+%% 引数:ルビ全角を単位とした実数
+%% この文字への pre-, post-intrusion の許容量
+\define@key[ltj]{japaram}{rubypreintrusion}{%
+ \ltj@@set@stack@real{RIPRE}{0}{0x7FFFFFFF}#1 }
+\define@key[ltj]{japaram}{rubypostintrusion}{%
+ \ltj@@set@stack@real{RIPOST}{0}{0x7FFFFFFF}#1 }
+\def\ltj@@set@stack@real#1#2#3{%
+ \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1,
+ #2, #3, token.scan_word)}}
+
+% ルビ用のキー設定
+\def\ltj@@rkeydef#1{
+ \define@key[ltj]{ruby}{#1}{\expandafter\def\csname ltj@@rubyip@#1\endcsname{##1}}
+}
+%% attr_ruby_mode
+%% bit 0: intrusion を有効にするか(1: 有効)
+%% bit 1: 前後の intrusion 許容量を小さい方に揃える (1: yes)
+%% bit 2, 3: intrusion をどう使って親文字を配置するか
+%% 00: intrusion なしでとりあえず計算し,左右の突出分を進入に割り当てる
+%% 01: pre-intrusion でまかなえるだけまかない,無理なら post- も使う
+%% 10: post を優先
+%% 11: 2 min (pre,post) までは pre, post に均等配分しようとする
+%% >=01 で,intrusion で賄えきれなかった場合はいつものように伸長する.
+%% bit 4: 熟語ルビの際の処理方法(0: 常にグループ,1: 可能な限りブロックごとに)
+%% ↑bit 4 は今は無効
+\ltj@@rkeydef{mode}
+%% intrusion 量強制固定(bit 0, bit 1 より優先,負数で「自動」)
+%% attr は sp 単位だが,ユーザーはルビ全角単位で指定する
+%% attr_ruby_maxprep, attr_ruby_maxpostp
+\ltj@@rkeydef{pre}
+\ltj@@rkeydef{post}
+%% 親文字伸長の際の比,{0}{1}{1} などと0--7 の数 3 つで指定
+%% attr_ruby_stretch (bol left,middle,right)(eol)(middle) 27-bits
+\ltj@@rkeydef{stretchbol} % 行頭形
+\ltj@@rkeydef{stretcheol} % 行末形
+\ltj@@rkeydef{stretch} % 行中形
+%% ルビが伸長するときの比 {1}{2}{1} などと0--7 の数 3 つで指定
+%% attr_ruby_mode 上位部分
+\ltj@@rkeydef{stretchruby}
+%% ルビ<親のとき,ルビと親文字の端の最大値
+%% attr_ruby_maxmargin
+%% attr は sp 単位だが,ユーザーは親文字全角単位で指定
+\ltj@@rkeydef{maxmargin}
+%% ルビと親文字の垂直方向の空き
+%% attr_ruby_intergap
+%% attr は sp 単位だが,ユーザーは親文字全角単位で指定
+\ltj@@rkeydef{intergap}
+
+\ltj@@rkeydef{kenten}%% 圏点文字
+\ltj@@rkeydef{fontcmd}%% フォント
+\define@boolkey[ltj]{ruby}{rubysmash}[true]{}
+
+
+%%%%%%%% setkeys の別名
+\protected\def\ltjsetruby{\setkeys[ltj]{ruby}}
+
+% ここからは ruby マクロ内でなんとかされる事項
+%% ルビと親文字の大きさの比
+\ltj@@rkeydef{size}
+
+% 中つき用簡易設定.
+\define@key[ltj]{ruby}{naka}[none]{\setkeys[ltj]{ruby}{mode=1, stretch=121, stretchruby=121}}
+% 肩つき用簡易設定.
+\define@key[ltj]{ruby}{kata}[none]{\setkeys[ltj]{ruby}{mode=9, stretch=121, stretchruby=001}}
+
+%%%%%%%% 補助関数
+
+% Lua ソースに渡す table 生成
+\def\ltj@@ruby@create@table#1{% #1: ルビ全角
+ \string{
+ rubyzw = \ltj@safe@dimen{#1},
+ maxmargin = \ltj@safe@dimen{\ltj@@rubyip@maxmargin\zw},
+ pre = \ltj@safe@dimen{\ltj@@rubyip@pre#1},
+ post = \ltj@safe@dimen{\ltj@@rubyip@post#1},
+ intergap = \ltj@safe@dimen{\ltj@@rubyip@intergap\zw},
+ stretch
+ = 262144 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretchbol
+ + 512 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretcheol
+ + \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretch,
+ mode
+ = 2097152 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretchruby
+ + \ltj@safe@num{\ltj@@rubyip@mode}
+ + 1048576 * \ifltj@ruby@rubysmash1\else0\fi
+ \string}
+}
+%%%
+%%% 1098765432109876543210976543210
+%%% |st_ruby|! |--| ← mode
+\def\ltj@@ruby@cts#1#2#3{%
+ ((\ltj@safe@num{#1}) * 64 + (\ltj@safe@num{#2}) * 8 + \ltj@safe@num{#3})%
+}
+
+
+%%%%%%%% ZR さんの PXrubrica パッケージ中のコードから引用・改変
+% \pxrr@decompbar: a|bc -> \ltj@@ruby@mark{a}\ltj@@ruby@mark{bc}
+\let\pxrr@res\empty
+\def\pxrr@ifx#1{%
+ \ifx#1\expandafter\@firstoftwo
+ \else\expandafter\@secondoftwo
+ \fi
+}
+\def\pxrr@nil{\noexpand\pxrr@nil}
+\def\pxrr@end{\noexpand\pxrr@end}
+\def\pxrr@appto#1#2{%
+ \expandafter\def\expandafter#1\expandafter{#1#2}%
+}
+\def\pxrr@decompbar#1{%
+ \let\pxrr@res\@empty
+ \pxrr@decompbar@loopa\pxrr@nil#1|\pxrr@end|%
+}
+\def\pxrr@decompbar@loopa#1|{%
+ \expandafter\pxrr@decompbar@loopb\expandafter{\@gobble#1}%
+}
+\def\pxrr@decompbar@loopb#1{%
+ \pxrr@decompbar@loopc#1\relax\pxrr@nil{#1}%
+}
+\def\pxrr@decompbar@loopc#1#2\pxrr@nil#3{%
+ \pxrr@ifx{#1\pxrr@end}{}{%
+ \ifx\pxrr@res\@empty
+ \def\pxrr@res{\ltj@@ruby@mark}%
+ \else
+ \pxrr@appto\pxrr@res{\ltj@@ruby@mark}%
+ \fi
+ \pxrr@appto\pxrr@res{{#3}}%
+ \pxrr@decompbar@loopa\pxrr@nil
+ }%
+}
+%%%%%%%% ここまで
+
+%%%%%%%% TeX command
+\protected\def\ltjruby{\@ifnextchar[\ltj@@ruby{\ltj@@ruby[]}}%]
+\AtBeginDocument{%
+ \ifdefined\ruby\else\let\ruby=\ltjruby\fi
+ \directlua{luatexja.ruby.read_old_break_info()}%
+}
+\def\ltj@@ruby[#1]#2#3{{% #1: option #2: 親文字群,#3: ルビ文字列群,共に| 区切り
+ \setkeys[ltj]{ruby}{#1}%
+ \directlua{ruby_tmplist_r = \string{\string}; ruby_tmplist_p = \string{\string}}%
+ \leavevmode\dimen0=\f@size pt\dimen1=\ltj@@rubyip@size\dimen0%
+ % 引数展開,テーブルにセット
+ \pxrr@decompbar{#2}{\let\ltj@@ruby@mark\ltj@@ruby@sp\pxrr@res}%
+ \pxrr@decompbar{#3}{\let\ltj@@ruby@mark\ltj@@ruby@sr\pxrr@res}%
+ {\fontsize{\ltj@@rubyip@size\dimen0}\z@\selectfont\ltj@@rubyip@fontcmd\global\dimen1=\zw}%
+ \directlua{%
+ luatexja.ruby.texiface(\ltj@@ruby@create@table{\dimen1},
+ ruby_tmplist_r, ruby_tmplist_p)}%
+}}
+
+\def\ltj@@ruby@sr#1{%
+ \setbox0=\hbox{\fontsize{\dimen1}\z@\ltj@@rubyip@fontcmd\selectfont#1}%
+ \directlua{table.insert(ruby_tmplist_r, luatexja.ruby.cpbox())}%
+}
+\def\ltj@@ruby@sp#1{%
+ \setbox0=\hbox{\selectfont#1}%
+ \directlua{table.insert(ruby_tmplist_p, luatexja.ruby.cpbox())}%
+}
+
+\protected\def\ltjkenten{\@ifnextchar[\ltj@@kenten{\ltj@@kenten[]}}%]
+\let\kenten=\ltjkenten
+\def\ltj@@kenten[#1]#2{{%
+ \setkeys[ltj]{ruby}{#1, stretchruby=101}%
+ \@tfor\ltj@@kenten@temp:=#2\do{\ltj@@ruby[]{\ltj@@kenten@temp}{\ltj@@rubyip@kenten}}%
+}}
+
+% 初期値.要調整
+%% ひらがな
+\count@="3040\loop\relax\ifnum \count@<"30A0
+ \ltjsetparameter{rubypreintrusion={\the\count@,1},
+ rubypostintrusion={\the\count@,1}}
+ \advance\count@1\repeat
+%% 「」
+\ltjsetparameter{rubypreintrusion={`「,1},
+ rubypostintrusion={`」,1}}
+%% ,、
+\ltjsetparameter{rubypreintrusion={`,,1},
+ rubypostintrusion={`,,1}}
+\ltjsetparameter{rubypreintrusion={`、,1},
+ rubypostintrusion={`、,1}}
+%% ・
+\ltjsetparameter{rubypreintrusion={`・,1},
+ rubypostintrusion={`・,1}}
+%% 段落インデント部分
+\ltjsetparameter{rubypreintrusion={-1,1}}
+
+\setkeys[ltj]{ruby}{
+ pre=-1, post=-1, mode=1,
+ stretchruby={1}{2}{1}, stretch = {1}{2}{1},
+ stretchbol={0}{1}{1}, stretcheol={1}{1}{0},
+ maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
+ kenten=\ltjalchar`•, fontcmd=\relax
+}
+
+\endinput
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-zhfonts.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-zhfonts.sty
new file mode 100644
index 0000000000..8e215d3f6e
--- /dev/null
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-zhfonts.sty
@@ -0,0 +1,77 @@
+% luatexja-zhfonts.sty
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luatexja-zhfonts}[2013/09/10 Setting for Chinese fonts]
+\RequirePackage{luatexja-fontspec}
+
+% SinoType 华文字体
+\DeclareOption{SinoType}{
+\setmainjfont[BoldFont=STZhongsong]{STSong}
+\setsansjfont[BoldFont=STXihei]{STXihei}
+\newjfontface\kai{STKaiti}
+\newjfontface\fang{STFangsong}
+}
+
+% ZhongYi 中易字体
+\DeclareOption{ZhongYi}{
+\setmainjfont[BoldFont=SimHei]{SimSun}
+\setsansjfont[BoldFont=SimHei]{SimHei}
+\newjfontface\kai{KaiTi}
+\newjfontface\fang{FangSong}
+}
+
+% Adobe Adobe字体
+\DeclareOption{Adobe}{
+\setmainjfont[BoldFont=AdobeHeitiStd-Regular]{AdobeSongStd-Light}
+\setsansjfont[BoldFont=AdobeHeitiStd-Regular]{AdobeHeitiStd-Regular}
+\newjfontface\kai{AdobeKaitiStd-Regular}
+\newjfontface\fang{AdobeFangsongStd-Regular}
+}
+
+% Founder 方正字体
+\DeclareOption{Founder}{
+\setmainjfont[BoldFont=FZXiaoBiaoSong-B05]{FZShuSong-Z01}
+\setsansjfont[BoldFont=FZHei-B01]{FZHei-B01}
+\newjfontface\kai{FZKai-Z03}
+\newjfontface\fang{FZFangSong-Z02}
+}
+
+% HanYi-J 汉仪字体-文房字宝-简体
+% HanYi-F 汉仪字体-文房字宝-繁体
+% 书宋一简 HYA9GJM.ttf
+% 中宋简  HYA3GJM.ttf
+% 中黑简  HYB1GJM.ttf
+% 粗黑简  HYB9GJM.ttf
+% 楷体简  HYC1GJM.ttf
+% 仿宋简  HYD1GJM.ttf
+\DeclareOption{HanYi-J}{
+\setmainjfont[BoldFont=HYA9GJM.ttf]{HYA3GJM.ttf}
+\setsansjfont[BoldFont=HYB9GJM.ttf]{HYB1GJM.ttf}
+\newjfontface\kai{HYC1GJM.ttf}
+\newjfontface\fang{HYD1GJM.ttf}
+}
+
+\DeclareOption{HanYi-F}{
+\setmainjfont[BoldFont=HYA9GFM.ttf]{HYA3GFM.ttf}
+\setsansjfont[BoldFont=HYB9GFM.ttf]{HYB1GFM.ttf}
+\newjfontface\kai{HYC1GFM.ttf}
+\newjfontface\fang{HYD1GFM.ttf}
+}
+
+% cwTeX TrueType (in Debian/Ubuntu)
+\DeclareOption{cwttf}{
+\setmainjfont[BoldFont=cwTeXHeiBold]{cwTeXMing}
+\setsansjfont[BoldFont=cwTeXHeiBold]{cwTeXHeiBold}
+\newjfontface\kai{cwTeXKai}
+\newjfontface\fang{cwTeXFangSong}
+}
+
+% Fandol fonts http://fandol-doc.googlecode.com/files/fandol-fonts.7z
+\DeclareOption{Fandol}{
+\setmainjfont[BoldFont=FandolSong-Bold]{FandolSong-Regular}
+\setsansjfont[BoldFont=FandolHei-Bold]{FandolHei-Regular}
+\newjfontface\kai{FandolKai-Regular}
+\newjfontface\fang{FandolFang-Regular}
+}
+
+\ProcessOptions\relax
+\endinput