OSDN Git Service

Fixed ticket #26398, and whatsits from LuaTeX-ja stack system and \inhibitglue are...
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 26 Sep 2011 09:21:50 +0000 (18:21 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 26 Sep 2011 09:21:50 +0000 (18:21 +0900)
src/lltjfont.sty
src/luatexja-core.lua
src/luatexja-core.sty
src/luatexja/jfmglue.lua
src/luatexja/stack.lua
test/test07-math.pdf
test/test07-math.tex

index e6713e5..da35c15 100644 (file)
 
 \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
index aab611c..8190708 100644 (file)
@@ -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) .. '+' 
index ecde410..8c68293 100644 (file)
 \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>
index 902d81c..b4962ff 100644 (file)
@@ -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
index ea23801..35d446f 100644 (file)
@@ -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
index 0ccf43f..dde7ccb 100644 (file)
Binary files a/test/test07-math.pdf and b/test/test07-math.pdf differ
index 5aae176..55dc9be 100644 (file)
@@ -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$