2 % lltjfont.sty: derived from plfonts.dtx in pLaTeX.
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjfont}[2011/11/22 Patch to NFSS2 for LuaLaTeX-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
31 \def\in@@##1<#1>##2##3\in@@{%
32 \ifx\in@##2\in@false\else\in@true\fi}%
34 \def\fam@elt{\noexpand\fam@elt}
35 \def\enc@elt{\noexpand\enc@elt}
37 \let\kyenc@list\@empty
38 \let\ktenc@list\@empty
43 \ifmmode\copy\strutbox\else\unhcopy\strutbox\fi
45 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi
48 \def\tstrut{\relax\hbox{\tate
49 \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
50 \def\zstrut{\relax\hbox{\tate
51 \ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
52 \def\DeclareFontEncoding{%
56 \DeclareFontEncoding@}
57 \def\DeclareFontEncoding@#1#2#3{%
59 \ifx\csname T@#1\endcsname\relax
60 \def\cdp@elt{\noexpand\cdp@elt}%
61 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
62 {\default@family}{\default@series}%
64 \expandafter\let\csname#1-cmd\endcsname\@changed@cmd
65 \def\enc@elt{\noexpand\enc@elt}%
67 \@font@info{Redeclaring font encoding #1}%
69 \global\@namedef{T@#1}{#2}%
70 \global\@namedef{M@#1}{\default@M#3}%
71 \xdef\LastDeclaredEncoding{#1}%
73 \def\DeclareKanjiEncoding#1{%
75 The \string\DeclareKanjiEncoding\space is obsoleted command. Please use
77 the \string\DeclareTateKanjiEncoding\space for `Tate-kumi' encoding, and
79 the \string\DeclareYokoKanjiEncoding\space for `Yoko-kumi' encoding.
81 I treat the `#1' encoding as `Yoko-kumi'.}
82 \DeclareYokoKanjiEncoding{#1}%
84 \def\DeclareYokoKanjiEncoding{%
88 \DeclareYokoKanjiEncoding@}
89 \def\DeclareYokoKanjiEncoding@#1#2#3{%
91 \ifx\csname T@#1\endcsname\relax
92 \def\cdp@elt{\noexpand\cdp@elt}%
93 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
94 {\default@k@family}{\default@k@series}%
96 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
97 \def\enc@elt{\noexpand\enc@elt}%
98 \xdef\kyenc@list{\kyenc@list\enc@elt<#1>}%
99 \xdef\kenc@list{\kenc@list\enc@elt<#1>}%
101 \@font@info{Redeclaring KANJI (yoko) font encoding #1}%
103 \global\@namedef{T@#1}{#2}%
104 \global\@namedef{M@#1}{\default@KM#3}%
106 \def\DeclareTateKanjiEncoding{%
109 \expandafter\endgroup
110 \DeclareTateKanjiEncoding@}
111 \def\DeclareTateKanjiEncoding@#1#2#3{%
113 \ifx\csname T@#1\endcsname\relax
114 \def\cdp@elt{\noexpand\cdp@elt}%
115 \xdef\cdp@list{\cdp@list\cdp@elt{#1}%
116 {\default@k@family}{\default@k@series}%
118 \expandafter\let\csname#1-cmd\endcsname\@changed@kcmd
119 \def\enc@elt{\noexpand\enc@elt}%
120 \xdef\ktenc@list{\ktenc@list\enc@elt<#1>}%
121 \xdef\kenc@list{\kenc@list\enc@elt<#1>}%
123 \@font@info{Redeclaring KANJI (tate) font encoding #1}%
125 \global\@namedef{T@#1}{#2}%
126 \global\@namedef{M@#1}{\default@KM#3}%
128 \@onlypreamble\DeclareKanjiEncoding
129 \@onlypreamble\DeclareYokoKanjiEncoding
130 \@onlypreamble\DeclareYokoKanjiEncoding@
131 \@onlypreamble\DeclareTateKanjiEncoding
132 \@onlypreamble\DeclareTateKanjiEncoding@
133 \def\DeclareKanjiEncodingDefaults#1#2{%
135 \ifx\default@KT\@empty\else
136 \@font@info{Overwriting KANJI encoding scheme text defaults}%
138 \gdef\default@KT{#1}%
141 \ifx\default@KM\@empty\else
142 \@font@info{Overwriting KANJI encoding scheme math defaults}%
144 \gdef\default@KM{#2}%
146 \let\default@KT\@empty
147 \let\default@KM\@empty
148 \@onlypreamble\DeclareKanjiEncodingDefaults
149 \def\DeclareFontFamily#1#2#3{%
151 {\@latex@error{Encoding scheme `#1' unknown}\@eha}%
152 {\def\reserved@a{#3}%
154 \expandafter\let\csname #1+#2\expandafter\endcsname
155 \ifx \reserved@a\@empty
161 \def\DeclareKanjiFamily#1#2#3{%
163 {\@latex@error{KANJI Encoding scheme `#1' unknown}\@eha}%
164 {\def\reserved@a{#3}%
166 \expandafter\let\csname #1+#2\expandafter\endcsname
167 \ifx \reserved@a\@empty
173 \def\DeclareKanjiSubstitution#1#2#3#4{%
174 \expandafter\ifx\csname T@#1\endcsname\relax
175 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
180 \def\cdp@elt##1##2##3##4{%
181 \def\reserved@b{##1}%
182 \ifx\reserved@a\reserved@b
183 \addto@hook\toks@{\cdp@elt{#1}{#2}{#3}{#4}}%
185 \addto@hook\toks@{\cdp@elt{##1}{##2}{##3}{##4}}%
188 \xdef\cdp@list{\the\toks@}%
190 \global\@namedef{D@#1}{\def\default@family{#2}%
191 \def\default@series{#3}%
192 \def\default@shape{#4}}%
194 \def\DeclareErrorKanjiFont#1#2#3#4#5{%
195 \xdef\error@kfontshape{%
196 \noexpand\expandafter\noexpand\split@name\noexpand\string
197 \expandafter\noexpand\csname#1/#2/#3/#4/#5\endcsname
199 \gdef\default@k@family{#2}%
200 \gdef\default@k@series{#3}%
201 \gdef\default@k@shape{#4}%
202 \global\let\k@family\default@k@family
203 \global\let\k@series\default@k@series
204 \global\let\k@shape\default@k@shape
206 \gdef\f@baselineskip{#5pt}}
207 \@onlypreamble\DeclareKanjiSubstitution
208 \@onlypreamble\DeclareErrorKanjiFont
209 \def\DeclareFixedFont#1#2#3#4#5#6{%
214 \edef\tmp@item{{#2}}%
215 \expandafter\expandafter\expandafter
216 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
218 \usekanji{#2}{#3}{#4}{#5}%
219 \global\let#1\getjfont
221 %\expandafter\expandafter\expandafter
222 %\inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
224 % \usekanji{#2}{#3}{#4}{#5}%
227 \useroman{#2}{#3}{#4}{#5}%
228 \global\expandafter\let\expandafter#1\the\font
233 \def\reDeclareMathAlphabet#1#2#3{%
234 \edef#1{\noexpand\protect\expandafter\noexpand\csname%
235 \expandafter\@gobble\string#1\space\space\endcsname}%
236 \edef\@tempa{\expandafter\@gobble\string#2}%
237 \edef\@tempb{\expandafter\@gobble\string#3}%
238 \edef\@tempc{\string @\expandafter\@gobbletwo\string#2}%
240 \edef\@tempa{\expandafter\@gobbletwo\string#2}%
241 \edef\@tempb{\expandafter\@gobbletwo\string#3}%
243 \expandafter\edef\csname\expandafter\@gobble\string#1\space\space\endcsname%
244 {\noexpand\DualLang@mathalph@bet%
245 {\expandafter\noexpand\csname\@tempa\space\endcsname}%
246 {\expandafter\noexpand\csname\@tempb\space\endcsname}%
249 \@onlypreamble\reDeclareMathAlphabet
250 \def\DualLang@mathalph@bet#1#2{%
252 \ifx\math@bgroup\bgroup% 2e normal style (\mathrm{...})
253 \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
255 \ifx\math@bgroup\relax% 2e two letter style (\rm->\mathrm)
256 \let\DualLang@Mfontsw\DLMfontsw@oldstyle
258 \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
262 \let\DualLang@Mfontsw\@firstoftwo
264 \DualLang@Mfontsw{#1}{#2}%
266 \def\DLMfontsw@standard#1#2#3{#1{#2{#3}}\egroup}
267 \def\DLMfontsw@oldstyle#1#2{#1\relax\@fontswitch\relax{#2}}
268 \def\DLMfontsw@oldlfont#1#2{#1\relax#2\relax}
270 \def\DeclareRelationFont#1#2#3#4#5#6#7#8{%
272 \ifx\rel@shape\@empty
274 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
275 \romanencoding{#5}\romanfamily{#6}%
279 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
280 \romanencoding{#5}\romanfamily{#6}%
281 \romanseries{#7}\romanshape{#8}}%
284 \def\SetRelationFont#1#2#3#4#5#6#7#8{%
286 \ifx\rel@shape\@empty
287 \expandafter\def\csname rel@#1/#2/#3/all\endcsname{%
288 \romanencoding{#5}\romanfamily{#6}%
291 \expandafter\def\csname rel@#1/#2/#3/#4\endcsname{%
292 \romanencoding{#5}\romanfamily{#6}%
293 \romanseries{#7}\romanshape{#8}}%
297 \def\userelfont{\@knjcmdtrue}
298 \DeclareRobustCommand\selectfont{%
299 \let\tmp@error@fontshape\error@fontshape
300 \let\error@fontshape\error@kfontshape
301 \edef\tmp@item{{\k@encoding}}%
302 \expandafter\expandafter\expandafter
303 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
305 \let\cy@encoding\k@encoding
306 \edef\ct@encoding{\csname t@enc@\k@encoding\endcsname}%
308 \expandafter\expandafter\expandafter
309 \inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
311 \let\ct@encoding\k@encoding
312 \edef\cy@encoding{\csname y@enc@\k@encoding\endcsname}%
314 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
318 %\let\k@encoding\ct@encoding
319 %\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
322 \let\k@encoding\cy@encoding
323 \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
326 \expandafter\def\expandafter\k@encoding\tmp@item
328 \let\error@fontshape\tmp@error@fontshape
329 \if@knjcmd \@knjcmdfalse
331 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname\relax
333 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname\relax
335 \csname rel@\k@encoding/\k@family/\k@series/all\endcsname
338 \csname rel@\k@encoding/\k@family/\k@series/\k@shape\endcsname
342 \xdef\font@name{\csname\curr@fontshape/\f@size\endcsname}%
346 \ifx\f@linespread\baselinestretch \else
347 \set@fontsize\baselinestretch\f@size\f@baselineskip
350 \def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}}
351 \KanjiEncodingPair{JY3}{JT3}
352 \def\set@fontsize#1#2#3{%
353 \@defaultunits\@tempdimb#2pt\relax\@nnil
354 \edef\f@size{\strip@pt\@tempdimb}%
355 \@defaultunits\@tempskipa#3pt\relax\@nnil
356 \edef\f@baselineskip{\the\@tempskipa}%
357 \edef\f@linespread{#1}%
358 \let\baselinestretch\f@linespread
360 \baselineskip\f@baselineskip\relax
361 \baselineskip\f@linespread\baselineskip
362 \normalbaselineskip\baselineskip
364 \setbox\strutbox\hbox{%\yoko
366 \@height.7\baselineskip \@depth.3\baselineskip}%
367 \setbox\tstrutbox\hbox{%\tate
369 \@height.5\baselineskip \@depth.5\baselineskip}%
370 \setbox\zstrutbox\hbox{%\tate
372 \@height.7\baselineskip \@depth.3\baselineskip}%
373 \let\size@update\relax}}
375 \newdimen\adjust@dimen
376 \def\adjustbaseline{%
377 \setbox\adjust@box\hbox{\ltjsetparameter{yjabaselineshift=\z@}あ}%
381 \cvs\normalbaselineskip
383 \cHT\cht \advance\cHT\cdp
385 % \setbox\adjust@box\hbox{\tbaselineshift\z@ M}%
386 % \adjust@dimen\ht\adjust@box
387 % \advance\adjust@dimen\dp\adjust@box
388 % \advance\adjust@dimen-\cHT
389 % \divide\adjust@dimen\tw@
390 % \advance\adjust@dimen\cdp
391 % \advance\adjust@dimen-\dp\adjust@box
392 % \tbaselineshift\adjust@dimen
395 \DeclareRobustCommand\romanencoding[1]{%
396 \expandafter\ifx\csname T@#1\endcsname\relax
397 \@latex@error{Encoding scheme `#1' unknown}\@eha
399 \edef\f@encoding{#1}%
400 \ifx\cf@encoding\f@encoding
401 \let\enc@update\relax
403 \let\enc@update\@@enc@update
407 \DeclareRobustCommand\kanjiencoding[1]{%
408 \expandafter\ifx\csname T@#1\endcsname\relax
409 \@latex@error{KANJI Encoding scheme `#1' unknown}\@eha
411 \edef\k@encoding{#1}%
412 \ifx\ck@encoding\k@encoding
413 \let\kenc@update\relax
415 \let\kenc@update\@@kenc@update
419 \DeclareRobustCommand\fontencoding[1]{%
420 \edef\tmp@item{{#1}}%
421 \expandafter\expandafter\expandafter
422 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
423 \ifin@ \kanjiencoding{#1}\else\romanencoding{#1}\fi}
426 \csname T@\k@encoding\endcsname
427 \csname D@\k@encoding\endcsname
428 \let\kenc@update\relax
429 \let\ck@encoding\k@encoding
430 \edef\tmp@item{{\k@encoding}}%
431 \expandafter\expandafter\expandafter
432 \inlist@\expandafter\tmp@item\expandafter{\kyenc@list}%
433 \ifin@ \let\cy@encoding\k@encoding
435 \expandafter\expandafter\expandafter
436 \inlist@\expandafter\tmp@item\expandafter{\ktenc@list}%
437 \ifin@ \let\ct@encoding\k@encoding
439 \@latex@error{KANJI Encoding scheme `\k@encoding' unknown}\@eha
443 \let\kenc@update\relax
444 \def\@changed@kcmd#1#2{%
445 \ifx\protect\@typeset@protect
447 \expandafter\ifx\csname\ck@encoding\string#1\endcsname\relax
448 \expandafter\ifx\csname ?\string#1\endcsname\relax
449 \expandafter\def\csname ?\string#1\endcsname{%
450 \TextSymbolUnavailable#1%
453 \global\expandafter\let
454 \csname\cf@encoding \string#1\expandafter\endcsname
455 \csname ?\string#1\endcsname
457 \csname\ck@encoding\string#1%
458 \expandafter\endcsname
465 \DeclareRobustCommand\romanfamily[1]{\edef\f@family{#1}}
466 \DeclareRobustCommand\kanjifamily[1]{\edef\k@family{#1}}
467 % \notkfam@list@<enc>: list of non-defined kanji families under <enc>
468 % \kfam@list@<enc>: list of kanji families under <enc>, defined in a .fd file
469 \DeclareRobustCommand\fontfamily[1]{%
470 \@notkfamfalse\@notffamfalse\edef\tmp@item{{#1}}%
471 \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
473 \else % search font definition file...
474 \ifcsname kfam@list@\k@encoding\endcsname\else
475 \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}
476 \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}
478 \edef\@templist{\@nameuse{kfam@list@\k@encoding}}%
479 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
480 \ifin@\edef\k@family{#1}\else%
481 \edef\@templist{\@nameuse{notkfam@list@\k@encoding}}%
482 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
483 \ifin@\@notkfamtrue\else%
484 \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\k@encoding+%
485 \message{(I search kanjifont definition file: \@@temp#1.fd)}%
486 \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
488 \expandafter\xdef\csname kfam@list@\k@encoding\endcsname
489 {\@nameuse{kfam@list@\k@encoding}\fam@elt<#1>}\edef\k@family{#1}%
491 \expandafter\xdef\csname notkfam@list@\k@encoding\endcsname
492 {\@nameuse{notkfam@list@\k@encoding}\fam@elt<#1>}\@notkfamtrue%
497 \ifcsname \f@encoding+#1\endcsname
499 \else % search font definition file...
500 \ifcsname ffam@list@\f@encoding\endcsname\else
501 \expandafter\gdef\csname ffam@list@\f@encoding\endcsname{}
502 \expandafter\gdef\csname notffam@list@\f@encoding\endcsname{}
504 \edef\@templist{\@nameuse{ffam@list@\f@encoding}}%
505 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
506 \ifin@\edef\f@family{#1}\else
507 \edef\@templist{\@nameuse{notffam@list@\f@encoding}}%
508 \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
509 \ifin@\@notffamtrue\else
510 \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\f@encoding+%
511 \message{(I search font definition file: \@@temp#1.fd)}%
512 \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
514 \expandafter\xdef\csname ffam@list@\f@encoding\endcsname
515 {\@nameuse{ffam@list@\f@encoding}\fam@elt<#1>}\edef\f@family{#1}%
517 \expandafter\xdef\csname notffam@list@\f@encoding\endcsname
518 {\@nameuse{notffam@list@\f@encoding}\fam@elt<#1>}\@notffamtrue%
523 \if@notkfam\if@notffam
524 {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
525 \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
526 {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
527 \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
530 \DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}}
531 \DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}}
532 \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}
533 \DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}}
534 \DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}}
535 \DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}}
536 \def\usekanji#1#2#3#4{%
537 \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}%
538 \selectfont\ignorespaces}
539 \def\useroman#1#2#3#4{%
540 \romanencoding{#1}\romanfamily{#2}\romanseries{#3}\romanshape{#4}%
541 \selectfont\ignorespaces}
542 \def\usefont#1#2#3#4{%
543 \edef\tmp@item{{#1}}%
544 \expandafter\expandafter\expandafter
545 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
546 \ifin@ \usekanji{#1}{#2}{#3}{#4}%
547 \else\useroman{#1}{#2}{#3}{#4}%
549 \DeclareRobustCommand\normalfont{%
550 \kanjiencoding{\kanjiencodingdefault}%
551 \kanjifamily{\kanjifamilydefault}%
552 \kanjiseries{\kanjiseriesdefault}%
553 \kanjishape{\kanjishapedefault}%
554 \romanencoding{\encodingdefault}%
555 \romanfamily{\familydefault}%
556 \romanseries{\seriesdefault}%
557 \romanshape{\shapedefault}%
558 \selectfont\ignorespaces}
560 \let\reset@font\normalfont
561 \DeclareRobustCommand\mcfamily
562 {\not@math@alphabet\mcfamily\mathmc
563 \kanjifamily\mcdefault\selectfont}
564 \DeclareRobustCommand\gtfamily
565 {\not@math@alphabet\gtfamily\mathgt
566 \kanjifamily\gtdefault\selectfont}
567 \let\romanprocess@table\process@table
568 \def\kanjiprocess@table{%
569 \kanjiencoding{\kanjiencodingdefault}%
570 \kanjifamily{\kanjifamilydefault}%
571 \kanjiseries{\kanjiseriesdefault}%
572 \kanjishape{\kanjishapedefault}%
578 \@onlypreamble\romanprocess@table
579 \@onlypreamble\kanjiprocess@table
580 \DeclareTextCommandDefault{\textunderscore}{%
581 \leavevmode\kern.06em
582 %\iftdir\raise-\tbaselineshift\fi
583 \vbox{\hrule\@width.3em}}
585 %%%%%% LuaTeX-ja specific
587 % #1 の展開結果から encoding 部分をとりだし,それが和文用かどうかの結果を \ifin@ に代入
588 \def\ltj@@IsFontJapanese#1{%
589 \expandafter\ltj@@IsFontJapaneseX#1//:%
590 \expandafter\expandafter\expandafter
591 \inlist@\expandafter\tmp@item\expandafter{\kenc@list}}
592 \def\ltj@@IsFontJapaneseX#1/#2/:{\edef\tmp@item{{\directlua{tex.print('#1')}}}}
595 \let\extract@afont\extract@font
597 \expandafter \ifx \font@name \relax
598 \let\extract@font\extract@jfont
600 \let\extract@font\extract@afont
602 \let\getjfont\font@name}
606 \expandafter\globaljfont\font@name\external@font\relax
607 \font@name%\global\zw=\zw\global\zh=\zh
608 \csname \f@encoding+\f@family\endcsname
609 \csname\curr@fontshape\endcsname}
611 \let\ltj@@al@do@subst@correction=\do@subst@correction
612 \def\ltj@@ja@do@subst@correction{%
613 \xdef\subst@correction{%
615 \global\expandafter\let\csname \curr@fontshape/\f@size\endcsname\font@name%
617 \aftergroup\subst@correction
619 \def\do@subst@correction{%
620 \ltj@@IsFontJapanese{\curr@fontshape}\ifin@
621 \ltj@@ja@do@subst@correction
623 \ltj@@al@do@subst@correction
628 %%%%%% Japanese font for math mode
630 % \M@<enc> から その <enc> が和文用か調べる
632 \gdef\ltj@@mathJapaneseFonts#1M#2#3\relax{\ltj@@IsFontJapanese{#3}}}
634 \let\ltj@@al@getanddefine@fonts=\getanddefine@fonts
635 \def\ltj@@ja@getanddefine@fonts#1#2{%
636 \xdef\font@name{\csname \string#2/\tf@size\endcsname}%
637 \pickup@jfont\let\textfont@name\font@name
638 \xdef\font@name{\csname \string#2/\sf@size\endcsname}%
639 \pickup@jfont\let\scriptfont@name\font@name
640 \xdef\font@name{\csname \string#2/\ssf@size\endcsname}%
642 \edef\math@fonts{\math@fonts\ltjsetparameter{%
643 jatextfont={#1,\textfont@name},%
644 jascriptfont={#1,\scriptfont@name},%
645 jascriptscriptfont={#1,\font@name}}}%
648 \def\getanddefine@fonts#1#2{%
649 \ltj@tempcnta=#1\ltj@@IsFontJapanese{\string#2}%
650 \ifin@\let\ltj@temp=\ltj@@ja@getanddefine@fonts%
651 \else \let\ltj@temp=\ltj@@al@getanddefine@fonts\fi
654 \def\use@mathgroup#1#2{\relax\ifmmode
656 \expandafter\ifx\csname M@\f@encoding\endcsname#1\else
657 #1\fi\ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
658 \ifin@\jfam#2\relax\else\mathgroup#2\relax\fi
659 \expandafter\math@egroup\fi}%