From 23c26360244f7f15daca59158fcb2bd51d71ab7a Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Tue, 22 Nov 2011 12:49:58 +0900 Subject: [PATCH] Bugfix of the previous commit. --- src/luatexja-core.sty | 23 ++++++++--------------- src/patches/lltjp-unicode-math.sty | 11 +++++++---- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index 666a6fe..b0233cc 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -201,15 +201,19 @@ \def\zw{\directlua{luatexja.jfont.load_zw()}\ltj@zw} \def\zh{\directlua{luatexja.jfont.load_zh()}\ltj@zh} + %%%%%%%% \inhibitglue +\protected\def\ltj@reset@globaldefs{% + \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}} +\protected\def\ltj@restore@globaldefs{\directlua{tex.globaldefs = ltj.global_temp}} \let\new@everypar=\everypar \protected\def\inhibitglue{\relax% \ifvmode - \directlua{ltj.global_temp = tex.globaldefs; tex.globaldefs = 0}% trick + \ltj@reset@globaldefs \xdef\@@tempa{\the\everypar}% \xdef\@@tempb{\everypar={\@@tempa}\@@tempa\noexpand\ltj@@ihb}% \everypar\expandafter{\@@tempb}% - \directlua{tex.globaldefs = ltj.global_temp}% trick + \ltj@restore@globaldefs \else\ifhmode\ltj@@ihb\fi\fi} \def\ltj@@ihb{\directlua{luatexja.jfmglue.create_inhibitglue_node()}} @@ -264,9 +268,7 @@ \define@key[ltj]{japaram}{jascriptscriptfont}{% \expandafter\ltj@@set@stackfont#1:{mjss}} \def\ltj@@set@stackfont#1,#2:#3{% - \directlua{% - ltj.global_temp = tex.globaldefs; - tex.globaldefs = 0}% + \ltj@reset@globaldefs \ltj@tempcnta=\ltj@curjfnt\ltj@curjfnt=-1 #2% \ifnum\ltj@curjfnt=-1 \@PackageError{luatexja-core}% @@ -277,7 +279,7 @@ \ltj@safe@num@or\ltj@defnum{#1}, \the\ltj@curjfnt)}% \fi \ltj@curjfnt=\ltj@tempcnta - \directlua{tex.globaldefs = ltj.global_temp}% + \ltj@restore@globaldefs } % yalbaselineshift = @@ -423,15 +425,6 @@ \csname ltj@kcat4\endcsname="7FFFFFFF %" \csname ltj@kcat5\endcsname="7FFFFFFF %" \csname ltj@kcat6\endcsname="7FFFFFFF }%" -\protected\def\ltj@backup@kcat{\edef\ltj@restore@kcat{% - \csname ltj@kcat0\endcsname=\expandafter\the\csname ltj@kcat0\endcsname\relax - \csname ltj@kcat1\endcsname=\expandafter\the\csname ltj@kcat1\endcsname\relax - \csname ltj@kcat2\endcsname=\expandafter\the\csname ltj@kcat2\endcsname\relax - \csname ltj@kcat3\endcsname=\expandafter\the\csname ltj@kcat3\endcsname\relax - \csname ltj@kcat4\endcsname=\expandafter\the\csname ltj@kcat4\endcsname\relax - \csname ltj@kcat5\endcsname=\expandafter\the\csname ltj@kcat5\endcsname\relax - \csname ltj@kcat6\endcsname=\expandafter\the\csname ltj@kcat6\endcsname\relax}} -\let\ltj@restore@kcat=\relax \protected\def\ltjjachar{\afterassignment\ltj@@kchar\ltj@tempcnta} \def\ltj@@kchar{{\directlua{tex.globaldefs = 0}\ltj@alljachar\ltj@@origchar\ltj@tempcnta}} diff --git a/src/patches/lltjp-unicode-math.sty b/src/patches/lltjp-unicode-math.sty index ff8ad2d..beb3261 100644 --- a/src/patches/lltjp-unicode-math.sty +++ b/src/patches/lltjp-unicode-math.sty @@ -24,11 +24,14 @@ \directlua{luatexja.math.is_math_letters[\int_eval:n {#4}]=true} } \group_begin: - \char_set_catcode_other:N \^ - \gdef\q{hoge}\gdef\r{piyo} \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil {%" - \tl_set:Nn \l_tmpa_tl {\ifmmode\char"#2\else\ltjalchar"#2\relax\fi} - \cs_gset_eq:NN #1 \l_tmpa_tl + \group_begin: + \char_set_lccode:nn { `! } { "#2 } + \tex_lowercase:D { + \tl_set:Nn \l_tmpa_tl {\ifmmode!\else{\directlua{tex.globaldefs = 0}\ltj@allalchar!}\fi} + \cs_gset_eq:NN #1 \l_tmpa_tl + } + \group_end: } \group_end: -- 2.11.0