OSDN Git Service

partially reverted commit 79c1a4f5.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 14 Jul 2012 10:08:39 +0000 (19:08 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 14 Jul 2012 10:08:39 +0000 (19:08 +0900)
autospacing and autoxspacing now use different attributes, as before.

doc/luatexja.dtx
src/ltj-jfmglue.lua
src/luatexja-core.sty
src/luatexja.lua
test/test03-after.pdf
test/test03-after.tex

index 529ecf0..1580ac9 100644 (file)
@@ -2603,16 +2603,11 @@ One can use also numbers to specify these two parameters (see Subsection~\ref{ss
 If you want to enable/disable all insertions of \Param{kanjiskip} and
 \Param{xkanjiskip}, set \Param{autospacing} and \Param{autoxspacing}
 parameters to \texttt{true}/\texttt{false}, respectively.
-Note that if you sets one of the parameters 
-\Param{autospacing}~and~\Param{autoxspacing},
-the other parameter also will be set globally.
 %</en>
 %<*ja>
 もし全ての\Param{kanjiskip}と\Param{xkanjiskip}の挿入を有効化/無効化
 したければ,それぞれ\Param{autospacing}と\Param{autoxspacing}を
 \texttt{true}/\texttt{false}に設定すればよい.
-なお,\Param{autospacing}と\Param{autoxspacing}の片方をグローバルに設定した場合,
-他方のパラメタもグローバルに設定されることになる.
 %</ja>
 %<*zh>
 如果你想要启用/屏蔽所有的\Param{kanjiskip}和\Param{xkanjiskip}插入,设定
@@ -4659,10 +4654,18 @@ The amount of shifting the baseline of Japanese fonts in scaled point ($2^{-16}\
 
 \attr{ltj@autospc}
 %<*en>
-Whether the auto insertion of \Param{kanjiskip} and \Param{xkanjiskip} is allowed at the node.
+Whether the auto insertion of \Param{kanjiskip} is allowed at the node.
 %</en>
 %<*ja>
-そのノードで\Param{kanjiskip}や\Param{xkanjiskip}の自動挿入が許されるかどうか.
+そのノードで\Param{kanjiskip}の自動挿入が許されるかどうか.
+%</ja>
+
+\attr{ltj@autoxspc}
+%<*en>
+Whether the auto insertion of \Param{xkanjiskip} is allowed at the node.
+%</en>
+%<*ja>
+そのノードで\Param{xkanjiskip}の自動挿入が許されるかどうか.
 %</ja>
 
 \attr{ltj@icflag}
index d439ed0..e4562d9 100644 (file)
@@ -65,6 +65,7 @@ local attr_jchar_class = luatexbase.attributes['ltj@charclass']
 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
 local attr_icflag = luatexbase.attributes['ltj@icflag']
 local attr_autospc = luatexbase.attributes['ltj@autospc']
+local attr_autoxspc = luatexbase.attributes['ltj@autoxspc']
 local attr_uniqid = luatexbase.attributes['ltj@uniqid']
 local max_dimen = 1073741823
 
@@ -446,9 +447,8 @@ function set_np_xspc_jachar(Nx, x)
    y = ltjs.get_penalty_table('xsp', c, 3, box_stack_level)
    Nx.xspc_before = (y%2==1)
    Nx.xspc_after  = (y>=2)
-   y = has_attr(x, attr_autospc) or 0
-   Nx.auto_kspc = (y>=2)
-   Nx.auto_xspc = (y%2==1)
+   Nx.auto_kspc = (has_attr(x, attr_autospc)==1)
+   Nx.auto_xspc = (has_attr(x, attr_autoxspc)==1)
 end
 
 -- 欧文文字のデータを取得
@@ -475,7 +475,7 @@ function set_np_xspc_alchar(Nx, c,x, lig)
    local y = ltjs.get_penalty_table('xsp', c, 3, box_stack_level)
    Nx.xspc_before = (y%2==1)
    Nx.xspc_after  = (y>=2)
-   Nx.auto_xspc = (has_attr(x, attr_autospc)%2==1)
+   Nx.auto_xspc = (has_attr(x, attr_autoxspc)==1)
 end
 
 -- Np の情報取得メインルーチン
index 23d51e3..44445a5 100644 (file)
 \newluatexattribute\ltj@yablshift % attribute for \yabaselineshift
 \newluatexattribute\ltj@ykblshift % attribute for \ykbaselineshift
 \newluatexattribute\ltj@autospc   % attribute for autospacing
-\ltj@autospc=0
+\newluatexattribute\ltj@autoxspc  % attribute for autoxspacing
 \newluatexattribute\ltj@icflag    % attribute for italic correction
 
 %%%%%%%% Attributes for character ranges
     \ltj@safe@num@or{nil}{\ltj@temp},0,3)}}
 
 % autospacing = <bool> (default: true)
-%% \numexpr 3/2\relax yields 2, so we use \numexpr (2*3-1)/4\relax to get [3/2].
 \define@boolkey[ltj]{japaram}{autospacing}[true]{%
   \ifltj@japaram@autospacing
-    \directlua{luatexja.ext_print_global()}\ltj@autospc%
-      =\numexpr\ltj@autospc-((2*\the\ltj@autospc-1)/4)*2+2\relax
+    \directlua{luatexja.ext_print_global()}\ltj@autospc=1
   \else
-    \directlua{luatexja.ext_print_global()}\ltj@autospc%
-      =\numexpr\ltj@autospc-((2*\the\ltj@autospc-1)/4)*2\relax
+    \directlua{luatexja.ext_print_global()}\ltj@autospc=0
   \fi}
 
 % autoxspacing = <bool> (default: true)
 \define@boolkey[ltj]{japaram}{autoxspacing}[true]{%
   \ifltj@japaram@autoxspacing
-    \directlua{luatexja.ext_print_global()}\ltj@autospc%
-      =\numexpr((2*\the\ltj@autospc-1)/4)*2+1\relax
+    \directlua{luatexja.ext_print_global()}\ltj@autoxspc=1
   \else
-    \directlua{luatexja.ext_print_global()}\ltj@autospc%
-      =\numexpr((2*\the\ltj@autospc-1)/4)*2\relax
+    \directlua{luatexja.ext_print_global()}\ltj@autoxspc=0
   \fi}
 
 % [x]]kanjiskip = <dimen>
index 02cf1b8..bcbe4a9 100644 (file)
@@ -151,9 +151,9 @@ function luatexja.ext_get_parameter_unary(k)
    elseif k == 'jcharwidowpenalty' then
       tex.write(ltjs.get_penalty_table('jwp', 0, 0, tex.getcount('ltj@@stack')))
    elseif k == 'autospacing' then
-      tex.write(math.floor(tex.getattribute('ltj@autospc')/2))
+      tex.write(tex.getattribute('ltj@autospc'))
    elseif k == 'autoxspacing' then
-      tex.write(tex.getattribute('ltj@autospc')%2)
+      tex.write(tex.getattribute('ltj@autoxspc'))
    elseif k == 'differentjfm' then
       if luatexja.jfmglue.diffmet_rule == math.max then
         tex.write('large')
@@ -212,7 +212,7 @@ end
 
 -- EXT: print \global if necessary
 function luatexja.ext_print_global()
-  if isglobal=='global' then tex.sprint(cat_lp, '\\global') end
+   if luatexja.isglobal=='global' then tex.sprint(cat_lp, '\\global') end
 end
 
 -- main process
index c81a7de..c0f5f2b 100644 (file)
Binary files a/test/test03-after.pdf and b/test/test03-after.pdf differ
index 89f80bb..2c4eb77 100644 (file)
@@ -27,7 +27,7 @@
 
 \ltjgetparameter{prebreakpenalty}{`(},
 \ltjgetparameter{prebreakpenalty}{`)},
-\ltjetparameter{prebreakpenalty}{`あ}
+\ltjgetparameter{prebreakpenalty}{`あ}
 
 
 \ltjgetparameter{postbreakpenalty}{`(},