OSDN Git Service

luatexja-preset: use CJKShape=NLC/JIS1990.
[luatex-ja/luatexja.git] / src / patches / lltjfont.sty
index a3fec95..00cb175 100644 (file)
@@ -3,7 +3,7 @@
 % 
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjfont}[2011/11/22 Patch to NFSS2 for LuaLaTeX-ja]
+\ProvidesPackage{lltjfont}[2013/05/14 Patch to NFSS2 for LuaTeX-ja]
 
 \let\k@encoding\@empty
 \let\ck@encoding\@empty
       \fi
    \endgroup
   }
+\def\DLMfontsw@standard#1#2#3{#1{#2{#3}}}
 \def\reDeclareMathAlphabet#1#2#3{%
-  \edef#1{\noexpand\protect\expandafter\noexpand\csname%
-    \expandafter\@gobble\string#1\space\space\endcsname}%
-  \edef\@tempa{\expandafter\@gobble\string#2}%
-  \edef\@tempb{\expandafter\@gobble\string#3}%
-  \edef\@tempc{\string @\expandafter\@gobbletwo\string#2}%
-  \ifx\@tempc\@tempa%
-    \edef\@tempa{\expandafter\@gobbletwo\string#2}%
-    \edef\@tempb{\expandafter\@gobbletwo\string#3}%
+  \ifdefined#2 
+    \@temptokena\expandafter{#2}%
+  \else
+    \@temptokena{#2}%
   \fi
-  \expandafter\edef\csname\expandafter\@gobble\string#1\space\space\endcsname%
-    {\noexpand\DualLang@mathalph@bet%
-      {\expandafter\noexpand\csname\@tempa\space\endcsname}%
-      {\expandafter\noexpand\csname\@tempb\space\endcsname}%
-  }%
-}
-\@onlypreamble\reDeclareMathAlphabet
-\def\DualLang@mathalph@bet#1#2{%
-  \relax\ifmmode
-    \ifx\math@bgroup\bgroup%     2e normal style     (\mathrm{...})
-      \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
-    \else
-      \ifx\math@bgroup\relax%    2e two letter style (\rm->\mathrm)
-        \let\DualLang@Mfontsw\DLMfontsw@oldstyle
-      \else
-        \bgroup\let\DualLang@Mfontsw\DLMfontsw@standard
-      \fi
-    \fi
+  \ifdefined#3
+    \toks0\expandafter{#3}%
   \else
-    \let\DualLang@Mfontsw\@firstoftwo
+    \toks0{#3}%
   \fi
-  \DualLang@Mfontsw{#1}{#2}%
+  \long\protected\edef#1{%
+    \noexpand\DLMfontsw@standard{\the\@temptokena}{\the\toks0}}%
 }
-\def\DLMfontsw@standard#1#2#3{#1{#2{#3}}\egroup}
-\def\DLMfontsw@oldstyle#1#2{#1\relax\@fontswitch\relax{#2}}
-\def\DLMfontsw@oldlfont#1#2{#1\relax#2\relax}
+\@onlypreamble\reDeclareMathAlphabet
 \def\all@shape{all}%
 \def\DeclareRelationFont#1#2#3#4#5#6#7#8{%
   \def\rel@shape{#4}%
     \edef\k@family{#1}%
   \else % search font definition file...
      \ifcsname kfam@list@\k@encoding\endcsname\else
-       \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}
-       \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}
+       \expandafter\gdef\csname kfam@list@\k@encoding\endcsname{}%
+       \expandafter\gdef\csname notkfam@list@\k@encoding\endcsname{}%
      \fi
      \edef\@templist{\@nameuse{kfam@list@\k@encoding}}%
      \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
        \edef\@templist{\@nameuse{notkfam@list@\k@encoding}}%
        \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
        \ifin@\@notkfamtrue\else%
-         \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\k@encoding+%
-         \message{(I search kanjifont definition file: \@@temp#1.fd)}%
+         \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\k@encoding+%
+         \message{(I search kanjifont definition file: \@@temp)}%
          \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
          \if@tempswz
            \expandafter\xdef\csname kfam@list@\k@encoding\endcsname
     \edef\f@family{#1}%
   \else % search font definition file...
      \ifcsname ffam@list@\f@encoding\endcsname\else
-       \expandafter\gdef\csname ffam@list@\f@encoding\endcsname{}
-       \expandafter\gdef\csname notffam@list@\f@encoding\endcsname{}
+       \expandafter\gdef\csname ffam@list@\f@encoding\endcsname{}%
+       \expandafter\gdef\csname notffam@list@\f@encoding\endcsname{}%
      \fi
      \edef\@templist{\@nameuse{ffam@list@\f@encoding}}%
      \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
        \edef\@templist{\@nameuse{notffam@list@\f@encoding}}%
        \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
        \ifin@\@notffamtrue\else
-         \def\@temp##1+{\lowercase{\def\@@temp{##1}}}\expandafter\@temp\f@encoding+%
-         \message{(I search font definition file: \@@temp#1.fd)}%
+         \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\f@encoding+%
+         \message{(I search font definition file: \@@temp)}%
          \IfFileExists{\@@temp#1.fd}{\@tempswztrue}{\@tempswzfalse}%
          \if@tempswz
            \expandafter\xdef\csname ffam@list@\f@encoding\endcsname
 \def\useroman#1#2#3#4{%
     \romanencoding{#1}\romanfamily{#2}\romanseries{#3}\romanshape{#4}%
     \selectfont\ignorespaces}
-\def\usefont#1#2#3#4{%
+\protected\def\usefont#1#2#3#4{%
   \edef\tmp@item{{#1}}%
   \expandafter\expandafter\expandafter
   \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
   \expandafter\ltj@@IsFontJapaneseX#1//:%
   \expandafter\expandafter\expandafter
   \inlist@\expandafter\tmp@item\expandafter{\kenc@list}}
-\def\ltj@@IsFontJapaneseX#1/#2/:{\edef\tmp@item{{\directlua{tex.print('#1')}}}}
+\def\ltj@@IsFontJapaneseX#1/#2/:{\edef\tmp@item{{\directlua{%
+  tex.print(luatexbase.catcodetables["latex-package"], '#1')}%
+}}}
 
 
 \let\extract@afont\extract@font
   \pickup@jfont\let\scriptfont@name\font@name
   \xdef\font@name{\csname \string#2/\ssf@size\endcsname}%
   \pickup@jfont
-  \edef\math@fonts{\math@fonts\ltjsetparameter{%
-    jatextfont={#1,\textfont@name},%
-    jascriptfont={#1,\scriptfont@name},%
-    jascriptscriptfont={#1,\font@name}}}%
+  \edef\math@fonts{\math@fonts\ltj@setpar@global%
+    \ltj@@set@stackfont#1,\textfont@name:{MJT}%
+    \ltj@@set@stackfont#1,\scriptfont@name:{MJS}%
+    \ltj@@set@stackfont#1,\font@name:{MJSS}%
+  }%
 }
 
 \def\getanddefine@fonts#1#2{%