OSDN Git Service

fix #44916 by introducing "rubydepth" key.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 24 Jun 2022 23:21:13 +0000 (08:21 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Fri, 24 Jun 2022 23:21:13 +0000 (08:21 +0900)
src/addons/luatexja-ruby.sty
src/ltj-ruby.lua

index 8367feb..c8b452d 100644 (file)
   \expandafter\def\csname ltj@@rubyip@tbaseheight\endcsname{#1}%
 }
 %% これらの値が正のとき,親文字の高さをこの値(\zh 単位)とみなす
+
+\ltj@@rkeydef{yrubydepth} % 縦組以外 (yoko, utod, dtou)
+\ltj@@rkeydef{trubydepth} % 縦組
+\define@key[ltj]{ruby}{rubydepth}{%
+  \expandafter\def\csname ltj@@rubyip@yrubydepth\endcsname{#1}%
+  \expandafter\def\csname ltj@@rubyip@trubydepth\endcsname{#1}%
+}
+
 \define@boolkey[ltj]{ruby}{intrude_jfmgk}[true]{}
 \define@boolkey[ltj]{ruby}{intrude_xkanjiskip}[true]{}
 \define@boolkey[ltj]{ruby}{intrude_kanjiskip}[true]{}
           + 1048576 * \ifltj@ruby@rubysmash1\else0\fi),
       baseheight = \ltj@safe@dimen{\ifnum\ltjgetparameter{direction}=3
                      \ltj@@rubyip@tbaseheight\else\ltj@@rubyip@ybaseheight\fi\zh},
+      rubydepth = \ltj@safe@dimen{\ifnum\ltjgetparameter{direction}=3
+                     \ltj@@rubyip@trubydepth\else\ltj@@rubyip@yrubydepth\fi#1},
       intrude_jfmgk = \string{
        \ifltj@ruby@intrude_jfmgk [luatexja.icflag_table.FROM_JFM]=true,\fi
        \ifltj@ruby@intrude_kanjiskip
   stretchbol={0}{1}{1}, stretcheol={1}{1}{0},
   maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
   kenten=\textbullet, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
+  yrubydepth=-1, trubydepth=-1,
   intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip,
   epsilon=0.0001,
 }
index 320b730..865db05 100644 (file)
@@ -398,6 +398,7 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
    setfield(a, 'depth', 0); setfield(k, 'kern', tmp_tbl.intergap)
    insert_after(r, r, a); insert_after(r, a, k);
    insert_after(r, k, p); setfield(p, 'next', nil)
+   if tmp_tbl.rubydepth >= 0 then setfield(r, 'depth', tmp_tbl.rubydepth) end
    if tmp_tbl.baseheight >= 0 then setfield(p, 'height', tmp_tbl.baseheight) end
    a = node.direct.vpack(r); setfield(a, 'shift', 0)
    set_attr(a, attr_ruby, post_intrusion)