summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luatexja
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-31 03:01:15 +0000
committerNorbert Preining <norbert@preining.info>2020-10-31 03:01:15 +0000
commit246102ab63f099b158dd29e1d911471223cdb207 (patch)
treee33e4a75a47907b343dba18936f7b4cf71bed7c3 /macros/luatex/generic/luatexja
parent2ad4e5bb3dc803f2c4fc3623bc0e367cd7f2c691 (diff)
CTAN sync 202010310301
Diffstat (limited to 'macros/luatex/generic/luatexja')
-rw-r--r--macros/luatex/generic/luatexja/README8
-rw-r--r--macros/luatex/generic/luatexja/doc/luatexja-en.pdfbin702554 -> 703072 bytes
-rw-r--r--macros/luatex/generic/luatexja/doc/luatexja-ja.pdfbin1137264 -> 1137731 bytes
-rw-r--r--macros/luatex/generic/luatexja/doc/luatexja-ruby.pdfbin353336 -> 375376 bytes
-rw-r--r--macros/luatex/generic/luatexja/doc/luatexja-ruby.tex373
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty4
-rw-r--r--macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty29
-rw-r--r--macros/luatex/generic/luatexja/src/jfm-ujis.lua13
-rw-r--r--macros/luatex/generic/luatexja/src/jfm-ujisv.lua11
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-jfmglue.lua31
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-latex.sty4
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-otf.lua4
-rw-r--r--macros/luatex/generic/luatexja/src/ltj-ruby.lua184
-rw-r--r--macros/luatex/generic/luatexja/src/luatexja.sty4
14 files changed, 399 insertions, 266 deletions
diff --git a/macros/luatex/generic/luatexja/README b/macros/luatex/generic/luatexja/README
index 7488d2f5d1..a4c1384466 100644
--- a/macros/luatex/generic/luatexja/README
+++ b/macros/luatex/generic/luatexja/README
@@ -1,4 +1,4 @@
-The LuaTeX-ja Package 20201005.0
+The LuaTeX-ja Package 20201030.0
--------------------------------
Copyright (c) 2011--2020 The LuaTeX-ja project
License: modified BSD (see COPYING)
@@ -45,9 +45,9 @@ Installation
2. If you must/want to install manually:
a. Download the source archive from CTAN,
- or tagged as 20201005.0 in the Git repository by
+ or tagged as 20201030.0 in the Git repository by
<http://git.osdn.jp/view?p=luatex-ja/luatexja.git
- ;a=snapshot;h=refs/tags/20201005.0;sf=tgz>
+ ;a=snapshot;h=refs/tags/20201030.0;sf=tgz>
b. Extract the archive and process following three files by LuaLaTeX
to generate classes for Japanese typesetting:
@@ -96,4 +96,4 @@ Notes
This file and ltj-kinsoku.lua are not used anymore.
(Do not remove ltj-kinsoku.tex.)
-Last commit date: Mon Oct 5 15:47:16 2020 +0900
+Last commit date: Fri Oct 30 14:32:37 2020 +0900
diff --git a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf
index 6b2043d2af..890021f98c 100644
--- a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf
+++ b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf
Binary files differ
diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf
index 8d19e491c8..41e9b9ba33 100644
--- a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf
+++ b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf
Binary files differ
diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf
index ade61a681c..0b436587ab 100644
--- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf
+++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf
Binary files differ
diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex
index f4a3614447..d135b02acc 100644
--- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex
+++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex
@@ -1,7 +1,8 @@
%#! lualatex
%%% a test of ruby.
-\documentclass[a4paper,10pt]{ltjsarticle}
+\documentclass[a4paper,10ptj]{ltjsarticle}
\usepackage[rgb]{xcolor}
+\usepackage{enumitem,mleftright}
\usepackage{luatexja-otf,amsmath,bxghost}
\usepackage[no-math]{fontspec}
\usepackage[match]{luatexja-fontspec}
@@ -47,6 +48,9 @@
\title{\textsf{luatexja-ruby}パッケージ}
\author{\LuaTeX-jaプロジェクトチーム}
\date{\texttt{\csname ver@luatexja-ruby.sty\endcsname}(\today)}
+\makeatletter
+\def\mybox#1{\unskip\ {\Large \fboxrule=0.1mm\fboxsep=0mm\fcolorbox{cyan}{white}{\hbox{\<\ltjjachar#1\<}}}\ }
+
\begin{document}
\catcode`\<=13
\def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}}
@@ -77,15 +81,30 @@ plain \LuaTeX でのロードはまだサポートしておらず,
\href{http://zrbabbler.sp.land.to/pxrubrica.html}{\textsf{pxrubrica}パッケージ}%
での用法に準ずる.
-\begin{quotation}
-進入あり:と\ltjruby{暁}{あかつき}の
-
-進入なし:{\setkeys[ltj]{ruby}{mode=0}と\ltjruby{暁}{あかつき}の}
+\begin{quote}
+ 進入あり:と\ltjruby{暁}{あかつき}の\\
+ 進入なし:と\ltjruby[mode=0]{暁}{あかつき}の\\
+ 突出あり:\ltjruby[stretch={1}{2}{1}]{聴衆}{ちようしゆう}\\
+ 突出なし:\ltjruby[stretch={0}{2}{0}]{聴衆}{ちようしゆう}
+\end{quote}
-突出あり:{\setkeys[ltj]{ruby}{stretch={1}{2}{1}}\ltjruby{聴衆}{ちようしゆう}}
+なお,本パッケージでは親文字と直前・直後の文字の間に0でない和文処理グルー
+\footnote{JFMで指定されたグルーや,標準の和文間空白(\Param{kanjiskip}),標準の和欧文間空白(\Param{xkanjiskip}).}%
+がくることも考慮しているため,「\emph{前後の文字への}\underline{進入(許容)量}」と「進入(許容)量」とは異なる可能性がある.
+この文書では次のように称する:
+\begin{description}
+ \item[\underline{文字進入量}] 前後の文字へルビ文字が実際にかかる長さ.常に下線を引くことにする.
+ \item[進入量] 前後の文字,およびそれとルビの間の和文処理グルーにかかる長さ
+\end{description}
+多くの場合,和文処理グルーは0以上の長さのため,進入量は\underline{文字進入量}以上である.
-突出なし:{\setkeys[ltj]{ruby}{stretch={0}{2}{0}}\ltjruby{聴衆}{ちようしゆう}}
-\end{quotation}
+例えば次の例では,直前の文字「来」への\underline{前文字進入量}は0であるが,
+前進入量は(和欧文間空白にかかる分まで含めるので)正である.
+\begin{quote}
+ \Large
+ 本来\ltjruby{foohoge}{\vrule ほげほげふがふが\vrule}においては……\\
+ 本来foohogeにおいては……
+\end{quote}
\subsection{\ruby{命|令}{めい|れい}}
\paragraph{\cs{ltjruby}}
@@ -93,71 +112,37 @@ plain \LuaTeX でのロードはまだサポートしておらず,
\begin{quote}
\ttfamily \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\}
\end{quote}
-のように使用する.
+のように親文字→ルビの順序で指定する.
第2・第3引数内の「\verb+|+」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照.
-<option>には以下の内容をkey-valueリストで指定可能である:
+\medskip
+<option>には以下の内容をkey-valueリストで指定可能である.
+<real>は10進の実数値を表す.<bool>は真偽値\texttt{true}(真)か\texttt{false}(偽)であり,
+値を省略したときには\texttt{true}の意味になる.
+
\begin{description}
\def\makelabel#1{\ttfamily\bfseries #1}
-\item[pre=<real>] 前進入許容量をルビ全角単位で指定.
+\item[pre=<real>] \underline{前文字進入許容量}をルビ全角単位で指定.
負の長さを指定した場合は,ルビの状況や直前の文字に応じた自動指定を意味する.
既定値は負(つまり,自動指定).
-\item[post=<real>] 同様に,後進入許容量を指定する.既定値は負(自動指定).
+\item[post=<real>] 同様に,\underline{後文字進入許容量}を指定する.既定値は負(自動指定).
\item[mode] 進入処理のモードを表すbit vector.下位2\,bitは,\texttt{pre}や
\texttt{post}が負である場合にしか効力を発揮しない.既定値は$(0001)_2 = 1$.
\begin{description}
- \item[bit 0] 進入を無効にするならば0,有効にするならば1.
+ \item[bit 0] 前後の\underline{文字への進入}を無効にするならば0,有効にするならば1.
\item[bit 1] 前進入許容量$B$と後進入許容量$A$が異なった場合,
-そのまま処理する場合は0,小さい方に揃えるならば1.
- \item[bit 2--3] ルビ文字の突出量$x$から実際の前進入量$b$,後進入量$a$の計算方法を指定する.
-親文字の文字数が$k+1$,親文字の前に入る空白量・間の空白量・後ろの空白量の比が$p:q:r$のとき,
-\begin{description}
- \item[00] $b=\min(B, xp/(p+kq+r))$, \ $a=\min(A, xr/(p+kq+r))$
- \item[01] $b=\min(B, x)$, \ $a=\min(A, \max(x-b,0))$
- \item[10] $a=\min(A, x)$, \ $b=\min(B, \max(x-a,0))$
- \item[11] $M=\min(B,A)$とおく.もし$x\le 2M$ならば$b=a=x/2$.そうでなければ
-\[
- b=\min\left(B, M + \frac{(x-2M)p}{p+kq+r}\right),\qquad
- a=\min\left(A, M + \frac{(x-2M)r}{p+kq+r}\right)
-\]
-\end{description}
-
- \typeout{AAAA}
-組み方の具体例を実際に示す.例示のため,平仮名にはルビが1字まで,「立」にはルビを
-0.5字分までかけてよいことにしている.
-\begin{description}
-\item[00]{\setkeys[ltj]{ruby}{mode=1}%
-\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
-は\ltjruby{美}{うつく}しい
- \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
-は\ltjruby{暁}{あかつき}立\quad
-は\ltjruby{聴衆}{ちようしゆう}立\par}
-\item[01]{\setkeys[ltj]{ruby}{mode=5}%
-\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
-は\ltjruby{美}{うつく}しい
- \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
-は\ltjruby{暁}{あかつき}立\quad
-は\ltjruby{聴衆}{ちようしゆう}立\par}
-\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
-は\ltjruby{暁}{あかつき}立\quad
-は\ltjruby{聴衆}{ちようしゆう}立\par}
-\item[11]{\setkeys[ltj]{ruby}{mode=13}%
-\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
-は\ltjruby{美}{うつく}しい\quad
-は\ltjruby{聴衆}{ちようしゆう}と\quad
-は\ltjruby{暁}{あかつき}立\quad
-は\ltjruby{聴衆}{ちようしゆう}立\par}
-\end{description}
-
+ そのまま処理する場合は0,小さい方に揃えるならば1.
+ \item[bit 2--3] ルビ文字の突出量から実際の前・後進入量の計算方法を指定する.
+ 詳しい計算方法については\ref{ssec:calc_intrusion}\nobreak 小節を参照.
\end{description}
+\item[intrude\_jfmgk=<bool>] 進入量算出の際に,前後のJFMグルーの自然長を考慮するか否か.既定値は真.
+\item[intrude\_kanjiskip=<bool>] 進入量算出の際に,ルビ前後に挿入される
+ 標準の和文間空白(\Param{kanjiskip})の自然長を
+ 考慮するか否か.既定値は真.
+\item[intrude\_xkanjiskip=<bool>] 進入量算出の際に,ルビ前後に挿入される
+ 標準の和欧文間空白(\Param{xkanjiskip})の自然長を考慮するか否か.既定値は真.
\item[stretchruby=\{<left>\}\{<middle>\}\{<right>\}] 親文字の合計長が
ルビ文字の合計長より長い時に,ルビ文字の前・間・後に入れる空白の割合であり,
それぞれ0--7の自然数で指定する.
@@ -177,9 +162,9 @@ plain \LuaTeX でのロードはまだサポートしておらず,
\item[後突出禁止] \verb+{1}{1}{0}+
\end{description}
-\item[stretchbol=\{<left>\}\{<middle>\}\{<right>\}] 行頭形〜.
+\item[stretchbol=\{<left>\}\{<middle>\}\{<right>\}] 行頭形に対する\texttt{stretch}と同様の指定.
既定値は\ \verb+{0}{1}{1}+ である.
-\item[stretcheol=\{<left>\}\{<middle>\}\{<right>\}] 行末形〜.
+\item[stretcheol=\{<left>\}\{<middle>\}\{<right>\}] 行末形に対する\texttt{stretch}と同様の指定.
既定値は\ \verb+{1}{1}{0}+ である.
\item[maxmargin=<real>] 親文字の方がルビより長い時に,ルビの先頭と親文字の先頭,及び
@@ -204,9 +189,9 @@ plain \LuaTeX でのロードはまだサポートしておらず,
\emph{縦組以外での}ルビの親文字の高さを全角高さの<real>倍と強制的に固定する.
負の値が指定された場合は「固定しない」(すなわち,v0.3より前の挙動と同じになる).
既定値は0.88.
-\item[tbaseheight=<real>] \texttt{ybaselineshift}と同様だが,こちらは\emph{縦組での}ルビの親文字の高さを指定する.
+\item[tbaseheight=<real>] \texttt{ybaseheight}と同様だが,こちらは\emph{縦組での}ルビの親文字の高さを指定する.
既定値は0.5.
-\item[baseheight=<real>] \texttt{ybaselineshift},\texttt{tbaselinesift}を同時に指定したことと同義.
+\item[baseheight=<real>] \texttt{ybaseheight},\texttt{tbaseheight}を同時に指定したことと同義.
\begin{LTXexample}[width=0.3\textwidth, preset=\Large]
\noindent
\ltjruby[baseheight=0.88]{本}{ほん}\
@@ -221,8 +206,9 @@ plain \LuaTeX でのロードはまだサポートしておらず,
-\item[kenten=<command>]各文字につく圏点の出力命令を指定する.既定値は「\verb+\ltjalchar`•+」
-であり,\texttt{U+2022} (Bullet)を\textbf{ALchar}として出力することを指定している.
+\item[kenten=<command>]各文字につく圏点の出力命令を指定する.
+ 既定値は「\verb+\ltjalchar`+\texttt{\ltjalchar`•}」であり,\texttt{U+2022}~(Bullet)を
+ \textbf{ALchar}として出力することを指定している.
\item[fontcmd=<command>]ルビ用のフォント切り替え命令を指定する.
このキーの内容が実行された後に\ \verb+\fontsize...\selectfont+\ が実行されるので,
@@ -240,7 +226,7 @@ plain \LuaTeX でのロードはまだサポートしておらず,
\medskip
次の2つは,以上で説明した複数のオプションを一度に設定するためのものである.
-普通はこの2つのうちいずれかを設定するだけで足りるだろう.
+普通はこの2\nobreak つのうちいずれかを設定するだけで足りるだろう.
\begin{description}
\def\makelabel#1{\ttfamily\bfseries #1}
@@ -262,37 +248,42 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
stretchruby={1}{2}{1}, stretch = {1}{2}{1},
stretchbol={0}{1}{1}, stretcheol={1}{1}{0},
maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
- kenten=\ltjalchar`•, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5
+ kenten=\ltjalchar`•, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
+ intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip
\end{verbatim}
\paragraph{\texttt{\textbackslash ltjsetparamater} に追加されるキー}
\begin{description}
\item[\Param{rubypreintrusion}\ttfamily =\{<chr\_code>, <pre\_int>\}]
-文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長をルビ全角単位で指定.
+ 文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長
+ (つまり,\underline{前文字進入許容量})をルビ全角単位で指定.
\item[\Param{rubypostintrusion}\ttfamily =\{<chr\_code>, <post\_int>\}]
-文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長をルビ全角単位で指定.
+ 文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長
+ (つまり,\underline{後文字進入許容量})をルビ全角単位で指定.
\end{description}
以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は1である:
-\makeatletter
-\def\mybox#1{{\fboxrule=0.1mm\fboxsep=0mm\fcolorbox{cyan}{white}{\hbox{\null\ltjjachar#1\null}}}}
\begin{quote}
ひらがな(\texttt{U+3040}--\texttt{U+309F}),カタカナ(\texttt{U+30A0}--\texttt{U+30FF}),
仮名補助など(\texttt{U+1B000}--\texttt{U+1B16F}),\\
- 中点類・分離禁止文字
- \@for\@tmp:=`\・,`\:,`\;,`\―,`\‥,`\…,`〳,`\〴,`\〵,"2014 \do{\mybox{\@tmp}}
+ 分離禁止文字
+ \@for\@tmp:=`\―,`\‥,`\…,`〳,`\〴,`\〵,"2014 \do{\mybox{\@tmp}}
+\end{quote}
+次に,以下の文字は\Param{rubypreintrusion},~\Param{rubypostintrusion}とも初期値は0.5である:
+\begin{quote}
+ 中点類\@for\@tmp:=`\・,`\:,`\; \do{\mybox{\@tmp}}
\end{quote}
-次に,以下の文字は\Param{rubypreintrusion}のみ初期値は1である:
+また,以下の文字は\Param{rubypreintrusion}のみ初期値は1である:
\begin{quote}
始め括弧類
- \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox{\@tmp}},
+ \@for\@tmp:=`\‘,`\“,`\〈,`\《,`\「,`\『,`\【,`\〔,`\〖,`\〘,`\〝,`\(,`\[,`\{,`\⦅ \do{\mybox{\@tmp}}\unskip,
「文字コード$-1$の文字
- \footnote{段落開始の\ \texttt{\textbackslash parindent}\ を表す.
+ \footnote{段落開始の\ \texttt{\textbackslash parindent}分インデントを表す.
通常の\LuaTeX-jaにおける指定では「文字コード$-1$」は文中数式境界を表していることに注意.}」
\end{quote}
-また,以下の文字は\Param{rubypostintrusion}のみ初期値は1である:
+さらに,以下の文字は\Param{rubypostintrusion}のみ初期値は1である:
\begin{quote}
閉じ括弧類
- \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox{\@tmp}},
+ \@for\@tmp:=`\’,`\”,`\〉,`\》,`\」,`\』,`\】,`\〕,`\〗,`\〙,`\〟,`\),`\],`\},`\⦆ \do{\mybox{\@tmp}}\unskip,
句読点類\@for\@tmp:=`\、,`\,,`\。,`\. \do{\mybox{\@tmp}}
\end{quote}
\makeatother
@@ -305,10 +296,11 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
\ttfamily\cs{ltjkenten}[<option>]\{親文字\}
\end{quote}
のように使用する.複数文字に圏点をつける場合でも,\verb+\ltjruby+ のように「\texttt{|}」を使って
-文字を区切る\textbf{必要はない}ことに注意してほしい.
+文字を区切る\textbf{必要はない}(\verb+\kenten+内では「\texttt{|}」は特別な意味を持たない)
+ことに注意してほしい.
-圏点として出力される文字は \texttt{kenten} キーによって指定し,
-圏点自身の大きさは(ルビと同様に)\texttt{size} キーで指定する.
+圏点として出力される文字は\texttt{kenten}キーによって指定し,
+圏点自身の大きさは(ルビと同様に)\texttt{size}キーで指定する.
\subsection{グループの\ruby{指|定}{し|てい}}
\label{ssec:grp}
@@ -362,25 +354,22 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
面倒でも手動で \texttt{pre}, \texttt{post} などを使って頑張って欲しい.
\item 実装方法の都合により,ルビの直前・直後・途中で2箇所以上の改行が起きる場合,例えば
\begin{center}
- \begin{tabular}{lll}
- \toprule
\Large …の\ltjruby[stretch=110]{表}{ひよう}
- \vrule\ltjruby[stretch=010]{現|力}{げん|りよく}\vrule&
+ \vrule\ltjruby[stretch=010]{現|力}{げん|りよく}\vrule\qquad
\Large \vrule\ltjruby[stretch=010]{表|現}{ひよう|げん}
- \vrule\ltjruby[stretch=011]{力}{りよく}は…&
-\Large \vrule\ltjruby[stretch=010]{表|現|力}{ひよう|げん|りよく}\vrule\\
-\bottomrule
- \end{tabular}
+ \vrule\ltjruby[stretch=011]{力}{りよく}は…\qquad
+\Large \vrule\ltjruby[stretch=010]{表|現|力}{ひよう|げん|りよく}\vrule
+
\end{center}
などの組み方は\emph{想定していない}.
+エラーが発生して止まることもあるし,エラーが発生しなくても正しく組まれない.
\end{itemize}
\section{\ruby{注|意|点}{ちゆう|い|てん}}
-\begin{description}
-\item[ルビ文字のはみ出し]
+\paragraph{前後からのルビ文字のはみ出し}
「日本語組版処理の要件」の図3.82のように,
-ルビ文字のはみ出しが繋がらないようにする処理について述べる.
+前後からのルビ文字のはみ出しが繋がらないようにする処理が組み込まれている.
例えば,
\begin{LTXexample}[preset=\Large,width=0.3\textwidth]
@@ -389,44 +378,42 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
\end{LTXexample}
において,1行目右側の「\ltjruby{陵}{みささぎ}」のルビが前の「と」にかかる量は次のように決まる:
\begin{enumerate}
-\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の後側進入量は前もって知ることはでき
+\item 1回目の実行では,行分割前に「\ltjruby{陵}{りよう}」の\underline{後文字進入量}は前もって知ることはでき
ない.なので,「\ltjruby{陵}{りよう}」は行中形で組まれるものとして
-「\ltjruby{陵}{みささぎ}」前側進入許容量は
+「\ltjruby{陵}{みささぎ}」前文字進入許容量は
\[
\underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}}
--\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの後側進入量(行中形)}}=0.25\,\mathrm{zw}
+-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(行中形)}}=0.25\,\mathrm{zw}
\]
-となる.行分割後,「\ltjruby{陵}{りよう}」の実際の後側進入量は
+となる.行分割後,「\ltjruby{陵}{りよう}」の実際の\underline{後文字進入量}は
<jobname>\texttt{.ltjruby}ファイルに記述される.
-\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の後側進入量
-を用いて,「\ltjruby{陵}{みささぎ}」前側進入許容量を次のように計算する:
+\item 2回目以降の実行では,<jobname>\texttt{.ltjruby}ファイルに保存された「\ltjruby{陵}{りよう}」の\underline{後文字進入量}
+を用いて,「\ltjruby{陵}{みささぎ}」の\underline{前文字進入許容量}を次のように計算する:
\[
\underbrace{0.5\,\mathrm{zw}}_{\text{元々の許容量}}
--\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの後側進入量 (from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}.
+-\underbrace{0.25\,\mathrm{zw}}_{\text{前のルビの\underline{後文字進入量}(from \texttt{.ltjruby})}}=0.25\,\mathrm{zw}.
\]
\end{enumerate}
<jobname>\texttt{.ltjruby}ファイルに保存する際,各 \verb+\ltjruby+ 命令の呼び出しを識別するキーが必要になるが,
そのキーとしては単純に「何個目の \verb+\ltjruby+ 命令か」である.
なお,以上の処理は,1行目と2行目を比較すれば分かるように,
-「\ltjruby{陵}{みささぎ}」の\emph{前進入許容量指定(\texttt{pre})が自動}になっている場合のみ
+「\ltjruby{陵}{みささぎ}」の\emph{\underline{前文字進入許容量}指定(\texttt{pre})が自動}になっている場合のみ
実施される.
-\item[段落末尾のルビ]
+\paragraph{段落末尾のルビ}
段落がルビで終わった場合,そのルビが行末形で組まれることはない.
これは,段落の「本当の」末尾には \verb+\penalty10000\parfillskip+ があるためで,
-ルビ処理用に作った最後のグルー(\ref{sec:impl}\nobreak 節の説明では$g_2$)が消去されないことによる.
+ルビ処理用に作った最後のグルー(\ref{ssec:impl}\nobreak 小節の説明では$g_2$)が消去されないことによる.
\verb+\parfillskip+ の長さ(や,場合によっては \verb+\rightskip+)を実測し,
それによって処理を変えるのも可能だが,そのようなことはしなかった.
段落がルビで終わることは普通ない(最低でも句点が続くだろう)と思うからである.
-
-
-\item[段落先頭のルビ]
+\paragraph{段落先頭のルビ}
同様に,段落先頭のルビは行頭形にはならない.
-\texttt{pre}が負(つまり,自動指定)のとき,段落最初の \verb+\parindent+ 部分への
-進入は可能である.\verb+\parindent+ 部分への進入許容量は
+\texttt{pre}が負(つまり,自動指定)のとき,段落最初の \verb+\parindent+ 分への
+進入は可能である.ここ\verb+\parindent+ 分のインデントへの\underline{進入許容量}は
「文字$-1$」に対する\Param{rubypreintrusion}(既定値は1,ルビ全角単位)と
\ \verb+\parindent+ の長さのうち小さい方である.
\begin{LTXexample}[preset=\Large,width=0.4\textwidth]
@@ -435,12 +422,137 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1}
\ltjruby{承}{うけたまわ}り……\par
\parindent0.25\zw\ltjruby{陵}{みささぎ}は……
\end{LTXexample}
-\end{description}
+
+\paragraph{和文処理グルーの伸縮}
+現バージョンでは,進入量調整に和文処理グルーを考慮させる,
+\begin{quote}
+\texttt{intrude\_jfmgk}, \texttt{intrude\_kanjiskip}, \texttt{intrude\_xkanjiskip}キー
+\end{quote}
+の値が\texttt{true}(真)で
+あった状況でも,考慮されるのは\emph{自然長の値のみ}である.そのため,行の調整処理が発生した場合は
+意図しない結果となる.
+
+例えば,標準設定での中黒「・」の直後のルビからの中黒への進入許容量は
+\begin{quote}
+ 中黒「・」への\underline{前進入許容量}はルビ全角の半分で,
+ 中黒本体の後の四分空きには進入可能
+\end{quote}
+となっている.そのため,下の例の1, 2行目ともルビの前進入量は0.5\,zwとなる.
+しかし,2行目では詰め量の0.5\,zwがほとんど中黒周囲の四分空きで負担されるため,
+実際には「中黒本体にほぼ0.5\,zwが進入する」という望ましくない結果が得られている.
+\begin{LTXexample}[preset=\Large,width=0.4\textwidth]
+\leavevmode\hbox{あ・\ltjruby{◆}{◆◆◆◆}漢字}\\
+\hbox spread-0.5\zw{あ・\ltjruby{◆}{◆◆◆◆}漢字}
+\end{LTXexample}
+
+また,次の例では2行目では前後の\underline{文字進入量}がルビ1字分と等しくなっているが,
+3行目のように1全角伸ばすという調整が行われた後は\underline{文字進入量}が不揃いになってしまっている.
+これはもともと「\texttt{;}」には後側にのみ和欧文間空白が入ることと,3行目ではこの和欧文間空白が
+伸びているためである.
+\begin{LTXexample}[preset=\Large,width=0.4\textwidth]
+\leavevmode\hbox{……に%
+ \ltjruby{\texttt{;}}{セミコロン}という……}\\
+\hbox spread\zw{……に%
+ \ltjruby{\texttt{;}}{セミコロン}という……}
+\end{LTXexample}
\newpage
\section{\ruby{実|装}{じつ|そう}について}
-\label{sec:impl}
-次の例で実装の大まかな方法を説明する.
+\subsection{進入量の計算}
+\label{ssec:calc_intrusion}
+ルビ文字を自然に組んだときの幅が親文字のそれより多い場合,
+ルビの前後への進入量は次のように決定される.
+\begin{enumerate}[label=\emph{Step~\arabic*},labelindent=0pt,itemindent=*,itemsep=\medskipamount]
+ \item \underline{前文字進入許容量}$B_0$,\underline{後進入文字許容量}$A_0$の算出.
+
+ ルビ全角の長さを$r$とする.
+ \begin{enumerate}
+ \item \texttt{pre}の指定値が非負であった場合は,それに$r$を掛けたものを$B_0$とする.\\
+ そうでなかった場合は,「ルビの直前の文字」に対する
+ \Param{rubypreintrusion}の値に$r$を掛けたものを$B_0$とする
+ \footnote{%
+ なお,「ルビの直前の文字」が段落最初の\cs{parindent}分のインデントであった場合,
+ $B_0$を,「文字コード$-1$の文字」\Param{rubypreintrusion}の値に$r$を掛けた値と\cs{parindent}のうち
+ 小さい方とする.
+ }.
+ \item \texttt{post}の指定値が非負であった場合は,それに$r$を掛けたものを$A_0$とする.\\
+ そうでなかった場合は,「ルビの直後の文字」に対する
+ \Param{rubypostintrusion}の値にルビ全角の値を掛けたものを$A_0$とする.
+ \item \texttt{mode}の最下位ビット(bit~0)が0であった場合は,$B_0\leftarrow 0$, $A\leftarrow 0$とする.
+ \item もし2つ前の文字がルビで,その直後(つまりいま処理しているルビから見れば直前)
+ の文字へ$a'$だけの進入があった場合,現在のルビについて$B_0←\min(0,B_0-a')$とする.
+ \end{enumerate}
+ \item 前進入許容量$B$,後進入許容量$A$の算出.
+ \begin{enumerate}
+ \item まず$B\leftarrow B_0$,\ \ $A\leftarrow A_0$とする.
+ \item ルビとその直前の文字の間に和文処理グルー$g$が挿入された場合,
+ \begin{itemize}
+ \item $g$がJFMグルーの場合は,\texttt{intrude\_jfmgk}が真の場合に,
+ \item $g$が標準の和文間空白(\Param{kanjiskip})の場合は,
+ \texttt{intrude\_kanjiskip}が真の場合に,
+ \item $g$が標準の和欧文間空白(\Param{xkanjiskip})の場合は,
+ \texttt{intrude\_xkanjiskip}が真の場合に,
+ \end{itemize}
+ それぞれ$g$の自然長を$B$に加算する.
+
+ ルビとその直後の文字との間に和文処理グルーが挿入された場合も同様である.
+
+ \item \texttt{mode}の2番目のビット(bit~1)が0であった場合は,$B$,~$A\leftarrow \min(B,A)$とする.
+ \end{enumerate}
+ \item 実際の前進入量$b$,後進入量$a$の計算.
+
+ ルビ文字の突出量を$x$,
+ 親文字の文字数を$k+1$,親文字の前に入る空白量・間の空白量・後ろの空白量の比を$p:q:r$とする.
+ このとき,\texttt{mode}のbit 2,~3の値によって$b$,~$a$を次のように算出する:
+\begin{description}[labelindent=\zw]
+ \item[00] $b=\min(B, xp/(p+kq+r))$, \ $a=\min(A, xr/(p+kq+r))$
+ \item[01] $b=\min(B, x)$, \ $a=\min(A, \max(x-b,0))$
+ \item[10] $a=\min(A, x)$, \ $b=\min(B, \max(x-a,0))$
+ \item[11] $M=\min(B,A)$とおく.もし$x\le 2M$ならば$b=a=x/2$.そうでなければ
+\[
+ b=\min\mleft(B, M + \frac{(x-2M)p}{p+kq+r}\mright),\qquad
+ a=\min\mleft(A, M + \frac{(x-2M)r}{p+kq+r}\mright).
+\]
+\end{description}
+
+組み方の具体例を実際に示す.例示のため,平仮名にはルビが1字まで,「立」にはルビを
+0.5字分までかけてよいことにしている.
+\begin{description}[labelindent=\zw]
+\item[00]{\setkeys[ltj]{ruby}{mode=1}%
+\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
+は\ltjruby{美}{うつく}しい
+ \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
+は\ltjruby{暁}{あかつき}立\quad
+は\ltjruby{峠}{とうげ}立\quad
+は\ltjruby{聴衆}{ちようしゆう}立\par}
+\item[01]{\setkeys[ltj]{ruby}{mode=5}%
+\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
+は\ltjruby{美}{うつく}しい
+ \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
+は\ltjruby{暁}{あかつき}立\quad
+は\ltjruby{峠}{とうげ}立\quad
+は\ltjruby{聴衆}{ちようしゆう}立\par}
+\item[10]{%
+\setkeys[ltj]{ruby}{mode=9}%
+\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
+は\ltjruby{美}{うつく}しい
+ \quad は\ltjruby{聴衆}{ちようしゆう}と\quad
+は\ltjruby{暁}{あかつき}立\quad
+は\ltjruby{峠}{とうげ}立\quad
+は\ltjruby{聴衆}{ちようしゆう}立\par}
+\item[11]{\setkeys[ltj]{ruby}{mode=13}%
+\ltjsetparameter{rubypreintrusion={`立,0.5}, rubypostintrusion={`立,0.5}}%
+は\ltjruby{美}{うつく}しい\quad
+は\ltjruby{聴衆}{ちようしゆう}と\quad
+は\ltjruby{暁}{あかつき}立\quad
+は\ltjruby{峠}{とうげ}立\quad
+は\ltjruby{聴衆}{ちようしゆう}立\par}
+\end{description}
+\end{enumerate}
+
+\subsection{ノードの扱い}
+\label{ssec:impl}
+次の例で内部実装の大まかな方法を説明する.
\begin{LTXexample}[preset=\Large]
……を\ltjruby{流|暢}{りゆう|ちよう}に……
\end{LTXexample}
@@ -534,7 +646,7 @@ $g_0\rightarrow W\rightarrow r_1\rightarrow g_2 \rightarrow r_2\rightarrow g_2$\
$g_i$,~$r_i$達の幅は,図\nobreak\ref{fig:node}に示したような対応に沿って算出する.
例えばこの場合,行中形$n_5$に対して
\[
- g_0+r_1+g_2+r_2+g_2 = 3\,\mathrm{zw}-(0.25\,\mathrm{zw}\times 2)=2.5\,\mathrm{zw}
+ g_0+r_1+g_2+r_2+g_2 = (3-0.25\times 2)\,\mathrm{zw}=2.5\,\mathrm{zw}
\]
という方程式が立つ(zwは親文字全角の幅,進入量込).
$n_1$から$n_5$まで計5本の方程式が立つが,これらはGau\ss の消去法で解くことができて
@@ -702,6 +814,24 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
\ruby[size=1]{Cogito ergo sum}{コギト・エルゴ・スム}% 欧文空白は伸長しない
\end{LTXexample}
+
+\typeout{AAAAAA}
+\setbox0=\vbox{\hsize20\zw
+ \ltjsetparameter{rubypreintrusion={`◆,1}}
+ \ltjsetparameter{rubypostintrusion={`◆,1}}
+ \def\TEST{\ruby{CD}{◆ンパクト・ディス◆}}
+ %\ltjsetparameter{xkanjiskip=.25\zw}
+ ◆◆◆\TEST ◆◆◆◆◆◆◆◆◆◆◆\TEST %
+ ◆◆◆◆◆◆\kern1\zw ◆◆◆◆◆◆◆◆◆\kern0.5\zw ◆◆◆◆◆◆◆◆◆◆◆◆◆◆\TEST ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
+
+ 値とは\ruby{\texttt{;}}{セミコロン}で区切\\
+ ◆\ruby{A}{◆}◆\\◆\ruby{A}{◆◆}◆\\◆\ruby{A}{◆◆◆}◆\\◆\ruby{A}{◆◆◆◆}◆\\%
+ ◆\ruby{A}{◆◆◆◆◆}◆\\◆\ruby{A}{◆◆◆◆◆◆}◆\\◆A◆
+
+ \makebox[10\zw][s]{値とは\ruby{\texttt{;}}{セミコロン}で区切}%
+}
+\fbox{\box0}
+
\newpage
\section{『日本語組版処理の要件』20120403の例}
@@ -715,7 +845,7 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
3.50 \ruby{人}{ひと}に\ruby{誨}{おし}えて\ruby{\倦}{う}まず
% モノルビ.面倒でも複数回の実行が必要
3.51 \ruby{鬼}{き}\ruby{門}{もん}の\ruby{方}{ほう}\ruby{角}{がく}を%
- \ruby{凝}{ぎょう}\ruby{視}{し}する
+ \ruby{凝}{ぎよう}\ruby{視}{し}する
% 熟語ルビ
3.52 \ruby{鬼|門}{き|もん}の\ruby{方|角}{ほう|がく}を\ruby{凝|視}{ぎよう|し}する
3.53 \ruby{茅場町}{かやばちよう}\quad\ruby{茅|場}{かや|ば}\ruby{町}{ちよう}
@@ -793,9 +923,9 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
% モノルビ配置.望ましくない
3.76× の\ruby{流}{りゆう}\ruby{儀}{ぎ}を\quad の\ruby{無}{む}\ruby{常}{じよう}を\quad%
-要調整 3.77\ {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず
- \hbox{\vrule\vbox{\hsize=10\zw ああああああああの%
- \ruby{流|儀}{りゆう|ぎ}がある.}\vrule}\textbf{←なぜ改行できない}\quad%
+3.77 {\ltjsetruby{stretchbol=121, stretcheol=121}% 行頭・行末揃えず
+ \hbox{\vrule\vbox{\hsize=10\zw\noindent\kern.75\zw
+ あああああああの\ruby{流|儀}{りゆう|ぎ}がある.}\vrule}\quad%
\hbox{\vrule\vbox{\hsize=5\zw ……等の\ruby{無|常}{む|じよう}を}\vrule}}
\end{LTXexample}
@@ -803,7 +933,6 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
\begin{LTXexample}[pos=t]
\obeylines
3.78 \ruby{人}{ひと}は\ruby{死}{し}して\ruby{名}{な}を\ruby{残}{のこ}す
-% 現在の自動設定の仕様では「脚」の前が四分だけ「要件」の例より空く
3.79 漢字の部首には\ruby{偏}{へん}・\ruby{冠}{かんむり}・\ruby{脚}{きやく}・%
\ruby{旁}{つくり}がある
3.79 漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby{脚}{きやく},%
@@ -811,11 +940,6 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
\end{LTXexample}
\begin{LTXexample}[pos=t]
\obeylines
-% もちろん手動で進入量を指定すれば話は別
-3.79 漢字の部首には\ruby{偏}{へん}・\ruby{冠}{かんむり}・\ruby[pre=1]{脚}{きやく}・%
- \ruby{旁}{つくり}がある
-3.79 漢字の部首には\ruby{偏}{へん},\ruby{冠}{かんむり},\ruby[pre=1]{脚}{きやく},%
- \ruby{旁}{つくり}がある
3.79 この\ruby{\噂}{うわさ}の好きな人は\ruby{懐}{ふところ}ぐあいもよく、\ruby{檜}{ひのき}を
3.80 漢字の部首には「\ruby{偏}{へん}」「\ruby{冠}{かんむり}」「\ruby{脚}{きやく}」%
「\ruby{旁}{つくり}」がある
@@ -823,8 +947,13 @@ $r_2$,~$g_2$を行Bから除去・メモリ解放し,代わりに$n_3$を行B
3.81× に\ruby{暁}{あかつき}の\kern-1\zw の\ruby{趣}{おもむき}を(良くない例)
3.82 に\ruby{暁}{あかつき}の\ruby{趣}{おもむき}を
-% 漢字にルビを2分まで掛けても良い流儀
+% 漢字・ひらがな・カタカナにルビを2分まで掛けても良い流儀
{%
+ \catcode`\<12%
+ \makeatletter\count@="3040\loop\relax\ifnum \count@<"30FF%
+ \ltjsetparameter{rubypreintrusion={\the\count@,0.5}, %
+ rubypostintrusion={\the\count@,0.5}}%
+ \advance\count@1 \repeat
\ltjsetparameter{rubypostintrusion={`好,0.5}}
\ltjsetparameter{rubypostintrusion={`具,0.5}}
\ltjsetparameter{rubypostintrusion={`材,0.5}}
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty
index ca187cc900..10c2cd8fde 100644
--- a/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-ajmacros.sty
@@ -68,7 +68,7 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-ajmacros}[2017/05/05]
+ \ProvidesPackage{luatexja-ajmacros}[2020-10-09]
\fi %</LaTeX>
%%------------------
@@ -435,7 +435,7 @@
\@tempcntb12054
\@aj@ligaturedef{医療法人}{学校法人}{共同組合}{協同組合}{合資会社}{合名会社}{社団法人}{宗教法人}{郵便番号}\@nil
\expandafter\gdef\csname ajLigオングストローム*\endcsname
- {\mbox{\kern.05zw\ajLig{オントロ}\kern-.1zw\ajLig{グスーム}\kern.05zw}}
+ {\mbox{\kern.05\zw\ajLig{オントロ}\kern-.1\zw\ajLig{グスーム}\kern.05\zw}}
\@tempcnta20929
\@tempcntb20943
\@aj@ligaturedef{ガル}{グレイ}{クローナ}{シーベルト}{シェケル}{ジュール}{デシベル}{ドット}{バイト}{ビット}{ベクレル}{ボー}{ランド}{リンギット}\@nil%AJ1-6
diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty
index 7c1a939e6d..149dd03de7 100644
--- a/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty
+++ b/macros/luatex/generic/luatexja/src/addons/luatexja-ruby.sty
@@ -4,7 +4,7 @@
% LaTeX only!
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{luatexja-ruby}[2020-10-05 v0.3]
+\ProvidesPackage{luatexja-ruby}[2020-10-30 v0.4]
\RequirePackage{luatexja}
%%------------------
@@ -73,8 +73,11 @@
\expandafter\def\csname ltj@@rubyip@ybaseheight\endcsname{#1}%
\expandafter\def\csname ltj@@rubyip@tbaseheight\endcsname{#1}%
}
-
%% これらの値が正のとき,親文字の高さをこの値(\zh 単位)とみなす
+\define@boolkey[ltj]{ruby}{intrude_jfmgk}[true]{}
+\define@boolkey[ltj]{ruby}{intrude_xkanjiskip}[true]{}
+\define@boolkey[ltj]{ruby}{intrude_kanjiskip}[true]{}
+
%%%%%%%% setkeys の別名
\protected\def\ltjsetruby{\setkeys[ltj]{ruby}}
@@ -91,8 +94,11 @@
%%%%%%%% 補助関数
% Lua ソースに渡す table 生成
-\def\ltj@@ruby@create@table#1{% #1: ルビ全角
+\bgroup
+\catcode`\_=11
+\gdef\ltj@@ruby@create@table#1{% #1: ルビ全角
\string{
+ before_jfmgk = 0, after_jfmgk = 0,
rubyzw = \ltj@safe@dimen{#1},
maxmargin = \ltj@safe@dimen{\ltj@@rubyip@maxmargin\zw},
pre = \ltj@safe@dimen{\ltj@@rubyip@pre#1},
@@ -108,8 +114,20 @@
+ 1048576 * \ifltj@ruby@rubysmash1\else0\fi),
baseheight = \ltj@safe@dimen{\ifnum\ltjgetparameter{direction}=3
\ltj@@rubyip@tbaseheight\else\ltj@@rubyip@ybaseheight\fi\zh},
+ intrude_jfmgk = \string{
+ \ifltj@ruby@intrude_jfmgk [luatexja.icflag_table.FROM_JFM]=true,\fi
+ \ifltj@ruby@intrude_kanjiskip
+ [luatexja.icflag_table.KANJI_SKIP]=true,
+ [luatexja.icflag_table.KANJI_SKIP_JFM]=true,
+ \fi
+ \ifltj@ruby@intrude_xkanjiskip
+ [luatexja.icflag_table.XKANJI_SKIP]=true,
+ [luatexja.icflag_table.XKANJI_SKIP_JFM]=true,
+ \fi
+ \string}
\string}
}
+\egroup
%%%
%%% 1098765432109876543210976543210
%%% |st_ruby|! |--| ← mode
@@ -213,7 +231,7 @@
{\ltjsetparameter{rubypostintrusion={\@tmp,1}}}
%% 中点類
\@for\@tmp:=`\・,`\:,`\;,`\―,`\‥,`\…,`〳,`\〴,`\〵,"2014 \do
- {\ltjsetparameter{rubypreintrusion={\@tmp,1},rubypostintrusion={\@tmp,1}}}
+ {\ltjsetparameter{rubypreintrusion={\@tmp,0.5},rubypostintrusion={\@tmp,0.5}}}
%% 読点・句点
\@for\@tmp:=`\、,`\,,`\。,`\. \do
{\ltjsetparameter{rubypostintrusion={\@tmp,1}}}
@@ -225,7 +243,8 @@
stretchruby={1}{2}{1}, stretch = {1}{2}{1},
stretchbol={0}{1}{1}, stretcheol={1}{1}{0},
maxmargin=0.5, size=0.5, intergap=0, rubysmash=false,
- kenten=\ltjalchar`•, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5
+ kenten=\ltjalchar`•, fontcmd=\relax, ybaseheight=0.88, tbaseheight=0.5,
+ intrude_jfmgk, intrude_kanjiskip, intrude_xkanjiskip
}
\endinput
diff --git a/macros/luatex/generic/luatexja/src/jfm-ujis.lua b/macros/luatex/generic/luatexja/src/jfm-ujis.lua
index 5df1986ea6..07c51b554f 100644
--- a/macros/luatex/generic/luatexja/src/jfm-ujis.lua
+++ b/macros/luatex/generic/luatexja/src/jfm-ujis.lua
@@ -6,7 +6,6 @@
-- kanjiskip: 0pt plus .25zw minus 0pt
-- xkanjiskip: .25zw plus .25zw (or .0833zw) minus .125zw
-
local t = {
version = 3,
dir = 'yoko',
@@ -332,11 +331,12 @@ local t = {
}
},
-
[99] = { -- box末尾
- chars = {'boxbdd', 'parbdd', 'glue'},
+ chars = {'boxbdd', 'glue'},
+ },
+ [199] = { -- box末尾
+ chars = {'parbdd'},
},
-
}
local ht = t[007].chars
@@ -357,4 +357,9 @@ for i,v in pairs(t) do
end
end
+local jf = luatexja.jfont.jfm_feature
+if jf and jf.beginpar_middledot_zw==true then
+ t[199].kern = { [3] = 0.25 }
+end
+
luatexja.jfont.define_jfm(t)
diff --git a/macros/luatex/generic/luatexja/src/jfm-ujisv.lua b/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
index b2044bde5a..62becb25a3 100644
--- a/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
+++ b/macros/luatex/generic/luatexja/src/jfm-ujisv.lua
@@ -6,7 +6,6 @@
-- kanjiskip: 0pt plus .25zw minus 0pt
-- xkanjiskip: .25zw plus .25zw (or .0833zw) minus .125zw
-
local t = {
version = 3,
dir = 'tate',
@@ -275,7 +274,10 @@ local t = {
},
[99] = { -- box末尾
- chars = {'boxbdd', 'parbdd', 'glue'},
+ chars = {'boxbdd', 'glue'},
+ },
+ [199] = { -- box末尾
+ chars = {'parbdd'},
},
}
@@ -305,4 +307,9 @@ for i,v in pairs(t) do
end
end
+local jf = luatexja.jfont.jfm_feature
+if jf and jf.beginpar_middledot_zw==true then
+ t[199].kern = { [3] = 0.25 }
+end
+
luatexja.jfont.define_jfm(t)
diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua
index e3cae86534..7775e4720d 100644
--- a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua
+++ b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua
@@ -3,7 +3,7 @@
--
luatexbase.provides_module({
name = 'luatexja.jfmglue',
- date = '2020-10-05',
+ date = '2020-10-22',
description = 'Insertion process of JFM glues, [x]kanjiskip and others',
})
luatexja.jfmglue = luatexja.jfmglue or {}
@@ -1220,27 +1220,10 @@ do
end
end
-local ensure_tex_attr = ltjb.ensure_tex_attr
-local function cleanup(mode, TEMP)
- -- luatexja.ext_show_node_list(to_node(head), '> ', print)
- -- adjust attr_icflag for avoiding error
- if tex.getattribute(attr_icflag)~=0 then ensure_tex_attr(attr_icflag, 0) end
- node_free(kanji_skip);
- node_free(xkanji_skip); node_free(TEMP)
-
- if mode then
- local h = node_next(head)
- if getid(h) == id_penalty and getfield(h, 'penalty') == 10000 then
- h = node_next(h)
- if getid(h) == id_glue and getsubtype(h) == 15 and not node_next(h) then
- return false
- end
- end
- end
- return head
-end
-------------------- 外部から呼ばれる関数
+local ensure_tex_attr = ltjb.ensure_tex_attr
+local tex_getattr = tex.getattribute
-- main interface
function luatexja.jfmglue.main(ahead, mode, dir)
if not ahead then return ahead end
@@ -1267,9 +1250,11 @@ function luatexja.jfmglue.main(ahead, mode, dir)
end
handle_list_tail(mode, last)
end
- --luatexja.ext_show_node_list(to_node(ahead ), '>A ', print)
- --print()
- return cleanup(mode, TEMP)
+ -- adjust attr_icflag for avoiding error
+ if tex_getattr(attr_icflag)~=0 then ensure_tex_attr(attr_icflag, 0) end
+ node_free(kanji_skip);
+ node_free(xkanji_skip); node_free(TEMP)
+ return head
end
end
diff --git a/macros/luatex/generic/luatexja/src/ltj-latex.sty b/macros/luatex/generic/luatexja/src/ltj-latex.sty
index 834f16e70a..506adea2e7 100644
--- a/macros/luatex/generic/luatexja/src/ltj-latex.sty
+++ b/macros/luatex/generic/luatexja/src/ltj-latex.sty
@@ -12,7 +12,7 @@
\def\luatexjalatexLoaded{\endinput}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ltj-latex}[2020-10-01 LaTeX support of LuaTeX-ja]
+\ProvidesPackage{ltj-latex}[2020-10-09 LaTeX support of LuaTeX-ja]
% cleanup at end of the document
%\let\ltj@@orig@end=\@@end
@@ -67,7 +67,7 @@
\def\ltj@pkgpatch#1{\@ifnextchar[{\ltj@pkgpatch@{#1}}{\ltj@pkgpatch@{#1}[lltjp-#1]}}%]
\ifltj@ltfilehook@avail
- \def\ltj@pkgpatch@@{\AddToHook{env/document/before}[luatexja.autopatch]}
+ \def\ltj@pkgpatch@@{\AddToHook{begindocument/before}[luatexja.autopatch]}
\else
\def\ltj@pkgpatch@@{\gpreto\@begindocumenthook}
\fi
diff --git a/macros/luatex/generic/luatexja/src/ltj-otf.lua b/macros/luatex/generic/luatexja/src/ltj-otf.lua
index 56c0154e34..42792769d7 100644
--- a/macros/luatex/generic/luatexja/src/ltj-otf.lua
+++ b/macros/luatex/generic/luatexja/src/ltj-otf.lua
@@ -191,13 +191,13 @@ ltjb.add_to_callback('pre_linebreak_filter', extract,'ltj.otf',
-- 和文フォント読み込み時に,ind -> unicode 対応をとっておく.
local function ind_to_uni(fmtable, fn)
if fn<0 then return end
- local cid = ltju.get_cidinfo(fn);
+ local cid = ltju.get_cidinfo(fn)
local t = ltjf_font_extra_info[fn]; t = t and t.ind_to_uni
if t and cid.ordering == "Japan1" then
for i, v in pairs(fmtable.chars) do
local j = string.match(i, "^AJ1%-([0-9]*)")
if j then
- j = t[i]
+ j = t[tonumber(j)]
if j then
fmtable.cid_char_type = fmtable.cid_char_type or {}
fmtable.cid_char_type[j] = v
diff --git a/macros/luatex/generic/luatexja/src/ltj-ruby.lua b/macros/luatex/generic/luatexja/src/ltj-ruby.lua
index e2cb40d925..685e19bb0b 100644
--- a/macros/luatex/generic/luatexja/src/ltj-ruby.lua
+++ b/macros/luatex/generic/luatexja/src/ltj-ruby.lua
@@ -3,7 +3,7 @@
--
luatexbase.provides_module({
name = 'luatexja.ruby',
- date = '2020-10-05',
+ date = '2020-10-30',
description = 'Ruby annotation',
})
luatexja.ruby = {}
@@ -43,14 +43,7 @@ local id_pbox_w = 258 -- cluster which consists of a whatsit
local attr_icflag = luatexbase.attributes['ltj@icflag']
-- ルビ処理用の attribute は他のやつの流用なので注意!
-- 進入許容量 (sp)
-local attr_ruby_maxprep = luatexbase.attributes['ltj@charclass']
-local attr_ruby_maxpostp = luatexbase.attributes['ltj@kcat0']
-local attr_ruby_maxmargin = luatexbase.attributes['ltj@kcat1']
-local attr_ruby_stretch = luatexbase.attributes['ltj@kcat2']
-local attr_ruby_mode = luatexbase.attributes['ltj@kcat3']
local attr_ruby_id = luatexbase.attributes['ltj@kcat4'] -- uniq id
-local attr_ruby_intergap = luatexbase.attributes['ltj@kcat5']
-local attr_ruby_baseheight= luatexbase.attributes['ltj@kcat6']
local attr_ruby = luatexbase.attributes['ltj@rubyattr']
-- ルビ内部処理用,以下のようにノードによって使われ方が異なる
-- * (whatsit) では JAglue 処理時に,
@@ -260,17 +253,9 @@ local function texiface_low(rst, rtlr, rtlp)
setfield(w, 'type', 110); setfield(w, 'user_id', RUBY_PRE)
local wv = node_new(id_whatsit, sid_user)
setfield(w, 'value', to_node(wv))
- setfield(wv, 'type', 100)
- setfield(wv, 'value', floor(#rtlr))
+ setfield(wv, 'type', 108)
+ setfield(wv, 'value', rst); rst.count = floor(#rtlr)
setfield(wv, 'user_id', RUBY_PRE) -- dummy
- set_attr(wv, attr_ruby, rst.rubyzw)
- set_attr(wv, attr_ruby_maxmargin, rst.maxmargin)
- set_attr(wv, attr_ruby_maxprep, rst.pre)
- set_attr(wv, attr_ruby_maxpostp, rst.post)
- set_attr(wv, attr_ruby_intergap, rst.intergap)
- set_attr(wv, attr_ruby_baseheight, rst.baseheight)
- set_attr(wv, attr_ruby_stretch, rst.stretch)
- set_attr(wv, attr_ruby_mode, rst.mode)
local n = wv
for i = 1, #rtlr do
_, n = insert_after(wv, n, rtlr[i])
@@ -314,13 +299,19 @@ end
----------------------------------------------------------------
-- r, p の中身のノードは再利用される
-local function enlarge_parent(r, p, tmp_tbl, intmode)
+local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
-- r: ルビ部分の格納された box,p: 同,親文字
local rwidth = getfield(r, 'width')
local sumprot = rwidth - getfield(p, 'width') -- >0
local pre_intrusion, post_intrusion
local ppre, pmid, ppost = tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost
local mapre, mapost = tmp_tbl.mapre, tmp_tbl.mapost
+ local intmode = floor(tmp_tbl.mode/4)%4
+ if no_begin then mapre = mapre + tmp_tbl.before_jfmgk end
+ if no_end then mapost = mapost + tmp_tbl.after_jfmgk end
+ if (tmp_tbl.mode%4 >=2) and (tmp.pre<0) and (tmp.post<0) then
+ mapre = min(mapre,mapost); mapost = mapre
+ end
if intmode == 0 then -- とりあえず組んでから決める
p = enlarge(p, rwidth, ppre, pmid, ppost, 0, 0)
pre_intrusion = min(mapre, round(ppre*getfield(p, 'glue_set')*65536))
@@ -350,25 +341,26 @@ local function enlarge_parent(r, p, tmp_tbl, intmode)
setfield(p, 'width', rwidth)
local ps = getlist(p)
setfield(ps, 'width', getfield(ps, 'width') - pre_intrusion)
- return r, p, post_intrusion
+ local orig_post_intrusion = post_intrusion
+ if no_end then orig_post_intrusion = max(orig_post_intrusion - tmp_tbl.after_jfmgk, 0) end
+ return r, p, orig_post_intrusion
end
-- ルビボックスの生成(単一グループ)
-- returned value: <new box>, <ruby width>, <post_intrusion>
local max_margin
-local function new_ruby_box(r, p, tmp_tbl)
+local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end)
local post_intrusion = 0
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(tmp_tbl.imode/0x100000); rsmash = (imode%2 ==1)
+ imode = floor(tmp_tbl.mode/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,
- floor(tmp_tbl.imode/4)%4)
+ r, p, post_intrusion = enlarge_parent(r, p, tmp_tbl, no_begin, no_end)
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
@@ -392,10 +384,10 @@ local function new_ruby_box(r, p, tmp_tbl)
end
local a, k = node_new(id_rule), node_new(id_kern, 1)
setfield(a, 'width', 0); setfield(a, 'height', 0)
- setfield(a, 'depth', 0); setfield(k, 'kern', tmp_tbl.rgap)
+ 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.bheight >= 0 then setfield(p, 'height', tmp_tbl.bheight) 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)
if rsmash or getfield(a, 'height')<getfield(p, 'height') then
@@ -416,10 +408,7 @@ local max_allow_pre, max_allow_post
-- 中付き熟語ルビ,cmp containers
-- 「文字の構成を考えた」やつはどうしよう
-local pre_low_cal_box
-do
-local tmp_tbl = {}
-pre_low_cal_box = function (w, cmp)
+local function pre_low_cal_box(w, cmp)
local rb = {}
local pb = {}
local kf = {}
@@ -427,17 +416,15 @@ pre_low_cal_box = function (w, cmp)
-- kf[cmp+i] : container i--cmp からなる行頭形
-- kf[2cmp+1] : 行中形
local wv = getfield(w, 'value')
+ local rst = getfield(wv, 'value')
local mdt -- nt*: node temp
local coef = {} -- 連立一次方程式の拡大係数行列
- local rtb = expand_3bits(has_attr(wv, attr_ruby_stretch))
- tmp_tbl.rgap = has_attr(wv, attr_ruby_intergap)
- tmp_tbl.imode = has_attr(wv, attr_ruby_mode)
- tmp_tbl.bheight = has_attr(wv, attr_ruby_baseheight)
+ local rtb = expand_3bits(rst.stretch)
-- node list 展開・行末形の計算
local nt, nta, ntb = wv, nil, nil -- nt*: node temp
- tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost = rtb[6], rtb[5], rtb[4]
- tmp_tbl.mapre, tmp_tbl.mapost = max_allow_pre, 0
+ rst.ppre, rst.pmid, rst.ppost = rtb[6], rtb[5], rtb[4]
+ rst.mapre, rst.mapost = max_allow_pre, 0
for i = 1, cmp do
nt = node_next(nt); rb[i] = nt; nta = concat(nta, node_copy(nt))
nt = node_next(nt); pb[i] = nt; ntb = concat(ntb, node_copy(nt))
@@ -445,31 +432,31 @@ pre_low_cal_box = function (w, cmp)
for j = 1, 2*i do coef[i][j] = 1 end
for j = 2*i+1, 2*cmp+1 do coef[i][j] = 0 end
kf[i], coef[i][2*cmp+2]
- = new_ruby_box(node_copy(nta), node_copy(ntb), tmp_tbl)
+ = new_ruby_box(node_copy(nta), node_copy(ntb), rst, true, false)
end
node_free(nta); node_free(ntb)
-- 行頭形の計算
local nta, ntb = nil, nil
- tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost = rtb[9], rtb[8], rtb[7]
- tmp_tbl.mapre, tmp_tbl.mapost = 0, max_allow_post
+ rst.ppre, rst.pmid, rst.ppost = rtb[9], rtb[8], rtb[7]
+ rst.mapre, rst.mapost = 0, max_allow_post
for i = cmp,1,-1 do
coef[cmp+i] = {}
for j = 1, 2*i-1 do coef[cmp+i][j] = 0 end
for j = 2*i, 2*cmp+1 do coef[cmp+i][j] = 1 end
nta = concat(node_copy(rb[i]), nta); ntb = concat(node_copy(pb[i]), ntb)
kf[cmp+i], coef[cmp+i][2*cmp+2]
- = new_ruby_box(node_copy(nta), node_copy(ntb), tmp_tbl)
+ = new_ruby_box(node_copy(nta), node_copy(ntb), rst, false, true)
end
-- ここで,nta, ntb には全 container を連結した box が入っているので
-- それを使って行中形を計算する.
coef[2*cmp+1] = {}
for j = 1, 2*cmp+1 do coef[2*cmp+1][j] = 1 end
- tmp_tbl.ppre, tmp_tbl.pmid, tmp_tbl.ppost = rtb[3], rtb[2], rtb[1]
- tmp_tbl.mapre, tmp_tbl.mapost = max_allow_pre, max_allow_post
+ rst.ppre, rst.pmid, rst.ppost = rtb[3], rtb[2], rtb[1]
+ rst.mapre, rst.mapost = max_allow_pre, max_allow_post
kf[2*cmp+1], coef[2*cmp+1][2*cmp+2], post_intrusion_backup
- = new_ruby_box(nta, ntb, tmp_tbl)
+ = new_ruby_box(nta, ntb, rst, true, true)
-- w.value の node list 更新.
local nt = wv
@@ -483,7 +470,6 @@ pre_low_cal_box = function (w, cmp)
end
return coef
end
-end
local first_whatsit
do
@@ -535,8 +521,9 @@ 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 nv = getfield(n, 'value')
- max_allow_pre = has_attr(nv, attr_ruby_maxprep) or 0
+ local nv = getfield(n, 'value')
+ local rst = getfield(nv, 'value')
+ max_allow_pre = rst.pre or 0
local atr = has_attr(n, attr_ruby) or 0
if max_allow_pre < 0 then
if atr>0 then
@@ -550,13 +537,12 @@ local function pre_high(ahead)
end
end
post_intrusion_backup = 0
- max_allow_post = has_attr(nv, attr_ruby_maxpostp) or 0
- max_margin = has_attr(nv, attr_ruby_maxmargin) or 0
- local coef = pre_low_cal_box(n, getfield(nv, 'value'))
+ max_allow_post = rst.post or 0
+ max_margin = rst.maxmargin or 0
+ local coef = pre_low_cal_box(n, rst.count)
local s = node_tail(nv) --ルビ文字
head, n = pre_low_app_node(
- head, n, getfield(nv, 'value'), coef,
- getfield(s, 'height'), getfield(s, 'depth')
+ head, n, rst.count, coef, getfield(s, 'height'), getfield(s, 'depth')
)
else
n = first_whatsit(node_next(n))
@@ -646,7 +632,7 @@ local function post_high_break(head)
rs[1], rw = ha, nil; ha = node_next(ha)
elseif i==2 then
rw = ha
- cmp = getfield(getfield(rw, 'value'), 'value')
+ cmp = getfield(getfield(rw, 'value'), 'value').count
local hb, hc = node_remove(getlist(h), rw)
setfield(h, 'head', hb); ha = hc
else -- i>=3
@@ -678,7 +664,7 @@ local function post_high_hbox(ahead)
rs[1], rw = ha, nil; ha = node_next(ha)
elseif i==2 then
rw = ha
- cmp = getfield(getfield(rw, 'value'), 'value')
+ cmp = getfield(getfield(rw, 'value'), 'value').count
head, ha = node_remove(head, rw)
else -- i >= 3
rs[#rs+1] = ha; ha = node_next(ha)
@@ -701,37 +687,38 @@ do
elseif getfield(lp, 'user_id') == RUBY_PRE then
Np.first, Np.nuc, Np.last = lp, lp, lp
local lpv = getfield(lp, 'value')
+ local rst = getfield(lpv, 'value')
local x = node_next(node_next(lpv))
Np.last_char = luatexja.jfmglue.check_box_high(Np, getlist(x), nil)
if Nq.id ~=id_pbox_w then
if type(Nq.char)=='number' then
-- Nq is a JAchar
- if has_attr(lpv, attr_ruby_maxprep) < 0 then -- auto
+ if rst.pre < 0 then -- auto
local p = round((ltjs.table_current_stack[RIPRE + Nq.char] or 0)
- *has_attr(lpv, attr_ruby))
- if has_attr(lpv, attr_ruby_mode)%2 == 0 then -- intrusion 無効
+ *rst.rubyzw)
+ if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
- set_attr(lpv, attr_ruby_maxprep, -p)
+ rst.pre = -p
end
if Nq.prev_ruby then
set_attr(lp, attr_ruby, Nq.prev_ruby)
end
- elseif has_attr(lpv, attr_ruby_maxprep) < 0 then -- auto
+ elseif rst.pre < 0 then -- auto
if Nq.char == 'parbdd' then
local p = round((ltjs.table_current_stack[RIPRE-1] or 0)
- *has_attr(lpv, attr_ruby))
+ *rst.rubyzw)
p = min(p, Nq.width)
- if has_attr(lpv, attr_ruby_mode)%2 == 0 then -- intrusion 無効
+ if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
- set_attr(lpv, attr_ruby_maxprep, p)
+ rst.pre = p
else
- set_attr(lpv, attr_ruby_maxprep, 0)
+ rst.pre = 0
end
end
- elseif has_attr(lpv, attr_ruby_maxprep) < 0 then -- auto
- set_attr(lpv, attr_ruby_maxprep, 0)
+ elseif rst.pre < 0 then -- auto
+ rst.pre = 0
end
return Np
else
@@ -743,6 +730,16 @@ do
end
do
+ local FROM_JFM = luatexja.icflag_table.FROM_JFM
+ local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP
+ local function add_gk(t, index, p)
+ local ic = get_attr_icflag(p)
+ if ic and (ic>FROM_JFM) and (ic<KANJI_SKIP) then ic = FROM_JFM end
+ if t.intrude_jfmgk[ic] then
+ if getid(p)==id_kern then t[index] = t[index] + getfield(p, 'kern')
+ else t[index] = t[index] + getfield(p, 'width') end
+ end
+ end
local RIPOST = luatexja.stack_table_index.RIPOST
local function whatsit_after_callback(s, Nq, Np)
if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then
@@ -752,44 +749,35 @@ do
insert_before(Nq.nuc, Np.first, last_glue)
Np.first = last_glue
next_cluster_array[Nq.nuc] = last_glue -- ルビ処理用のグルー
--- if Nq.gk then
--- if type(Nq.gk)=="table" then
--- for _,v in ipairs(Nq.gk) do luatexja.ext_show_node(node.direct.tonode(v), 'BBt> ', print) end
--- else luatexja.ext_show_node(node.direct.tonode(Nq.gk), 'BBB> ', print) end
--- end
end
local nqnv = getfield(Nq.nuc, 'value')
+ local rst = getfield(nqnv, 'value')
+ if Nq.gk then
+ if type(Nq.gk)=="table" then
+ for _,v in ipairs(Nq.gk) do add_gk(rst, 'before_jfmgk', v) end
+ else add_gk(rst, 'before_jfmgk', Nq.gk) end
+ end
local x = node_next(node_next(nqnv))
- for i = 2, getfield(nqnv, 'value') do x = node_next(node_next(x)) end
+ for i = 2, rst.count do x = node_next(node_next(x)) end
Nq.last_char = luatexja.jfmglue.check_box_high(Nq, getlist(x), nil)
luatexja.jfmglue.after_hlist(Nq)
if Np and Np.id ~=id_pbox_w and type(Np.char)=='number' then
-- Np is a JAchar
- local rm = has_attr(nqnv, attr_ruby_mode)
- if has_attr(nqnv, attr_ruby_maxpostp) < 0 then -- auto
+ if rst.post < 0 then -- auto
local p = round((ltjs.table_current_stack[RIPOST + Np.char] or 0)
- *has_attr(nqnv, attr_ruby))
- if rm%2 == 0 then -- intrusion 無効
+ *rst.rubyzw)
+ if rst.mode%2 == 0 then -- intrusion 無効
p = 0
end
- if rm%4 >= 2 then
- local q = has_attr(nqnv, attr_ruby_maxprep)
- if q < p then p = q
- elseif q > p then
- set_attr(nqnv, attr_ruby_maxprep, p)
- end
- end
- set_attr(nqnv, attr_ruby_maxpostp, p)
+ rst.post = p
end
Np.prev_ruby = has_attr(getfield(Nq.nuc, 'value'), attr_ruby_id)
-- 前のクラスタがルビであったことのフラグ
else -- 直前が文字以外
local nqnv = getfield(Nq.nuc, 'value')
- if has_attr(nqnv, attr_ruby_maxpostp) < 0 then -- auto
- set_attr(nqnv, attr_ruby_maxpostp, 0)
- if has_attr(nqnv, attr_ruby_mode)%4 >= 2 then
- set_attr(nqnv, attr_ruby_maxprep, 0)
- end
+ local rst = getfield(nqnv, 'value')
+ if rst.post < 0 then -- auto
+ rst.post = 0
end
end
return true
@@ -799,16 +787,16 @@ do
end
luatexbase.add_to_callback("luatexja.jfmglue.whatsit_after", whatsit_after_callback,
"luatexja.ruby.np_info_after", 1)
-end
-if false then -- いまは off
- local function w (s, Nq, Np)
- if Np.gk then
- if type(Np.gk)=="table" then
- for _,v in ipairs(Np.gk) do luatexja.ext_show_node(node.direct.tonode(v), 'AAt> ', print) end
- else luatexja.ext_show_node(node.direct.tonode(Np.gk), 'AAA> ', print) end
- end
- end
- luatexbase.add_to_callback("luatexja.jfmglue.whatsit_last_minute", w,
+ local function w (s, Nq, Np)
+ if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then
+ local rst = getfield(getfield(Nq.nuc, 'value'), 'value')
+ if Np.gk then
+ if type(Np.gk)=="table" then
+ for _,v in ipairs(Np.gk) do add_gk(rst, 'after_jfmgk', v) end
+ else add_gk(rst, 'after_jfmgk', Np.gk) end
+ end
+ end
+ end
+ luatexbase.add_to_callback("luatexja.jfmglue.whatsit_last_minute", w,
"luatexja.ruby.np_info_last_minute", 1)
end
-
diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty
index 74df9c779c..f70120dd1f 100644
--- a/macros/luatex/generic/luatexja/src/luatexja.sty
+++ b/macros/luatex/generic/luatexja/src/luatexja.sty
@@ -35,13 +35,13 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja}[2020-10-05 Japanese Typesetting with Lua(La)TeX]
+ \ProvidesPackage{luatexja}[2020-10-30 Japanese Typesetting with Lua(La)TeX]
\DeclareOption{disablejfam}{\ltj@disablejfamtrue}
\DeclareOption*{}
\ProcessOptions\relax
\fi %</LaTeX>
%%%% VERSION
-\def\LuaTeXjaversion{20201005.0}
+\def\LuaTeXjaversion{20201030.0}
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs