OSDN Git Service

luatexja-ruby: bugfix
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 4 Oct 2020 22:18:52 +0000 (07:18 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sun, 4 Oct 2020 22:18:52 +0000 (07:18 +0900)
doc/luatexja-ruby.tex
src/addons/luatexja-ruby.sty
src/ltj-ruby.lua

index 9ce9588..f0bd6c8 100644 (file)
@@ -42,6 +42,8 @@
   HaranoAjiMincho-Regular:extend=0.67;jfm=ujisc33}{}
 
 \title{\textsf{luatexja-ruby}パッケージ}
+\author{\LuaTeX-jaプロジェクトチーム}
+\date{\texttt{\csname ver@luatexja-ruby.sty\endcsname}(\today)}
 \begin{document}
 \catcode`\<=13
 \def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}}
@@ -116,6 +118,7 @@ plain \LuaTeX でのロードはまだサポートしておらず,
 \]
 \end{description}
 
+  \typeout{AAAA}
 組み方の具体例を実際に示す.例示のため,平仮名にはルビが1字まで,「立」にはルビを
 0.5字分までかけてよいことにしている.
 \begin{description}
@@ -131,7 +134,10 @@ plain \LuaTeX でのロードはまだサポートしておらず,
   \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
 は\ltjruby{暁}{あかつき}立\quad
 は\ltjruby{聴衆}{ちようしゆう}立\par}
-\item[10]{\setkeys[ltj]{ruby}{mode=9}%
+\item[10]{%
+  \typeout{MODE: \csname ltj@@rubyip@mode\endcsname.}%
+  \setkeys[ltj]{ruby}{mode=9}%
+  \typeout{MODE: \csname ltj@@rubyip@mode\endcsname.}%
 \ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
 は\ltjruby{美}{うつく}しい
   \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
@@ -363,15 +369,15 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
 -\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの後側進入量(行中形)}}=0.25\,\mathrm{zw}
 \]
 となる.行分割後,「\ltjruby{陵}{りよう}」の実際の後側進入量は
-auxファイルに記述される.
-\item 2回目以降の実行では,auxファイルに保存された「\ltjruby{陵}{りよう}」の後側進入量
+<jobname>\texttt{.ltjruby}ファイルに記述される.
+\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の後側進入量
 を用いて,「\ltjruby{陵}{みささぎ}」前側進入許容量を次のように計算する:
 \[
  \underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}}
--\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの後側進入量 (from aux)}}=0.25\,\mathrm{zw}.
+-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの後側進入量 (from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}.
 \]
 \end{enumerate}
-auxファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが,
+<jobname>\texttt{.ltjruby}ファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが,
 そのキーとしては単純に「何個目の \verb+\ltjruby+ 命令か」である.
 
 なお,以上の処理は,1行目と2行目を比較すれば分かるように,
index 03959b8..8d7a53a 100644 (file)
@@ -4,7 +4,7 @@
 
 % LaTeX only!
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-ruby}[2020-10-04 v0.3]
+\ProvidesPackage{luatexja-ruby}[2020-10-05 v0.3]
 \RequirePackage{luatexja}
 
 %%------------------
@@ -96,9 +96,9 @@
          + 512 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretcheol
          + \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretch,
       mode 
-        = 2097152 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretchruby
+        = (2097152 * \expandafter\ltj@@ruby@cts\ltj@@rubyip@stretchruby
           + \ltj@safe@num{\ltj@@rubyip@mode}
-          + 1048576 * \ifltj@ruby@rubysmash1\else0\fi,
+          + 1048576 * \ifltj@ruby@rubysmash1\else0\fi),
       baseheight = \ltj@safe@dimen{\ltj@@rubyip@baseheight\zh},
     \string}
 }
index d2d6ce0..532752a 100644 (file)
@@ -358,16 +358,17 @@ end
 local max_margin
 local function new_ruby_box(r, p, tmp_tbl)
    local post_intrusion = 0
-   local imode = tmp_tbl.imode
+   local imode
    local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost
    local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost
    local rpre, rmid, rpost, rsmash
-   imode = floor(imode/262144); rsmash = (imode%2 ==1)
+   imode = floor(tmp_tbl.imode/0x100000); rsmash = (imode%2 ==1)
    imode = floor(imode/2); rpost = imode%8;
    imode = (imode-rpost)/8;  rmid  = imode%8;
    imode = (imode-rmid)/8;   rpre  = imode%8
    if getfield(r, 'width') > getfield(p, 'width') then  -- change the width of p
-      r, p, post_intrusion  = enlarge_parent(r, p, tmp_tbl, imode%4)
+      r, p, post_intrusion  = enlarge_parent(r, p, tmp_tbl, 
+        floor(tmp_tbl.imode/4)%4)
    elseif getfield(r, 'width') < getfield(p, 'width') then -- change the width of r
       r = enlarge(r, getfield(p, 'width'), rpre, rmid, rpost, 0, 0)
       post_intrusion = 0
@@ -430,7 +431,7 @@ pre_low_cal_box = function (w, cmp)
    local coef = {} -- 連立一次方程式の拡大係数行列
    local rtb = expand_3bits(has_attr(wv, attr_ruby_stretch))
    tmp_tbl.rgap = has_attr(wv, attr_ruby_intergap)
-   tmp_tbl.imode = floor(has_attr(wv, attr_ruby_mode)/4)
+   tmp_tbl.imode = has_attr(wv, attr_ruby_mode)
    tmp_tbl.bheight = has_attr(wv, attr_ruby_baseheight)
 
    -- node list 展開・行末形の計算
@@ -560,7 +561,7 @@ local function pre_high(ahead)
    local n = first_whatsit(head)
    while n do
       if getsubtype(n) == sid_user and getfield(n, 'user_id') == RUBY_PRE then
-        local around_skip = get_around_skip(head, n) 
+--        local around_skip = get_around_skip(head, n) 
         local nv = getfield(n, 'value')
          max_allow_pre = has_attr(nv, attr_ruby_maxprep) or 0
          local atr = has_attr(n, attr_ruby) or 0