OSDN Git Service

Fixed ticket #26398, and whatsits from LuaTeX-ja stack system and \inhibitglue are...
[luatex-ja/luatexja.git] / src / luatexja-core.sty
index 66e03aa..8c68293 100644 (file)
 %%%%%%%% \inhibitglue
 \protected\def\inhibitglue{\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
+\newif\ifydir\ydirtrue
+\newif\iftdir\tdirfalse
+
 %%%%%%%% \ltjdefcharrange<name>{100-200,3000-,5000,...}
 \protected\def\ltjdefcharrange#1#2{%
-  \ltj@tempcntc=#1 \expandafter\ltj@@dcrange#2,,\ignorespaces}
+  {\ltj@tempcntc=#1 \expandafter\ltj@@dcrange#2,,}\ignorespaces}
 \def\ltj@@dcrange#1,{\def\ltj@temp{#1}%
   \ifx\ltj@temp\empty\let\@next=\relax\else
   \ltj@@dcrangeA{#1}\let\@next=\ltj@@dcrange\fi\@next}
     \ltj@tempcnta=#1 \ltj@tempcntb=\ltj@tempcnta
   \else
     \def\ltj@temp{#1}%
-    \ifx\ltj@temp\empty\ltj@tempcnta='200 \else\ltj@tempcnta=#1 \fi
+    \ifx\ltj@temp\empty\ltj@tempcnta='200\else\ltj@tempcnta=#1\fi\relax
     \def\ltj@temp{#2}%
-    \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF \else\ltj@tempcntb=#2 \fi%"
+    \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF\else\ltj@tempcntb=#2\fi\relax%"
   \fi
   \directlua{luatexja.charrange.add_char_range(\the\ltj@tempcnta,\the\ltj@tempcntb,
     \the\ltj@tempcntc)}%
 \define@key[ltj]{japaram}{jascriptscriptfont}{%
   \expandafter\ltj@@set@stackfont#1:{mjss}}
 \def\ltj@@set@stackfont#1,#2:#3{%
-  \ltj@tempcntb=\globaldefs{\globaldefs0 \ltj@curjfnt=-1 #2%
-   \global\ltj@tempcnta=\ltj@curjfnt}\globaldefs\ltj@tempcntb%
-  \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>
 }
 
 \protected\def\ltjsetparameter#1{%
-  \ifnum\globaldefs=0\directlua{ltj.isglobal=''}\else\directlua{ltj.isglobal='global'}\fi
+  \ifnum\globaldefs>0\directlua{ltj.isglobal='global'}\else\directlua{ltj.isglobal=''}\fi
   \setkeys[ltj]{japaram}{#1}\ignorespaces}
-\protected\def\ltjglobalsetparameter#1{\directlua{ltj.isglobal='global'}%
+\protected\def\ltjglobalsetparameter#1{%
+  \ifnum\globaldefs<0\directlua{ltj.isglobal=''}\else\directlua{ltj.isglobal='global'}\fi
   \setkeys[ltj]{japaram}{#1}\ignorespaces}
 
 %%%%%%%% 
 %%------------------ all done
 \ltj@core@AtEnd
 \endinput
-%% EOF
\ No newline at end of file
+%% EOF