2 %% lltjfont.sty: derived from plfonts.dtx in pLaTeX.
6 \let\ck@encoding\@empty
7 % LuaTeX-ja uses JY3 and JT3 encodings.
8 \def\cy@encoding{JY3}\def\ct@encoding{JT3}
13 \def\curr@kfontshape{\k@encoding/\k@family/\k@series/\k@shape}
14 \def\rel@fontshape{\f@encoding/\f@family/\f@series/\f@shape}
15 \ifdefined\Cht\else\newdimen\Cht\fi
16 \ifdefined\cht\else\newdimen\cht\fi
17 \ifdefined\Cdp\else\newdimen\Cdp\fi
18 \ifdefined\cdp\else\newdimen\cdp\fi
19 \ifdefined\Cwd\else\newdimen\Cwd\fi
20 \ifdefined\cwd\else\newdimen\cwd\fi
21 \ifdefined\Cvs\else\newdimen\Cvs\fi
22 \ifdefined\cvs\else\newdimen\cvs\fi
23 \ifdefined\Chs\else\newdimen\Chs\fi
24 \ifdefined\chs\else\newdimen\chs\fi
25 \ifdefined\cHT\else\newdimen\cHT\fi
28 \def\in@@##1<#1>##2##3\in@@{%
29 \ifx\in@##2\in@false\else\in@true\fi}%
31 \def\fam@elt{\noexpand\fam@elt}
32 \def\enc@elt{\noexpand\enc@elt}
34 \let\kyenc@list\@empty
35 \let\ktenc@list\@empty
40 \ifmmode\copy\strutbox\else\unhcopy\strutbox\fi
42 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi
45 \def\tstrut{\relax\hbox{\tate
46 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
47 \def\zstrut{\relax\hbox{\tate
48 \ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
49 \def\DeclareFontEncoding{%
53 \DeclareFontEncoding@}
54 \def\DeclareFontEncoding@#1#2#3{%
56 \ifx\csname T@#1\endcsname\relax
57 \def\cdp@elt{\noexpand\cdp@elt}%
58 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
59 {\default@family}{\default@series}%
61 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
62 \def\enc@elt{\noexpand\enc@elt}%
64 \@font@info{Redeclaring font encoding #1}%
66 \global\@namedef{T@#1}{#2}%
67 \global\@namedef{M@#1}{\default@M#3}%
68 \xdef\LastDeclaredEncoding{#1}%
70 \def\DeclareKanjiEncoding#1{%
72 The \string\DeclareKanjiEncoding\space is obsoleted command. Please use
74 the \string\DeclareTateKanjiEncoding\space for `Tate-kumi' encoding, and
76 the \string\DeclareYokoKanjiEncoding\space for `Yoko-kumi' encoding.
78 I treat the `#1' encoding as `Yoko-kumi'.}
79 \DeclareYokoKanjiEncoding{#1}%
81 \def\DeclareYokoKanjiEncoding{%
85 \DeclareYokoKanjiEncoding@}
86 \def\DeclareYokoKanjiEncoding@#1#2#3{%
88 \ifx\csname T@#1\endcsname\relax
89 \def\cdp@elt{\noexpand\cdp@elt}%
90 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
91 {\default@k@family}{\default@k@series}%
93 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
94 \def\enc@elt{\noexpand\enc@elt}%
95 \xdef\kyenc@list{\kyenc@list\enc@elt<#1>}%
96 \xdef\kenc@list{\kenc@list\enc@elt<#1>}%
98 \@font@info{Redeclaring KANJI (yoko) font encoding #1}%
100 \global\@namedef{T@#1}{#2}%
101 \global\@namedef{M@#1}{\default@KM#3}%
103 \def\DeclareTateKanjiEncoding{%
106 \expandafter\endgroup
107 \DeclareTateKanjiEncoding@}
108 \def\DeclareTateKanjiEncoding@#1#2#3{%
110 \ifx\csname T@#1\endcsname\relax
111 \def\cdp@elt{\noexpand\cdp@elt}%
112 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
113 {\default@k@family}{\default@k@series}%
115 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
116 \def\enc@elt{\noexpand\enc@elt}%
117 \xdef\ktenc@list{\ktenc@list\enc@elt<#1>}%
118 \xdef\kenc@list{\kenc@list\enc@elt<#1>}%
120 \@font@info{Redeclaring KANJI (tate) font encoding #1}%
122 \global\@namedef{T@#1}{#2}%
123 \global\@namedef{M@#1}{\default@KM#3}%
125 \@onlypreamble\DeclareKanjiEncoding
126 \@onlypreamble\DeclareYokoKanjiEncoding
127 \@onlypreamble\DeclareYokoKanjiEncoding@
128 \@onlypreamble\DeclareTateKanjiEncoding
129 \@onlypreamble\DeclareTateKanjiEncoding@
130 \def\DeclareKanjiEncodingDefaults#1#2{%
132 \ifx\default@KT\@empty\else
133 \@font@info{Overwriting KANJI encoding scheme text defaults}%
135 \gdef\default@KT{#1}%
138 \ifx\default@KM\@empty\else
139 \@font@info{Overwriting KANJI encoding scheme math defaults}%
141 \gdef\default@KM{#2}%
143 \let\default@KT\@empty
144 \let\default@KM\@empty
145 \@onlypreamble\DeclareKanjiEncodingDefaults
146 \def\DeclareFontFamily#1#2#3{%
148 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
149 {\def\reserved@a{#3}%
151 \expandafter\let\csname #1+#2\expandafter\endcsname
152 \ifx \reserved@a\@empty
158 \def\DeclareKanjiFamily#1#2#3{%
160 {\@latex@error{KANJI Encoding scheme `#1' unknown}\@eha}%
161 {\def\reserved@a{#3}%
163 \expandafter\let\csname #1+#2\expandafter\endcsname
164 \ifx \reserved@a\@empty
170 \def\DeclareKanjiSubstitution#1#2#3#4{%
171 \expandafter\ifx\csname T@#1\endcsname\relax
172 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
177 \def\cdp@elt##1##2##3##4{%
178 \def\reserved@b{##1}%
179 \ifx\reserved@a\reserved@b
180 \addto@hook\toks@{\cdp@elt{#1}{#2}{#3}{#4}}%
182 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
185 \xdef\cdp@list{\the\toks@}%
187 \global\@namedef{D@#1}{\def\default@family{#2}%
188 \def\default@series{#3}%
189 \def\default@shape{#4}}%
191 \def\DeclareErrorKanjiFont#1#2#3#4#5{%
192 \xdef\error@kfontshape{%
193 \noexpand\expandafter\noexpand\split@name\noexpand\string
194 \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
196 \gdef\default@k@family{#2}%
197 \gdef\default@k@series{#3}%
198 \gdef\default@k@shape{#4}%
199 \global\let\k@family\default@k@family
200 \global\let\k@series\default@k@series
201 \global\let\k@shape\default@k@shape
203 \gdef\f@baselineskip{#5pt}}
204 \@onlypreamble\DeclareKanjiSubstitution
205 \@onlypreamble\DeclareErrorKanjiFont
206 \def\DeclareFixedFont#1#2#3#4#5#6{%
211 \edef\tmp@item{{#2}}%
212 \expandafter\expandafter\expandafter
213 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
215 \usekanji{#2}{#3}{#4}{#5}%
216 \global\let#1\getjfont
218 %\expandafter\expandafter\expandafter
219 %\inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
221 % \usekanji{#2}{#3}{#4}{#5}%
224 \useroman{#2}{#3}{#4}{#5}%
225 \global\expandafter\let\expandafter#1\the\font
230 \def\reDeclareMathAlphabet#1#2#3{%
231 \edef#1{\noexpand\protect\expandafter\noexpand\csname%
232 \expandafter\@gobble\string#1\space\space\endcsname}%
233 \edef\@tempa{\expandafter\@gobble\string#2}%
234 \edef\@tempb{\expandafter\@gobble\string#3}%
235 \edef\@tempc{\string @\expandafter\@gobbletwo\string#2}%
237 \edef\@tempa{\expandafter\@gobbletwo\string#2}%
238 \edef\@tempb{\expandafter\@gobbletwo\string#3}%
240 \expandafter\edef\csname\expandafter\@gobble\string#1\space\space\endcsname%
241 {\noexpand\DualLang@mathalph@bet%
242 {\expandafter\noexpand\csname\@tempa\space\endcsname}%
243 {\expandafter\noexpand\csname\@tempb\space\endcsname}%
246 \@onlypreamble\reDeclareMathAlphabet
247 \def\DualLang@mathalph@bet#1#2{%
249 \ifx\math@bgroup\bgroup% 2e normal style (\mathrm{...})
250 \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
252 \ifx\math@bgroup\relax% 2e two letter style (\rm->\mathrm)
253 \let\DualLang@Mfontsw\DLMfontsw@oldstyle
255 \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
259 \let\DualLang@Mfontsw\@firstoftwo
261 \DualLang@Mfontsw{#1}{#2}%
263 \def\DLMfontsw@standard#1#2#3{#1{#2{#3}}\egroup}
264 \def\DLMfontsw@oldstyle#1#2{#1\relax\@fontswitch\relax{#2}}
265 \def\DLMfontsw@oldlfont#1#2{#1\relax#2\relax}
267 \def\DeclareRelationFont#1#2#3#4#5#6#7#8{%
269 \ifx\rel@shape\@empty
271 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
272 \romanencoding{#5}\romanfamily{#6}%
276 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
277 \romanencoding{#5}\romanfamily{#6}%
278 \romanseries{#7}\romanshape{#8}}%
281 \def\SetRelationFont#1#2#3#4#5#6#7#8{%
283 \ifx\rel@shape\@empty
284 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
285 \romanencoding{#5}\romanfamily{#6}%
288 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
289 \romanencoding{#5}\romanfamily{#6}%
290 \romanseries{#7}\romanshape{#8}}%
294 \def\userelfont{\@knjcmdtrue}
295 \DeclareRobustCommand\selectfont{%
296 \let\tmp@error@fontshape\error@fontshape
297 \let\error@fontshape\error@kfontshape
298 \edef\tmp@item{{\k@encoding}}%
299 \expandafter\expandafter\expandafter
300 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
302 \let\cy@encoding\k@encoding
303 \edef\ct@encoding{\csname t@enc@\k@encoding\endcsname}%
305 \expandafter\expandafter\expandafter
306 \inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
308 \let\ct@encoding\k@encoding
309 \edef\cy@encoding{\csname y@enc@\k@encoding\endcsname}%
311 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
315 %\let\k@encoding\ct@encoding
316 %\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
319 \let\k@encoding\cy@encoding
320 \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
323 \expandafter\def\expandafter\k@encoding\tmp@item
325 \let\error@fontshape\tmp@error@fontshape
326 \if@knjcmd \@knjcmdfalse
328 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\relax
330 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\relax
332 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname
335 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname
339 \xdef\font@name{\csname\curr@fontshape/\f@size\endcsname}%
343 \ifx\f@linespread\baselinestretch \else
344 \set@fontsize\baselinestretch\f@size\f@baselineskip
347 \def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}}
348 \KanjiEncodingPair{JY3}{JT3}
349 \def\set@fontsize#1#2#3{%
350 \@defaultunits\@tempdimb#2pt\relax\@nnil
351 \edef\f@size{\strip@pt\@tempdimb}%
352 \@defaultunits\@tempskipa#3pt\relax\@nnil
353 \edef\f@baselineskip{\the\@tempskipa}%
354 \edef\f@linespread{#1}%
355 \let\baselinestretch\f@linespread
357 \baselineskip\f@baselineskip\relax
358 \baselineskip\f@linespread\baselineskip
359 \normalbaselineskip\baselineskip
361 \setbox\strutbox\hbox{%\yoko
363 \@height.7\baselineskip \@depth.3\baselineskip}%
364 \setbox\tstrutbox\hbox{%\tate
366 \@height.5\baselineskip \@depth.5\baselineskip}%
367 \setbox\zstrutbox\hbox{%\tate
369 \@height.7\baselineskip \@depth.3\baselineskip}%
370 \let\size@update\relax}}
372 \newdimen\adjust@dimen
373 \def\adjustbaseline{%
374 \setbox\adjust@box\hbox{\ltjsetparameter{yjabaselineshift=\z@}あ}%
378 \cvs\normalbaselineskip
380 \cHT\cht \advance\cHT\cdp
382 % \setbox\adjust@box\hbox{\tbaselineshift\z@ M}%
383 % \adjust@dimen\ht\adjust@box
384 % \advance\adjust@dimen\dp\adjust@box
385 % \advance\adjust@dimen-\cHT
386 % \divide\adjust@dimen\tw@
387 % \advance\adjust@dimen\cdp
388 % \advance\adjust@dimen-\dp\adjust@box
389 % \tbaselineshift\adjust@dimen
392 \DeclareRobustCommand\romanencoding[1]{%
393 \expandafter\ifx\csname T@#1\endcsname\relax
394 \@latex@error{Encoding scheme `#1' unknown}\@eha
396 \edef\f@encoding{#1}%
397 \ifx\cf@encoding\f@encoding
398 \let\enc@update\relax
400 \let\enc@update\@@enc@update
404 \DeclareRobustCommand\kanjiencoding[1]{%
405 \expandafter\ifx\csname T@#1\endcsname\relax
406 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
408 \edef\k@encoding{#1}%
409 \ifx\ck@encoding\k@encoding
410 \let\kenc@update\relax
412 \let\kenc@update\@@kenc@update
416 \DeclareRobustCommand\fontencoding[1]{%
417 \edef\tmp@item{{#1}}%
418 \expandafter\expandafter\expandafter
419 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
420 \ifin@ \kanjiencoding{#1}\else\romanencoding{#1}\fi}
423 \csname T@\k@encoding\endcsname
424 \csname D@\k@encoding\endcsname
425 \let\kenc@update\relax
426 \let\ck@encoding\k@encoding
427 \edef\tmp@item{{\k@encoding}}%
428 \expandafter\expandafter\expandafter
429 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
430 \ifin@ \let\cy@encoding\k@encoding
432 \expandafter\expandafter\expandafter
433 \inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
434 \ifin@ \let\ct@encoding\k@encoding
436 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
440 \let\kenc@update\relax
441 \def\@changed@kcmd#1#2{%
442 \ifx\protect\@typeset@protect
444 \expandafter\ifx\csname\ck@encoding\string#1\endcsname\relax
445 \expandafter\ifx\csname ?\string#1\endcsname\relax
446 \expandafter\def\csname ?\string#1\endcsname{%
447 \TextSymbolUnavailable#1%
450 \global\expandafter\let
451 \csname\cf@encoding \string#1\expandafter\endcsname
452 \csname ?\string#1\endcsname
454 \csname\ck@encoding\string#1%
455 \expandafter\endcsname
462 \DeclareRobustCommand\romanfamily[1]{\edef\f@family{#1}}
463 \DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}}
464 % \notkfam@list@<enc>: list of non-defined kanji families under <enc>
465 % \kfam@list@<enc>: list of kanji families under <enc>, defined in a .fd file
466 \DeclareRobustCommand\fontfamily[1]{%
467 \@notkfamfalse\@notffamfalse\edef\tmp@item{{#1}}%
468 \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
470 \else % search font definition file...
471 \ifcsname kfam@list@\k@encoding\endcsname\else
472 \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}
473 \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}
475 \edef\@templist{\@nameuse{kfam@list@\k@encoding}}%
476 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
477 \ifin@\edef\k@family{#1}\else%
478 \edef\@templist{\@nameuse{notkfam@list@\k@encoding}}%
479 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
480 \ifin@\@notkfamtrue\else%
481 \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\k@encoding+%
482 \message{(I search kanjifont definition file: \@@temp#1.fd)}%
483 \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
485 \expandafter\xdef\csname kfam@list@\k@encoding\endcsname
486 {\@nameuse{kfam@list@\k@encoding}\fam@elt<#1>}\edef\k@family{#1}%
488 \expandafter\xdef\csname notkfam@list@\k@encoding\endcsname
489 {\@nameuse{notkfam@list@\k@encoding}\fam@elt<#1>}\@notkfamtrue%
494 \ifcsname \f@encoding+#1\endcsname
496 \else % search font definition file...
497 \ifcsname ffam@list@\f@encoding\endcsname\else
498 \expandafter\gdef\csname ffam@list@\f@encoding\endcsname{}
499 \expandafter\gdef\csname notffam@list@\f@encoding\endcsname{}
501 \edef\@templist{\@nameuse{ffam@list@\f@encoding}}%
502 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
503 \ifin@\edef\f@family{#1}\else
504 \edef\@templist{\@nameuse{notffam@list@\f@encoding}}%
505 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
506 \ifin@\@notffamtrue\else
507 \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\f@encoding+%
508 \message{(I search font definition file: \@@temp#1.fd)}%
509 \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
511 \expandafter\xdef\csname ffam@list@\f@encoding\endcsname
512 {\@nameuse{ffam@list@\f@encoding}\fam@elt<#1>}\edef\f@family{#1}%
514 \expandafter\xdef\csname notffam@list@\f@encoding\endcsname
515 {\@nameuse{notffam@list@\f@encoding}\fam@elt<#1>}\@notffamtrue%
520 \if@notkfam\if@notffam
521 {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
522 \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
523 {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
524 \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
527 \DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}}
528 \DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}}
529 \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}
530 \DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}}
531 \DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}}
532 \DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}}
533 \def\usekanji#1#2#3#4{%
534 \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}%
535 \selectfont\ignorespaces}
536 \def\useroman#1#2#3#4{%
537 \romanencoding{#1}\romanfamily{#2}\romanseries{#3}\romanshape{#4}%
538 \selectfont\ignorespaces}
539 \def\usefont#1#2#3#4{%
540 \edef\tmp@item{{#1}}%
541 \expandafter\expandafter\expandafter
542 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
543 \ifin@ \usekanji{#1}{#2}{#3}{#4}%
544 \else\useroman{#1}{#2}{#3}{#4}%
546 \DeclareRobustCommand\normalfont{%
547 \kanjiencoding{\kanjiencodingdefault}%
548 \kanjifamily{\kanjifamilydefault}%
549 \kanjiseries{\kanjiseriesdefault}%
550 \kanjishape{\kanjishapedefault}%
551 \romanencoding{\encodingdefault}%
552 \romanfamily{\familydefault}%
553 \romanseries{\seriesdefault}%
554 \romanshape{\shapedefault}%
555 \selectfont\ignorespaces}
557 \let\reset@font\normalfont
558 \DeclareRobustCommand\mcfamily
559 {\not@math@alphabet\mcfamily\mathmc
560 \kanjifamily\mcdefault\selectfont}
561 \DeclareRobustCommand\gtfamily
562 {\not@math@alphabet\gtfamily\mathgt
563 \kanjifamily\gtdefault\selectfont}
564 \let\romanprocess@table\process@table
565 \def\kanjiprocess@table{%
566 \kanjiencoding{\kanjiencodingdefault}%
567 \kanjifamily{\kanjifamilydefault}%
568 \kanjiseries{\kanjiseriesdefault}%
569 \kanjishape{\kanjishapedefault}%
575 \@onlypreamble\romanprocess@table
576 \@onlypreamble\kanjiprocess@table
577 \DeclareTextCommandDefault{\textunderscore}{%
578 \leavevmode\kern.06em
579 %\iftdir\raise-\tbaselineshift\fi
580 \vbox{\hrule\@width.3em}}
582 %%%%%% LuaTeX-ja specific
584 % #1 の展開結果から encoding 部分をとりだし,それが和文用かどうかの結果を \ifin@ に代入
585 \def\ltj@@IsFontJapanese#1{%
586 \expandafter\ltj@@IsFontJapaneseX#1//:%
587 \expandafter\expandafter\expandafter
588 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}}
589 \def\ltj@@IsFontJapaneseX#1/#2/:{\edef\tmp@item{{\directlua{tex.print('#1')}}}}
592 \let\extract@afont\extract@font
594 \expandafter \ifx \font@name \relax
595 \let\extract@font\extract@jfont
597 \let\extract@font\extract@afont
599 \let\getjfont\font@name}
603 \expandafter\globaljfont\font@name\external@font\relax
604 \font@name%\global\zw=\zw\global\zh=\zh
605 \csname \f@encoding+\f@family\endcsname
606 \csname\curr@fontshape\endcsname}
608 \let\ltj@@al@do@subst@correction=\do@subst@correction
609 \def\ltj@@ja@do@subst@correction{%
610 \xdef\subst@correction{%
612 \global\expandafter\let\csname \curr@fontshape/\f@size\endcsname\font@name%
614 \aftergroup\subst@correction
616 \def\do@subst@correction{%
617 \ltj@@IsFontJapanese{\curr@fontshape}\ifin@
618 \ltj@@ja@do@subst@correction
620 \ltj@@al@do@subst@correction
625 %%%%%% Japanese font for math mode
627 % \M@<enc> から その <enc> が和文用か調べる
629 \gdef\ltj@@mathJapaneseFonts#1M#2#3\relax{\ltj@@IsFontJapanese{#3}}}
631 \let\ltj@@al@getanddefine@fonts=\getanddefine@fonts
632 \def\ltj@@ja@getanddefine@fonts#1#2{%
633 \xdef\font@name{\csname \string#2/\tf@size\endcsname}%
634 \pickup@jfont\let\textfont@name\font@name
635 \xdef\font@name{\csname \string#2/\sf@size\endcsname}%
636 \pickup@jfont\let\scriptfont@name\font@name
637 \xdef\font@name{\csname \string#2/\ssf@size\endcsname}%
639 \edef\math@fonts{\math@fonts\ltjsetparameter{%
640 jatextfont={#1,\textfont@name},%
641 jascriptfont={#1,\scriptfont@name},%
642 jascriptscriptfont={#1,\font@name}}}%
645 \def\getanddefine@fonts#1#2{%
646 \ltj@tempcnta=#1\ltj@@IsFontJapanese{\string#2}%
647 \ifin@\let\ltj@temp=\ltj@@ja@getanddefine@fonts%
648 \else \let\ltj@temp=\ltj@@al@getanddefine@fonts\fi
651 \def\use@mathgroup#1#2{\relax\ifmmode
653 \expandafter\ifx\csname M@\f@encoding\endcsname#1\else
654 #1\fi\ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
655 \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi
656 \expandafter\math@egroup\fi}%