autospacing and autoxspacing now use different attributes, as before.
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}插入,设定
\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}
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
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
-- 欧文文字のデータを取得
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 の情報取得メインルーチン
\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>
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')
-- 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
\ltjgetparameter{prebreakpenalty}{`(},
\ltjgetparameter{prebreakpenalty}{`)},
-\ltjetparameter{prebreakpenalty}{`あ}
+\ltjgetparameter{prebreakpenalty}{`あ}
\ltjgetparameter{postbreakpenalty}{`(},