OSDN Git Service

Bugfix in \/, and another change in \fontfamily.
[luatex-ja/luatexja.git] / src / luatexja-core.sty
index f24ffe2..59447a9 100644 (file)
 \newcount\ltj@tempcntc
 \newdimen\ltj@tempdima
 \newskip\ltj@tempskipa
+\newtoks\ltj@temptoks
 
 \newdimen\ltj@zw
 \newdimen\ltj@zh
 \newdimen\jQ \jQ=0.25mm
-\newdimen\jH \jH=0.25mm
+\let\jH=\jQ
 
 %%%%%%%% error message
 \def\ltj@defnum{0}
 \def\zh{\directlua{luatexja.jfont.load_zh()}\ltj@zh}
 
 %%%%%%%% \inhibitglue
-\protected\def\inhibitglue{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
+\let\new@everypar=\everypar
+\protected\def\inhibitglue{%
+  \ifvmode
+  \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}% trick
+    \xdef\@@tempa{\the\everypar}%
+    \xdef\@@tempb{\everypar={\@@tempa}\@@tempa\noexpand\ltj@@ihb}%
+    \everypar\expandafter{\@@tempb}%
+    \directlua{tex.globaldefs = ltj.global_temp}% trick
+  \else\ifhmode\ltj@@ihb\fi\fi}
+\def\ltj@@ihb{\directlua{luatexja.jfmglue.create_inhibitglue_node()}}
 
 %%%%%%%% \yoko, \tate, \ifydir, \iftdir
 %% At this moment, tategaki mode is not implemented; 
 %% there is only yokogaki mode now.
 \let\yoko\relax
 \let\tate\relax
-\let\ifydir\iftrue
-\let\iftdir\iffalse
+\newif\ifydir\ydirtrue
+\newif\iftdir\tdirfalse
 
 %%%%%%%% \ltjdefcharrange<name>{100-200,3000-,5000,...}
 \protected\def\ltjdefcharrange#1#2{%
 \define@key[ltj]{japaram}{jascriptscriptfont}{%
   \expandafter\ltj@@set@stackfont#1:{mjss}}
 \def\ltj@@set@stackfont#1,#2:#3{%
-  {\directlua{tex.globaldefs=0}\ltj@curjfnt=-1 #2%
-   \global\ltj@tempcnta=\ltj@curjfnt}%
-  \ifnum\ltj@tempcnta=-1
+  \directlua{%
+    ltj.global_temp = tex.globaldefs; 
+    tex.globaldefs = 0}%
+  \ltj@tempcnta=\ltj@curjfnt\ltj@curjfnt=-1 #2%
+  \ifnum\ltj@curjfnt=-1
     \@PackageError{luatexja-core}%
     {\string#2 is not a control sequence that represents \MessageBreak
      a Japanese font}{}%
   \else
     \directlua{luatexja.stack.set_stack_font(ltj.isglobal, \asluastring{#3},
-    \ltj@safe@num@or\ltj@defnum{#1}, \the\ltj@tempcnta)}%
-  \fi}
+    \ltj@safe@num@or\ltj@defnum{#1}, \the\ltj@curjfnt)}%
+  \fi
+  \ltj@curjfnt=\ltj@tempcnta
+  \directlua{tex.globaldefs = ltj.global_temp}%
+  }
 
 % yalbaselineshift = <dimen>
 % yjabaselineshift = <dimen>