From: Hironori Kitagawa Date: Mon, 26 Sep 2011 09:21:50 +0000 (+0900) Subject: Fixed ticket #26398, and whatsits from LuaTeX-ja stack system and \inhibitglue are... X-Git-Tag: 20120419.0~73 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=03b1187135bacf873e3376e49b589b4524ee5f5e;p=luatex-ja%2Fluatexja.git Fixed ticket #26398, and whatsits from LuaTeX-ja stack system and \inhibitglue are now appended only in (restricted) horizontal mode. --- diff --git a/src/lltjfont.sty b/src/lltjfont.sty index e6713e5..da35c15 100644 --- a/src/lltjfont.sty +++ b/src/lltjfont.sty @@ -654,8 +654,9 @@ \def\getanddefine@fonts#1#2{% \ltj@tempcnta=#1\ltj@@IsFontJapanese{\string#2}% - \ifin@\ltj@@ja@getanddefine@fonts{#1}{#2}% - \else \ltj@@al@getanddefine@fonts{#1}{#2}\fi + \ifin@\let\ltj@temp=\ltj@@ja@getanddefine@fonts% + \else \let\ltj@temp=\ltj@@al@getanddefine@fonts\fi + \ltj@temp{#1}{#2}% } \def\use@mathgroup#1#2{\relax\ifmmode \math@bgroup diff --git a/src/luatexja-core.lua b/src/luatexja-core.lua index aab611c..8190708 100644 --- a/src/luatexja-core.lua +++ b/src/luatexja-core.lua @@ -216,7 +216,7 @@ function debug_show_node_X(p,print_fn) local s local pt=node_type(p.id) local base = debug_depth .. string.format('%X', has_attr(p,attr_icflag) or 0) - .. ' ' .. pt .. ' ' .. p.subtype + .. ' ' .. pt .. ' ' .. tostring(p.subtype ) if pt == 'glyph' then s = base .. ' ' .. utf.char(p.char) .. ' ' .. tostring(p.font) .. ' (' .. print_scaled(p.height) .. '+' diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index ecde410..8c68293 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -253,16 +253,21 @@ \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 = % yjabaselineshift = diff --git a/src/luatexja/jfmglue.lua b/src/luatexja/jfmglue.lua index 902d81c..b4962ff 100644 --- a/src/luatexja/jfmglue.lua +++ b/src/luatexja/jfmglue.lua @@ -821,6 +821,9 @@ end -- \inhibitglue function create_inhibitglue_node() - local g=node_new(id_whatsit, sid_user) - g.user_id=30111; g.type=100; g.value=1; node.write(g) + if tex.nest[tex.nest.ptr].mode == 127 or + tex.nest[tex.nest.ptr].mode == -127 then + local g=node_new(id_whatsit, sid_user) + g.user_id=30111; g.type=100; g.value=1; node.write(g) + end end diff --git a/src/luatexja/stack.lua b/src/luatexja/stack.lua index ea23801..35d446f 100644 --- a/src/luatexja/stack.lua +++ b/src/luatexja/stack.lua @@ -20,21 +20,24 @@ local charprop_stack_table={}; charprop_stack_table[0]={} function get_stack_level() local i = tex.getcount('ltj@@stack') - local j = tex.currentgrouplevel - if j > tex.getcount('ltj@@group@level') then - i = i+1 -- new stack level - local gd = tex.globaldefs - if gd>0 then tex.globaldefs = 0 end - -- 'tex.globaldefs = 0' is local even if \globaldefs > 0. - tex.setcount('ltj@@group@level', j) - for k,v in pairs(charprop_stack_table) do -- clear the stack above i - if k>=i then charprop_stack_table[k]=nil end + if tex.nest[tex.nest.ptr].mode == 127 or + tex.nest[tex.nest.ptr].mode == -127 then + local j = tex.currentgrouplevel + if j > tex.getcount('ltj@@group@level') then + i = i+1 -- new stack level + local gd = tex.globaldefs + if gd>0 then tex.globaldefs = 0 end + -- 'tex.globaldefs = 0' is local even if \globaldefs > 0. + tex.setcount('ltj@@group@level', j) + for k,v in pairs(charprop_stack_table) do -- clear the stack above i + if k>=i then charprop_stack_table[k]=nil end + end + charprop_stack_table[i] = table.fastcopy(charprop_stack_table[i-1]) + tex.setcount('ltj@@stack', i) + if gd>0 then tex.globaldefs = gd end + local g = node_new(id_whatsit, sid_user) + g.user_id=30112; g.type=100; g.value=j; node.write(g) end - charprop_stack_table[i] = table.fastcopy(charprop_stack_table[i-1]) - tex.setcount('ltj@@stack', i) - if gd>0 then tex.globaldefs = gd end - local g = node_new(id_whatsit, sid_user) - g.user_id=30112; g.type=100; g.value=j; node.write(g) end return i end diff --git a/test/test07-math.pdf b/test/test07-math.pdf index 0ccf43f..dde7ccb 100644 Binary files a/test/test07-math.pdf and b/test/test07-math.pdf differ diff --git a/test/test07-math.tex b/test/test07-math.tex index 5aae176..55dc9be 100644 --- a/test/test07-math.tex +++ b/test/test07-math.tex @@ -12,9 +12,8 @@ \paragraph{Unicodeの数式領域}\ 標準 $a_i=i,\ i=1, 2, \dots, n$. -\ltjdefcharrange{2}{"10000-"1FFFF}% 第1面を欧文扱いに -\ltjsetparameter{jacharrange={-2}}% -第1面を欧文扱いに $a_i=i,\ i=1, 2, \dots, n$. +\ltjsetparameter{jacharrange={-3, -8}}% +文字範囲3, 8を欧文扱いに $a_i=i,\ i=1, 2, \dots, n$. \paragraph{和文数式 on \LaTeX} 数式フォント関連のコマンドは一緒.e.g.\ in \verb+lltjdefs.sty+, @@ -37,7 +36,9 @@ mathgt: $\mathrm{\mathmc{あa}}\mathmc{あb}\mathgt{あa}$ \end{itemize} \bf mathversion bold: {\mathversion{bold}$aあa\mathgt{あa}$}き\\ -二つ目の「あ」は\verb+\mathgt+下だが,明朝なのは本文書の設定通り. +二つ目の「あ」は\verb+\mathgt+下だが,明朝なのは本文書の設定通り.\\ +アルファベットがなぜか出ない(Lua\TeX-ja非読み込み時でも)が, +私の環境だけか? \LaTeX では数式ファミリ番号は欧文と共用→$\the\jfam$