OSDN Git Service

Modified check_box function; sync with ptex-base_130104_math-spc_beta.diff
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 4 Jan 2013 02:10:51 +0000 (11:10 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 4 Jan 2013 02:10:51 +0000 (11:10 +0900)
cf. "数式の前後の四分アキ" in TeX forum
  (http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=913)

Note: \xkanjiskip around inline math formula can be controlled by
\ltjsetparameter{alxspmode={-1,...}} (not `\0) in LuaTeX-ja.

no_runtime/luatexja-kinsoku_make.tex
src/ltj-jfmglue.lua

index 8ae1973..dee63a3 100644 (file)
@@ -1,4 +1,4 @@
-%#!lualatex --shell-escape luatexja-kinsoku_make.tex
+%#!lualatex luatexja-kinsoku_make.tex
 \documentclass{article}
 \usepackage{luatexja}
 \makeatletter
@@ -8,8 +8,7 @@
  s = table.copy(luatexja.stack.charprop_stack_table[0])
  s[0].jwp, s[0].xsp = nil, nil
  s.kanjiskip = nil; s.xkanjiskip = nil
- table.tofile('ltj-kinsoku.out', s, 'return', false, true, false)
+ table.tofile('ltj-kinsoku.lua', s, 'return', false, true, false)
 \end{luacode}
-\immediate\write18{texluac -o ltj-kinsoku.lua ltj-kinsoku.out}
 \begin{document}
 \end{document}
\ No newline at end of file
index 0dc28f7..7f78741 100644 (file)
@@ -184,6 +184,11 @@ local function check_box(box_ptr, box_end)
               end
            end
         end
+      elseif pid==id_math then
+        if find_first_char then 
+           first_char = p; find_first_char = false
+        end
+        last_char = p; found_visible_node = true
       elseif not (pid==id_ins   or pid==id_mark
                  or pid==id_adjust or pid==id_whatsit
                  or pid==id_penalty) then
@@ -202,11 +207,16 @@ end
 function check_box_high(Nx, box_ptr, box_end)
    first_char = nil;  last_char = nil;  find_first_char = true
    if check_box(box_ptr, box_end) then
+      local first_char = first_char
       if first_char then
-         if first_char.font == (has_attr(first_char, attr_curjfnt) or -1) then 
-            set_np_xspc_jachar(Nx, first_char)
-         else
-            set_np_xspc_alchar(Nx, first_char.char,first_char, ligature_head)
+         if first_char.id==glyph_node then
+           if first_char.font == (has_attr(first_char, attr_curjfnt) or -1) then 
+              set_np_xspc_jachar(Nx, first_char)
+           else
+              set_np_xspc_alchar(Nx, first_char.char,first_char, ligature_head)
+           end
+        else -- math_node
+           set_np_xspc_alchar(Nx, -1,first_char)
          end
       end
    end
@@ -451,10 +461,14 @@ do
    function after_hlist(Nx)
       local s = Nx.last_char
       if s then
-        if s.font == (has_attr(s, attr_curjfnt) or -1) then 
-           set_np_xspc_jachar(Nx, s)
+        if s.id==glyph_node then
+           if s.font == (has_attr(s, attr_curjfnt) or -1) then 
+              set_np_xspc_jachar(Nx, s)
+           else
+              set_np_xspc_alchar(Nx, s.char, s, ligature_tail)
+           end
         else
-           set_np_xspc_alchar(Nx, s.char, s, ligature_tail)
+           set_np_xspc_alchar(Nx, -1, s)
         end
       else
         Nx.pre, Nx.met = nil, nil