2 % lltjfont.sty: derived from plfonts.dtx in pLaTeX.
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjfont}[2014/01/23 Patch to NFSS2 for LuaTeX-ja]
9 \let\ck@encoding\@empty
10 % LuaTeX-ja uses JY3 and JT3 encodings.
11 \def\cy@encoding{JY3}\def\ct@encoding{JT3}
16 \def\curr@kfontshape{\k@encoding/\k@family/\k@series/\k@shape}
17 \def\rel@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
18 \ifdefined\Cht\else\newdimen\Cht\fi
19 \ifdefined\cht\else\newdimen\cht\fi
20 \ifdefined\Cdp\else\newdimen\Cdp\fi
21 \ifdefined\cdp\else\newdimen\cdp\fi
22 \ifdefined\Cwd\else\newdimen\Cwd\fi
23 \ifdefined\cwd\else\newdimen\cwd\fi
24 \ifdefined\Cvs\else\newdimen\Cvs\fi
25 \ifdefined\cvs\else\newdimen\cvs\fi
26 \ifdefined\Chs\else\newdimen\Chs\fi
27 \ifdefined\chs\else\newdimen\chs\fi
28 \ifdefined\cHT\else\newdimen\cHT\fi
35 \ifmmode\copy\strutbox\else\unhcopy\strutbox\fi
37 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi
40 \def\tstrut{\relax\hbox{\tate
41 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
42 \def\zstrut{\relax\hbox{\tate
43 \ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
44 \def\DeclareFontEncoding{%
48 \DeclareFontEncoding@}
49 \def\DeclareFontEncoding@#1#2#3{%
51 \ifx\csname T@#1\endcsname\relax
52 \def\cdp@elt{\noexpand\cdp@elt}%
53 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
54 {\default@family}{\default@series}%
56 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
57 \def\enc@elt{\noexpand\enc@elt}%
59 \@font@info{Redeclaring font encoding #1}%
61 \global\@namedef{T@#1}{#2}%
62 \global\@namedef{M@#1}{\default@M#3}%
63 \xdef\LastDeclaredEncoding{#1}%
65 \def\DeclareKanjiEncoding#1{%
67 The \string\DeclareKanjiEncoding\space is obsoleted command. Please use
69 the \string\DeclareTateKanjiEncoding\space for `Tate-kumi' encoding, and
71 the \string\DeclareYokoKanjiEncoding\space for `Yoko-kumi' encoding.
73 I treat the `#1' encoding as `Yoko-kumi'.}
74 \DeclareYokoKanjiEncoding{#1}%
76 \def\DeclareYokoKanjiEncoding{%
80 \DeclareYokoKanjiEncoding@}
81 \def\DeclareYokoKanjiEncoding@#1#2#3{%
82 \expandafter\ifx\csname T@#1\endcsname\relax
83 \def\cdp@elt{\noexpand\cdp@elt}%
84 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
85 {\default@k@family}{\default@k@series}%
87 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
88 \directlua{luatexja.jfont.add_kyenc_list('\luatexluaescapestring{#1}')}%
90 \@font@info{Redeclaring KANJI (yoko) font encoding #1}%
92 \global\@namedef{T@#1}{#2}%
93 \global\@namedef{M@#1}{\default@KM#3}%
95 \def\DeclareTateKanjiEncoding{%
99 \DeclareTateKanjiEncoding@}
100 \def\DeclareTateKanjiEncoding@#1#2#3{%
101 \expandafter\ifx\csname T@#1\endcsname\relax
102 \def\cdp@elt{\noexpand\cdp@elt}%
103 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
104 {\default@k@family}{\default@k@series}%
106 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
107 \directlua{luatexja.jfont.add_ktenc_list('\luatexluaescapestring{#1}')}%
109 \@font@info{Redeclaring KANJI (tate) font encoding #1}%
111 \global\@namedef{T@#1}{#2}%
112 \global\@namedef{M@#1}{\default@KM#3}%
114 \@onlypreamble\DeclareKanjiEncoding
115 \@onlypreamble\DeclareYokoKanjiEncoding
116 \@onlypreamble\DeclareYokoKanjiEncoding@
117 \@onlypreamble\DeclareTateKanjiEncoding
118 \@onlypreamble\DeclareTateKanjiEncoding@
119 \def\DeclareKanjiEncodingDefaults#1#2{%
121 \ifx\default@KT\@empty\else
122 \@font@info{Overwriting KANJI encoding scheme text defaults}%
124 \gdef\default@KT{#1}%
127 \ifx\default@KM\@empty\else
128 \@font@info{Overwriting KANJI encoding scheme math defaults}%
130 \gdef\default@KM{#2}%
132 \let\default@KT\@empty
133 \let\default@KM\@empty
134 \@onlypreamble\DeclareKanjiEncodingDefaults
135 \def\DeclareFontFamily#1#2#3{%
137 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
138 {\def\reserved@a{#3}%
140 \expandafter\let\csname #1+#2\expandafter\endcsname
141 \ifx \reserved@a\@empty
147 \def\DeclareKanjiFamily#1#2#3{%
149 {\@latex@error{KANJI Encoding scheme `#1' unknown}\@eha}%
150 {\def\reserved@a{#3}%
152 \expandafter\let\csname #1+#2\expandafter\endcsname
153 \ifx \reserved@a\@empty
159 \def\DeclareKanjiSubstitution#1#2#3#4{%
160 \expandafter\ifx\csname T@#1\endcsname\relax
161 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
166 \def\cdp@elt##1##2##3##4{%
167 \def\reserved@b{##1}%
168 \ifx\reserved@a\reserved@b
169 \addto@hook\toks@{\cdp@elt{#1}{#2}{#3}{#4}}%
171 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
174 \xdef\cdp@list{\the\toks@}%
176 \global\@namedef{D@#1}{\def\default@family{#2}%
177 \def\default@series{#3}%
178 \def\default@shape{#4}}%
180 \def\DeclareErrorKanjiFont#1#2#3#4#5{%
181 \xdef\error@kfontshape{%
182 \noexpand\expandafter\noexpand\split@name\noexpand\string
183 \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
185 \gdef\default@k@family{#2}%
186 \gdef\default@k@series{#3}%
187 \gdef\default@k@shape{#4}%
188 \global\let\k@family\default@k@family
189 \global\let\k@series\default@k@series
190 \global\let\k@shape\default@k@shape
192 \gdef\f@baselineskip{#5pt}}
193 \@onlypreamble\DeclareKanjiSubstitution
194 \@onlypreamble\DeclareErrorKanjiFont
195 \def\DeclareFixedFont#1#2#3#4#5#6{%
200 \directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{#2}')}\ifin@%
201 \usekanji{#2}{#3}{#4}{#5}%
202 \global\let#1\getjfont
204 \directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{#2}')}\ifin@%
205 \usekanji{#2}{#3}{#4}{#5}%
206 \global\let#1\gettfont
208 \useroman{#2}{#3}{#4}{#5}%
209 \global\expandafter\let\expandafter#1\the\font
214 \def\DLMfontsw@standard#1#2#3{#1{#2{#3}}}
215 \def\reDeclareMathAlphabet#1#2#3{%
217 \@temptokena\expandafter{#2}%
222 \toks0\expandafter{#3}%
226 \long\protected\edef#1{%
227 \noexpand\DLMfontsw@standard{\the\@temptokena}{\the\toks0}}%
229 \@onlypreamble\reDeclareMathAlphabet
231 \def\DeclareRelationFont#1#2#3#4#5#6#7#8{%
233 \ifx\rel@shape\@empty
235 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
236 \romanencoding{#5}\romanfamily{#6}%
240 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
241 \romanencoding{#5}\romanfamily{#6}%
242 \romanseries{#7}\romanshape{#8}}%
245 \def\SetRelationFont#1#2#3#4#5#6#7#8{%
247 \ifx\rel@shape\@empty
248 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
249 \romanencoding{#5}\romanfamily{#6}%
252 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
253 \romanencoding{#5}\romanfamily{#6}%
254 \romanseries{#7}\romanshape{#8}}%
258 \def\userelfont{\@knjcmdtrue}
261 \RequirePackage{everysel}
262 \@EverySelectfont@Init
263 \def\ltj@selectfont@patch{%
264 \let\tmp@error@fontshape\error@fontshape
265 \let\error@fontshape\error@kfontshape
266 \directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{\k@encoding}')}\ifin@%
267 \let\cy@encoding\k@encoding
268 \edef\ct@encoding{\csname t@enc@\k@encoding\endcsname}%
270 \directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{\k@encoding}')}\ifin@%
271 \let\ct@encoding\k@encoding
272 \edef\cy@encoding{\csname y@enc@\k@encoding\endcsname}%
274 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
278 \let\k@encoding\ct@encoding
279 \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
282 \ltj@@does@alt@set{\curr@kfontshape}%
284 \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}%
285 % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
286 \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
289 \let\k@encoding\cy@encoding
290 \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
293 \ltj@@does@alt@set{\curr@kfontshape}%
295 \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}%
296 % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
297 \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
300 \edef\tmp@item{{\k@encoding}}\expandafter\def\expandafter\k@encoding\tmp@item
302 \let\error@fontshape\tmp@error@fontshape
304 \if@knjcmd \@knjcmdfalse
306 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\relax
308 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\relax
310 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\selectfont
311 % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり
314 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\selectfont
315 % 警告: 再び \selectfont を呼んでいる.無限ループの可能性あり
319 \EverySelectfont{\ltj@selectfont@patch}
320 \def\@EverySelectfont@Init{\let\@EverySelectfont@Init\undefined}
322 \def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}}
323 \def\set@fontsize#1#2#3{%
324 \@defaultunits\@tempdimb#2pt\relax\@nnil
325 \edef\f@size{\strip@pt\@tempdimb}%
326 \@defaultunits\@tempskipa#3pt\relax\@nnil
327 \edef\f@baselineskip{\the\@tempskipa}%
328 \edef\f@linespread{#1}%
329 \let\baselinestretch\f@linespread
331 \baselineskip\f@baselineskip\relax
332 \baselineskip\f@linespread\baselineskip
333 \normalbaselineskip\baselineskip
335 \setbox\strutbox\hbox{%\yoko
337 \@height.7\baselineskip \@depth.3\baselineskip}%
338 \setbox\tstrutbox\hbox{%\tate
340 \@height.5\baselineskip \@depth.5\baselineskip}%
341 \setbox\zstrutbox\hbox{%\tate
343 \@height.7\baselineskip \@depth.3\baselineskip}%
344 \let\size@update\relax}}
346 \newdimen\adjust@dimen
347 \def\adjustbaseline{%
348 \setbox\adjust@box\hbox{\ltjsetparameter{yjabaselineshift=\z@}あ}%
352 \cvs\normalbaselineskip
354 \cHT\cht \advance\cHT\cdp
356 \setbox0\hbox{\tate\ltjsetparameter{tjabaselineshift=\z@}あ}%
357 \setbox\adjust@box\hbox{\tate\ltjsetparameter{talbaselineshift=\z@}M}%
358 \adjust@dimen\ht\adjust@box
359 \advance\adjust@dimen\dp\adjust@box
360 \advance\adjust@dimen-\ht0
361 \divide\adjust@dimen\tw@
362 \advance\adjust@dimen0.5\dp0
363 \advance\adjust@dimen-\dp\adjust@box
364 \ltjsetparameter{talbaselineshift=\adjust@dimen}
367 \DeclareRobustCommand\romanencoding[1]{%
368 \expandafter\ifx\csname T@#1\endcsname\relax
369 \@latex@error{Encoding scheme `#1' unknown}\@eha
371 \edef\f@encoding{#1}%
372 \ifx\cf@encoding\f@encoding
373 \let\enc@update\relax
375 \let\enc@update\@@enc@update
379 \DeclareRobustCommand\kanjiencoding[1]{%
380 \expandafter\ifx\csname T@#1\endcsname\relax
381 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
383 \edef\k@encoding{#1}%
384 \ifx\ck@encoding\k@encoding
385 \let\kenc@update\relax
387 \let\kenc@update\@@kenc@update
391 \DeclareRobustCommand\fontencoding[1]{%
392 \directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{#1}')}\ifin@%
393 \kanjiencoding{#1}\else\romanencoding{#1}\fi}
396 \csname T@\k@encoding\endcsname
397 \csname D@\k@encoding\endcsname
398 \let\kenc@update\relax
399 \let\ck@encoding\k@encoding
400 \edef\tmp@enc{'\luatexluaescapestring{\k@encoding}'}
401 \directlua{luatexja.jfont.is_kyenc(\tmp@enc)}\ifin@%
402 \let\cy@encoding\k@encoding
404 \directlua{luatexja.jfont.is_ktenc(\tmp@enc)}\ifin@%
405 \let\ct@encoding\k@encoding
407 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
411 \let\kenc@update\relax
412 \def\@changed@kcmd#1#2{%
413 \ifx\protect\@typeset@protect
415 \expandafter\ifx\csname\ck@encoding\string#1\endcsname\relax
416 \expandafter\ifx\csname ?\string#1\endcsname\relax
417 \expandafter\def\csname ?\string#1\endcsname{%
418 \TextSymbolUnavailable#1%
421 \global\expandafter\let
422 \csname\cf@encoding \string#1\expandafter\endcsname
423 \csname ?\string#1\endcsname
425 \csname\ck@encoding\string#1%
426 \expandafter\endcsname
433 \DeclareRobustCommand\romanfamily[1]{\edef\f@family{#1}}
434 \DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}}
435 \DeclareRobustCommand\fontfamily[1]{%
436 \@notkfamfalse\@notffamfalse
437 \edef\tmp@item{'\luatexluaescapestring{#1}'}%
438 \edef\tmp@enc{'\luatexluaescapestring{\k@encoding}'}%
439 \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
441 \else % search font definition file...
442 \directlua{luatexja.jfont.is_kfam(\tmp@enc, \tmp@item)}%
443 \ifin@\edef\k@family{#1}\else%
444 \directlua{luatexja.jfont.is_Nkfam(\tmp@enc, \tmp@item)}%
445 \ifin@\@notkfamtrue\else%
446 % filename of font definition file is always lowercase
447 \edef\@temp{\lowercase{\noexpand\IfFileExists{\k@encoding#1.fd}}}%
448 \message{(I search kanjifont definition file)}%
449 \@temp{\@tempswztrue}{\@tempswzfalse}%
451 \directlua{luatexja.jfont.add_kfam_list(\tmp@enc, \tmp@item)}%
454 \directlua{luatexja.jfont.add_Nkfam_list(\tmp@enc, \tmp@item)}%
460 \edef\tmp@enc{'\luatexluaescapestring{\f@encoding}'}%
461 \ifcsname \f@encoding+#1\endcsname
463 \else % search font definition file...
464 \directlua{luatexja.jfont.is_ffam(\tmp@enc, \tmp@item)}%
465 \ifin@\edef\f@family{#1}\else
466 \directlua{luatexja.jfont.is_Nffam(\tmp@enc, \tmp@item)}%
467 \ifin@\@notffamtrue\else
468 % filename of font definition file is always lowercase
469 \edef\@temp{\lowercase{\noexpand\IfFileExists{\f@encoding#1.fd}}}%
470 \message{(I search font definition file)}%
471 \@temp{\@tempswztrue}{\@tempswzfalse}%
473 \directlua{luatexja.jfont.add_ffam_list(\tmp@enc, \tmp@item)}%
476 \directlua{luatexja.jfont.add_Nffam_list(\tmp@enc, \tmp@item)}%
482 \if@notkfam\if@notffam
483 {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
484 \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
485 {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
486 \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
489 \DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}}
490 \DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}}
491 \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}
492 \DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}}
493 \DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}}
494 \DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}}
495 \def\usekanji#1#2#3#4{%
496 \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}%
497 \selectfont\ignorespaces}
498 \def\useroman#1#2#3#4{%
499 \romanencoding{#1}\romanfamily{#2}\romanseries{#3}\romanshape{#4}%
500 \selectfont\ignorespaces}
501 \protected\def\usefont#1#2#3#4{%
502 \directlua{luatexja.jfont.is_kenc('\luatexluaescapestring{#1}')}\ifin@%
503 \usekanji{#1}{#2}{#3}{#4}%
504 \else\useroman{#1}{#2}{#3}{#4}%
506 \DeclareRobustCommand\normalfont{%
507 \kanjiencoding{\kanjiencodingdefault}%
508 \kanjifamily{\kanjifamilydefault}%
509 \kanjiseries{\kanjiseriesdefault}%
510 \kanjishape{\kanjishapedefault}%
511 \romanencoding{\encodingdefault}%
512 \romanfamily{\familydefault}%
513 \romanseries{\seriesdefault}%
514 \romanshape{\shapedefault}%
515 \selectfont\ignorespaces}
516 \let\reset@font\normalfont
517 \DeclareRobustCommand\mcfamily
518 {\not@math@alphabet\mcfamily\mathmc
519 \kanjifamily\mcdefault\selectfont}
520 \DeclareRobustCommand\gtfamily
521 {\not@math@alphabet\gtfamily\mathgt
522 \kanjifamily\gtdefault\selectfont}
523 \let\romanprocess@table\process@table
524 \def\kanjiprocess@table{%
525 \kanjiencoding{\kanjiencodingdefault}%
526 \kanjifamily{\kanjifamilydefault}%
527 \kanjiseries{\kanjiseriesdefault}%
528 \kanjishape{\kanjishapedefault}%
534 \@onlypreamble\romanprocess@table
535 \@onlypreamble\kanjiprocess@table
536 \DeclareTextCommandDefault{\textunderscore}{%
537 \leavevmode\kern.06em
538 %\iftdir\raise-\tbaselineshift\fi
539 \vbox{\hrule\@width.3em}}
541 %%%%%% LuaTeX-ja specific
543 % #1 の展開結果から encoding 部分をとりだし,それが和文用かどうかの結果を \ifin@ に代入
544 \def\ltj@@IsFontJapanese#1{%
545 \directlua{luatexja.jfont.is_kenc(string.match(
546 '\luatexluaescapestring{#1}', '[^/]+'))}}
549 \let\extract@afont\extract@font
551 \expandafter \ifx \font@name \relax
552 \let\extract@font\extract@jfont
554 \let\extract@font\extract@afont
556 \let\getjfont\font@name}
558 \expandafter \ifx \font@name \relax
559 \let\extract@font\extract@tfont
561 \let\extract@font\extract@afont
563 \let\gettfont\font@name}
565 % 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように
567 \def\ltj@@patch@external@font#1 at{%
568 #1\directlua{luatexja.jfont.print_aftl_address()}\space at%
572 \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
573 \edef\external@font{\expandafter\ltj@@patch@external@font\external@font}%
575 \expandafter\globaljfont\font@name\external@font\relax
576 \font@name%\global\zw=\zw\global\zh=\zh
577 \csname \f@encoding+\f@family\endcsname
578 \csname\curr@fontshape\endcsname}
581 \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
582 \edef\external@font{\expandafter\ltj@@patch@external@font\external@font}%
584 \expandafter\globaltfont\font@name\external@font\relax
585 \font@name%\global\zw=\zw\global\zh=\zh
586 \csname \f@encoding+\f@family\endcsname
587 \csname\curr@fontshape\endcsname}
589 \let\ltj@@al@do@subst@correction=\do@subst@correction
590 \def\ltj@@ja@do@subst@correction{%
591 \xdef\subst@correction{%
593 \global\expandafter\let\csname \curr@fontshape/\f@size\endcsname\font@name%
595 \aftergroup\subst@correction
597 \def\do@subst@correction{%
598 \ltj@@IsFontJapanese{\curr@fontshape}\ifin@%
599 \ltj@@ja@do@subst@correction
601 \ltj@@al@do@subst@correction
606 %%%%%% Japanese font for math mode
608 % \M@<enc> から その <enc> が和文用か調べる
610 \gdef\ltj@@mathJapaneseFonts#1M#2#3\relax{\ltj@@IsFontJapanese{#3}}}
612 \let\ltj@@al@getanddefine@fonts=\getanddefine@fonts
613 \def\ltj@@ja@getanddefine@fonts#1#2{%
614 \xdef\font@name{\csname \string#2/\tf@size\endcsname}%
615 \pickup@jfont\let\textfont@name\font@name
616 \xdef\font@name{\csname \string#2/\sf@size\endcsname}%
617 \pickup@jfont\let\scriptfont@name\font@name
618 \xdef\font@name{\csname \string#2/\ssf@size\endcsname}%
620 \edef\math@fonts{\math@fonts\ltj@setpar@global%
621 \ltj@@set@stackfont#1,\textfont@name:{MJT}%
622 \ltj@@set@stackfont#1,\scriptfont@name:{MJS}%
623 \ltj@@set@stackfont#1,\font@name:{MJSS}%
627 \def\getanddefine@fonts#1#2{%
628 \ltj@tempcnta=#1\ltj@@IsFontJapanese{\string#2}%
629 \ifin@\let\ltj@temp=\ltj@@ja@getanddefine@fonts%
630 \else \let\ltj@temp=\ltj@@al@getanddefine@fonts\fi
633 \def\use@mathgroup#1#2{\relax\ifmmode
635 \expandafter\ifx\csname M@\f@encoding\endcsname#1\else
636 #1\fi\ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
637 \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi
638 \expandafter\math@egroup\fi}%
640 %%%%%% Alternate Japanese Fonts
641 %%%% \DeclareAlternateKanjiFont<Benc><Bfam><Bser><Bshape><Aenc><Afam><Aser><Ashape><range>
643 \def\DeclareAlternateKanjiFont#1#2#3#4#5#6#7#8#9{%
645 \ifx\@temp\@empty\else
646 {\def\ltj@temp@bfont{#1/#2/#3/#4}\def\ltj@temp@afont{#5/#6/#7/#8}%
647 \expandafter\ltj@@altfont@latex#9,,}\ignorespaces
649 \def\ltj@@altfont@latex#1,{\def\ltj@temp{#1}%
650 \ifx\ltj@temp\empty\let\@next=\relax\else
651 \ltj@@altfont@latexA{#1}\let\@next=\ltj@@altfont@latex\fi\@next}
652 \def\ltj@@altfont@latexA#1{\ltj@@altfont@latexB#1--\@nil}
653 \def\ltj@@altfont@latexB#1-#2-#3\@nil{\def\ltj@temp{#3}%
655 \ltj@tempcnta=#1\relax\ltj@tempcntb=\ltj@tempcnta
658 \ifx\ltj@temp\empty\ltj@tempcnta='200\else\ltj@tempcnta=#1\fi\relax
660 \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF\else\ltj@tempcntb=#2\fi\relax%"
662 \directlua{luatexja.jfont.set_alt_font_latex(
663 \the\ltj@tempcnta,\the\ltj@tempcntb,
664 '\luatexluaescapestring{\ltj@temp@afont}',
665 '\luatexluaescapestring{\ltj@temp@bfont}')}%
668 %%%% \ClearAlternateKanjiFont<Benc><Bfam><Bser><Bshape>
670 \def\ClearAlternateKanjiFont#1#2#3#4{%
671 \directlua{luatexja.jfont.clear_alt_font_latex('\luatexluaescapestring{#1/#2/#3/#4}')}}
673 \def\ltj@pickup@altfont@aux#1{%
674 \begingroup\edef\font@name{\csname #1/\f@size\endcsname}\pickup@jfont\endgroup%
676 \def\ltj@pickup@altfont@copy#1#2{%
677 \ltj@@getjfontnumber#1%
678 \directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
681 \def\ltj@@does@alt@set#1{%
682 \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}}