diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-02 20:22:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-02 20:22:38 +0000 |
commit | f07221583be9b4c98b5db2cb0008a92de954d799 (patch) | |
tree | 7b37a17d5650238fc1630f195f1bd8638eb8e66b /Master/texmf-dist | |
parent | 577f093e401f937931fdb0b38a6c9680ad542604 (diff) |
luatexja (2oct22)
git-svn-id: svn://tug.org/texlive/trunk@64587 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
69 files changed, 1722 insertions, 1564 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README index 6cca0c1099a..991944f078f 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/README +++ b/Master/texmf-dist/doc/luatex/luatexja/README @@ -1,4 +1,4 @@ -The LuaTeX-ja Package 20220810.0 +The LuaTeX-ja Package 20221002.0 -------------------------------- Copyright (c) 2011--2022 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -42,9 +42,9 @@ Installation 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20220810.0 in the Git repository by + or tagged as 20221002.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20220810.0;sf=tgz> + ;a=snapshot;h=refs/tags/20221002.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -93,4 +93,4 @@ Notes This file and ltj-kinsoku.lua are not used anymore. (Do not remove ltj-kinsoku.tex.) -Last commit date: Wed Aug 10 11:32:01 2022 +0900 +Last commit date: Sun Oct 2 18:14:22 2022 +0900 diff --git a/Master/texmf-dist/doc/luatex/luatexja/ltjclasses.pdf b/Master/texmf-dist/doc/luatex/luatexja/ltjclasses.pdf Binary files differindex f5fe3bec34c..a31ce7daa38 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/ltjclasses.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/ltjclasses.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf b/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf Binary files differindex 08d50b5018f..786e01afa5a 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf Binary files differindex 4ec7df20046..abf8ee00615 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf Binary files differindex 8742f56b0a4..557c8ec4339 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx index 58f2cc15bd1..864306f9167 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx @@ -225,9 +225,7 @@ vscmd=\IVSB } -\catcode`\<=13 -\def<#1>{{\normalfont\rmfamily\itshape$\langle$#1\/$\rangle$}} -\let\LARG=< +\def\meta#1{{\normalfont\rmfamily\itshape$\langle$#1\/$\rangle$}} \maketitle \tableofcontents @@ -1111,7 +1109,7 @@ By default, the following fonts are used for these two families. \LaTeX へのパッチを読み込まない. \texttt{disablejfam}のない状況では,以前と同様に和文文字を数式モード中に - 直に書くことができる(但し\autoref{para:jachar_in_math}ページの記述も参照). + 直に書くことができる(但し\pageref{para:jachar_in_math}ページの記述も参照). その際には明朝体(\texttt{mc})で出力される. %</ja> @@ -1333,13 +1331,13 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ \item \cs{fontfamily}, \cs{fontseries}, \cs{fontshape} は欧文・和文フォント両方の属性を変更しようとする. もちろん,それらを実際に反映させるには手動で \cs{selectfont} を実行する必要がある. - なお,\cs{fontshape\{<shape>\}}は常に欧文フォントのシェイプを設定するが, + なお,\cs{fontshape\{\meta{shape}\}}は常に欧文フォントのシェイプを設定するが, もしも現在の和文フォントファミリ・シリーズで要求されたシェイプが利用不能だった場合には,和文フォントのシェイプは変更しない. 詳細は\ref{ssec:nfsspat}節を参照すること. %</ja> %<*en> -\item \verb+\fontencoding{+<encoding>\verb+}+ changes the encoding of alphabetic fonts +\item \verb+\fontencoding{+\meta{encoding}\verb+}+ changes the encoding of alphabetic fonts or Japanese fonts depending on the argument. For example, \verb+\fontencoding{JY3}+ changes the encoding of Japanese fonts to \texttt{JY3}, and \verb+\fontencoding{T1}+ changes the encoding of @@ -1349,7 +1347,7 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ For the detail, see Subsection~\ref{ssec:nfsspat}. %</en> %<*ja> -\item ここで,\cs{fontencoding\{<encoding>\}}は,引数により和文側か欧文 +\item ここで,\cs{fontencoding\{\meta{encoding}\}}は,引数により和文側か欧文 側かのどちらかのエンコーディングを変更する.例えば, \verb+\fontencoding{JY3}+ は和文フォントのエンコーディングを \texttt{JY3}に変更し,\verb+\fontencoding{T1}+ は欧文フォント側を @@ -1469,7 +1467,7 @@ this chapter. For the method, please see Subsection~\ref{ssec:math}. To use the functionality of the \Pkg{fontspec} package to Japanese fonts, it is needed to load the \Pkg{luatexja-fontspec} package in the preamble, as follows: \begin{quote} -\ttfamily \textbackslash usepackage[<options>]\{luatexja-fontspec\} +\ttfamily \textbackslash usepackage[\meta{options}]\{luatexja-fontspec\} \end{quote} This \Pkg{luatexja-fontspec} package automatically loads \Pkg{luatexja} and \Pkg{fontspec} @@ -1485,7 +1483,7 @@ TrueType・OpenTypeフォントを容易に扱うためのパッケージであ \LuaTeX-ja上において,\Pkg{fontspec}パッケージと同様の機能を和文フォントに対しても用いる場 合は\Pkg{luatexja-fontspec}パッケージを読み込む: \begin{quote} -\ttfamily \textbackslash usepackage[<options>]\{luatexja-fontspec\} +\ttfamily \textbackslash usepackage[\meta{options}]\{luatexja-fontspec\} \end{quote} このパッケージは自動で\Pkg{luatexja}パッケージと\Pkg{fontspec}パッケージを読み込む. %</ja> @@ -1566,11 +1564,11 @@ If this option is specified, usual family-changing commands such as 欧文フォントだけでなく和文フォントも変更するようになる. %</ja> - \item[pass=<opts>] -%<en> \emph{(Obsoleted)}\ Specify options <opts> which will be passed to the \Pkg{fontspec} package. -%<ja> \Pkg{fontspec} パッケージに渡すオプション <opts> を指定する.本オプションは時代遅れである. + \item[pass=\meta{options}] +%<en> \emph{(Obsoleted)}\ Specify options \meta{options} which will be passed to the \Pkg{fontspec} package. +%<ja> \Pkg{fontspec} パッケージに渡すオプション \meta{options} を指定する.本オプションは時代遅れである. -\item[scale=<float>] +\item[scale=\meta{float}] %<*en> Override the ratio of the font size of Japanese fonts to that of alphabetic fonts. The default value is determined as follows: @@ -2439,56 +2437,58 @@ becuse a \emph{JAchar} is encapsulated by a horizontal box if needed. \paragraph{数式における挙動:\pTeX との違い} \textbf{ALchar}のベースラインを補正する\Param{yalbaselineshift}, \Param{talbaselineshift}パラメータは ほぼ\pTeX における \cs{ybaselineshift}, \cs{tbaselineshift} に対応しているものであるが, -数式中の挙動は異なっているので注意が必要である. -例えば,\autoref{tab:math_bsa}のように,数式中に明示的に現れた \cs{hbox},~\cs{vbox} は,横組において +数式中の挙動は異なっているので注意が必要である(\autoref{tab:math_bsa}参照). \begin{itemize} - \item 2015年以前の\pTeX では,ボックス全体が \cs{ybaselineshift} だとシフトされるので, - \autoref{tab:math_bsa}中の``い''のように,ボックス中の和文文字は - \ \cs{ybaselineshift} だけシフトされ,一方,``for all''のように, - ボックス内の欧文文字は2重にシフトされることになる. - \item 一方,\LuaTeX-jaではそのようなことはおこらず, - 数式中に明示的に現れた \cs{hbox},~\cs{vbox} はシフトしない.そのため, - \autoref{tab:math_bsa}中の``い''も``for all''も,それぞれ本文中に - 書かれたときと同じ上下位置に組まれる. - - なお,\TeX~Live~2016以降の\pTeX では改修がなされ,\LuaTeX-jaと - 近い挙動になるようにしているが,数式中に直に書かれた``あ''のベースラインについては - まだ違いが見られる. + \item バージョン20221002.0以降では, + \pTeX~4.0.0と同様に数式が\Param{yalbaselineshift}だけシフトされる. + + しかしそれでは数式中に直に書かれた\cs{hbox},~\cs{vbox}中の欧文には + \Param{yalbaselineshift}が二重に適用されることになるので, + 数式中に直に書かれた\cs{hbox},~\cs{vbox}には + \Param{yalbaselineshift}を打ち消す補正をしている. + + なお,\cs{vcenter}によるボックスにはこの「打ち消す補正」は行われないので注意. +\item \pTeX では数式のスタイルごとに「打ち消す補正」の割合を\cs{textbaselineshiftfactor}, + \cs{scriptbaselineshiftfactor}, \cs{scriptscriptbaselineshiftfactor}で + 指定できるようにしたが,\LuaTeX-jaでは2番の数式ファミリ(\cs{fam2})に使われているフォントの + 大きさから自動で計算する. + +\item 数式中に直に書かれた和文文字(\autoref{tab:math_bsa}中の``あ'')については + \pTeX と\LuaTeX-jaで違いが見られる. + \pTeX では,欧文文字と変わらず欧文ベースライン補正(\cs{ybaselineshift})がかかり, + また周囲に和欧文間空白(\cs{xkanjiskip})が入りうる. + その一方,\LuaTeX-jaでは「和文ベースライン補正(\Param{yjabaselineshift})がかかる」見た目に + なり,また周囲に和欧文間空白は入らない. \end{itemize} - -なお,バージョン20170401.0以降の\LuaTeX-jaでは,\cs{vcenter} によるボックスには -全体が\Param{yalbaselineshift}, \Param{talbaselineshift} パラメータが反映されるようにしている. -その方が結果が自然であることによる変更なのだが,結果的に\cs{vcenter} については\pTeX と同じ挙動となった. - \begin{table} \small\centering \caption{数式関係のベースライン補正($\Param{yalbaselineshift}=10\,\textrm{pt}$)} \label{tab:math_bsa} \newdimen\origbaselineskip \origbaselineskip=\baselineskip -\begin{tabular}{lp{30\zw}} +\begin{tabular}{lp{35\zw}} \toprule \emph{入力}&\vspace*{\dimexpr-\origbaselineskip-\smallskipamount} \begin{lstlisting} 数式abc: $あa\hbox{い}$, $\int_0^x t\,dt=x^2/2$, -$\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ +$\Phi\vdash F(x)\ \hbox{for all}\ x\in A$, +$\sqrt{A}-\underline{X}+\frac{あ3}{2あ}-\vcenter{\hbox{aお}}$ \end{lstlisting}\\ \noalign{\vskip-\origbaselineskip} \midrule -\emph{\pTeX~(--2015)}& -{\ltjsetparameter{yalbaselineshift=10pt}% -数式abc: $\lower10pt\hbox{あ}a\lower10pt\hbox{い}$, $\int_0^x t\,dt=x^2/2$, -$\Phi\vdash F(x)\ \lower10pt\hbox{for all}\ x\in A$ -\par}\\\noalign{\vskip-\origbaselineskip}\midrule -\emph{\pTeX~(2016--)}& +\emph{\pTeX~(p4.0.0)}& {\ltjsetparameter{yalbaselineshift=10pt}% -数式abc: $\lower10pt\hbox{あ}a\hbox{い}$, $\int_0^x t\,dt=x^2/2$, +\protected\def\>{\hskip\ltjgetparameter{xkanjiskip}} +数式abc: $\lower10pt\hbox{あ}\>a\hbox{い}$, $\int_0^x t\,dt=x^2/2$, $\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ +$\sqrt{A}-\underline{X} + +\frac{\lower10pt\hbox{\scalebox{0.7}{あ}}\>3}{2\>\lower10pt\hbox{\scalebox{0.7}{あ}}}-\vcenter{\hbox{aお}}$ \par}\\\noalign{\vskip-\origbaselineskip}\midrule \emph{\LuaTeX-ja}& {\ltjsetparameter{yalbaselineshift=10pt}% 数式abc: $あa\hbox{い}$, $\int_0^x t\,dt=x^2/2$, -$\Phi\vdash F(x)\ \hbox{for all}\ x\in A$ +$\Phi\vdash F(x)\ \hbox{for all}\ x\in A$, +$\sqrt{A}-\underline{X}+\frac{あ\>3}{2あ}-\vcenter{\hbox{aお}}$ \par}\\ \noalign{\vskip-\origbaselineskip} \bottomrule @@ -3157,9 +3157,9 @@ To access box dimensions \emph{with respect to current direction}, one have to use the following commands instead of \cs{wd} wtc. \begin{cslist} - \item[\cs{ltjgetwd}<num>\textrm{, }\cs{ltjgetht}<num>\textrm{, }% - \cs{ltjgetdp}<num>] -These commands return \emph{an internal dimension} of \cs{box<num>} with respect to + \item[\cs{ltjgetwd}\meta{num}\textrm{, }\cs{ltjgetht}\meta{num}\textrm{, }% + \cs{ltjgetdp}\meta{num}] +These commands return \emph{an internal dimension} of \cs{box\meta{num}} with respect to the current direction. One can use these in \cs{dimexpr} primitive, as the followings. \begin{lstlisting} \dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701 @@ -3180,10 +3180,10 @@ The following is an example. \the\ltjgetht32767, \\ \the\ltjgetdp32767.} \end{LTXexample} - \item[\cs{ltjsetwd}<num>=<dimen>\textrm{, }\cs{ltjsetht}<num>=<dimen>\textrm{, }% - \cs{ltjsetdp}<num>=<dimen>] -These commands set the dimension of \cs{box<num>}. One does not need - to group the argument <num>; four calls of \cs{ltjsetwd} below have the same meaning. + \item[\cs{ltjsetwd}\meta{num}=\meta{dimen}\textrm{, }\cs{ltjsetht}\meta{num}=\meta{dimen}\textrm{, }% + \cs{ltjsetdp}\meta{num}=\meta{dimen}] +These commands set the dimension of \cs{box\meta{num}}. One does not need + to group the argument \meta{num}; four calls of \cs{ltjsetwd} below have the same meaning. \begin{lstlisting} \ltjsetwd42 20pt, \ltjsetwd42=20pt, \ltjsetwd=42 20pt, \ltjsetwd=42=20pt \end{lstlisting} @@ -3192,7 +3192,7 @@ These commands set the dimension of \cs{box<num>}. One does not need %</en> %<*ja> \paragraph{\cs{wd} 達と組方向} -ボックスレジスタ \cs{box}<num> にセットされているボックスの幅・高さ・深さの取得や +ボックスレジスタ \cs{box}\meta{num} にセットされているボックスの幅・高さ・深さの取得や 変更にはそれぞれ \cs{wd},~\cs{ht},~\cs{dp} プリミティブを用いるのであった. \pTeX ではこれらのプリミティブは,「現在の組方向におけるボックスの寸法」を指すもので, 同じボックスに対しても現在の組方向によって返る値は異なるものであった. @@ -3214,13 +3214,13 @@ These commands set the dimension of \cs{box<num>}. One does not need \begin{cslist} - \item[\cs{ltjgetwd}<num>\textrm{, }\cs{ltjgetht}<num>\textrm{, }% - \cs{ltjgetdp}<num>] + \item[\cs{ltjgetwd}\meta{num}\textrm{, }\cs{ltjgetht}\meta{num}\textrm{, }% + \cs{ltjgetdp}\meta{num}] 現在の組方向に応じたボックスの寸法の取得を行う.結果は内部長さであるため, \begin{lstlisting} \dimexpr 2\ltjgetwd42-3pt\relax, \the\ltjgetwd1701 \end{lstlisting} -のように \cs{wd}<num> の代わりとして扱うことができる. +のように \cs{wd}\meta{num} の代わりとして扱うことができる. 使用例は以下の通りである. \begin{LTXexample}[width=0.3\textwidth] \parindent0pt @@ -3237,8 +3237,8 @@ These commands set the dimension of \cs{box<num>}. One does not need \the\ltjgetht32767, \\ \the\ltjgetdp32767.} \end{LTXexample} - \item[\cs{ltjsetwd}<num>=<dimen>\textrm{, }\cs{ltjsetht}<num>=<dimen>\textrm{, }% - \cs{ltjsetdp}<num>=<dimen>] + \item[\cs{ltjsetwd}\meta{num}=\meta{dimen}\textrm{, }\cs{ltjsetht}\meta{num}=\meta{dimen}\textrm{, }% + \cs{ltjsetdp}\meta{num}=\meta{dimen}] 現在の組方向に応じたボックスの寸法の設定を行う.\cs{afterassignment} を2回利用して 実装しているので,次の4通りは全て同じ意味である. \begin{lstlisting} @@ -3255,8 +3255,8 @@ These commands set the dimension of \cs{box<num>}. One does not need %<*en> \subsection{Getting current direction} The \Param{direction} parameter returns the current direction, and -the \Param{boxdir} parameter (with the argument <num>) -returns the direction of a box register \cs{box}<num>. +the \Param{boxdir} parameter (with the argument \meta{num}) +returns the direction of a box register \cs{box}\meta{num}. The returned value of these parameters are a \emph{string}: \begin{center} \small @@ -3279,15 +3279,15 @@ Returned value&\texttt{4}&\texttt{3}&\texttt{1}&\texttt{11}&\texttt{0}\\ %</en> %<*ja> \subsection{組方向の取得} -「現在の組方向」や「<num>番のボックスの組方向」は, -\pTeX では \cs{ifydir} や \cs{ifybox}<num> といった条件判断文を使って +「現在の組方向」や「\meta{num}番のボックスの組方向」は, +\pTeX では \cs{ifydir} や \cs{ifybox}\meta{num} といった条件判断文を使って 判断することができた. しかし,\LuaTeX-jaはあくまでも\TeX マクロとLuaコードで 記述されており,それでは新たな条件判断命令を作るのは難しい. \LuaTeX-jaでは,\Param{direction}パラメータで現在の組方向を, -\Param{boxdir}パラメータ(と追加の引数<num>)によって -\cs{box}<num>の組方向をそれぞれ取得できるようにした. +\Param{boxdir}パラメータ(と追加の引数\meta{num})によって +\cs{box}\meta{num}の組方向をそれぞれ取得できるようにした. 戻り値は文字列である: \begin{center} \small @@ -3330,18 +3330,18 @@ The following primitives are redefined by \LuaTeX-ja (using~\verb+\protected\def for supporting Japanese typesetting and multiple directions: \begin{cslist}[style=standard] \item[\cs{/}] - \item[\cs{unhbox}<num>\textrm{, }\cs{unvbox}<num>\textrm{, }\cs{unhcopy}<num>\textrm{, }\cs{unvcopy}<num>] - \item[\cs{vadjust}\{<material>\}] - \item[\cs{insert}<number>\{<material>\}] + \item[\cs{unhbox}\meta{num}\textrm{, }\cs{unvbox}\meta{num}\textrm{, }\cs{unhcopy}\meta{num}\textrm{, }\cs{unvcopy}\meta{num}] + \item[\cs{vadjust}\{\meta{material}\}] + \item[\cs{insert}\meta{number}\{\meta{material}\}] \item[\cs{lastbox}] - \item[\cs{raise}<dimen><box>\textrm{, }\cs{lower}<dimen><box>\textrm{, } - \cs{moveleft}<dimen><box>\textrm{, }\cs{moveright}<dimen><box>\textrm{, }] - \item[\cs{split}<number>to<dimen>\textrm{, }\cs{vcenter}\{<material>\}] + \item[\cs{raise}\meta{dimen}\meta{box}\textrm{, }\cs{lower}\meta{dimen}\meta{box}\textrm{, } + \cs{moveleft}\meta{dimen}\meta{box}\textrm{, }\cs{moveright}\meta{dimen}\meta{box}\textrm{, }] + \item[\cs{split}\meta{number}to\meta{dimen}\textrm{, }\cs{vcenter}\{\meta{material}\}] \end{cslist} -On each primitive \cs{<primitive>} in the list above, -its meaning just before loading \LuaTeX-ja is backed up into \cs{ltj@@orig@<primitive>}, -and the meaning after redefinition by \LuaTeX-ja is stored in \cs{ltj@@<primitive>}. +On each primitive \cs{\meta{primitive}} in the list above, +its meaning just before loading \LuaTeX-ja is backed up into \cs{ltj@@orig@\meta{primitive}}, +and the meaning after redefinition by \LuaTeX-ja is stored in \cs{ltj@@\meta{primitive}}. For example, \autoref{fig:primitive_meaning} shows the situation of \cs{vadjust} primitive. %</en> %<*ja> @@ -3352,29 +3352,29 @@ For example, \autoref{fig:primitive_meaning} shows the situation of \cs{vadjust} \begin{cslist} \item[\cs{/}] 和文フォントに対するイタリック補正のサポートが追加されている. - \item[\cs{unhbox}<number>\textrm{, }\cs{unvbox}<number>\textrm{, }\cs{unhcopy}<number>\textrm{, }\cs{unvcopy}<number>] + \item[\cs{unhbox}\meta{number}\textrm{, }\cs{unvbox}\meta{number}\textrm{, }\cs{unhcopy}\meta{number}\textrm{, }\cs{unvcopy}\meta{number}] ボックスの組方向が現在のリストと異なる場合は事前にエラーメッセージを出力する. \pTeX と異なり,エラーを無視して無理矢理 \cs{unhbox}, \cs{unvbox} 等を 続行させることもできるが,その場合の組版結果は保証しない. - \item[\cs{vadjust}\{<material>\}] 一旦プリミティブ本来の挙動を行う.その後,<material>の組方向が + \item[\cs{vadjust}\{\meta{material}\}] 一旦プリミティブ本来の挙動を行う.その後,\meta{material}の組方向が 周囲の垂直リストの組方向と一致しない場合にエラーを出力し, 該当の \cs{vadjust} を無効にする. - \item[\cs{insert}<number>\{<material>\}] - 一旦プリミティブ本来の挙動を行い,その後<material>内の各ボックス・罫線の直前に組方向を示 + \item[\cs{insert}\meta{number}\{\meta{material}\}] + 一旦プリミティブ本来の挙動を行い,その後\meta{material}内の各ボックス・罫線の直前に組方向を示 すdirection whatsitを挿入する. \item[\cs{lastbox}] ボックスの「中身」を現在の組方向に合わせるためのノード (\textit{dir\_box}という)を必要ならば除去し, 正しく「中身」のボックスが返されるように前処理をする. - \item[\cs{raise}<dimen><box>\textrm{, }\cs{lower}<dimen><box>\textrm{, } - \cs{moveleft}<dimen><box>\textrm{, }\cs{moveright}<dimen><box>\textrm{, }] + \item[\cs{raise}\meta{dimen}\meta{box}\textrm{, }\cs{lower}\meta{dimen}\meta{box}\textrm{, } + \cs{moveleft}\meta{dimen}\meta{box}\textrm{, }\cs{moveright}\meta{dimen}\meta{box}\textrm{, }] \leavevmode\vspace{-\baselineskip} - \item[\cs{split}<number>to<dimen>\textrm{, }\cs{vcenter}\{<material>\}] + \item[\cs{split}\meta{number}to\meta{dimen}\textrm{, }\cs{vcenter}\{\meta{material}\}] これらのプリミティブについては必要に応じて\textit{dir\_box}を作成する前処理を追加している. \end{cslist} -上記の一覧中にあるプリミティブ\cs{<primitive>}については, -\LuaTeX-ja読み込み前の意味が\cs{ltj@@orig@<primitive>}に, -そして\LuaTeX-jaによる再定義後の意味が\cs{ltj@@<primitive>}に保存される. +上記の一覧中にあるプリミティブ\cs{\meta{primitive}}については, +\LuaTeX-ja読み込み前の意味が\cs{ltj@@orig@\meta{primitive}}に, +そして\LuaTeX-jaによる再定義後の意味が\cs{ltj@@\meta{primitive}}に保存される. 例えば,\cs{vadjust}については\autoref{fig:primitive_meaning}のようになっている. %</ja> \begin{figure} @@ -3487,13 +3487,13 @@ Note that the defined control sequence \textit{font\_def} token, but a macro. Hence the input like \verb+\fontname\tradmc+ causes a error. We denote control sequences which are defined in -\cs{jfont} by <jfont\_cs>. +\cs{jfont} by \meta{jfont\_cs}. %</en> %<*ja> なお,\cs{jfont} で定義された制御綴(上の例だと \cs{tradmc}) は\textit{font\_def}トークンではなくマクロである.従って,\verb+\fontname\tradmc+のような 入力はエラーとなる.以下では \cs{jfont} で定義された -制御綴を<jfont\_cs>で表す. +制御綴を\meta{jfont\_cs}で表す. %</ja> %<en>\paragraph{Specifying JFM} @@ -3501,8 +3501,8 @@ causes a error. We denote control sequences which are defined in %<en> The general scheme for specifying a JFM is the following: %<ja> JFMの一般的な指定は次のようになっている: \begin{quote} - \cs{jfont}<jfont\_cs>\texttt{=...;jfm=}<JFM name>[\texttt{/\{}<JFM features>\texttt{\}}]% - \texttt{;...;}[\texttt{jfmvar=}<identifier>]\texttt{;...} + \cs{jfont}\meta{jfont\_cs}\texttt{=...;jfm=}\meta{JFM name}[\texttt{/\{}\meta{JFM features}\texttt{\}}]% + \texttt{;...;}[\texttt{jfmvar=}\meta{identifier}]\texttt{;...} \end{quote} \begin{figure} @@ -3525,21 +3525,21 @@ causes a error. We denote control sequences which are defined in %<*en> \begin{description} -\item[<JFM name>] - The name of a (horizontal) JFM. \LuaTeX-ja searches and loads \texttt{jfm-<JFM name>.lua}. -\item[<JFM features>] +\item[\meta{JFM name}] + The name of a (horizontal) JFM. \LuaTeX-ja searches and loads \texttt{jfm-\meta{JFM name}.lua}. +\item[\meta{JFM features}] An optional comma-separated list of JFM options. Enclosing braces (\verb+{}+) are optional, but this does not escape any characters. The contents of this list can be accessed by a table \texttt{luatexja.jfont.jfm\_feature} from a JFM, at its loading. See \autoref{fig:jfmfeat} for an example. Note that any JFM files which is shipped with \LuaTeX-ja does not use this feature. -\item[<identifier>] +\item[\meta{identifier}] An optional string. \end{description} LuaTeX-ja ``does not distinguish'' two Japanese fonts which uses same JFM and are the same size. -Here ``uses same JFM'' means that all~of <JFM name>, <JFM features>~and~<identifier> of two fonts +Here ``uses same JFM'' means that all~of \meta{JFM name}, \meta{JFM features}~and~\meta{identifier} of two fonts agree. For example, The first ``)'' and ``【'' in \autoref{fig:jfmvar} are typeset in different real fonts. @@ -3547,35 +3547,35 @@ However, because they use the same JFMs and their size are same, \LuaTeX-ja inserts penalties, glues and kerns as if these two character are typeset in a same font. Namely, the glue between these characters is halfwidth, as in ``)\nobreak【''. However, this does not applies with \cs{F}~and~\cs{H} in \autoref{fig:jfmvar}, -because their <identifier> are different. +because their \meta{identifier} are different. %</en> %<*ja> \begin{description} -\item[<JFM name>] - (横組用)JFMの名称.\LuaTeX-jaは\texttt{jfm-<JFM name>.lua}というファイルを探索して読み込む. -\item[<JFM features>] +\item[\meta{JFM name}] + (横組用)JFMの名称.\LuaTeX-jaは\texttt{jfm-\meta{JFM name}.lua}というファイルを探索して読み込む. +\item[\meta{JFM features}] 省略可能なコンマ区切りリスト.全体を囲む \verb+{}+ は省略可能であるが, - 囲ったからといって<JFM features>の中で使用可能な文字が増えるわけではない. - <JFM features>で指定された内容は,テーブル\texttt{luatexja.jfont.jfm\_feature}として + 囲ったからといって\meta{JFM features}の中で使用可能な文字が増えるわけではない. + \meta{JFM features}で指定された内容は,テーブル\texttt{luatexja.jfont.jfm\_feature}として JFM読み込み時に(JFMから)アクセス可能である.\autoref{fig:jfmfeat}に使用例を載せた. なお,\LuaTeX-jaが標準で提供するJFMではこの機能は用いられていない. -\item[<identifier>] +\item[\meta{identifier}] 省略可能な文字列. \end{description} \LuaTeX-jaはJFMとサイズが同じで, 実フォントだけが異なる2つの和文フォントは「区別されない」. -ここで「JFMが同じ」とは,両フォントの<JFM name>, <JFM features>, <identifier>が +ここで「JFMが同じ」とは,両フォントの\meta{JFM name}, \meta{JFM features}, \meta{identifier}が 全て一致することである. 例えば\autoref{fig:jfmvar}において,最初の「)」と「【」の実フォントは異なるが, JFMもサイズも同じなので,普通に「)\nobreak【」と入力した時と同じように組まれる,つまり両文字の間は半角空きとなる. -しかし,JFMとサイズが同じであっても,\texttt{jfmvar}キーの値<identifier>の異なる -2つの和文フォント,例えば\autoref{fig:jfmvar}で言う \cs{F} と \cs{H}, -は「区別される」.異なる和文フォントに異なる \texttt{jfmvar} キーを割り当て, -かつ\Param{differentjfm}パラメータを \texttt{both} に設定すれば, +しかし,JFMとサイズが同じであっても,\texttt{jfmvar}キーの値\meta{identifier}の異なる +2つの和文フォント,例えば\autoref{fig:jfmvar}で言う\cs{F}と\cs{H}, +は「区別される」.異なる和文フォントに異なる \texttt{jfmvar}キーを割り当て, +かつ\Param{differentjfm}パラメータを\texttt{both}に設定すれば, \pTeX と似た状況で組版されることになる. %</ja> @@ -3823,8 +3823,8 @@ This means the following two lines have the same meaning: \paragraph{\texttt{extend}と\texttt{slant}} OpenType機能と見かけ上同じような形式で指定できるものに, \begin{description} -\item[\texttt{extend=}<extend>] 横方向に<extend>倍拡大する. -\item[\texttt{slant=}<slant>] <slant>に指定された割合だけ傾ける. +\item[\texttt{extend=}\meta{extend}] 横方向に\meta{extend}倍拡大する. +\item[\texttt{slant=}\meta{slant}] \meta{slant}に指定された割合だけ傾ける. \end{description} の2つがある. \texttt{extend}や\texttt{slant}を指定した場合は,それに応じたJFMを指定すべきである% @@ -3836,8 +3836,8 @@ OpenType機能と見かけ上同じような形式で指定できるものに, \paragraph{\texttt{extend} and \texttt{slant}} The following setting can be specified as OpenType font features: \begin{cslist}[style=standard] -\item[\texttt{extend=}<extend>] expand the font horizontally by <extend>. -\item[\texttt{slant=}<slant>] slant the font. +\item[\texttt{extend=}\meta{extend}] expand the font horizontally by \meta{extend}. +\item[\texttt{slant=}\meta{slant}] slant the font. \end{cslist} Note that \LuaTeX-ja doesn't adjust JFMs by these \texttt{extend} and \texttt{slant} settings; one have to write new JFMs on purpose. @@ -3897,7 +3897,6 @@ as shown in~\autoref{fig:ltjksp}. \label{ssec:tfont} \begin{comment} - {\catcode`\<=12\catcode`\>=12 \begin{table}[t] %<en>\caption{Differences between vertical JFMs shipped with \LuaTeX-ja} %<ja>\caption{\LuaTeX-ja に同梱されている縦組用 JFM の違い} @@ -3941,7 +3940,6 @@ as shown in~\autoref{fig:ltjksp}. \end{minipage} \ltjsetparameter{jacharrange={-3}} \end{table} -} \end{comment} %<*en> @@ -4033,7 +4031,7 @@ A font defined by~\cs{tfont} differs the following points from that by~\cs{jfont \item さらに,「いかなるscript,~languageでも\texttt{vert}により置換されない」グリフ のうち,UAX~\#50で``r''もしくは``Tr''と指定されているものは90度自動回転させる. \item \ref{ssec:math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない. - \item <JFM name>には縦組用JFMを指定する. + \item \meta{JFM name}には縦組用JFMを指定する. 以下の縦組用JFMが\LuaTeX-jaには同梱されている.%おり,違いを\autoref{tab-difjfm-tate}に示した. \begin{description} \item[\texttt{jfm-ujisv.lua}] \LuaTeX-jaの標準縦組用JFMである.このJFMは\upTeX で @@ -4299,7 +4297,7 @@ floating-point numbers in design-size unit. \begin{cslist}[style=standard] -\item[version=<version>] +\item[version=\meta{version}] %<en>(optional, default value is~1) %<ja>(任意,既定値は1) @@ -4310,7 +4308,7 @@ The version JFM. Currently 1,~2,~and,~3 are supported JFMのバージョン.1,~2,~3がサポートされる. %</ja> -\item[dir=<direction>] +\item[dir=\meta{direction}] %<en>(required) %<ja>(必須) @@ -4322,7 +4320,7 @@ or \texttt{'tate'}~(vertical) are supported. JFMの書字方向.\texttt{'yoko'}(横組)と \texttt{'tate'}(縦組)がサポートされる. %</ja> -\item[zw=<length>] +\item[zw=\meta{length}] %<en>(required) %<ja>(必須) @@ -4333,7 +4331,7 @@ JFMの書字方向.\texttt{'yoko'}(横組)と \texttt{'tate'}(縦組) \LuaTeX-jaではここで指定する. %</ja> -\item[zh=<length>] +\item[zh=\meta{length}] %<en>(required) %<ja>(必須) @@ -4344,7 +4342,7 @@ JFMの書字方向.\texttt{'yoko'}(横組)と \texttt{'tate'}(縦組) \LuaTeX-jaではここで指定する. %</ja> -\item[kanjiskip=\{<natural>, <stretch>, <shrink>\}] +\item[kanjiskip=\{\meta{natural}, \meta{stretch}, \meta{shrink}\}] %<en>(optional) %<ja>(任意) @@ -4353,17 +4351,17 @@ This field specifies the ``ideal'' amount of \Param{kanjiskip}. As noted in Subsection~\ref{subs-kskip}, if the parameter \Param{kanjiskip} is \cs{maxdimen}, the value specified in this field is actually used (if this field is not specified in - JFM, it is regarded as 0\,pt). Note that <stretch> and <shrink> + JFM, it is regarded as 0\,pt). Note that \meta{stretch} and \meta{shrink} fields are in design-size unit too. %</en> %<*ja> 理想的な\Param{kanjiskip}の量を指定する.\ref{subs-kskip}節で述べたように, もし\Param{kanjiskip}が \cs{maxdimen} の値ならば,このフィールドで指定された -値が実際には用いられる(指定なしは0\,ptとして扱われる).<stretch>と<shrink>のフィールドもdesign size +値が実際には用いられる(指定なしは0\,ptとして扱われる).\meta{stretch}と\meta{shrink}のフィールドもdesign size が単位であることに注意せよ. %</ja> -\item[xkanjiskip=\{<natural>, <stretch>, <shrink>\}] +\item[xkanjiskip=\{\meta{natural}, \meta{stretch}, \meta{shrink}\}] %<en>(optional) %<ja>(任意) @@ -4396,7 +4394,7 @@ the following fields: %</ja> \begin{cslist}[style=standard] -\item[chars=\{<character>, ...\}] +\item[chars=\{\meta{character}, ...\}] %<en>(required except character class~0) %<ja>(文字クラス0を除いて必須) @@ -4426,7 +4424,7 @@ This field is a list of characters which are in this character \end{itemize} %</ja> -\item[width=<length>, height=<length>, depth=<length>, italic=<length>] +\item[width=\meta{length}, height=\meta{length}, depth=\meta{length}, italic=\meta{length}] %<en>(required) %<ja>(必須) @@ -4476,7 +4474,7 @@ JFM書字方向&\emph{\texttt{'yoko'}(横組)}&\multicolumn{1}{l}{\emph{\tex すれば,これによってプロポーショナル組を行うことができる. %</ja> -\item[left=<length>, down=<length>, align=<align>]\ +\item[left=\meta{length}, down=\meta{length}, align=\meta{align}]\ %<*en> These fields are for adjusting the position of the ``real'' glyph. Legal @@ -4696,14 +4694,14 @@ Furthermore, the glyph is shifted according to values of fields \label{fig:pos-tate} \end{figure} -\item[kern={\{[$j$]=<kern>, [$j'$]=\{<kern>, [ratio=<ratio>]\}, ...\}}] +\item[kern={\{[$j$]=\meta{kern}, [$j'$]=\{\meta{kern}, [ratio=\meta{ratio}]\}, ...\}}] \nopagebreak -\item[glue={\{[$j$]=\{<width>, <stretch>, <shrink>, [ratio=<ratio>, ...]\}, ...\}}]\leavevmode +\item[glue={\{[$j$]=\{\meta{width}, \meta{stretch}, \meta{shrink}, [ratio=\meta{ratio}, ...]\}, ...\}}]\leavevmode %<*ja> 文字クラス$i$の文字と$j$の文字の間に挿入されるカーンやグルーの量を指定する. -<ratio>は,グルーの自然長のうちどれだけの割合が「後の文字」由来かを示す量で, +\meta{ratio}は,グルーの自然長のうちどれだけの割合が「後の文字」由来かを示す量で, $0$から$+1$の実数値をとる.省略時の値は$0.5$である. このフィールドの値は\Param{differentjfm}の値が \texttt{pleft},~\texttt{pright},~\texttt{paverage}の値のときのみ実際に用いられる. @@ -4711,8 +4709,8 @@ $0$から$+1$の実数値をとる.省略時の値は$0.5$である. 例えば,\cite{x4051}では,句点と中点の間には, 句点由来の二分空きと中点由来の四分空きが挿入されるが,この場合には \begin{itemize} -\item <width>には$0.5+0.25=0.75$を指定する. -\item <ratio>には$0.25/(0.5+0.25)=1/3$を指定する. +\item \meta{width}には$0.5+0.25=0.75$を指定する. +\item \meta{ratio}には$0.25/(0.5+0.25)=1/3$を指定する. \end{itemize} %</ja> %<*en> @@ -4721,32 +4719,32 @@ $0$から$+1$の実数値をとる.省略時の値は$0.5$である. Specifies the amount of kern or glue which will be inserted between characters in character class~$i$ and those in character class~$j$. -<ratio> specifies how much the glue is originated in the ``right'' character. +\meta{ratio} specifies how much the glue is originated in the ``right'' character. It is a real number between 0 and 1, and treated as 0.5 if omitted. For example, The width of a glue between an ideographic full stop ``。'' and a fullwidth middle dot ``・'' is three-fourth of fullwidth, namely halfwidth from the ideographic full stop, and quarter-width from the fullwidth middle dot. In this case, -we specify <ratio> to $0.25/(0.5+0.25)=1/3$. +we specify \meta{ratio} to $0.25/(0.5+0.25)=1/3$. %</en> %<*ja> グルーの指定においては,上記に加えて各 \texttt{[$j$]} の各サブテーブル内に 次のキーを指定できる, \begin{cslist}[style=standard] -\item[priority=<priority>] +\item[priority=\meta{priority}] \Pkg{luatexja-adjust}による優先順位付き 行長調整(\ref{ssec:adj}節)において,このグルーの優先度を指定する.許される値は以下の通り: \begin{description} \item[バージョン1] $-4$から$+3$の間の整数 - \item[バージョン2以降] $-4$から$+3$の間の整数の2つ組\texttt{\{<stretch>, <shrink>\}}か, - または$-4$から$+3$の間の整数.<stretch>, <shrink>はそれぞれこのグルーが伸びるときの優先度,縮むときの + \item[バージョン2以降] $-4$から$+3$の間の整数の2つ組\texttt{\{\meta{stretch}, \meta{shrink}\}}か, + または$-4$から$+3$の間の整数.\meta{stretch}, \meta{shrink}はそれぞれこのグルーが伸びるときの優先度,縮むときの 優先度であり,単に整数$i$が指定された場合は\texttt{\{$i$, $i$\}}であると解釈される. \end{description} ここで指定する値は,大きい値ほど「先に伸ばされる」「先に縮ませる」ことを意味しており,省略時の値 は0である.範囲外の値が指定されたときの動作は未定義である. -\item[kanjiskip\_natural=<num>\textrm{, }% - kanjiskip\_stretch=<num>\textrm{, }kanjiskip\_shrink=<num>]\leavevmode +\item[kanjiskip\_natural=\meta{num}\textrm{, }% + kanjiskip\_stretch=\meta{num}\textrm{, }kanjiskip\_shrink=\meta{num}]\leavevmode \label{pg:ksp_nat} JFMによって本来挿入されるグルーの他に @@ -4787,15 +4785,15 @@ JFMによって本来挿入されるグルーの他に In case of glue, one can specify following additional keys in each \texttt{[$j$]} subtable: \begin{cslist}[style=standard] -\item[priority=<priority>] +\item[priority=\meta{priority}] An integer in $[-4,3]$ (treated as 0 if omitted), or -a pair of these integers \texttt{\{<stretch>, <shrink>\}} (version 2~or~later). +a pair of these integers \texttt{\{\meta{stretch}, \meta{shrink}\}} (version 2~or~later). This is used only in line adjustment with priority by \Pkg{luatexja-adjust} (see Subsection~\ref{ssec:adj}). Higher value means the glue is easy to stretch, and is also easy to shrink. -\item[kanjiskip\_natural=<num>\textrm{, }% - kanjiskip\_stretch=<num>\textrm{, }kanjiskip\_shrink=<num>]\leavevmode +\item[kanjiskip\_natural=\meta{num}\textrm{, }% + kanjiskip\_stretch=\meta{num}\textrm{, }kanjiskip\_shrink=\meta{num}]\leavevmode These keys specifies the amount of the natural width of \Param{kanjiskip}% (the stretch/shrink part, respectively) which will be inserted @@ -4835,7 +4833,7 @@ Hence we have the following result: \end{cslist} %</en> -\item[end\_stretch=<kern>, end\_shrink=<kern>] +\item[end\_stretch=\meta{kern}, end\_shrink=\meta{kern}] %<*ja> (任意,バージョン1のみ) @@ -4847,7 +4845,7 @@ Hence we have the following result: (optional, version~1 only) %</en> - \item[end\_adjust=\{<kern>, <kern>, ...\}] + \item[end\_adjust=\{\meta{kern}, \meta{kern}, ...\}] %<*ja> (任意,バージョン2以降) @@ -4869,7 +4867,7 @@ Hence we have the following result: (optional, version~2 or~later) %</en> - \item[round\_threshold=<float>] + \item[round\_threshold=\meta{float}] %<*ja> (任意,バージョン3以降,文字クラス0のみ) @@ -5130,7 +5128,7 @@ an external package is needed to support this in plain \TeX\ and font families. There is no relation between the value of \cs{fam} and that of \cs{jfam}; with appropriate settings, one can set both \cs{fam} and \cs{jfam} to the same value. -Here <jfont\_cs> in the argument of \Param{jatextfont} etc.\ is +Here \meta{jfont\_cs} in the argument of \Param{jatextfont} etc.\ is a control sequence which is defined by \cs{jfont}, i.e., a \emph{horizontal} Japanese font. %</en> @@ -5139,7 +5137,7 @@ a \emph{horizontal} Japanese font. \autoref{tab-math}は数式フォントファミリに対する \TeX のプリミティブと対応する ものを示している.\cs{fam} と \cs{jfam} の値の間には関係はなく, 適切な設定の下では \cs{fam} と \cs{jfam} の両方に同じ値を設定することができる. -\Param{jatextfont} 他の第2引数<jfont\_cs>は,\cs{jfont} で定義された +\Param{jatextfont} 他の第2引数\meta{jfont\_cs}は,\cs{jfont} で定義された \emph{横組用}和文フォントである.\cs{tfont} で定義された \emph{縦組用}和文フォントを指定することは想定していない. %</ja> @@ -5157,9 +5155,9 @@ a \emph{horizontal} Japanese font. %<ja>\bf 和文フォント&\bf 欧文フォント\\ \midrule \cs{jfam}${}\in [0,256)$&\cs{fam}\\ -\ttfamily\Param{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\ttfamily\cs{textfont}<fam>=<font\_cs>\\ -\ttfamily\Param{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\ttfamily\cs{scriptfont}<fam>=<font\_cs>\\ -\ttfamily\Param{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\ttfamily\cs{scriptscriptfont}<fam>=<font\_cs>\\ +\ttfamily\Param{jatextfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}&\ttfamily\cs{textfont}\meta{fam}=\meta{font\_cs}\\ +\ttfamily\Param{jascriptfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}&\ttfamily\cs{scriptfont}\meta{fam}=\meta{font\_cs}\\ +\ttfamily\Param{jascriptscriptfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}&\ttfamily\cs{scriptscriptfont}\meta{fam}=\meta{font\_cs}\\ \bottomrule \end{tabular} \end{table} @@ -5247,8 +5245,8 @@ The value of \texttt{jfmvar}~key, which is specified at \cs{jfont}. The default value is the empty string. \item[\texttt{chars}] The mapping table from character codes to its character classes.\\ -The specification \texttt{[i].chars=\{<character>, ...\}} in the JFM will be stored in this - field as \texttt{chars=\{[<character>]=\,$i$, ...\}}. +The specification \texttt{[i].chars=\{\meta{character}, ...\}} in the JFM will be stored in this + field as \texttt{chars=\{[\meta{character}]=\,$i$, ...\}}. \item[\texttt{char\_type}] For $i\in\omega$, \texttt{char\_type[$i$]} is information of characters whose class is $i$, and has the following fields: @@ -5283,8 +5281,8 @@ sp単位で格納している. \cs{jfont},~\cs{tfont} で指定された \texttt{jfmvar} キーの値(未指定のときは空文字列). \item[chars] 文字コードから文字クラスへの対応が記述されたテーブル.\\ -JFM内の \texttt{[i].chars=\{<character>, ...\}} という指定は\ -\texttt{chars=\{[<character>]=\,$i$, ...\}} という形式に変換されている. +JFM内の \texttt{[i].chars=\{\meta{character}, ...\}} という指定は\ +\texttt{chars=\{[\meta{character}]=\,$i$, ...\}} という形式に変換されている. \item[char\_type] $i\in\omega$に対して,\texttt{char\_type[$i$]} は文字クラス$i$の文字の寸法を格納しており, 以下のフィールドを持つ. @@ -5303,23 +5301,19 @@ JFMで指定されているそれぞれの値をスケーリングしたもの のいずれかの値をとる. \end{itemize} $i$,~$j\in \omega$に対して,\texttt{char\_type[$i$][$j$]} は -文字クラス$i$の文字と$j$の文字の間に挿入されるグルーやカーンを格納している. +文字クラス$i$の文字と$j$の文字の間に挿入されるグルーやカーンの情報を格納している. 間に入るものがカーンであれば,この値は% -\texttt{[$j$]=\{[1]=<kern\_node>, ratio=<ratio>\}}であり, -<kern\_node>はカーンを表すノードである\footnote{% - バージョン20150420.0以降ではノードのアクセス手法にdirect access - modelを用いているため,ノードそのものを表すユーザーデータではなく, - 内部で参照のために使われる添字(整数)である. -}. - -グルーであれば,この値は以下のキーを持つテーブルである. +\texttt{[$j$]=\{\meta{kern}, ratio=\meta{ratio}\}}であり, +\meta{kern}はカーンの値をsp単位で表したものである. + +一方,間に入るものがグルーであれば,この値は以下のキーを持つテーブルである. \begin{description} - \item[\texttt{width}, \texttt{stretch}, \texttt{shrink}] + \item[{[1], [2], [3]}] グルーのそれぞれ自然長,伸び量,縮み量をsp単位で表したもの. - \item[\texttt{priority}] (バージョン2以降の)JFMでの指定 \texttt{\{<stretch>,<shrink>\}} を + \item[\texttt{priority}] (バージョン2以降の)JFMでの指定 \texttt{\{\meta{stretch},\meta{shrink}\}} を \[ - (\text{<stretch>}+4)\cdot 8+\text{<shrink>}+4 + (\text{\meta{stretch}}+4)\cdot 8+\text{\meta{shrink}}+4 \] として0--63の整数にパックしたもの. \item[\texttt{ratio}, \texttt{kanjiskip\_natural}, \texttt{kanjiskip\_stretch}, \texttt{kanjiskip\_shrink}] @@ -5366,7 +5360,7 @@ A function used in this callback should be in the following form: このコールバックで呼び出される関数は次の形をしていなければならない: %</ja> \begin{lstlisting}[numbers=left] -function (<number> char_class, <table> jfont_info, <number> chr_code) +function (<number> char_class, <table> jfont_info, <number> char_code) if char_class~=0 then return char_class else .... @@ -5515,7 +5509,7 @@ adopted in the whole paragraph or the whole hbox. \end{itemize} \begin{cslist}[style=standard] -\item[\DParam{jcharwidowpenalty}\,=<penalty>$^\ast$] [\cs{jcharwidowpenalty}]\ +\item[\DParam{jcharwidowpenalty}\,=\meta{penalty}$^\ast$] [\cs{jcharwidowpenalty}]\ %<*en> Penalty value for suppressing orphans. This penalty is inserted just @@ -5528,24 +5522,24 @@ Penalty value for suppressing orphans. This penalty is inserted just 挿入される. %</ja> -\item[\DParam{kcatcode}\,=\{<chr\_code>,<natural number>\}$^\ast$]\ +\item[\DParam{kcatcode}\,=\{\meta{char\_code},\meta{natural number}\}$^\ast$]\ %<*en> -An additional attributes which each character whose character code is <chr\_code> has. -At version~20120506.0 or later, the lowermost bit of <natural number> indicates +An additional attributes which each character whose character code is \meta{char\_code} has. +At version~20120506.0 or later, the lowermost bit of \meta{natural number} indicates whether the character is considered as a punctuation mark (see the description of \Param{jcharwidowpenalty} above). %</en> %<*ja> -文字コードが<chr\_code>の文字が持つ付加的な属性値. -バージョン20120506.0以降では,<natural number>の最下位ビットが,その文字が句読点と +文字コードが\meta{char\_code}の文字が持つ付加的な属性値. +バージョン20120506.0以降では,\meta{natural number}の最下位ビットが,その文字が句読点と みなされるかどうかを表している(上の\Param{jcharwidowpenalty}の記述を参照). %</ja> -\item[\DParam{prebreakpenalty}\,=\{<chr\_code>,<penalty>\}$^\ast$] [\cs{prebreakpenalty}]\ +\item[\DParam{prebreakpenalty}\,=\{\meta{char\_code},\meta{penalty}\}$^\ast$] [\cs{prebreakpenalty}]\ %<*ja> -文字コード<chr\_code>の\textbf{JAchar}が行頭にくることを抑止するために, +文字コード\meta{char\_code}の\textbf{JAchar}が行頭にくることを抑止するために, この文字の前に挿入/追加されるペナルティの量を指定する. 例えば閉じ括弧「〗」は絶対に行頭にきてはならないので, @@ -5565,7 +5559,7 @@ At version~20120506.0 or later, the lowermost bit of <natural number> indicates という制限があったが,\LuaTeX-jaではこれらの制限は解消されている. %</ja> %<*en> -Set a penalty which is inserted automatically before the character <chr\_code>, +Set a penalty which is inserted automatically before the character \meta{char\_code}, to prevent a line starts from this character. For example, a line cannot started with one of closing brackets ``〗'', so \LuaTeX-ja sets \begin{lstlisting} @@ -5582,42 +5576,42 @@ for the same character. \end{itemize} %</en> -\item[\DParam{postbreakpenalty}\,=\{<chr\_code>,<penalty>\}$^\ast$] +\item[\DParam{postbreakpenalty}\,=\{\meta{char\_code},\meta{penalty}\}$^\ast$] [\cs{postbreakpenalty}]\ %<*ja> -文字コード<chr\_code>の\textbf{JAchar}が行末にくることを抑止するために, +文字コード\meta{char\_code}の\textbf{JAchar}が行末にくることを抑止するために, この文字の後に挿入/追加されるペナルティの量を指定する. %</ja> %<*en> -Set a penalty which is inserted automatically after the character <chr\_code>, +Set a penalty which is inserted automatically after the character \meta{char\_code}, to prevent a line ends with this character. %</en> -\item[\DParam{jatextfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$] +\item[\DParam{jatextfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}$^\ast$] %<en>[\cs{textfont} in \TeX] %<ja>[\TeX の \cs{textfont}] -\item[\DParam{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$] +\item[\DParam{jascriptfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}$^\ast$] %<en>[\cs{scriptfont} in \TeX] %<ja>[\TeX の \cs{scriptfont}] -\item[\DParam{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}$^\ast$] +\item[\DParam{jascriptscriptfont}\,=\{\meta{jfam},\meta{jfont\_cs}\}$^\ast$] %<en>[\cs{scriptscriptfont} in \TeX] %<ja>[\TeX の \cs{scriptscriptfont}] -\item[\DParam{yjabaselineshift}\,=<dimen>]\ -\item[\DParam{yalbaselineshift}\,=<dimen>] [\cs{ybaselineshift}] -\item[\DParam{tjabaselineshift}\,=<dimen>]\ -\item[\DParam{talbaselineshift}\,=<dimen>] [\cs{tbaselineshift}] +\item[\DParam{yjabaselineshift}\,=\meta{dimen}]\ +\item[\DParam{yalbaselineshift}\,=\meta{dimen}] [\cs{ybaselineshift}] +\item[\DParam{tjabaselineshift}\,=\meta{dimen}]\ +\item[\DParam{talbaselineshift}\,=\meta{dimen}] [\cs{tbaselineshift}] -\item[\DParam{jaxspmode}\,=\{<chr\_code>,<mode>\}$^\ast$]\ +\item[\DParam{jaxspmode}\,=\{\meta{char\_code},\meta{mode}\}$^\ast$]\ %<*en> -Set whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is <chr\_code>. -The followings are allowed for <mode>: +Set whether inserting \Param{xkanjiskip} is allowed before/after a \textbf{JAchar} whose character code is \meta{char\_code}. +The followings are allowed for \meta{mode}: %</en> %<*ja> -文字コードが<chr\_code>の\textbf{JAchar}の前/後ろに\Param{xkanjiskip}の +文字コードが\meta{char\_code}の\textbf{JAchar}の前/後ろに\Param{xkanjiskip}の 挿入を許すかどうかの設定. -以下の<mode>が許される: +以下の\meta{mode}が許される: %</ja> \begin{description} %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character. @@ -5636,17 +5630,17 @@ This parameter is similar to the \cs{inhibitxspcode} primitive of \pTeX, but not このパラメータは\pTeX の \cs{inhibitxspcode} プリミティブと似ているが, 互換性はない. %</ja> -\item[\DParam{alxspmode}\,=\{<chr\_code>,<mode>\}$^\ast$] [\cs{xspcode}]\ +\item[\DParam{alxspmode}\,=\{\meta{char\_code},\meta{mode}\}$^\ast$] [\cs{xspcode}]\ %<*en> Set whether inserting \Param{xkanjiskip} is allowed before/after a - \textbf{ALchar} whose character code is <chr\_code>. - The followings are allowed for <mode>: + \textbf{ALchar} whose character code is \meta{char\_code}. + The followings are allowed for \meta{mode}: %</en> %<*ja> -文字コードが<chr\_code>の\textbf{ALchar}の前/後ろに\Param{xkanjiskip}の +文字コードが\meta{char\_code}の\textbf{ALchar}の前/後ろに\Param{xkanjiskip}の 挿入を許すかどうかの設定. -以下の<mode>が許される: +以下の\meta{mode}が許される: %</ja> \begin{description} %<en>\item[0, \texttt{inhibit}] Insertion of \Param{xkanjiskip} is inhibited before the character, nor after the character. @@ -5666,9 +5660,9 @@ Note that parameters \Param{jaxspmode} and \Param{alxspmode} share a common tabl これら2つのパラメータは互いの別名となっていることに注意する. %</ja> -\item[\DParam{autospacing}\,=<bool>] [\cs{autospacing}] -\item[\DParam{autoxspacing}\,=<bool>] [\cs{autoxspacing}] -\item[\DParam{kanjiskip}\,=<skip>$^\ast$] [\cs{kanjiskip}]\ +\item[\DParam{autospacing}\,=\meta{bool}] [\cs{autospacing}] +\item[\DParam{autoxspacing}\,=\meta{bool}] [\cs{autoxspacing}] +\item[\DParam{kanjiskip}\,=\meta{skip}$^\ast$] [\cs{kanjiskip}]\ %<*ja> デフォルトで2つの\textbf{JAchar}の間に挿入されるグルーである. @@ -5684,7 +5678,7 @@ If the natural width of this parameter is \cs{maxdimen}, \LuaTeX-ja uses the value which is specified in the JFM for current Japanese font (See Subsection~\ref{ssec:jfm-str}). %</en> -\item[\DParam{xkanjiskip}\,=<skip>$^\ast$] [\cs{xkanjiskip}]\ +\item[\DParam{xkanjiskip}\,=\meta{skip}$^\ast$] [\cs{xkanjiskip}]\ %<*ja> デフォルトで\textbf{JAchar}と\textbf{ALchar}の間に挿入されるグルーである. @@ -5701,7 +5695,7 @@ the value which is specified in the JFM for current Japanese font (See Subsectio %</en> -\item[\DParam{differentjfm}\,=<mode>$^\dagger$]\ +\item[\DParam{differentjfm}\,=\meta{mode}$^\dagger$]\ %<*en> Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different. @@ -5729,22 +5723,22 @@ The default value is \texttt{paverage}. \dots 各々の値による差異の詳細は\ref{ssec:cluster-wa}節の「『右空白』の算出」を参照してほしい. %</ja> -\item[\DParam{jacharrange}\,=<ranges>] -\item[\DParam{kansujichar}\,=\{<digit>, <chr\_code>\}$^\ast$] [\cs{kansujichar}] +\item[\DParam{jacharrange}\,=\meta{ranges}] +\item[\DParam{kansujichar}\,=\{\meta{digit}, \meta{char\_code}\}$^\ast$] [\cs{kansujichar}] -\item[\DParam{direction}\,=<dir>\ \hbox{\normalfont\rmfamily (always local)}]\ +\item[\DParam{direction}\,=\meta{dir}\ \hbox{\normalfont\rmfamily (always local)}]\ %<*en> Assigning to this parameter has the same effect as -\cs{yoko}~(if $\hbox{<dir>}=4$), \cs{tate}~(if $\hbox{<dir>}=3$), -\cs{dtou}~(if $\hbox{<dir>}=1$) or \cs{utod}~(if $\hbox{<dir>}=11$). -If the argument <dir> is not one of 4,~3, 1~nor~11, +\cs{yoko}~(if $\hbox{\meta{dir}}=4$), \cs{tate}~(if $\hbox{\meta{dir}}=3$), +\cs{dtou}~(if $\hbox{\meta{dir}}=1$) or \cs{utod}~(if $\hbox{\meta{dir}}=11$). +If the argument \meta{dir} is not one of 4,~3, 1~nor~11, the behavior of this assignment is undefined. %</en> %<*ja> -組方向を変更する \cs{yoko}~(if $\hbox{<dir>}=4$), \cs{tate}~(if $\hbox{<dir>}=3$), -\cs{dtou}~(if $\hbox{<dir>}=1$), \cs{utod}~(if $\hbox{<dir>}=11$) と同じ役割を持つ. -利用可能な状況もこれら4命令と同一である.引数<dir>が4,~3, 1,~11のいずれでも無いときの +組方向を変更する \cs{yoko}~(if $\hbox{\meta{dir}}=4$), \cs{tate}~(if $\hbox{\meta{dir}}=3$), +\cs{dtou}~(if $\hbox{\meta{dir}}=1$), \cs{utod}~(if $\hbox{\meta{dir}}=11$) と同じ役割を持つ. +利用可能な状況もこれら4命令と同一である.引数\meta{dir}が4,~3, 1,~11のいずれでも無いときの 動作は未定義である. %</ja> @@ -5829,27 +5823,27 @@ returns 0,~1, 2,~or~3, instead of \texttt{preonly} etc. \item %<*en> -\verb+\ltjgetparameter{jacharrange}{+<range>\verb+}+ returns \texttt{0} -if ``characters which belong to the character range~<range> are \textbf{JAchar}'', +\verb+\ltjgetparameter{jacharrange}{+\meta{range}\verb+}+ returns \texttt{0} +if ``characters which belong to the character range~\meta{range} are \textbf{JAchar}'', \texttt{1} if ``\dots~are \textbf{ALchar}''. -Although there is no character range~$-1$, specifying $-1$ to <range> does not cause an +Although there is no character range~$-1$, specifying $-1$ to \meta{range} does not cause an error (returns 1). %</en> %<*ja> -\verb+\ltjgetparameter{jacharrange}{+<range>\verb+}+ は,<range>が\textbf{JAchar}達の -範囲ならば0を,そうでなければ1を返す.「$-1$番の文字範囲」は存在しないが,<range>に$-1$を +\verb+\ltjgetparameter{jacharrange}{+\meta{range}\verb+}+ は,\meta{range}が\textbf{JAchar}達の +範囲ならば0を,そうでなければ1を返す.「$-1$番の文字範囲」は存在しないが,\meta{range}に$-1$を 指定してもエラーは発生しない(1を返す). %</ja> \item %<*en> -For an integer~<digit> between 0~and~9, - \verb+\ltjgetparameter{kansujichar}{+<digit>\verb+}+ returns the character code -of the result of \cs{kansuji}<digit>. +For an integer~\meta{digit} between 0~and~9, + \verb+\ltjgetparameter{kansujichar}{+\meta{digit}\verb+}+ returns the character code +of the result of \cs{kansuji}\meta{digit}. %</en> %<*ja> -0--9の数<digit>に対して, -\verb+\ltjgetparameter{kansujichar}{+<digit>\verb+}+ は,\cs{kansuji}<digit>で出力され +0--9の数\meta{digit}に対して, +\verb+\ltjgetparameter{kansujichar}{+\meta{digit}\verb+}+ は,\cs{kansuji}\meta{digit}で出力され る文字の文字コードを返す. %</ja> @@ -5870,13 +5864,13 @@ and 4 means \emph{yoko} direction (horizontal typesetting). \item %<*en> -For an integer~<reg\_num> between 0~and~65535, -\verb+\ltjgetparameter{boxdir}{+<reg\_num>\verb+}+ returns the direction of -\cs{box}<reg\_num>. If this box register is void, the returned value is zero. +For an integer~\meta{register} between 0~and~65535, +\verb+\ltjgetparameter{boxdir}{+\meta{register}\verb+}+ returns the direction of +\cs{box}\meta{register}. If this box register is void, the returned value is zero. %</en> %<*ja> -0--65535の数<reg\_num>に対して, -\verb+\ltjgetparameter{boxdir}{+<reg\_num>\verb+}+ は,\cs{box}<reg\_num>に +0--65535の数\meta{register}に対して, +\verb+\ltjgetparameter{boxdir}{+\meta{register}\verb+}+ は,\cs{box}\meta{register}に 格納されているボックスの組方向を表す.もしこのレジスタが空の場合は,0が返される. %</ja> @@ -5894,31 +5888,31 @@ jatextfont, jascriptfont, jascriptscriptfont, jacharrange \item %<*en> -\verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+ returns -the range number which <chr\_code> belongs to +\verb+\ltjgetparameter{chartorange}{+\meta{char\_code}\verb+}+ returns +the range number which \meta{char\_code} belongs to (although there is no parameter named ``chartorange''). -If <chr\_code> is between 0 and 127, this <chr\_code> does not belong to +If \meta{char\_code} is between 0 and 127, this \meta{char\_code} does not belong to any character range. In this case, - \verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+ + \verb+\ltjgetparameter{chartorange}{+\meta{char\_code}\verb+}+ returns $-1$. -Hence, one can know whether <chr\_code> is \textbf{JAchar} or not +Hence, one can know whether \meta{char\_code} is \textbf{JAchar} or not by the following: %</en> %<*ja> -\verb+\ltjgetparameter{chartorange}{+<chr\_code>\verb+}+ によって -<chr\_code>の属する文字範囲の番号を知ることができる. +\verb+\ltjgetparameter{chartorange}{+\meta{char\_code}\verb+}+ によって +\meta{char\_code}の属する文字範囲の番号を知ることができる. -<chr\_code>に0--127の値を指定した場合(このとき,<chr\_code>が属する +\meta{char\_code}に0--127の値を指定した場合(このとき,\meta{char\_code}が属する 文字範囲は存在しない)は$-1$が返る. -そのため,<chr\_code>が\textbf{JAchar}か\textbf{ALchar}かは +そのため,\meta{char\_code}が\textbf{JAchar}か\textbf{ALchar}かは 次で知ることができる: %</ja> \begin{quote} \ttfamily \verb+\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{+% - <chr\_code>\verb+}}+\\\null\hfill\verb+% 0 if JAchar, 1 if ALchar+ + \meta{char\_code}\verb+}}+\\\null\hfill\verb+% 0 if JAchar, 1 if ALchar+ \end{quote} %<*en> @@ -6059,44 +6053,6 @@ that is, without executing \cs{ltj@setpar@global} in advance, is \emph{not} supp \cs{ltj@setpar@global}を直前に実行せず,単独で \cs{ltjsetkanjiskip}, \cs{ltjsetxkanjiskip}を実行することは想定されていないので注意. - - -\paragraph{ベースライン補正量の設定} -\pLaTeX の\Pkg{ascmac}パッケージでは,縦組の欧文ベースライン補正量の一時待避・復帰処理に -\ \cs{@saveybaselineshift}\ という寸法レジスタを用い -\begin{lstlisting} -\@savetbaselineshift\tbaselineshift\tbaselineshift\z@ -... -\tbaselineshift\@savetbaselineshift -\end{lstlisting} -という処理を行っている. - -これを\LuaTeX-ja 用に \cs{ltjsetparameter} を使って書き直すと, -\begin{lstlisting} -\@savetbaselineshift\ltjgetparameter{talbaselineshift} -\ltjsetparameter{talbaselineshift=\z@} -... -\ltjsetparameter{talbaselineshift=\@savetbaselineshift} -\end{lstlisting} -となる. - -さて,縦組の欧文ベースライン補正量\Param{talbaselineshift}は, -実際には \cs{ltj@tablshift} という属性レジスタに格納されている -(\ref{sec-para}\nobreak 節参照).属性レジスタは長さではなく整数値を格納する\footnote{% - 従って,\texttt{\textbackslash @savetbaselineshift=\textbackslash ltj@tablshift}\ - のように記述することはできない.属性レジスタを \cs{tbaselineshift} という名称にしなかっ - たのはそのためである. -}ものであり,\cs{ltj@tablshift} は補正量を sp 単位で保持することから, -上記のコードと同じ内容をより速い以下のコードで実現することができる. -\begin{lstlisting} -\@savetbaselineshift\ltj@tablshift sp% -\ltj@tablshift\z@ -... -\ltj@tablshift\@savetbaselineshift -\end{lstlisting} -この手法は \Pkg{ascmac} パッケージの\LuaTeX-ja対応パッチ \Pkg{lltjp-tascmac.sty} で -実際に用いられている.\Pkg{lltjp-tascmac.sty} は自動的に読み込まれるので, -ユーザは何も気にせず普通に \Pkg{ascmac} パッケージを \cs{usepackage} で読みこめば良い. %</ja> @@ -6376,17 +6332,17 @@ Note that any shorthand form of \cs{insert}[\texttt{x}]\texttt{kanjiskip} are no Using \cs{ltjdeclarealtfont}, one can ``compose'' more than one Japanese fonts. This \cs{ltjdeclarealtfont} uses in the following form: \begin{quote} -\ttfamily \textbackslash ltjdeclarealtfont<base\_font\_cs><alt\_font\_cs>\{<range>\} +\ttfamily \textbackslash ltjdeclarealtfont\meta{base\_font\_cs}\meta{alt\_font\_cs}\{\meta{range}\} \end{quote} -where <base\_font\_cs>~and~<alt\_font\_cs> are defined by \cs{jfont}. +where \meta{base\_font\_cs}~and~\meta{alt\_font\_cs} are defined by \cs{jfont}. Its meaning is \begin{quote} -If the current Japanese font is <base\_font\_cs>, characters which belong to <range> -is typeset by another Japanese font <alt\_font\_cs>, instead of <base\_font\_cs>. +If the current Japanese font is \meta{base\_font\_cs}, characters which belong to \meta{range} +is typeset by another Japanese font \meta{alt\_font\_cs}, instead of \meta{base\_font\_cs}. \end{quote} -Here <range> is a comma-separated list of character codes, but also accepts negative integers: +Here \meta{range} is a comma-separated list of character codes, but also accepts negative integers: $-n$~($n≥1$) means that all characters of character classes~$n$, with respect to JFM used -by <base\_font\_cs>. Note that characters which do not exist in <alt\_font\_cs> are +by \meta{base\_font\_cs}. Note that characters which do not exist in \meta{alt\_font\_cs} are ignored. For example, if \cs{hoge} uses \texttt{jfm-ujis.lua}, the standard JFM of \LuaTeX-ja, @@ -6411,18 +6367,18 @@ because simple ``\texttt{-1}'' is treated as the range between 0~and~1. \cs{ltjdeclarealtfont} は以下の書式で使用する: \begin{quote} -\ttfamily \textbackslash ltjdeclarealtfont<base\_font\_cs><alt\_font\_cs>\{<range>\} +\ttfamily \textbackslash ltjdeclarealtfont\meta{base\_font\_cs}\meta{alt\_font\_cs}\{\meta{range}\} \end{quote} -これは「現在の和文フォント」が<base\_font\_cs>であるとき, -<range>に属する文字は<alt\_font\_cs>を用いて組版される,という意味である. +これは「現在の和文フォント」が\meta{base\_font\_cs}であるとき, +\meta{range}に属する文字は\meta{alt\_font\_cs}を用いて組版される,という意味である. \begin{itemize} - \item <base\_font\_cs>, <alt\_font\_cs>は + \item \meta{base\_font\_cs}, \meta{alt\_font\_cs}は \cs{jfont} によって定義された和文フォントである. - \item <range>は文字コードの範囲を表すコンマ区切りのリストであるが, - 例外として負数$-n$は「<base\_font\_cs>のJFMの文字クラス$n$に属する全ての文字」 + \item \meta{range}は文字コードの範囲を表すコンマ区切りのリストであるが, + 例外として負数$-n$は「\meta{base\_font\_cs}のJFMの文字クラス$n$に属する全ての文字」 を意味する. -<range>中に<alt\_font\_cs>中に実際には存在しない文字が指定された場合は, +\meta{range}中に\meta{alt\_font\_cs}中に実際には存在しない文字が指定された場合は, その文字に対する設定は無視される. \end{itemize} @@ -6441,17 +6397,17 @@ because simple ``\texttt{-1}'' is treated as the range between 0~and~1. %<*ja> \subsection{\cs{ltjalchar} と \cs{ltjjachar}} -文字コードが$\text{<chr\_code>}~(\geq 128=\mathtt{0x80})$の文字を -\ \cs{char} プリミティブを使い \cs{char}<chr\_code> として出力させると, +文字コードが$\text{\meta{char\_code}}~(\geq 128=\mathtt{0x80})$の文字を +\ \cs{char} プリミティブを使い \cs{char}\meta{char\_code} として出力させると, その文字の属する文字範囲(\ref{ssec:setrange}節参照)によって \textbf{ALchar}か\textbf{JAchar}か,つまり欧文フォントで出力されるか和文フォントで出力され るかが決まる. -文字範囲の設定を無視し,文字コードが<chr\_code>の文字を強制的に +文字範囲の設定を無視し,文字コードが\meta{char\_code}の文字を強制的に \textbf{ALchar}, \textbf{JAchar}で出力する命令がそれぞれ \ \cs{ltjalchar},~\cs{ltjjachar} である.使用方法は \cs{char} と同じく -\ \cs{ltjalchar}<chr\_code>, \cs{ltjjachar}<chr\_code>とすればよい. -\LuaTeX-ja~20190926.0から,<chr\_code>が127以下の場合でも\cs{ltjjachar}<chr\_code>が +\ \cs{ltjalchar}\meta{char\_code}, \cs{ltjjachar}\meta{char\_code}とすればよい. +\LuaTeX-ja~20190926.0から,\meta{char\_code}が127以下の場合でも\cs{ltjjachar}\meta{char\_code}が \textbf{JAchar}として出力されるようになっている. 以下は\ref{ssec:setrange}節に載せた例に,\cs{char} の動作などを追加したものである. @@ -6594,10 +6550,10 @@ but on the other hand \cs{zw}~and~\cs{zh} are specified by JFM. %</en> -\item[\cs{DeclareYokoKanjiEncoding}\{<encoding>\}\{<text-settings>\}\{<math-settings>\}] +\item[\cs{DeclareYokoKanjiEncoding}\{\meta{encoding}\}\{\meta{text-settings}\}\{\meta{math-settings}\}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] -\item[\cs{DeclareTateKanjiEncoding}\{<encoding>\}\{<text-settings>\}\{<math-settings>\}] +\item[\cs{DeclareTateKanjiEncoding}\{\meta{encoding}\}\{\meta{text-settings}\}\{\meta{math-settings}\}] %<*en> In NFSS2 under \LuaTeX-ja, distinction between alphabetic fonts @@ -6616,13 +6572,13 @@ In NFSS2 under \LuaTeX-ja, distinction between alphabetic fonts それぞれ定義する. %</ja> -\item[\cs{DeclareKanjiEncodingDefaults}\{<text-settings>\}\{<math-settings>\}] +\item[\cs{DeclareKanjiEncodingDefaults}\{\meta{text-settings}\}\{\meta{math-settings}\}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] -\item[\cs{DeclareKanjiSubstitution}\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}] +\item[\cs{DeclareKanjiSubstitution}\{\meta{encoding}\}\{\meta{family}\}\{\meta{series}\}\{\meta{shape}\}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] -\item[\cs{DeclareErrorKanjiFont}\{<encoding>\}\{<family>\}\{<series>\}\{<shape>\}\{<size>\}] +\item[\cs{DeclareErrorKanjiFont}\{\meta{encoding}\}\{\meta{family}\}\{\meta{series}\}\{\meta{shape}\}\{\meta{size}\}] %<*en> The above 3~commands are just the counterparts for \cs{DeclareFontEncodingDefaults} and~others. @@ -6631,34 +6587,34 @@ The above 3~commands are just the counterparts for \cs{DeclareFontEncodingDefaul 上記3つのコマンドはちょうどNFSS2 の \cs{DeclareFontEncodingDefaults} などに対応するものである. %</ja> -\item[\cs{reDeclareMathAlphabet}\{<unified-cmd>\}\{<al-cmd>\}\{<ja-cmd>\}] +\item[\cs{reDeclareMathAlphabet}\{\meta{unified-cmd}\}\{\meta{al-cmd}\}\{\meta{ja-cmd}\}] % ToDo: en %<*ja> 和文・欧文の数式用フォントファミリを一度に変更する命令を作成する. -具体的には,欧文数式用フォントファミリ変更の命令<al-cmd>(\cs{mathrm} 等)と,和文数式用フォ - ントファミリ変更の命令<ja-cmd>(\cs{mathmc} 等)の2つを同時に行う命令として - <unified-cmd>を(再)定義する.実際の使用では<unified-cmd>と - <al-cmd>に同じものを指定する,すなわち,<al-cmd>で和文側も変 +具体的には,欧文数式用フォントファミリ変更の命令\meta{al-cmd}(\cs{mathrm} 等)と,和文数式用フォ + ントファミリ変更の命令\meta{ja-cmd}(\cs{mathmc} 等)の2つを同時に行う命令として + \meta{unified-cmd}を(再)定義する.実際の使用では\meta{unified-cmd}と + \meta{al-cmd}に同じものを指定する,すなわち,\meta{al-cmd}で和文側も変 更させるようにするのが一般的と思われる. 本命令は \begin{center} -<unified-cmd>\texttt{\{}<arg>\texttt{\}}\quad$\longrightarrow$\quad -(<al-cmd>の1段展開結果)\texttt{\{}<ja-cmd>の1段展開結果)\texttt{\{<arg>\}\}} +\meta{unified-cmd}\texttt{\{}\meta{arg}\texttt{\}}\quad$\longrightarrow$\quad +(\meta{al-cmd}の1段展開結果)\texttt{\{}\meta{ja-cmd}の1段展開結果)\texttt{\{\meta{arg}\}\}} \end{center} と定義を行うので,使用には注意が必要である: %<en>\vspace{-\medskipamount} \begin{itemize} -\item <al-cmd>,~<ja-cmd>は既に定義されていなければならない. +\item \meta{al-cmd},~\meta{ja-cmd}は既に定義されていなければならない. \cs{reDeclareMathAlphabet}\\の後に -両命令の内容を再定義しても,<unified-cmd>の内容にそれは反映されない. -\item <al-cmd>,~<ja-cmd>に\verb+\@mathrm+などと \texttt{@} をつけた命令を指定した時の動作は保証できない. +両命令の内容を再定義しても,\meta{unified-cmd}の内容にそれは反映されない. +\item \meta{al-cmd},~\meta{ja-cmd}に\verb+\@mathrm+などと \texttt{@} をつけた命令を指定した時の動作は保証できない. \end{itemize} %</ja> -\item[\cs{DeclareRelationFont}\{<ja-encoding>\}\{<ja-family>\}\{<ja-series>\}\{<ja-shape>\}\\* - \null\hfill\{<al-encoding>\}\{<al-family>\}\{<al-series>\}\{<al-shape>\}] +\item[\cs{DeclareRelationFont}\{\meta{ja-encoding}\}\{\meta{ja-family}\}\{\meta{ja-series}\}\{\meta{ja-shape}\}\\* + \null\hfill\{\meta{al-encoding}\}\{\meta{al-family}\}\{\meta{al-series}\}\{\meta{al-shape}\}] %<*en> This command sets the ``accompanied'' alphabetic font (given by the latter 4~arguments) with respect to a Japanese font given by the former 4~arguments. @@ -6733,17 +6689,17 @@ In \LuaTeX-ja, this \cs{adjustbaseline} does similar task, namely setting the 設定処理も行っていたが,\LuaTeX-jaでも全く同様である. %</ja> -\item[\cs{fontfamily}\{<family>\}] +\item[\cs{fontfamily}\{\meta{family}\}] %<*en> As in \LaTeXe, this command changes current font family (alphabetic, Japanese,~\emph{or both}) -to <family>. See Subsection~\ref{ssec:fontfamilycmd} for detail. +to \meta{family}. See Subsection~\ref{ssec:fontfamilycmd} for detail. %</en> %<*ja> 元々の\LaTeXe におけるものと同様に,このコマンドは現在のフォントファミリ(欧文, -和文,\emph{もしくは両方})を<family>に変更する.詳細は\ref{ssec:fontfamilycmd}節を参照すること. +和文,\emph{もしくは両方})を\meta{family}に変更する.詳細は\ref{ssec:fontfamilycmd}節を参照すること. %</ja> -\item[\cs{fontshape}\{<shape>\}\textrm{, }\cs{fontshapeforce}\{<shape>\}] +\item[\cs{fontshape}\{\meta{shape}\}\textrm{, }\cs{fontshapeforce}\{\meta{shape}\}] %<*en> As in \LaTeXe, this command changes current alphabetic font shape according to shape change rules. @@ -6758,8 +6714,8 @@ when \cs{itshape} is called, because almost all Japanese fonts only have shape ``\texttt{n}'', and \cs{itshape} calls \cs{fontshape}. \LuaTeX-ja~20200323.0 change the behavior. Namely, -\cs{fontshape\{<shape>\}}~and~\cs{fontshapeforce\{<shape>\}} change current Japanese font shape, only if -the required shape (according to shape changing rules) or <shape> is avaliable in current Japanese font family/series. +\cs{fontshape\{\meta{shape}\}}~and~\cs{fontshapeforce\{\meta{shape}\}} change current Japanese font shape, only if +the required shape (according to shape changing rules) or \meta{shape} is avaliable in current Japanese font family/series. When this is not the case, an info such as \begin{verbatim} Kanji font shape JY3/mc/m/it' undefined @@ -6780,8 +6736,8 @@ is issued instead of a warning. といった警告をもたらしてしまっていた. 一方,\LuaTeX-ja 20200323.0以降では, -\cs{fontshape\{<shape>\}}, \cs{fontshapeforce\{<shape>\}}が和文フォントシェイプを更新するのは, -シェイプ更新規則に基づいた値や<shape>の少なくとも一つが現在の和文フォントファミリ・シリーズで利用可能なときに限られる. +\cs{fontshape\{\meta{shape}\}}, \cs{fontshapeforce\{\meta{shape}\}}が和文フォントシェイプを更新するのは, +シェイプ更新規則に基づいた値や\meta{shape}の少なくとも一つが現在の和文フォントファミリ・シリーズで利用可能なときに限られる. どちらでもなく,和文フォントシェイプが変更されなかった場合には \begin{verbatim} Kanji font shape JY3/mc/m/it' undefined @@ -6790,10 +6746,10 @@ is issued instead of a warning. というinfo(警告でなく)を出力する. %</ja> -\item[\cs{kanjishape}\{<shape>\}\textrm{, }\cs{kanjishapeforce}\{<shape>\}] +\item[\cs{kanjishape}\{\meta{shape}\}\textrm{, }\cs{kanjishapeforce}\{\meta{shape}\}] %<*en> -\cs{kanjishape\{<shape>\}} changes current Japanese font shape according to shape change rules, and -\cs{kanjishapeforce\{<shape>\}} changes current Japanese font shape to <shape>, regardless of the rules. +\cs{kanjishape\{\meta{shape}\}} changes current Japanese font shape according to shape change rules, and +\cs{kanjishapeforce\{\meta{shape}\}} changes current Japanese font shape to \meta{shape}, regardless of the rules. Hence \cs{kanjishape\{it\}} produces a warning \begin{verbatim} Font shape `JY3/mc/m/it' undefined @@ -6822,12 +6778,13 @@ which is not produced by \cs{fontshape\{it\}}. \label{fig:altkanji} \end{figure} -\item[\cs{DeclareAlternateKanjiFont}\{<base-encoding>\}\{<base-family>\}\{<base-series>\}\{<base-shape>\}\\ - \null\hfill\{<alt-encoding>\}\{<alt-family>\}\{<alt-series>\}\{<alt-shape>\}\{<range>\}] +\item[\cs{DeclareAlternateKanjiFont}\\ + \{\meta{base-encoding}\}\{\meta{base-family}\}\{\meta{base-series}\}\{\meta{base-shape}\}\\ + \{\meta{alt-encoding}\}\{\meta{alt-family}\}\{\meta{alt-series}\}\{\meta{alt-shape}\}\{\meta{range}\}] %<*ja> \ref{ssec:altfont}節の\ \cs{ltjdeclarealtfont} と同様に,前半の4引数の -和文フォント(基底フォント)のうち<range>中の文字を +和文フォント(基底フォント)のうち\meta{range}中の文字を 第5から第8引数の和文フォントを使って組むように指示する. 使用例を図\nobreak\ref{fig:altkanji}に載せた. @@ -6840,13 +6797,13 @@ which is not produced by \cs{fontshape\{it\}}. あるいは(これらを含むが)\cs{selectfont} が実行された時である. \item 段落やhboxの最後での設定値が段落/hbox全体にわたって通用する点や, -<range>に負数$-n$を指定した場合,それが「基底フォントの文字クラス$n$に属する文字全体」 +\meta{range}に負数$-n$を指定した場合,それが「基底フォントの文字クラス$n$に属する文字全体」 と解釈されるのは \cs{ltjdeclarealtfont} と同じである. \end{itemize}% %</ja> %<*en> As \cs{ltjdeclarealtfont}~(Subsection~\ref{ssec:altfont}), -characters in <range> of the Japanese font (we say the \emph{base font}) +characters in \meta{range} of the Japanese font (we say the \emph{base font}) which specified by first 4 arguments are typeset by the Japanese font which specified by fifth to eighth arguments (we say the \emph{alternate font}). @@ -6898,11 +6855,11 @@ The code below does not work either: %<ja>\subsection{\cs{fontfamily}コマンドの詳細} \label{ssec:fontfamilycmd} %<*en> -In this subsection, we describe when \cs{fontfamily}<family> changes current +In this subsection, we describe when \cs{fontfamily}\meta{family} changes current Japanese/alphabetic font family. Basically, current Japanese fotn family is changed to -<family> if it is recognized as a Japanese font family, and similar with alphabetic font +\meta{family} if it is recognized as a Japanese font family, and similar with alphabetic font family. There is a case that current Japanese/alphabetic font family are both changed to -<family>, and another case that <family> isn't recognized as a Japanese/alphabetic font +\meta{family}, and another case that \meta{family} isn't recognized as a Japanese/alphabetic font family either. \paragraph{Recognition as Japanese font family} @@ -6911,56 +6868,56 @@ This order is very similar to \cs{fontfamily} in \pLaTeXe, but we re-implemented We use an auxiliary list~$N_{\mathrm{J}}$. %</en> %<*ja> -本節では,\cs{fontfamily}<family> がいつ和文/欧文フォントファミリを変更するかについて解説 -する.基本的には,<family>が和文フォントファミリだと認識されれば和文側が,欧文フォントファ +本節では,\cs{fontfamily}\meta{family} がいつ和文/欧文フォントファミリを変更するかについて解説 +する.基本的には,\meta{family}が和文フォントファミリだと認識されれば和文側が,欧文フォントファ ミリだと認識されれば欧文側が変更される.どちらとも認識されれば和文・欧文の両方が変わるこ とになるし,当然どちらとも認識されないこともある. \paragraph{和文フォントファミリとしての認識} -まず,<family>が和文フォントファミリとして認識されるかは以下の順序で決定される. +まず,\meta{family}が和文フォントファミリとして認識されるかは以下の順序で決定される. これは\pLaTeXe の \cs{fontfamily} にとても似ているが,ここではLuaによって実装している. 補助的に「和文フォントファミリではないと認識された」ファミリを格納したリスト$N_{\mathrm{J}}$を用いる. %</ja> \begin{enumerate} %<*en> -\item If the family~<family> has been defined already by \cs{DeclareKanjiFamily}, - <family> is recognized as a Japanese font family. - Note that <family> need not be defined under \emph{current} Japanese font encoding. +\item If the family~\meta{family} has been defined already by \cs{DeclareKanjiFamily}, + \meta{family} is recognized as a Japanese font family. + Note that \meta{family} need not be defined under \emph{current} Japanese font encoding. %</en> %<*ja> -\item ファミリ<family>が既に \cs{DeclareKanjiFamily} によって定義されている場合, - <family>は和文フォントファミリであると認識される. - ここで,<family>は現在の和文フォントエンコーディングで定義されていなくてもよい. +\item ファミリ\meta{family}が既に \cs{DeclareKanjiFamily} によって定義されている場合, + \meta{family}は和文フォントファミリであると認識される. + ここで,\meta{family}は現在の和文フォントエンコーディングで定義されていなくてもよい. %</ja> %<*en> -\item If the family~<family> has been listed in a list~$N_{\mathrm{J}}$, this means - that <family> is not a Japanese font family. +\item If the family~\meta{family} has been listed in a list~$N_{\mathrm{J}}$, this means + that \meta{family} is not a Japanese font family. %</en> %<*ja> -\item ファミリ<family>がリスト$N_{\mathrm{J}}$に既に含まれていれば,それは - <family>が和文フォントファミリではないことを意味する. +\item ファミリ\meta{family}がリスト$N_{\mathrm{J}}$に既に含まれていれば,それは + \meta{family}が和文フォントファミリではないことを意味する. %</ja> %<*en> -\item If the \Pkg{luatexja-fontspec} package is loaded, we stop here, and <family> is not +\item If the \Pkg{luatexja-fontspec} package is loaded, we stop here, and \meta{family} is not recognized as a Japanese font family. If the \Pkg{luatexja-fontspec} package is \emph{not} loaded, -now \LuaTeX-ja looks whether there exists a Japanese font encoding~<enc> such that - a font definition named \texttt{<enc><family>.fd} (the file name is - all lowercase) exists. If so, <family> is recognized as a Japanese font family (the font definition file won't be loaded here). - If not, <family> is not a Japanese font family, and - <family> is appended to the list~$N_{\mathrm{J}}$. +now \LuaTeX-ja looks whether there exists a Japanese font encoding~\meta{enc} such that + a font definition named \texttt{\meta{enc}\meta{family}.fd} (the file name is + all lowercase) exists. If so, \meta{family} is recognized as a Japanese font family (the font definition file won't be loaded here). + If not, \meta{family} is not a Japanese font family, and + \meta{family} is appended to the list~$N_{\mathrm{J}}$. %</en> %<*ja> \item もし\Pkg{luatexja-fontspec}パッケージが読み込まれていれば,ここで終了であり, -<family>は和文フォントファミリとして認識されないことになる. +\meta{family}は和文フォントファミリとして認識されないことになる. -もし\Pkg{luatexja-fontspec}パッケージが読み込まれていなければ,和文エンコーディング<enc>で -フォント定義ファイル\texttt{<enc><family>.fd}(ファイル名は全て小文字)が存在するようなも +もし\Pkg{luatexja-fontspec}パッケージが読み込まれていなければ,和文エンコーディング\meta{enc}で +フォント定義ファイル\texttt{\meta{enc}\meta{family}.fd}(ファイル名は全て小文字)が存在するようなも のがあるかどうかを調べる. -存在すれば,<family>は和文フォントファミリと認識される(フォント定義ファイルは読み込まれな +存在すれば,\meta{family}は和文フォントファミリと認識される(フォント定義ファイルは読み込まれな い). -存在しなければ,<family>は和文フォントファミリでないと認識され,リスト$N_{\mathrm{J}}$に<family>を追加することでそれを記憶する. +存在しなければ,\meta{family}は和文フォントファミリでないと認識され,リスト$N_{\mathrm{J}}$に\meta{family}を追加することでそれを記憶する. %</ja> \end{enumerate} @@ -6972,52 +6929,52 @@ We use auxiliary lists $F_{\mathrm{A}}$~and~$N_{\mathrm{A}}$, %</en> %<*ja> \paragraph{欧文フォントファミリとしての認識} -同様に,<family>が和文フォントファミリとして認識されるかは以下の順序で決定される. +同様に,\meta{family}が和文フォントファミリとして認識されるかは以下の順序で決定される. 補助的に「欧文フォントファミリと既に認識された」ファミリのリスト$F_{\textrm{A}}$と, 「欧文フォントファミリではないと認識された」ファミリを格納したリスト$N_{\mathrm{A}}$を用いる. %</ja> \begin{enumerate} %<*en> -\item If the family~<family> has been listed in a list~$F_{\mathrm{A}}$, - <family> is recognized as an alphabetic font family. +\item If the family~\meta{family} has been listed in a list~$F_{\mathrm{A}}$, + \meta{family} is recognized as an alphabetic font family. %</en> %<*ja> -\item ファミリ<family>がリスト$F_{\mathrm{A}}$に既に含まれていれば, - <family>は欧文フォントファミリと認識される. +\item ファミリ\meta{family}がリスト$F_{\mathrm{A}}$に既に含まれていれば, + \meta{family}は欧文フォントファミリと認識される. %</ja> %<*en> -\item If the family~<family> has been listed in a list~$N_{\mathrm{A}}$, this means - that <family> is not an alphabetic font family. +\item If the family~\meta{family} has been listed in a list~$N_{\mathrm{A}}$, this means + that \meta{family} is not an alphabetic font family. %</en> %<*ja> -\item ファミリ<family>がリスト$N_{\mathrm{A}}$に既に含まれていれば,それは - <family>が欧文フォントファミリではないことを意味する. +\item ファミリ\meta{family}がリスト$N_{\mathrm{A}}$に既に含まれていれば,それは + \meta{family}が欧文フォントファミリではないことを意味する. %</ja> %<*en> -\item If there exists an alphabetic font encoding such that the family~<family> has been - defined under it, <family> is recognized as an alphabetic font family, and - to memorize this, <family> is appended to the list~$F_{\mathrm{A}}$. +\item If there exists an alphabetic font encoding such that the family~\meta{family} has been + defined under it, \meta{family} is recognized as an alphabetic font family, and + to memorize this, \meta{family} is appended to the list~$F_{\mathrm{A}}$. %</en> %<*ja> -\item ある欧文フォントエンコーディング下でファミリ<family>が定義されていれば, - <family>は欧文フォントファミリと認識され,リスト$F_{\mathrm{A}}$に<family>を追加することでこのことを記憶する. +\item ある欧文フォントエンコーディング下でファミリ\meta{family}が定義されていれば, + \meta{family}は欧文フォントファミリと認識され,リスト$F_{\mathrm{A}}$に\meta{family}を追加することでこのことを記憶する. %</ja> %<*en> -\item Now \LuaTeX-ja looks whether there exists an alphabetic font encoding~<enc> such that - a font definition named \texttt{<enc><family>.fd} (the file name is +\item Now \LuaTeX-ja looks whether there exists an alphabetic font encoding~\meta{enc} such that + a font definition named \texttt{\meta{enc}\meta{family}.fd} (the file name is all lowercase) exists. If so, current alphabetic font family will be changed to - <family>~(the font definition file won't be loaded here). + \meta{family}~(the font definition file won't be loaded here). If not, current alphabetic font family won't be changed, and - <family> is appended to the list~$N_{\mathrm{A}}$. + \meta{family} is appended to the list~$N_{\mathrm{A}}$. %</en> %<*ja> -\item 最終段階では,欧文エンコーディング<enc>で -フォント定義ファイル\texttt{<enc><family>.fd}(ファイル名は全て小文字)が存在するようなも +\item 最終段階では,欧文エンコーディング\meta{enc}で +フォント定義ファイル\texttt{\meta{enc}\meta{family}.fd}(ファイル名は全て小文字)が存在するようなも のがあるかどうかを調べる. -存在すれば,<family>は欧文フォントファミリと認識される(フォント定義ファイルは読み込まれない). -存在しなければ,<family>は欧文フォントファミリと認識されないので,リスト$N_{\mathrm{A}}$に - <family>を追加してそのことを記憶する. +存在すれば,\meta{family}は欧文フォントファミリと認識される(フォント定義ファイルは読み込まれない). +存在しなければ,\meta{family}は欧文フォントファミリと認識されないので,リスト$N_{\mathrm{A}}$に + \meta{family}を追加してそのことを記憶する. %</ja> \end{enumerate} @@ -7046,17 +7003,17 @@ loaded. %<en>\paragraph{Remarks} %<ja>\paragraph{注意} %<*en> -Of course, there is a case that <family> is not recognized as a Japanese font family, nor +Of course, there is a case that \meta{family} is not recognized as a Japanese font family, nor an alphabetic font family. -In this case, \LuaTeX-ja treats ``the argument <family> is wrong'', so -set both current alphabetic and Japanese font family to <family>, +In this case, \LuaTeX-ja treats ``the argument \meta{family} is wrong'', so +set both current alphabetic and Japanese font family to \meta{family}, to use the default family for font substitution. %</en> %<*ja> さて,引数によっては,「和文フォントファミリとも欧文フォントファミリも認識されなかった」 という事態もあり得る. - この場合,引数<family>は不正だった,ということになるので, -和文・欧文の両方のフォントファミリを<family>に設定し,代用フォントが使われるに任せることにする. + この場合,引数\meta{family}は不正だった,ということになるので, +和文・欧文の両方のフォントファミリを\meta{family}に設定し,代用フォントが使われるに任せることにする. %</ja> %<*en> @@ -7137,63 +7094,63 @@ expl3の文法に沿った組方向変更命令や組方向による条件判断 \item[\cs{platex\_if\_direction\_yoko\_p:}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_direction\_yoko:\underline{\textsl{TF}}} \{<true code>\} \{<false code>\}] + \item[\cs{platex\_if\_direction\_yoko:\underline{\textsl{TF}}} \{\meta{true code}\} \{\meta{false code}\}] %<ja> 現在の組方向が横組であるか否かをテストする. %<en> Tests if the current direction is \emph{yoko} (horizontal writing). \item[\cs{platex\_if\_direction\_tate\_nomath\_p:}$^\dagger$] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_direction\_tate\_nomath:\underline{\textsl{TF}}}$^\dagger$ \{<true code>\} \{<false code>\}] + \item[\cs{platex\_if\_direction\_tate\_nomath:\underline{\textsl{TF}}}$^\dagger$ \{\meta{true code}\} \{\meta{false code}\}] %<ja> 現在の組方向が縦組であるか否かをテストする. %<en> Tests if the current direction is \emph{tate} (vertical writing). \item[\cs{platex\_if\_direction\_tate\_math\_p:}$^\dagger$] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_direction\_tate\_math:\underline{\textsl{TF}}}$^\dagger$ \{<true code>\} \{<false code>\}] + \item[\cs{platex\_if\_direction\_tate\_math:\underline{\textsl{TF}}}$^\dagger$ \{\meta{true code}\} \{\meta{false code}\}] %<ja> 現在の組方向がutod方向(\pTeX でいう「縦数式ディレクション」)であるか否かをテストする. %<en> Tests if the current direction is \emph{utod}. \item[\cs{platex\_if\_direction\_tate\_p:}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_direction\_tate:\underline{\textsl{TF}}} \{<true code>\} \{<false code>\}] + \item[\cs{platex\_if\_direction\_tate:\underline{\textsl{TF}}} \{\meta{true code}\} \{\meta{false code}\}] %<ja> 現在の組方向が縦組またはutod方向であるか否かをテストする. %<en> Tests if the current direction is \emph{tate}~or~\emph{utod}. \item[\cs{platex\_if\_direction\_dtou\_p:}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_direction\_dtou:\underline{\textsl{TF}}} \{<true code>\} \{<false code>\}] + \item[\cs{platex\_if\_direction\_dtou:\underline{\textsl{TF}}} \{\meta{true code}\} \{\meta{false code}\}] %<ja> 現在の組方向がdtou方向であるか否かをテストする. %<en> Tests if the current direction is \emph{dtou}. - \item[\cs{platex\_if\_box\_yoko\_p:N} <box>] + \item[\cs{platex\_if\_box\_yoko\_p:N} \meta{box}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_box\_yoko:N\underline{\textsl{TF}}} <box> \{<true code>\} \{<false code>\}] -%<ja> ボックス<box>の組方向が横組であるか否かをテストする. -%<en> Tests if the direction of <box> is \emph{yoko}. - \item[\cs{platex\_if\_box\_tate\_nomath\_p:N}$^\dagger$ <box>] + \item[\cs{platex\_if\_box\_yoko:N\underline{\textsl{TF}}} \meta{box} \{\meta{true code}\} \{\meta{false code}\}] +%<ja> ボックス\meta{box}の組方向が横組であるか否かをテストする. +%<en> Tests if the direction of \meta{box} is \emph{yoko}. + \item[\cs{platex\_if\_box\_tate\_nomath\_p:N}$^\dagger$ \meta{box}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_box\_tate\_nomath:N\underline{\textsl{TF}}}$^\dagger$ <box> \{<true code>\} \{<false code>\}] -%<ja> ボックス<box>の組方向が縦組であるか否かをテストする. -%<en> Tests if the direction of <box> is \emph{tate}. - \item[\cs{platex\_if\_box\_tate\_math\_p:N}$^\dagger$ <box>] + \item[\cs{platex\_if\_box\_tate\_nomath:N\underline{\textsl{TF}}}$^\dagger$ \meta{box} \{\meta{true code}\} \{\meta{false code}\}] +%<ja> ボックス\meta{box}の組方向が縦組であるか否かをテストする. +%<en> Tests if the direction of \meta{box} is \emph{tate}. + \item[\cs{platex\_if\_box\_tate\_math\_p:N}$^\dagger$ \meta{box}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_box\_tate\_math:N\underline{\textsl{TF}}}$^\dagger$ <box> \{<true code>\} \{<false code>\}] -%<ja> ボックス<box>の組方向がutod方向であるか否かをテストする. -%<en> Tests if the direction of <box> is \emph{utod}. - \item[\cs{platex\_if\_box\_tate\_p:N} <box>] + \item[\cs{platex\_if\_box\_tate\_math:N\underline{\textsl{TF}}}$^\dagger$ \meta{box} \{\meta{true code}\} \{\meta{false code}\}] +%<ja> ボックス\meta{box}の組方向がutod方向であるか否かをテストする. +%<en> Tests if the direction of \meta{box} is \emph{utod}. + \item[\cs{platex\_if\_box\_tate\_p:N} \meta{box}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] - \item[\cs{platex\_if\_box\_tate:N\underline{\textsl{TF}}} <box> \{<true code>\} \{<false code>\}] -%<ja> ボックス<box>の組方向が縦組またはutod方向であるか否かをテストする. -%<en> Tests if the direction of <box> is \emph{tate}~or~\emph{utod}. - \item[\cs{platex\_if\_box\_dtou\_p:N} <box>] + \item[\cs{platex\_if\_box\_tate:N\underline{\textsl{TF}}} \meta{box} \{\meta{true code}\} \{\meta{false code}\}] +%<ja> ボックス\meta{box}の組方向が縦組またはutod方向であるか否かをテストする. +%<en> Tests if the direction of \meta{box} is \emph{tate}~or~\emph{utod}. + \item[\cs{platex\_if\_box\_dtou\_p:N} \meta{box}] %<en>\ \\[\dimexpr-\medskipamount-2\baselineskip\relax] %<ja>\ \\[\dimexpr-2\baselineskip\relax] -\item[\cs{platex\_if\_box\_dtou:N\underline{\textsl{TF}}} <box> \{<true code>\} \{<false code>\}] -%<ja> ボックス<box>の組方向がdtou方向であるか否かをテストする. -%<en> Tests if the direction of <box> is \emph{dtou}. +\item[\cs{platex\_if\_box\_dtou:N\underline{\textsl{TF}}} \meta{box} \{\meta{true code}\} \{\meta{false code}\}] +%<ja> ボックス\meta{box}の組方向がdtou方向であるか否かをテストする. +%<en> Tests if the direction of \meta{box} is \emph{dtou}. \end{cslist} @@ -7231,7 +7188,7 @@ the commands of Japanese version: \begin{cslist} -\item[CID=<name>\textrm{, }JFM=<name>\textrm{, }JFM-var=<name>] +\item[CID=\meta{name}\textrm{, }JFM=\meta{name}\textrm{, }JFM-var=\meta{name}] %<*en> These 3 keys correspond to \texttt{cid}, \texttt{jfm} and @@ -7282,7 +7239,7 @@ will not be embedded in the output PDF file. See Subsection~\ref{ssec:psft}. \label{fig:yokotate-fontspec} \end{figure} -\item[Kanjiskip=<bool>] +\item[Kanjiskip=\meta{bool}] %<*ja> \pageref{pg:ltjksp}ページで説明した \verb+\jfont+ 中での \texttt{ltjksp} 指定と 同一の効力を持ち, @@ -7291,7 +7248,7 @@ JFM中における \texttt{kanjiskip\_natural}, \texttt{kanjiskip\_stretch},\ 標準値は \texttt{true} である. %</ja> -\item[TateFeatures=\{<features>\}\textrm{, }TateFont=<font>] +\item[TateFeatures=\{\meta{features}\}\textrm{, }TateFont=\meta{font}] %<*en> The \texttt{TateFeatures} key specifies font features which are only turned~on in vertical writing, such as \texttt{Style=VerticalKana}~(\texttt{vkna} feature). @@ -7304,7 +7261,7 @@ A demonstrarion is shown in \autoref{fig:yokotate-fontspec}. 指定する.使用例は\autoref{fig:yokotate-fontspec}参照. %</ja> -\item[YokoFeatures=\{<features>\}] +\item[YokoFeatures=\{\meta{features}\}] %<*en> The \texttt{YokoFeatures} key specifies font features which are only turned~on in horizontal writing,. @@ -7352,9 +7309,9 @@ as the following: \begin{lstlisting}[escapechar=\#] AltFont = { ... - { Range=#\LARG range>#, #\LARG features>#}, - { Range=#\LARG range>#, Font=#\LARG font~name>#, #\LARG features># }, - { Range=#\LARG range>#, Font=#\LARG font~name># }, + { Range=#\meta{range}#, #\meta{features}#}, + { Range=#\meta{range}#, Font=#\meta{font~name}#, #\meta{features}# }, + { Range=#\meta{range}#, Font=#\meta{font~name}># }, ... } \end{lstlisting} @@ -7371,7 +7328,7 @@ A demonstrarion is shown in \autoref{fig:altkanji-fontspec}. %<*ja> なお,\Pkg{luatexja-fontspec} 読み込み時には和文フォント定義ファイル% -\texttt{<ja-enc><family>.fd}は全く参照されなくなる. +\texttt{\meta{ja-enc}\meta{family}.fd}は全く参照されなくなる. %</ja> @@ -7457,21 +7414,21 @@ commands: \Pkg{luatexja-otf}は以下の2つの低レベルコマンドを提供する: %</ja> \begin{cslist} -\item[\cs{CID}\{<number>\}] +\item[\cs{CID}\{\meta{number}\}] %<*en> -Typeset a glyph whose CID number is <number>. +Typeset a glyph whose CID number is \meta{number}. If the Japanese font is neither Adobe-Japan1,~Adobe-GB1, Adobe-CNS1, Adobe-Korea1,~nor~Adobe-KR CID-keyed font, -\LuaTeX-ja treats that <number> is a CID number of Adobe-Japan1 character collection, +\LuaTeX-ja treats that \meta{number} is a CID number of Adobe-Japan1 character collection, and tries to typeset a ``most suitable glyph''. Note that if the Japanese font is loaded using the HarfBuzz library, this \cs{CID} command does not work. %</en> %<*ja> -CID番号が<number>の文字を出力する. +CID番号が\meta{number}の文字を出力する. もし現在の和文フォントがAdobe-Japan1,~Adobe-GB1, Adobe-CNS1, Adobe-Korea1,~Adobe-KRの - いずれのCID-keyed fontでもない場合,<number>はAdobe-Japan1のCID番号であると解釈し + いずれのCID-keyed fontでもない場合,\meta{number}はAdobe-Japan1のCID番号であると解釈し 「適切なグリフ」\footnote{% 特に縦組用グリフのCID番号を指定した場合は(LuaTeX-ja 20190504.0以降では若干改良されているが) 意図しない結果になる可能性が高い. @@ -7483,15 +7440,15 @@ CID番号が<number>の文字を出力する. なお,現在の和文フォントがHarfBuzzを用いて読み込まれた場合には,\cs{CID}は正しく動作しない. %</ja> -\item[\cs{UTF}\{<hex\_number>\}] +\item[\cs{UTF}\{\meta{hex\_number}\}] %<*en> -Typeset a character whose character code is <hex\_number> (in hexadecimal). -This command is similar to \verb+\char"+<hex\_number>,\ %" +Typeset a character whose character code is \meta{hex\_number} (in hexadecimal). +This command is similar to \verb+\char"+\meta{hex\_number},\ %" but please remind remarks below. %</en> %<*ja> -文字コードが(16進で)<hex\_number>の文字を出力する. -このコマンドは \verb+\char"+<hex\_number>と似ているが,下の注意を参照すること.%" +文字コードが(16進で)\meta{hex\_number}の文字を出力する. +このコマンドは \verb+\char"+\meta{hex\_number}と似ているが,下の注意を参照すること.%" %</ja> \end{cslist} @@ -7666,7 +7623,7 @@ for making the difference obvious.} \item $d\ge\cs{lineskiplimit}$の場合, 標準の行送り\cs{baselineskip}で組んでも十分な間隔があると判断され, 2行の間には長さ$d$の空白が挿入される.つまり行送りは\cs{baselineskip}. - \item {\catcode`\<=12$d<\cs{lineskiplimit}$}の場合, + \item $d<\cs{lineskiplimit}$の場合, 2行の間には長さ\cs{lineskip}の空白が挿入される. そのため(設定値によるが,多くの場合)行送りは\cs{baselineskip}より広がる. \end{itemize} @@ -7773,7 +7730,7 @@ for making the difference obvious.} 場合によっては行送りを「\cs{baselineskip}の整数倍」などと切りのいい値に揃えたいという状況が 考えられなくもない. - \Pkg{luatexja-adjust}パッケージでは,{\catcode`\<=12$d<\cs{lineskiplimit}$}のときに + \Pkg{luatexja-adjust}パッケージでは,$d<\cs{lineskiplimit}$のときに 行送りを\cs{baselineskip}の\Param{linestep\_factor}倍ずつ増減させて \begin{quote} 行間が\cs{lineskip}以上となるような, @@ -7830,11 +7787,11 @@ for making the difference obvious.} また,次のパラメータが\cs{ltjsetparameter}内で 追加される.いずれもグローバルに効力を発揮する. \begin{cslist}[style=standard] -\item[\DParam{stretch\_priority}\,=\{<list>\}] +\item[\DParam{stretch\_priority}\,=\{\meta{list}\}] \Param{kanjiskip}, \Param{xkanjiskip},および「\textbf{JAglue}以外のグルー」を, 「行を自然長より伸ばす」場合の調整に用いる優先度を指定する. -指定方法は,<list>の中にkey-value listの形で +指定方法は,\meta{list}の中にkey-value listの形で \begin{lstlisting} stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} \end{lstlisting} @@ -7849,17 +7806,17 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} \end{lstlisting} であり,「優先度$-4$」と指定されているJFMグルーが最も伸びにくいようになっている. -\item[\DParam{shrink\_priority}\,=\{<list>\}] +\item[\DParam{shrink\_priority}\,=\{\meta{list}\}] 同様に,「行を自然長より縮める」場合の調整に用いる優先度を指定する. それ以外は\Param{stretch\_priority}と指定の形式は変わらない(初期値も変わらない). - \item[\DParam{linestep\_factor}\,=<float>] + \item[\DParam{linestep\_factor}\,=\meta{float}] 段階的な行送り調整の際,\cs{baselineskip}の自然長の何倍単位で行送りを変えるかを指定する. 0を指定すると無効になるのと変わらない.また負数を指定すると, その絶対値が指定されたかのように扱われる. 初期値は0.5(つまり半行単位)である. - \item[\DParam{profile\_hgap\_factor}\,=<float>] + \item[\DParam{profile\_hgap\_factor}\,=\meta{float}] 「中身まで見た」行送り計算の際, 前の行にある深さが大きいものと次の行にある高さが大きいものが 水平方向にどれだけ離れていないといけないかを @@ -8019,7 +7976,6 @@ among the line-head form, the line-middle form, and the line-end form. それを\LuaTeX-ja用に書きなおしたものが本追加パッケージ \Pkg{lltjext} である. 従来の \Pkg{plext} パッケージとの違いは, -{\catcode`\<=12 \begin{itemize} \item 組方向オプション \texttt{<y>}(横組),\texttt{<t>}(縦組), \texttt{<z>}\ の他に\ \texttt{<d>}(dtou方向),\texttt{<u>}(utod方向)を追加した. @@ -8032,7 +7988,6 @@ among the line-head form, the line-middle form, and the line-end form. \item 連数字用命令 \cs{rensuji} における位置合わせオプション \texttt{[l]}, \texttt{[c]}, \texttt{[r]} の挙動を若干変更した. \end{itemize} -} %</ja> %<*en> @@ -8062,13 +8017,13 @@ counterpart of the \Pkg{plext} package. \item[d] dtou方向 \item[u] utod方向 \end{description} -\item[\cs{parbox}\<<dir>\>{[<pos>]}\{<width>\}\{<contents>\}] +\item[\cs{parbox}<\meta{dir}>{[\meta{pos}]}\{\meta{width}\}\{\meta{contents}\}] \cs{parbox} 命令も同様に,組方向の指定ができるように拡張されている. -\item[\cs{pbox}\<<dir>\>{[<width>][<pos>]}\{<contents>\}] -組方向<dir>で<contents>の中身をLRモードで組む命令である. -<width>が正の値であるときは,ボックス全体の幅がその値となる. -その際,中身は<pos>の値に従い,左寄せ(\texttt{l}),右揃え(\texttt{r}), +\item[\cs{pbox}<\meta{dir}>{[\meta{width}][\meta{pos}]}\{\meta{contents}\}] +組方向\meta{dir}で\meta{contents}の中身をLRモードで組む命令である. +\meta{width}が正の値であるときは,ボックス全体の幅がその値となる. +その際,中身は\meta{pos}の値に従い,左寄せ(\texttt{l}),右揃え(\texttt{r}), 中央揃え(それ以外)される. \item[picture環境] 図表作成に用いる\texttt{picture}環境も, @@ -8084,11 +8039,11 @@ $x$成分の増加方向は字送り方向,$y$成分の増加方向は行送 \cs{put},~\cs{line}, \cs{vector}, \cs{dashbox}, \cs{oval},~\cs{circle}も ベースライン補正を受けないように再定義されている. -\item[\cs{rensuji}{[<pos>]}\{<contents>\}\textrm{, }\cs{rensujiskip}] +\item[\cs{rensuji}{[\meta{pos}]}\{\meta{contents}\}\textrm{, }\cs{rensujiskip}] -\item[\cs{Kanji}\{<counter\_name>\}] +\item[\cs{Kanji}\{\meta{counter\_name}\}] -\item[\cs{kasen}\{<contents>\}\textrm{, }\cs{bou}\{<contents>\}\textrm{, +\item[\cs{kasen}\{\meta{contents}\}\textrm{, }\cs{bou}\{\meta{contents}\}\textrm{, }\cs{boutenchar}] \item[参照番号] @@ -8113,28 +8068,28 @@ the direction inside the environment is same as that outside the enviromnent. \item[d] \emph{dtou} direction \item[u] \emph{utod} direction \end{description} -\item[\cs{parbox}\<<dir>\>{[<pos>]}\{<width>\}\{<contents>\}] -\cs{parbox} command is also extended by \texttt{\<<dir>\>}. +\item[\cs{parbox}<\meta{dir}>{[\meta{pos}]}\{\meta{width}\}\{\meta{contents}\}] +\cs{parbox} command is also extended by \texttt{<\meta{dir}>}. -\item[\cs{pbox}\<<dir>\>{[<width>][<pos>]}\{<contents>\}] -This commands typeset <contents> in LR-mode, in <dir> direction. -If <width> is positive, the width of the box becomes this <width>. -In this case, <contents> will be aligned to left (when <pos> is \texttt{l}), +\item[\cs{pbox}<\meta{dir}>{[\meta{width}][\meta{pos}]}\{\meta{contents}\}] +This commands typeset \meta{contents} in LR-mode, in \meta{dir} direction. +If \meta{width} is positive, the width of the box becomes this \meta{width}. +In this case, \meta{contents} will be aligned to left (when \meta{pos} is \texttt{l}), center (\texttt{c}), or~right (\texttt{r}). \item[picture\textrm{\ environment}] -\texttt{picture} environment also extended by \texttt{\<<dir>\>}, as follows: +\texttt{picture} environment also extended by \texttt{<\meta{dir}>}, as follows: \begin{lstlisting} \begin{picture}<dir>(x_size, y_size)(x_offset,y_offset) ... \end{picture} \end{lstlisting} -\item[\cs{rensuji}{[<pos>]}\{<contents>\}\textrm{, }\cs{rensujiskip}] +\item[\cs{rensuji}{[\meta{pos}]}\{\meta{contents}\}\textrm{, }\cs{rensujiskip}] -\item[\cs{Kanji}\{<counter\_name>\}] +\item[\cs{Kanji}\{\meta{counter\_name}\}] -\item[\cs{kasen}\{<contents>\}\textrm{, }\cs{bou}\{<contents>\}\textrm{, +\item[\cs{kasen}\{\meta{contents}\}\textrm{, }\cs{bou}\{\meta{contents}\}\textrm{, }\cs{boutenchar}] \item[参照番号] @@ -8418,20 +8373,20 @@ since we use same font for both series of gothic. \item[jis2004\textrm{,~}2004jis] %<en>Use JIS~X~0213:2004 glyph variants if possible. %<ja>出来る限りJIS~X~0213:2004の字形を使う. -\item[jfm\_yoko=<jfm>] +\item[jfm\_yoko=\meta{jfm}] %<*en> -Use the JFM \texttt{jfm-<jfm>.lua} for horizontal direction, instead of \texttt{jfm-ujis.lua}~(default JFM). +Use the JFM \texttt{jfm-\meta{jfm}.lua} for horizontal direction, instead of \texttt{jfm-ujis.lua}~(default JFM). %</en> %<*ja> -横組用和文フォントで用いるJFMを\texttt{jfm-<jfm>.lua}にする.このオプションがない時は +横組用和文フォントで用いるJFMを\texttt{jfm-\meta{jfm}.lua}にする.このオプションがない時は \LuaTeX\nobreakdash -ja標準の\texttt{jfm-ujis.lua}が用いられる. %</ja> -\item[jfm\_tate=<jfm>] +\item[jfm\_tate=\meta{jfm}] %<*en> -Use the JFM \texttt{jfm-<jfm>.lua} for vertical direction, instead of \texttt{jfm-ujisv.lua}~(default JFM). +Use the JFM \texttt{jfm-\meta{jfm}.lua} for vertical direction, instead of \texttt{jfm-ujisv.lua}~(default JFM). %</en> %<*ja> -縦用和文フォントで用いるJFMを\texttt{jfm-<jfm>.lua}にする.このオプションがない時は +縦用和文フォントで用いるJFMを\texttt{jfm-\meta{jfm}.lua}にする.このオプションがない時は \LuaTeX-ja標準の\texttt{jfm-ujisv.lua}が用いられる. %</ja> @@ -8912,9 +8867,9 @@ From version~20170904.0, one can define new presets using \cs{ltjnewpreset}, and use them by \cs{ltjapplypreset}. These two commands can only be used in the preamble. %</en> \begin{cslist} - \item[\cs{ltjnewpreset}\{<name>\}\{<specification>\}] + \item[\cs{ltjnewpreset}\{\meta{name}\}\{\meta{specification}\}] %<*ja> - 新たに<name>という名称のプリセットを定義する.この名称は, + 新たに\meta{name}という名称のプリセットを定義する.この名称は, すでに定義されているプリセット名や, \ref{sssec:ltjpreset-general}で定義されているオプション,さらに 次の13個と重複してはならない. @@ -8923,35 +8878,35 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the mc mc-l mc-m mc-b mc-bx gt gt-u gt-d gt-m gt-b gt-bx gt-eb mg-m \end{quote} - <specification>は,プリセット名や以下のキー達のコンマ区切りリストを指定する: + \meta{specification}は,プリセット名や以下のキー達のコンマ区切りリストを指定する: \begin{description} - \item[\ttfamily mc-l=<font>] 明朝体細字(\cs{mcfamily}\cs{ltseries}) - \item[\ttfamily mc-m=<font>] 明朝体中字(\cs{mcfamily}\cs{mdseries}) - \item[\ttfamily mc-b=<font>] 明朝体太字(\cs{mcfamily}\cs{bfseries}) - \item[\ttfamily mc-bx=<font>] \texttt{mc-b=<font>}と同義. - \item[\ttfamily gt-u=<font>] \texttt{deluxe}オプション未指定時のゴシック体(\cs{gtfamily})・明朝体太字 - \item[\ttfamily gt-d=<font>] \texttt{deluxe}オプション指定時のゴシック体中字(\cs{gtfamily}\cs{mdseries}) - \item[\ttfamily gt-m=<font>] \texttt{deluxe}オプションの指定の有無に関係なく - ゴシック体中字(\cs{gtfamily}\cs{mdseries})を指定する.「\texttt{gt-u=<font>, gt-d<font>}」と同義. - \item[\ttfamily gt-b=<font>] ゴシック体太字(\cs{gtfamily}\cs{bfseries})\\ - なお,パッケージ読み込み時に\texttt{bold}オプションが指定された場合は,\texttt{mc-b=<font>}を指定したことにもなる. - \item[\ttfamily gt-bx=<font>] \texttt{gt-b=<font>}と同義. - \item[\ttfamily gt-eb=<font>] ゴシック体太字(\cs{gtfamily}\cs{ebseries}) - \item[\ttfamily mg-m=<font>] 丸ゴシック体(\cs{mgfamily}) - \item[\ttfamily mc=<font>] 明朝体の細字・中字・太字全部を設定. + \item[\ttfamily mc-l=\meta{font}] 明朝体細字(\cs{mcfamily}\cs{ltseries}) + \item[\ttfamily mc-m=\meta{font}] 明朝体中字(\cs{mcfamily}\cs{mdseries}) + \item[\ttfamily mc-b=\meta{font}] 明朝体太字(\cs{mcfamily}\cs{bfseries}) + \item[\ttfamily mc-bx=\meta{font}] \texttt{mc-b=\meta{font}}と同義. + \item[\ttfamily gt-u=\meta{font}] \texttt{deluxe}オプション未指定時のゴシック体(\cs{gtfamily})・明朝体太字 + \item[\ttfamily gt-d=\meta{font}] \texttt{deluxe}オプション指定時のゴシック体中字(\cs{gtfamily}\cs{mdseries}) + \item[\ttfamily gt-m=\meta{font}] \texttt{deluxe}オプションの指定の有無に関係なく + ゴシック体中字(\cs{gtfamily}\cs{mdseries})を指定する.「\texttt{gt-u=\meta{font}, gt-d\meta{font}}」と同義. + \item[\ttfamily gt-b=\meta{font}] ゴシック体太字(\cs{gtfamily}\cs{bfseries})\\ + なお,パッケージ読み込み時に\texttt{bold}オプションが指定された場合は,\texttt{mc-b=\meta{font}}を指定したことにもなる. + \item[\ttfamily gt-bx=\meta{font}] \texttt{gt-b=\meta{font}}と同義. + \item[\ttfamily gt-eb=\meta{font}] ゴシック体太字(\cs{gtfamily}\cs{ebseries}) + \item[\ttfamily mg-m=\meta{font}] 丸ゴシック体(\cs{mgfamily}) + \item[\ttfamily mc=\meta{font}] 明朝体の細字・中字・太字全部を設定. 以下を指定したことと同じである: \begin{quote} - \ttfamily mc-l=<font>, mc-m=<font>, mc-b=<font> + \ttfamily mc-l=\meta{font}, mc-m=\meta{font}, mc-b=\meta{font} \end{quote} - \item[\ttfamily gt=<font>] ゴシック体の中字・太字・極太全部を設定. + \item[\ttfamily gt=\meta{font}] ゴシック体の中字・太字・極太全部を設定. 以下を指定したことと同じである: \begin{quote} - \ttfamily gt-u=<font>, gt-d=<font>, gt-b=<font>, gt-eb=<font> + \ttfamily gt-u=\meta{font}, gt-d=\meta{font}, gt-b=\meta{font}, gt-eb=\meta{font} \end{quote} \end{description} %</ja> %<*en> - Define new preset~<name>. This <name> cannot be same as other presets, + Define new preset~\meta{name}. This <name> cannot be same as other presets, options described in Subsubsection~\ref{sssec:ltjpreset-general}, nor following 13~strings: \begin{quote} @@ -8959,47 +8914,47 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the mc mc-l mc-m mc-b mc-bx gt gt-u gt-d gt-m gt-b gt-bx gt-eb mg-m \end{quote} - <specification> is a comma-separated list which consists of + \meta{specification} is a comma-separated list which consists of other presets and/or the following keys: \begin{description} - \item[\ttfamily mc-l=<font>] mincho light - \item[\ttfamily mc-m=<font>] mincho medium - \item[\ttfamily mc-b=<font>] mincho bold - \item[\ttfamily mc-bx=<font>] synonym for \texttt{mc-b=<font>} - \item[\ttfamily gt-u=<font>] gothic, when \texttt{deluxe}~option is not specified. - \item[\ttfamily gt-d=<font>] gothic medium, when \texttt{deluxe}~option is specified. - \item[\ttfamily gt-m=<font>] gothic medium. This key is equivalent to ``\texttt{gt-u=<font>, gt-d<font>}''. - \item[\ttfamily gt-b=<font>] gothic bold\\ + \item[\ttfamily mc-l=\meta{font}] mincho light + \item[\ttfamily mc-m=\meta{font}] mincho medium + \item[\ttfamily mc-b=\meta{font}] mincho bold + \item[\ttfamily mc-bx=\meta{font}] synonym for \texttt{mc-b=\meta{font}} + \item[\ttfamily gt-u=\meta{font}] gothic, when \texttt{deluxe}~option is not specified. + \item[\ttfamily gt-d=\meta{font}] gothic medium, when \texttt{deluxe}~option is specified. + \item[\ttfamily gt-m=\meta{font}] gothic medium. This key is equivalent to ``\texttt{gt-u=\meta{font}, gt-d\meta{font}}''. + \item[\ttfamily gt-b=\meta{font}] gothic bold\\ Note that this key also specifies mincho bold if \texttt{bold} option is specified. - \item[\ttfamily gt-bx=<font>] synonym for \texttt{gt-b=<font>} - \item[\ttfamily gt-eb=<font>] gothic extra~bold - \item[\ttfamily mg-m=<font>] rounded gothic - \item[\ttfamily mc=<font>] Equivalent to + \item[\ttfamily gt-bx=\meta{font}] synonym for \texttt{gt-b=\meta{font}} + \item[\ttfamily gt-eb=\meta{font}] gothic extra~bold + \item[\ttfamily mg-m=\meta{font}] rounded gothic + \item[\ttfamily mc=\meta{font}] Equivalent to \begin{quote} - \ttfamily mc-l=<font>, mc-m=<font>, mc-b=<font> + \ttfamily mc-l=\meta{font}, mc-m=\meta{font}, mc-b=\meta{font} \end{quote} - \item[\ttfamily gt=<font>] Equivalent to + \item[\ttfamily gt=\meta{font}] Equivalent to \begin{quote} - \ttfamily gt-u=<font>, gt-d=<font>, gt-b=<font>, gt-eb=<font> + \ttfamily gt-u=\meta{font}, gt-d=\meta{font}, gt-b=\meta{font}, gt-eb=\meta{font} \end{quote} \end{description} %</en> - \item[\cs{ltjnewpreset}*\{<name>\}\{<specification>\}] + \item[\cs{ltjnewpreset}*\{\meta{name}\}\{\meta{specification}\}] %<*ja> \cs{ltjnewpreset}とほぼ同じであるが,こちらはすでに定義されているプリセット名 - を<name>に指定した場合にはエラーを出さずに定義を置き換える. + を\meta{name}に指定した場合にはエラーを出さずに定義を置き換える. %</ja> %<*en> - Almost same as \cs{ltjnewpreset}. However, if <name> matches a preset which already defined, + Almost same as \cs{ltjnewpreset}. However, if \meta{name} matches a preset which already defined, this command simply overwrite it. %</en> - \item[\cs{ltjapplypreset}\{<name>\}] -%<ja> <name>で指定されたプリセットを使って和文フォントを設定する. -%<en> Set Japanese font families using preset~<name>. + \item[\cs{ltjapplypreset}\{\meta{name}\}] +%<ja> \meta{name}で指定されたプリセットを使って和文フォントを設定する. +%<en> Set Japanese font families using preset~\meta{name}. \end{cslist} %<*ja> -なお,\cs{ltjnewpreset}の第二引数<specification>に含まれる +なお,\cs{ltjnewpreset}の第二引数\meta{specification}に含まれる プリセット名は\cs{ltjnewpreset}の時点で定義されている必要はなく, \cs{ltjapplypreset}で実際に使うときに定義されていれば良い. そのため,次のような記述も可能である: @@ -9152,9 +9107,11 @@ The character class of a \textbf{JAchar}. This attribute is only set on a \attr{ltj@yablshift} %<*en> The amount of shifting the baseline of alphabetic fonts in scaled point ($2^{-16}\,\textrm{pt}$). +``unset'' means zero. %</en> %<*ja> スケールド・ポイント($2^{-16}\,\textrm{pt}$)を単位とした欧文フォントのベースラインの移動量. +この属性が「未設定」(\texttt{-"7FFFFFFF})のときは0であるとみなされる.\cs{ltj@ykblshift}他も同様. %</ja> \attr{ltj@ykblshift} @@ -9171,17 +9128,21 @@ 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} is allowed at the node. +0 means ``not allowed'', and the other value (including ``unset'') means ``allowed''. %</en> %<*ja> そのノードで\Param{kanjiskip}の自動挿入が許されるかどうか. +0は「許可しない」,0以外の値(「未設定」も含む)は「許可する」. %</ja> \attr{ltj@autoxspc} %<*en> Whether the auto insertion of \Param{xkanjiskip} is allowed at the node. +0 means ``not allowed'', and the other value (including ``unset'') means ``allowed''. %</en> %<*ja> そのノードで\Param{xkanjiskip}の自動挿入が許されるかどうか. +0は「許可しない」,0以外の値(「未設定」も含む)は「許可する」. %</ja> \attr{ltj@icflag} @@ -9672,17 +9633,17 @@ but also by the value of \cs{globaldefs}. %</en> %<*ja> \paragraph{パラメータの設定} -\cs{ltjsetparameter} と,\cs{ltjglobalsetparameter} の定義は\autoref{fig:setpar-def}の +\cs{ltjsetparameter}と,\cs{ltjglobalsetparameter}の定義は\autoref{fig:setpar-def}の のようになっている. -本質的なのは最後の \cs{setkeys} で,これは\Pkg{xkeyval}パッケージの提供する命令である. +本質的なのは最後の\cs{setkeys}で,これは\Pkg{xkeyval}パッケージの提供する命令である. -このため,\cs{ltjsetparameter} に指定可能なパラメータを追加するには, -<prefix>を \texttt{ltj},<family>を \texttt{japaram} としたキーを +このため,\cs{ltjsetparameter}に指定可能なパラメータを追加するには, +\meta{prefix}を\texttt{ltj},\meta{family}を\texttt{japaram}としたキーを \begin{lstlisting} \define@key[ltj]{japaram}{...}{...} \end{lstlisting} のように定義すれば良いだけである. -なお,パラメータ指定がグローバルかローカルかどうかを示す \texttt{luatexja.isglobal} が, +なお,パラメータ指定がグローバルかローカルかどうかを示す\texttt{luatexja.isglobal}が, \begin{align} \texttt{luatexja.isglobal} = \begin{cases*} @@ -9690,8 +9651,8 @@ but also by the value of \cs{globaldefs}. \texttt{''}&(パラメータ設定はローカル). \end{cases*} \end{align} -として自動的にセットされる\footnote{命令が \cs{ltjglobalsetparameter} かどうかだけでは -なく,実行時の \cs{globaldefs} の値にも依存して定まる.}. +として自動的にセットされる\footnote{命令が\cs{ltjglobalsetparameter}かどうかだけでは +なく,実行時の\cs{globaldefs}の値にも依存して定まる.}. %</ja> %<*en> @@ -10138,11 +10099,11 @@ fonts might not have these transformation as an OpenType feature. \LuaTeX-jaにおける \textbf{JAglue} の挿入方法は,\pTeX のそれとは全く異なる. \pTeX では次のような仕様であった: \begin{itemize} -\item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)<char\_node>を +\item JFMグルーの挿入は,和文文字を表すトークンを元に水平リストに(文字を表す)\meta{char\_node}を 追加する過程で行われる. \item \Param{xkanjiskip}の挿入は,hboxへのパッケージングや行分割前に行われる. \item \Param{kanjiskip}はノードとしては挿入されない.パッケージングや行分割の計算時に -「和文文字を表す2つの<char\_node>の間には\Param{kanjiskip}がある」ものとみなされる. +「和文文字を表す2つの\meta{char\_node}の間には\Param{kanjiskip}がある」ものとみなされる. \end{itemize} しかし,\LuaTeX-jaでは,hboxへのパッケージングや行分割前に全ての \textbf{JAglue},即ちJFMグルー・\Param{xkanjiskip}・\Param{kanjiskip}の @@ -10458,16 +10419,16 @@ ga&(\inhibitglue 「使用フォントが\textit{Np}のそれと同じで,\hfi \] として,前側の文字のJFMを使った時の空白(グルー/カーン)と,後側の文字のJFMを使った時のそれを求める. -$\mathit{gb}$,~$\mathit{ga}$それぞれに対する<ratio>の値を$d_b$,~$d_a$とする. +$\mathit{gb}$,~$\mathit{ga}$それぞれに対する\meta{ratio}の値を$d_b$,~$d_a$とする. \begin{itemize} \item $\mathit{ga}$と$\mathit{gb}$の両方が未定義であるならば,JFM由来のグルーは挿入されず, \Param{kanjiskip}を採用することとなる. -どちらか片方のみが未定義であるならば,次のステップでその未定義の方は長さ0のkernで,<ratio>の値は0であるかのように扱われる. +どちらか片方のみが未定義であるならば,次のステップでその未定義の方は長さ0のkernで,\meta{ratio}の値は0であるかのように扱われる. \item \Param{diffrentjfm}の値が \texttt{pleft}, \texttt{pright}, \texttt{paverage} のとき, -<ratio>の指定に従って比例配分を行う. +\meta{ratio}の指定に従って比例配分を行う. JFM由来のグルー/カーンは以下の値となる: \[ f\left(\frac{1-d_b}2\textit{gb} + \frac{1+d_b}2\textit{ga}, @@ -10482,7 +10443,7 @@ y&($\Param{diffrentjfm}=\texttt{pright}$),\\ \end{dcases*} \] \item -\Param{differentjfm}がそれ以外の値の時は,<ratio>の値は無視され,JFM由来のグルー/カーンは以下の値となる: +\Param{differentjfm}がそれ以外の値の時は,\meta{ratio}の値は無視され,JFM由来のグルー/カーンは以下の値となる: \[ f(\textit{gb},\textit{ga}) \] @@ -10849,7 +10810,6 @@ $\mathit{Nq}.\mathit{tail}$は無意味なので, さて,\texttt{yoffset} の増減によって見かけのグリフ位置は上下に移動するが, 仮想ボディの高さ$h$,深さ$d$については \begin{description} -\catcode`\<=12\catcode`\>=12 \item[$\texttt{yoffset}\geq 0$のとき] $h = \max(\texttt{height} + \texttt{yoffset}, 0)$, $d = \max(\texttt{depth} - \texttt{yoffset}, 0)$, @@ -11367,7 +11327,6 @@ T^{+}&:=T^{+}_{L^+},&L^{+} = \max \{l\in 「行末に$a_{i}$全角だけのカーンを追加した時の,\textit{glue\_set}の値」を $b_{i}$とおく.式で書くと, \[ -\catcode`\<=12 b_{i} = \begin{dcases*} \frac{\lvert\textit{total}-a_{i}\text{\cs{zw}}\rvert}{T^{+}} &($\textit{total}-a_{i}\text{\cs{zw}}\geq 0$),\\ @@ -11452,7 +11411,7 @@ $|\textit{total}|$の分だけが,行中のグルーの伸び量,あるい \item \textit{total}が「(A)の伸び量の合計」以上ならば,(A)--(K)のどこまで負担すれば \textit{total}以上になるかを計算する. 例えば, -\[\catcode`\<=12 +\[ \textit{total} = (\text{(A)--(B)の伸び量の合計}) + p\cdot (\text{(C)の伸び量の合計}), \qquad 0\le p<1 \] @@ -11618,71 +11577,71 @@ This file conains some information (especially for vertical typesetting) about t Cache management system of \LuaTeX-ja is stored in \texttt{luatexja.base} (\texttt{ltj-base.lua}). There are four public functions for cache management in \texttt{luatexja.base}, -where <filename> stands for the file name \emph{without suffix}: +where \meta{filename} stands for the file name \emph{without suffix}: \begin{cslist} -\item[save\_cache(<filename>, <data>)] -Save a non-nil table <data> into a cache <filename>. -Both the compressed text form <filename>\texttt{.lua.gz} and its binary version +\item[save\_cache(\meta{filename}, \meta{data})] +Save a non-nil table \meta{data} into a cache \meta{filename}. +Both the compressed text form \meta{filename}\texttt{.lua.gz} and its binary version are created or updated. -\item[save\_cache\_luc(<filename>, <data>{[, <serialized\_data>]})] +\item[save\_cache\_luc(\meta{filename}, \meta{data}{[, \meta{serialized\_data}]})] Same as \texttt{save\_cache}, except that only the binary cache is updated. -The third argument <serialized\_data> is not usually given. -But if this is given, it is treated as a string representation of <data>. +The third argument \meta{serialized\_data} is not usually given. +But if this is given, it is treated as a string representation of \meta{data}. -\item[load\_cache(<filename>, <outdate>)] -Load the cache <filename>. -<outdate> is a function which takes one argument (the contents of the cache), +\item[load\_cache(\meta{filename}, \meta{outdate})] +Load the cache \meta{filename}. +\meta{outdate} is a function which takes one argument (the contents of the cache), and its return value is whether the cache is outdated. \texttt{load\_cache} first tries to -read the binary cache <filename>\texttt{.luc}. +read the binary cache \meta{filename}\texttt{.luc}. If its contents is up-to-date, \texttt{load\_cache} returns the contents. If the binary cache is not found or its contents is outdated, \texttt{load\_cache} tries to -read the compressed text form <filename>\texttt{.lua.gz}. +read the compressed text form \meta{filename}\texttt{.lua.gz}. Hence, the return value of \texttt{load\_cache} is non-nil, if and only if the updated cache is found. -\item[remove\_cache(<filename>)] -Remove the cahce <filename>. +\item[remove\_cache(\meta{filename})] +Remove the cahce \meta{filename}. \end{cslist} %</en> %<*ja> \subsection{内部命令} \LuaTeX-jaにおけるキャッシュ管理は,\texttt{luatexja.base}~(\texttt{ltj-base.lua})に 実装しており,以下の関数が公開されている. -ここで,<filename>は保存するキャッシュのファイル名を\emph{拡張子なしで}指定する. +ここで,\meta{filename}は保存するキャッシュのファイル名を\emph{拡張子なしで}指定する. \begin{cslist} -\item[save\_cache(<filename>, <data>)] -nilでない<data>をキャッシュ<filename>に保存する. -テキスト形式の<filename>\texttt{.lua.gz}\footnote{拡張子からわかる通り,実際にはgzip圧縮される.}のみならず, +\item[save\_cache(\meta{filename}, \meta{data})] +nilでない\meta{data}をキャッシュ\meta{filename}に保存する. +テキスト形式の\meta{filename}\texttt{.lua.gz}\footnote{拡張子からわかる通り,実際にはgzip圧縮される.}のみならず, そのバイナリ形式も作成・更新される. -\item[save\_cache\_luc(<filename>, <data>{[, <serialized\_data>]})] +\item[save\_cache\_luc(\meta{filename}, \meta{data}{[, \meta{serialized\_data}]})] \texttt{save\_cache}と同様だが,バイナリキャッシュのみが更新される. -第3引数<serialized\_data>が与えられた場合,それを -<data>の文字列化表現として使用する. -そのため,<serialized\_data>は普通は指定しないことになるだろう. +第3引数\meta{serialized\_data}が与えられた場合,それを +\meta{data}の文字列化表現として使用する. +そのため,\meta{serialized\_data}は普通は指定しないことになるだろう. -\item[load\_cache(<filename>, <outdate>)] -キャッシュ<filename>を読み込む. -<outdate>は1引数(キャッシュの中身)をとる関数であり, +\item[load\_cache(\meta{filename}, \meta{outdate})] +キャッシュ\meta{filename}を読み込む. +\meta{outdate}は1引数(キャッシュの中身)をとる関数であり, その戻り値は「キャッシュの更新が必要」かどうかを示すブール値でないといけない. -\texttt{load\_cache}は,まずバイナリキャッシュ<filename>\texttt{.luc}を -読みこむ.もしその内容が「新しい」,つまり<outdate>の評価結果が \texttt{false} なら +\texttt{load\_cache}は,まずバイナリキャッシュ\meta{filename}\texttt{.luc}を +読みこむ.もしその内容が「新しい」,つまり\meta{outdate}の評価結果が \texttt{false} なら \texttt{load\_cache}はこのバイナリキャッシュの中身を返す. もしバイナリキャッシュが見つからなかったか,「古すぎる」ならば(gzip圧縮された)テキスト形式の - <filename>\texttt{.lua.gz}を読み込み,<outdate>で再度評価する. + \meta{filename}\texttt{.lua.gz}を読み込み,\meta{outdate}で再度評価する. 以上より,\texttt{load\_cache}自体がnilでない値を返すのは,ちょうど「新しい」キャッシュが 見つかった場合である. -\item[remove\_cache(<filename>)] -キャッシュ<filename>を削除する.テキスト形式(gzip圧縮されているか否かを問わず)も +\item[remove\_cache(\meta{filename})] +キャッシュ\meta{filename}を削除する.テキスト形式(gzip圧縮されているか否かを問わず)も バイナリ形式もまとめて削除する. \end{cslist} %</ja> @@ -11912,12 +11871,16 @@ direction~whatsit内部のノードリストに,\textit{dir\_box}として格 {\fboxsep0pt\fcolorbox{cyan}{white}% {\large\KOZM\ltjjachar"#1#2#3#4}}\ (\texttt{U+#1#2#3#4})%" } + \def\DH#1#2#3#4{% + {\fboxsep0pt\fcolorbox{cyan}{white}% + {\large\ltjjachar"#1#2#3#4}}\ (\texttt{U+#1#2#3#4})%" + } \caption{\LuaTeX-ja標準で行われる縦組形への置換} \label{tab:vert_replace}\small\centering \begin{tabular}{*{3}{l@{}>{${}\longmapsto{}$}c@{}l}} \toprule - \D 3001&&\D FE11&\D 3002&&\D FE12&\D 3016&&\D FE17\\ - \D 3017&&\D FE18&\D 2026&&\D FE19&\D 2025&&\D FE30\\ + \D 3001&&\D FE11&\D 3002&&\D FE12&\D 3016&&\DH FE17\\ + \D 3017&&\DH FE18&\D 2026&&\D FE19&\D 2025&&\D FE30\\ \D 2014&&\D FE31&\D 2013&&\D FE32&\D FF3F&&\D FE33\\ \D FF08&&\D FE35&\D FF09&&\D FE36&\D FF5B&&\D FE37\\ \D FF5D&&\D FE38&\D 3014&&\D FE39&\D 3015&&\D FE3A\\ @@ -11999,6 +11962,22 @@ ISO 32000-1:2008, \textit{Document management -- Portable document format -- Par \bibitem{bxghost} Takuto ASAKURA. \newblock The \textsf{BXghost} Package. \url{https://github.com/wtsnjp/BXghost} \end{thebibliography} +\makeatletter +\let\ltj@@end=\@@end +{\catcode`\%=12\relax\catcode`\~=12\relax +\protected\gdef\@@end{% +\typeout{attributes:} +\directlua{ + for i=0,65535 do + local a = tex.getattribute(i) + if a~=-0x7FFFFFFF then + texio.write_nl('term and log', + string.format('attr %6d, %d', i, a)) + end + tex.setbox('global', i, nil) + end + print('IC', luatexja.inherit_na_count ) +}\ltj@@end}} \end{document} %</!showexpl> %<*showexpl> diff --git a/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx b/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx index e2d4dd9a509..f05afe97c1b 100644 --- a/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx +++ b/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx @@ -139,6 +139,7 @@ % (sync with ltsect.dtx 2020/07/27 v1.1e)} % \changes{v1.8f-ltj-21}{2021-12-22}{余計なコメントの削除.} % \changes{v1.8f-ltj-22}{2022-04-11}{kern featureが有効になっていたのを修正.} +% \changes{v1.8f-ltj-23}{2022-09-12}{|\stockwidth|がカーネルで定義される可能性に対応.} % \fi % % \iffalse @@ -168,7 +169,7 @@ %<11pt&bk>\ProvidesFile{ltjtbk11.clo} %<12pt&bk>\ProvidesFile{ltjtbk12.clo} %</tate> - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 %<article|report|book> Standard LuaLaTeX-ja class] %<10pt|11pt|12pt> Standard LuaLaTeX-ja file (size option)] %<*driver> @@ -977,10 +978,13 @@ % [2017-01-17 LTJ] [lt]jsclassesに合わせ、トンボオプションが指定されているとき「だけ」|\stockwidth|、 % |\stockheight|を定義するようにしました。aminophenさん、ありがとうございます。 % +% [2022-09-12 LTJ] \LaTeXe カーネルに|\stockwidth|、|\stockheight|が追加されるようですので、 +% クラスファイル側では未定義のときのみこれらの長さ変数を定義します。h20y6mさん、ありがとうございます。 +% % \begin{macrocode} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx b/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx index e190617c155..a1512103390 100644 --- a/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx +++ b/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx @@ -44,7 +44,7 @@ %<*driver> \ProvidesFile{ltjsclasses.dtx} %</driver> - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] %<*driver> \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{} \documentclass[disablejfam]{ltjsarticle} @@ -808,13 +808,15 @@ \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -892,10 +894,13 @@ % [2017-01-11] トンボオプションが指定されているとき「だけ」|\stockwidth|, % |\stockheight|を定義するようにしました。 % +% [2022-09-12 LTJ] \LaTeXe カーネルに|\stockwidth|、|\stockheight|が追加されるようですので、 +% クラスファイル側では未定義のときのみこれらの長さ変数を定義します。h20y6mさん、ありがとうございます。 +% % \begin{macrocode} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/source/luatex/luatexja/tool/test_exist_nodelib.tex b/Master/texmf-dist/source/luatex/luatexja/tool/test_exist_nodelib.tex new file mode 100644 index 00000000000..2d9ee7c3aeb --- /dev/null +++ b/Master/texmf-dist/source/luatex/luatexja/tool/test_exist_nodelib.tex @@ -0,0 +1,104 @@ +\catcode`\{=1 \catcode`\}=2 +\directlua{ +kpse.set_program_name('luatex') +print() print("LUATEX: ", tex.luatexversion, _VERSION) + +function test(c) + if not node[c] then print ('not imple: node.' .. c) end +end +test "direct" +test "free" +test "get_attribute" +test "getglue" +test "id" +test "insert_after" +test "is_node" +test "mlist_to_hlist" +test "new" +test "next" +test "set_attribute" +test "slide" +test "subtype" +test "tail" +test "traverse" +test "type" +test "write" + +function test(c) + if not node.direct[c] then print ('not imple: node.direct.' .. c) end +end + +test "copy" +test "copy_list" +test "dimensions" +test "end_of_math" +test "flush_list" +test "free" +test "get_attribute" +test "getattributelist" +test "getbox" +test "getchar" +test "getcomponents" +test "getdata" +test "getdepth" +test "getdir" +test "getfield" +test "getfont" +test "getglue" +test "getheight" +test "getid" +test "getkern" +test "getlang" +test "getlist" +test "getnext" +test "getnucleus" +test "getoffsets" +test "getpenalty" +test "getprev" +test "getshift" +test "getsub" +test "getsubtype" +test "getsup" +test "getwhd" +test "getwidth" +test "has_attribute" +test "hpack" +test "insert_after" +test "insert_before" +test "last_node" +test "new" +test "rangedimensions" +test "remove" +test "set_attribute" +test "setattributelist" +test "setchar" +test "setdata" +test "setdepth" +test "setdir" +test "setfield" +test "setfont" +test "setglue" +test "setheight" +test "setkern" +test "setlang" +test "setlist" +test "setnext" +test "setnucleus" +test "setoffsets" +test "setpenalty" +test "setshift" +test "setsub" +test "setsubtype" +test "setsup" +test "setwhd" +test "setwidth" +test "tail" +test "todirect" +test "tonode" +test "traverse" +test "traverse_id" +test "unset_attribute" +test "vpack" +test "write" +} +\end diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty index 6ac200b7e60..37346b2fad3 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-otf.sty @@ -64,7 +64,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-otf}[2019-09-26] + \ProvidesPackage{luatexja-otf}[2022-10-02] \fi %</LaTeX> % Load core module if not yet. @@ -85,8 +85,7 @@ %! Main part of luatexja-otf \RequireLuaTeXjaSubmodule{otf} -\newcount\ltj@tempcnta - +%\newcount\ltj@tempcnta % defined at luatexja-core.sty \protected\def\CID#1{\ifvmode\leavevmode\fi\ltj@tempcnta#1\relax\directlua{luatexja.otf.cid(\the\ltj@tempcnta)}\relax} %% \UTF compatible with the OTF package for pLaTeX diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-CCT.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-CCT.lua index c41f6da311d..5d861ba761e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-CCT.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-CCT.lua @@ -13,7 +13,7 @@ luatexja.jfont.define_jfm { [1] = { -- fw. opening punctuations chars = { - 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, + 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, 0x3018, 0x301D, 0xFF08, 0xFF3B, 0xFF5B, 0xFF5F }, align = 'right', left = 0.0, down = 0.0, @@ -25,9 +25,9 @@ luatexja.jfont.define_jfm { [2] = { -- fw. closing/colon punctuations chars = { - 0x2019, 0x201D, 0x3001, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, + 0x2019, 0x201D, 0x3001, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, 0x3017, 0x3019, 0x301F, 0xFF09, 0xFF0C, 0xFF3D, 0xFF5D, 0xFF60, - 0xFF1A, 0xFF1B + 0xFF1A, 0xFF1B }, align = 'left', left = 0.0, down = 0.0, width = 0.5, height = 0.88, depth = 0.12, italic=0.0, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-banjiao.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-banjiao.lua index 783e836ba2f..b30d040548b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-banjiao.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-banjiao.lua @@ -13,7 +13,7 @@ luatexja.jfont.define_jfm { [1] = { -- fw. opening punctuations chars = { - 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, + 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, 0x3018, 0x301D, 0xFF08, 0xFF3B, 0xFF5B, 0xFF5F }, align = 'right', left = 0.0, down = 0.0, @@ -25,7 +25,7 @@ luatexja.jfont.define_jfm { [2] = { -- fw. closing/colon/dot punctuations, except 4 & 7 chars = { - 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, + 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, 0x3017, 0x3019, 0x301F, 0xFF09, 0xFF0C, 0xFF3D, 0xFF5D, 0xFF60, 0xFF0E, 0xFF1A, 0xFF1B, 0xFF01, 0xFF1F }, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-jis.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-jis.lua index 642a2475e54..818e3abc800 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-jis.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-jis.lua @@ -21,7 +21,7 @@ luatexja.jfont.define_jfm { [1] = { -- 開き括弧類 chars = { - '‘', '“', '〈', '《', '「', '『', '【', '〔', '〖', + '‘', '“', '〈', '《', '「', '『', '【', '〔', '〖', '〘', '〝', '(', '[', '{', '⦅' }, align = 'right', left = 0.0, down = 0.0, @@ -33,7 +33,7 @@ luatexja.jfont.define_jfm { [2] = { -- 閉じ括弧類 chars = { - '’', '”', '、', '〉', '》', '」', '』', '】', '〕', + '’', '”', '、', '〉', '》', '」', '』', '】', '〕', '〗', '〙', '〟', ')', ',', ']', '}', '⦆' }, align = 'left', left = 0.0, down = 0.0, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-kaiming.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-kaiming.lua index 63ac222311d..a0464884752 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-kaiming.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-kaiming.lua @@ -13,7 +13,7 @@ luatexja.jfont.define_jfm { [1] = { -- fw. opening punctuations chars = { - 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, + 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, 0x3018, 0x301D, 0xFF08, 0xFF3B, 0xFF5B, 0xFF5F }, align = 'right', left = 0.0, down = 0.0, @@ -25,9 +25,9 @@ luatexja.jfont.define_jfm { [2] = { -- fw. closing/colon/dot punctuations, except 4 & 7 chars = { - 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, + 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, 0x3017, 0x3019, 0x301F, 0xFF09, 0xFF0C, 0xFF3D, 0xFF5D, 0xFF60, - 0xFF0E, 0xFF1A, 0xFF1B + 0xFF0E, 0xFF1A, 0xFF1B }, align = 'left', left = 0.0, down = 0.0, width = 0.5, height = 0.88, depth = 0.12, italic=0.0, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-min.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-min.lua index b59b5329c48..e07b3300396 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-min.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-min.lua @@ -68,8 +68,8 @@ luatexja.jfont.define_jfm { [3] = { chars = { '∴', '♀', '♂', '〃', '々', 'ぁ', 'ぃ', 'ぅ', 'ぇ', 'ぉ', 'っ', 'ゃ', 'ゅ ', - 'ょ', 'ゎ', 'ゕ', 'ゖ', 'ゞ', 'ァ', 'ィ', 'ゥ', 'ェ', 'ォ', 'ッ', 'ャ', 'ュ', 'ョ', - 'ヮ', 'ヵ', 'ヶ', 'ㇰ', 'ㇱ', 'ㇲ', 'ㇳ', 'ㇴ', 'ㇵ', 'ㇶ', 'ㇷ', 'ㇸ', 'ㇹ', 'ㇺ', + 'ょ', 'ゎ', 'ゕ', 'ゖ', 'ゞ', 'ァ', 'ィ', 'ゥ', 'ェ', 'ォ', 'ッ', 'ャ', 'ュ', 'ョ', + 'ヮ', 'ヵ', 'ヶ', 'ㇰ', 'ㇱ', 'ㇲ', 'ㇳ', 'ㇴ', 'ㇵ', 'ㇶ', 'ㇷ', 'ㇸ', 'ㇹ', 'ㇺ', 'ㇻ', 'ㇼ', 'ㇽ', 'ㇾ', 'ㇿ', '$', '¢', '£' }, align = 'middle', left = 0.0, down = 0.0, @@ -207,7 +207,7 @@ luatexja.jfont.define_jfm { }, [12] = { chars = { - 'ア', 'イ', 'ウ', 'オ', 'ケ', 'ゲ', 'サ', 'ザ', 'ソ', 'ゾ', 'チ', 'ヂ', 'ツ', + 'ア', 'イ', 'ウ', 'オ', 'ケ', 'ゲ', 'サ', 'ザ', 'ソ', 'ゾ', 'チ', 'ヂ', 'ツ', 'ヅ', 'ト', 'ド', 'ナ', 'フ', 'ブ', 'プ', 'ミ', 'メ', 'ラ', 'リ', 'ワ', 'ヲ' }, align = 'left', left = 0.0, down = 0.0, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-quanjiao.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-quanjiao.lua index 20590b6a961..2718e1b7155 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-quanjiao.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-quanjiao.lua @@ -13,7 +13,7 @@ luatexja.jfont.define_jfm { [1] = { -- fw. opening punctuations chars = { - 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, + 0x2018, 0x201C, 0x3008, 0x300A, 0x300C, 0x300E, 0x3010, 0x3014, 0x3016, 0x3018, 0x301D, 0xFF08, 0xFF3B, 0xFF5B, 0xFF5F }, align = 'right', left = 0.0, down = 0.0, @@ -25,7 +25,7 @@ luatexja.jfont.define_jfm { [2] = { -- fw. closing/colon/dot punctuations, except 4 & 7 chars = { - 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, + 0x2019, 0x201D, 0x3009, 0x300B, 0x300D, 0x300F, 0x3011, 0x3015, 0x3017, 0x3019, 0x301F, 0xFF09, 0xFF0C, 0xFF3D, 0xFF5D, 0xFF60, 0xFF0E, 0xFF1A, 0xFF1B, 0xFF01, 0xFF1F }, diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua index 08f567d20ab..2b94eca6dbc 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua @@ -26,7 +26,7 @@ local t = { [207] = { 0, 0, 0, kanjiskip_shrink=1 }, [8] = { 0, 0, 0, kanjiskip_shrink=1 }, }, - kern = { [307] = 0 }, + kern = { [307] = 0 }, round_threshold = 0.01, }, @@ -250,7 +250,7 @@ local t = { [6] = { 0, 0, 0, kanjiskip_shrink=1 }, [8] = { 0, 0, 0, kanjiskip_shrink=1 }, }, - kern = { [307] = 0 }, + kern = { [307] = 0 }, }, [107] = { -- 1/3 角 diff --git a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua index 2bfe670b9e5..7e870046c53 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua @@ -26,7 +26,7 @@ local t = { [207] = { 0, 0, 0, kanjiskip_shrink=1 }, [8] = { 0, 0, 0, kanjiskip_shrink=1 }, }, - kern = { [307] = 0 }, + kern = { [307] = 0 }, round_threshold = 0.01, }, diff --git a/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty b/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty index 532e7a29341..a83c9305c93 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjext}[2021-04-20 v1.2k-ltj-13 Macros for vertical writing] +\ProvidesPackage{lltjext}[2022-08-24 v1.2k-ltj-14 Macros for vertical writing] \RequirePackage{luatexja} \newcount\ltj@ext@dir \let\ltj@lltjext@orig@tabular=\tabular @@ -511,6 +511,8 @@ \def\ltj@@pic@reset@blshift{% \ltj@yablshift\z@\ltj@ykblshift\z@ \ltj@tablshift\z@\ltj@tkblshift\z@ + %\unsetattribute\ltj@yablshift\unsetattribute\ltj@ykblshift + %\unsetattribute\ltj@tablshift\unsetattribute\ltj@tkblshift }% \def\@@picture<#1>(#2,#3)(#4,#5){% \edef\ltj@@pic@save@blshift{% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua index 053b63ab1a4..89ad7816d2d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua @@ -12,21 +12,29 @@ luatexja.adjust = luatexja.adjust or {} local to_node = node.direct.tonode local to_direct = node.direct.todirect -local setfield = node.direct.setfield -local setglue = luatexja.setglue local getfield = node.direct.getfield local getlist = node.direct.getlist local getid = node.direct.getid local getfont = node.direct.getfont local getsubtype = node.direct.getsubtype +local getlang = node.direct.getlang +local getkern = node.direct.getkern +local getshift = node.direct.getshift +local getwidth = node.direct.getwidth +local getdepth = node.direct.getdepth +local setfield = node.direct.setfield +local setpenalty = node.direct.setpenalty +local setglue = node.direct.setglue +local setkern = node.direct.setkern +local setlist = node.direct.setlist local node_traverse_id = node.direct.traverse_id local node_new = node.direct.new local node_next = node.direct.getnext -local node_free = node.direct.free +local node_free = node.direct.flush_node or node.direct.free local node_prev = node.direct.getprev local node_tail = node.direct.tail -local has_attr = node.direct.has_attribute +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute local insert_after = node.direct.insert_after @@ -55,7 +63,7 @@ local get_attr_icflag do local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG get_attr_icflag = function(p) - return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG + return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG end end @@ -73,7 +81,7 @@ do for i=0,63 do tmp[#tmp+1] = { (i%8)-4, FROM_JFM+i } end else -- stretch for i=0,63 do tmp[#tmp+1] = { math.floor(i/8)-4, FROM_JFM+i } end - end + end local pt = priority_table[glue_sign] tmp[#tmp+1] = { pt[2]/10, XKANJI_SKIP } tmp[#tmp+1] = { pt[2]/10, XKANJI_SKIP_JFM } @@ -111,13 +119,13 @@ function get_total_stretched(p) for q in node_traverse_id(id_glue, ph) do local a = getfield(q, 'stretch_order') if a==0 then - local b = at2pr_st[get_attr_icflag(q)]; + local b = at2pr_st[get_attr_icflag(q)]; total_st[b] = total_st[b]+getfield(q, 'stretch') end total_st[a*65536] = total_st[a]+getfield(q, 'stretch') local a = getfield(q, 'shrink_order') if a==0 then - local b = at2pr_sh[get_attr_icflag(q)]; + local b = at2pr_sh[get_attr_icflag(q)]; total_sh[b] = total_sh[b]+getfield(q, 'shrink') end total_sh[a*65536] = total_sh[a]+getfield(q, 'shrink') @@ -130,7 +138,7 @@ function get_total_stretched(p) if not total_sh.order then total_sh.order, total_sh[-65536] = -1,0.1 -- dummy end - return getfield(p,'width') - dimensions(ph) + return getwidth(p) - dimensions(ph) end end @@ -152,7 +160,7 @@ local function aw_step1(p, total) -- 無限大のグルーで処理が行われているときは処理中止. return total, false end - if xi == id_glyph and getfield(x, 'lang')==lang_ja then + if xi == id_glyph and getlang(x)==lang_ja then -- 和文文字 xc = x elseif xi == id_hlist and get_attr_icflag(x) == PACKED then @@ -163,8 +171,8 @@ local function aw_step1(p, total) return total, false-- それ以外は対象外. end local eadt = ltjf_font_metric_table[getfont(xc)] - .char_type[has_attr(xc, attr_jchar_class) or 0].end_adjust - if not eadt then + .char_type[get_attr(xc, attr_jchar_class) or 0].end_adjust + if not eadt then return total, false end local eadt_ratio = {} @@ -176,8 +184,8 @@ local function aw_step1(p, total) eadt_ratio[i] = {i, t/total_sh[65536*total_sh.order], t, v} end end - table.sort(eadt_ratio, - function (a,b) + table.sort(eadt_ratio, + function (a,b) for i=2,4 do local at, bt = abs(a[i]), abs(b[i]) if at~=bt then return at<bt end @@ -186,7 +194,7 @@ local function aw_step1(p, total) end) if eadt[eadt_ratio[1][1]]~=0 then local kn = node_new(id_kern, 1) - setfield(kn, 'kern', eadt[eadt_ratio[1][1]]); set_attr(kn, attr_icflag, LINEEND) + setkern(kn, eadt[eadt_ratio[1][1]]); set_attr(kn, attr_icflag, LINEEND) insert_after(head, x, kn) return eadt_ratio[1][3], true else @@ -196,6 +204,7 @@ end -- step 1 最終行用 local min, max = math.min, math.max +local setsubtype = node.direct.setsubtype local function aw_step1_last(p, total) local head = getlist(p) local x = node_tail(head); if not x then return total, false end @@ -204,7 +213,7 @@ local function aw_step1_last(p, total) if getid(pf) ~= id_glue or getsubtype(pf) ~= 15 then return total, false end x = node_prev(node_prev(pf)) local xi, xc = getid(x) - if xi == id_glyph and getfield(x, 'lang')==lang_ja then + if xi == id_glyph and getlang(x)==lang_ja then -- 和文文字 xc = x elseif xi == id_hlist and get_attr_icflag(x) == PACKED then @@ -230,30 +239,30 @@ local function aw_step1_last(p, total) end end local eadt = ltjf_font_metric_table[getfont(xc)] - .char_type[has_attr(xc, attr_jchar_class) or 0].end_adjust - if not eadt then + .char_type[get_attr(xc, attr_jchar_class) or 0].end_adjust + if not eadt then return total, false end -- 続行条件2: min(eadt[1], 0)<= \parfillskip <= max(eadt[#eadt], 0) - local pfw = getfield(pf, 'width') - + (total>0 and getfield(pf, 'stretch') or -getfield(pf, 'shrink')) *getfield(p, 'glue_set') + local pfw = getwidth(pf) + + (total>0 and getfield(pf, 'stretch') or -getfield(pf, 'shrink')) *getfield(p, 'glue_set') if pfw<min(0,eadt[1]) or max(0,eadt[#eadt])<pfw then return total, false end -- \parfillskip を 0 にする - total = total + getfield(pf, 'width') + total = total + getwidth(pf) total_st.order, total_sh.order = 0, 0 - if getfield(pf, 'stretch_order')==0 then - local i = at2pr_st[-1] - total_st[0] = total_st[0] - getfield(pf, 'stretch') - total_st[i] = total_st[i] - getfield(pf, 'stretch') + if getfield(pf, 'stretch_order')==0 then + local i = at2pr_st[-1] + total_st[0] = total_st[0] - getfield(pf, 'stretch') + total_st[i] = total_st[i] - getfield(pf, 'stretch') total_st.order = (total_st[0]==0) and -1 or 0 end - if getfield(pf, 'shrink_order')==0 then - local i = at2pr_sh[-1] - total_sh[0] = total_sh[0] - getfield(pf, 'shrink') - total_sh[i] = total_sh[i] - getfield(pf, 'shrink') + if getfield(pf, 'shrink_order')==0 then + local i = at2pr_sh[-1] + total_sh[0] = total_sh[0] - getfield(pf, 'shrink') + total_sh[i] = total_sh[i] - getfield(pf, 'shrink') total_sh.order = (total_sh[0]==0) and -1 or 0 end - setfield(pf, 'subtype', 1); setglue(pf) + setsubtype(pf, 1); setglue(pf) local eadt_ratio = {} for i, v in ipairs(eadt) do local t = total - v @@ -263,8 +272,8 @@ local function aw_step1_last(p, total) eadt_ratio[i] = {i, t/total_sh[65536*total_sh.order], t, v} end end - table.sort(eadt_ratio, - function (a,b) + table.sort(eadt_ratio, + function (a,b) for i=2,4 do local at, bt = abs(a[i]), abs(b[i]) if at~=bt then return at<bt end @@ -273,7 +282,7 @@ local function aw_step1_last(p, total) end) if eadt[eadt_ratio[1][1]]~=0 then local kn = node_new(id_kern, 1) - setfield(kn, 'kern', eadt[eadt_ratio[1][1]]); set_attr(kn, attr_icflag, LINEEND) + setkern(kn, eadt[eadt_ratio[1][1]]); set_attr(kn, attr_icflag, LINEEND) insert_after(head, x, kn) return eadt_ratio[1][3], true else @@ -289,9 +298,9 @@ local node_hpack = node.direct.hpack local function repack(p) local orig_of, orig_hfuzz, orig_hbad = tex.overfullrule, tex.hfuzz, tex.hbadness tex.overfullrule=0; tex.hfuzz=1073741823; tex.hbadness=10000 - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') + local f = node_hpack(getlist(p), getwidth(p), 'exactly') tex.overfullrule=orig_of; tex.hfuzz=orig_hfuzz; tex.hbadness=orig_hbad - setfield(f, 'head', nil) + setlist(f, nil) setfield(p, 'glue_set', getfield(f, 'glue_set')) setfield(p, 'glue_order', getfield(f, 'glue_order')) setfield(p, 'glue_sign', getfield(f, 'glue_sign')) @@ -328,14 +337,14 @@ function aw_step2(p, total, added_flag) local id = (total>0) and 1 or 2 local res = total_stsh[id] local pnum = priority_num[id] - if total==0 or res.order > 0 then + if total==0 or res.order > 0 then -- もともと伸縮の必要なしか,残りの伸縮量は無限大 if added_flag then return repack(p) end end total = abs(total) for i = 1, pnum do if total <= res[i] then - local a = at2pr[id] + local a = at2pr[id] for j = i+1,pnum do clear_stretch(p, j, a, name) end @@ -353,32 +362,32 @@ do local insert_before = node.direct.insert_before local KINSOKU = luatexja.icflag_table.KINSOKU insert_lineend_kern = function (head, nq, np, Bp) - if nq.met then + if nq.met then local eadt = nq.met.char_type[nq.class].end_adjust if not eadt then return end if eadt[1]~=0 then local x = node_new(id_kern, 1) - setfield(x, 'kern', eadt[1]); set_attr(x, attr_icflag, LINEEND) + setkern(x, eadt[1]); set_attr(x, attr_icflag, LINEEND) insert_before(head, np.first, x) end local eadt_num = #eadt for i=2,eadt_num do local x = node_new(id_penalty) - setfield(x, 'penalty', 0); set_attr(x, attr_icflag, KINSOKU) + setpenalty(x, 0); set_attr(x, attr_icflag, KINSOKU) insert_before(head, np.first, x); Bp[#Bp+1] = x local x = node_new(id_kern, 1) - setfield(x, 'kern', eadt[i]-eadt[i-1]); set_attr(x, attr_icflag, LINEEND) + setkern(x, eadt[i]-eadt[i-1]); set_attr(x, attr_icflag, LINEEND) insert_before(head, np.first, x) end if eadt_num>1 or eadt[1]~=0 then local x = node_new(id_penalty) - setfield(x, 'penalty', 0); set_attr(x, attr_icflag, KINSOKU) + setpenalty(x, 0); set_attr(x, attr_icflag, KINSOKU) insert_before(head, np.first, x); Bp[#Bp+1] = x local x = node_new(id_kern, 1) - setfield(x, 'kern', -eadt[eadt_num]); set_attr(x, attr_icflag, LINEEND) + setkern(x, -eadt[eadt_num]); set_attr(x, attr_icflag, LINEEND) insert_before(head, np.first, x) local x = node_new(id_penalty) - setfield(x, 'penalty', 10000); set_attr(x, attr_icflag, KINSOKU) + setpenalty(x, 10000); set_attr(x, attr_icflag, KINSOKU) insert_before(head, np.first, x); Bp[#Bp+1] = x end end @@ -389,7 +398,6 @@ local adjust_width do local myaw_step1, myaw_step2, myaw_step1_last local dummy = function(p,t,n) return t, false end - local ltjs_fast_get_stack_skip = ltjs.fast_get_stack_skip function adjust_width(head) if not head then return head end local last_p @@ -408,7 +416,7 @@ do local function enable_cb(status_le, status_pr, status_lp, status_ls) if (status_le>0 or status_pr>0) and (not is_reg) then ltjb.add_to_callback('post_linebreak_filter', - adjust_width, 'Adjust width', + adjust_width, 'Adjust width', luatexbase.priority_in_callback('post_linebreak_filter', 'ltj.lineskip')-1) is_reg = true elseif is_reg and (status_le==0 and status_pr==0) then @@ -493,28 +501,26 @@ luatexja.unary_pars.profile_hgap_factor = function(t) return luatexja.adjust.profile_hgap_factor end do - local insert = table.insert + local insert, texget = table.insert, tex.get local rangedimensions, max = node.direct.rangedimensions, math.max local function profile_inner(box, range, ind, vmirrored, adj) - local w_acc, d_before = getfield(box,'shift'), 0 + local w_acc, d_before = getshift(box), 0 local x = getlist(box); local xn = node_next(x) while x do local w, h, d - if xn then w, h, d= rangedimensions(box,x,xn) - else w, h, d= rangedimensions(box,x) end + if xn then w, h, d = rangedimensions(box,x,xn) + else w, h, d = rangedimensions(box,x) end if vmirrored then h=d end local w_new = w_acc + w - if w>=0 then - range:insert(ind, h, w_acc-adj, w_new) - else - range:insert(ind, h, w_new-adj, w_acc) + if w>=0 then range:insert(ind, h, w_acc-adj, w_new) + else range:insert(ind, h, w_new-adj, w_acc) end w_acc = w_new; x = xn; if x then xn = node_next(x) end end - end + end function ltjl.p_profile(before, after, mirrored, bw) - local range, tls - = init_range(), luatexja.adjust.profile_hgap_factor*tex.get('lineskip', false) + local range, tls + = init_range(), luatexja.adjust.profile_hgap_factor*texget('lineskip', false) profile_inner(before, range, 3, true, tls) profile_inner(after, range, 4, mirrored, tls) range = range:flatten() @@ -527,8 +533,8 @@ do if bw-h-d<lmin then lmin=bw-h-d end end if lmin==1/0 then lmin = bw end - return lmin, - bw - lmin - getfield(before, 'depth') + return lmin, + bw - lmin - getdepth(before) - getfield(after, mirrored and 'depth' or 'height') end end @@ -536,7 +542,7 @@ end do local ltja = luatexja.adjust - local copy_glue = ltjl.copy_glue + local copy_glue, texget = ltjl.copy_glue, tex.get local floor, max = math.floor, math.max function ltjl.l_step(dist, g, adj, normal, bw, loc) if loc=='alignment' then @@ -544,7 +550,7 @@ do end if dist < tex.lineskiplimit then local f = max(1, bw*ltja.step_factor) - copy_glue(g, 'baselineskip', 1, normal - f * floor((dist-tex.get('lineskip', false))/f)) + copy_glue(g, 'baselineskip', 1, normal - f * floor((dist-texget('lineskip', false))/f)) else copy_glue(g, 'baselineskip', 2, normal) end @@ -556,13 +562,15 @@ do local sid_user = node.subtype 'user_defined' local node_remove = node.direct.remove local node_write = node.direct.write + local getvalue = node.direct.getdata + local setvalue = node.direct.setdata local GHOST_JACHAR = luatexbase.newuserwhatsitid('ghost of a jachar', 'luatexja') luatexja.userid_table.GHOST_JACHAR = GHOST_JACHAR function ltja.create_ghost_jachar_node(cl) local tn = node_new(id_whatsit, sid_user) setfield(tn, 'user_id', GHOST_JACHAR) setfield(tn, 'type', 100) - setfield(tn, 'value', cl) + setvalue(tn, cl) node_write(tn) end local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] @@ -570,19 +578,21 @@ do local dir_tate = luatexja.dir_table.dir_tate local get_dir_count = ltjd.get_dir_count local ltjf_font_metric_table = ltjf.font_metric_table + local has_attr = node.direct.has_attribute local function get_current_metric(n) - local fn = has_attr(n, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) + local fn = get_attr(n, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) return fn and ltjf_font_metric_table[fn] end local function whatsit_callback(Np, lp, Nq) if Np and Np.nuc then return Np elseif Np and getfield(lp, 'user_id') == GHOST_JACHAR then Np.first = lp; Np.nuc = lp; Np.last = lp; Np.class = 0 - if getfield(lp,'value')<2 then + if getvalue(lp)<2 then if Nq and Nq.met then Np.met = Nq.met; else Np.met = get_current_metric(lp) end Np.pre = 0; Np.post = 0; Np.xspc = 3 else Np.met, Np.pre = nil, nil; end - Np.auto_kspc, Np.auto_xspc = (has_attr(lp, attr_autospc)==1), (has_attr(lp, attr_autoxspc)==1) + Np.auto_kspc, Np.auto_xspc + = not has_attr(lp, attr_autospc, 0), not has_attr(lp, attr_autoxspc, 0) return Np else return Np end end @@ -590,7 +600,7 @@ do if not s and getfield(Nq.nuc, 'user_id') == GHOST_JACHAR then local x, y = node_prev(Nq.nuc), Nq.nuc Nq.first, Nq.nuc, Nq.last = x, x, x - if getfield(y,'value')%2==0 then + if getvalue(y)%2==0 then if Np and Nq.met then Nq.met = Np.met; else Nq.met = get_current_metric(y) end Nq.pre = 0; Nq.post = 0; Nq.xspc = 3 else Nq.met, Nq.pre = nil, nil; end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua index ad5bb816a57..41caef5b4c7 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua @@ -7,7 +7,7 @@ local node, table, tex, token = node, table, tex, token local cat_lp = luatexbase.catcodetables['latex-package'] --------------------- +-------------------- local ltjb = {} luatexja.base = ltjb @@ -44,7 +44,7 @@ do _error_set_message = function (msgcont, main, help) err_main = message_cont(main, msgcont):gsub(BEL, LF) err_help = (help and help~="") and into_lines(help) - or {"Sorry, I don't know how to help in this situation.", + or {"Sorry, I don't know how to help in this situation.", "Maybe you should try asking a human?" } end @@ -129,7 +129,7 @@ end --- Extension to tex.print(). Each argument string may contain -- newline characters, in which case the string is output (to -- TeX input stream) as multiple lines. --- @param ... (string) string to output +-- @param ... (string) string to output local function mprint(...) local arg = {...} local lines = {} @@ -202,7 +202,7 @@ do local function in_unicode(c, admit_math) local low = admit_math and -1 or 0 if type(c)~='number' or c<low or c>0x10FFFF then - local s = 'A character number must be between ' .. tostring(low) + local s = 'A character number must be between ' .. tostring(low) .. ' and 0x10ffff.\n' .. (admit_math and "(-1 is used for denoting `math boundary')\n" or '') .. 'So I changed this one to zero.' @@ -222,7 +222,7 @@ end -- * return value: non-nil iff the cache is up-to-date -- save_cache (filename, t): no return value -- save_cache_luc (filename, t): no return value --- save_cache always calls save_cache_luc. +-- save_cache always calls save_cache_luc. -- But sometimes we want to create only the precompiled cache, -- when its 'text' version is already present in LuaTeX-ja distribution. @@ -274,8 +274,8 @@ do if s then local sa = load(s) local f = io.open(fullpath, 'wb') - if f and sa then - f:write(dump(sa, true)) + if f and sa then + f:write(dump(sa, true)) texio.write('log', '(save cache: ' .. fullpath .. ')') f:close() end @@ -307,17 +307,17 @@ do break end end - if (not result) or outdate(result) then - return nil - else - return result + if (not result) or outdate(result) then + return nil + else + return result end end - + local function load_cache(filename, outdate) remove_file_if_exist(savepath .. '/' .. filename .. '.lua') local r = load_cache_a(filename .. luc_suffix, outdate, false) - if r then + if r then return r else local r = load_cache_a(filename .. '.lua.gz', outdate, true) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty index d46b54a1faf..ba88ec9450d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty @@ -20,9 +20,9 @@ %% Registers %\newcount\ltj@tempcnta % defined at luatexja-core.sty +%\newcount\ltj@tempdima % defined at luatexja-core.sty \newcount\ltj@tempcntb \newcount\ltj@tempcntc -\newdimen\ltj@tempdima % \newskip\ltj@tempskipa unused % \newtoks\ltj@temptoks unused diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua index 46075b21664..074ba3ce050 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua @@ -3,17 +3,18 @@ -- luatexbase.provides_module({ name = 'luatexja.charrange', - date = '2020-07-30', + date = '2022-08-19', description = 'Handling the range of Japanese characters', }) luatexja.charrange = {} luatexja.load_module 'base'; local ltjb = luatexja.base local getchar = node.direct.getchar -local has_attr = node.direct.has_attribute -local has_attr_node = node.has_attribute +local get_attr = node.direct.get_attribute +local get_attr_node = node.get_attribute local tex_getattr = tex.getattribute +local UNSET = -0x7FFFFFFF local ATTR_RANGE = 7 luatexja.charrange.ATTR_RANGE = ATTR_RANGE local jcr_cjk, jcr_noncjk = 0, 1 @@ -22,16 +23,22 @@ local kcat_attr_table = {} local pow_table = {} local fn_table = {} -- used in is_ucs_in_japanese_char_direct local nfn_table = {} -- used in is_ucs_in_japanese_char_node -for i = 0, 31*ATTR_RANGE-1 do - local ka, pw = luatexbase.attributes['ltj@kcat'..floor(i/31)], 1/(2^(i%31)) - local jcr_noncjk = jcr_noncjk - kcat_attr_table[i], pow_table[i] = ka, 2^(i%31) - fn_table[i] = function(p) return floor(has_attr(p, ka)*pw)%2 ~= jcr_noncjk end - nfn_table[i] = function(p) return floor(has_attr_node(p, ka)*pw)%2 ~= jcr_noncjk end +do + local ka = luatexbase.attributes['ltj@kcat0'] + for i = 0, 30 do + local pw = 2^i; kcat_attr_table[i], pow_table[i] = ka, pw + fn_table[i] = function(p) return get_attr(p, ka)&pw==0 end + nfn_table[i] = function(p) return get_attr_node(p, ka)&pw==0 end + end +end +for i = 31, 31*ATTR_RANGE-1 do + local ka, pw = luatexbase.attributes['ltj@kcat'..floor(i/31)], 2^(i%31) + kcat_attr_table[i], pow_table[i] = ka, pw + fn_table[i] = function(p) return (get_attr(p, ka) or 0)&pw==0 end + nfn_table[i] = function(p) return (get_attr_node(p, ka) or 0)&pw==0 end end fn_table[-1] = function() return false end -- for char --U+007F nfn_table[-1] = function() return false end -- for char --U+007F -pow_table[31*ATTR_RANGE] = 2^31 -- jcr_table_main[chr_code] = index -- index : internal 0, 1, 2, ..., 216 0: 'other' @@ -71,7 +78,8 @@ function luatexja.charrange.char_to_range(c) -- return the external range number end local function get_range_setting(i) -- i: internal range number - return floor(tex_getattr(kcat_attr_table[i])/pow_table[i])%2 + local a = tex_getattr(kcat_attr_table[i]) + return (a==UNSET and 0 or a)&pow_table[i] end -- glyph_node p は和文文字か? @@ -84,7 +92,7 @@ function luatexja.charrange.is_ucs_in_japanese_char_direct(p ,c) end function luatexja.charrange.is_japanese_char_curlist(c) -- assume that c>=0x80 - return get_range_setting(jcr_table_main[c])~= jcr_noncjk + return get_range_setting(jcr_table_main[c])==0 end -- EXT @@ -96,12 +104,11 @@ function luatexja.charrange.toggle_char_range(g, i) -- i: external range number elseif i==0 then return else local kc - if i>0 then kc=0 else kc=1; i=-i end - if i>=31*ATTR_RANGE then i=0 end - local attr = kcat_attr_table[i] - local a = tex_getattr(attr) - tex.setattribute(g, attr, - (floor(a/pow_table[i+1])*2+kc)*pow_table[i]+a%pow_table[i]) + if i>0 then kc=0 else kc=1; i=-i end; if i>=31*ATTR_RANGE then i=0 end + local attr, p = kcat_attr_table[i], pow_table[i] + local a = tex_getattr(attr); if a==UNSET then a=0 end + a = (a&~p)+kc*p; if a==0 and i>30 then a=UNSET end + tex.setattribute(g, attr, a) end end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua index dfb19ee2d0b..25c9b880c28 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua @@ -4,7 +4,6 @@ luatexja.load_module 'base'; local ltjb = luatexja.base luatexja.load_module 'stack'; local ltjs = luatexja.stack -local stack_table_index = luatexja.stack_table_index -- load jisx0208 table local cache_ver = 3 @@ -18,20 +17,21 @@ end -- \kuten, \jis, \euc, \sjis, \ucs, \kansuji -local utfchar=utf.char +local utfchar, floor = utf.char, math.floor +local texwrite, getcount = tex.write, tex.getcount +local cnt_stack = luatexbase.registernumber 'ltj@@stack' +local KSJ = luatexja.stack_table_index.KSJ +local get_stack_table = ltjs.get_stack_table local function to_kansuji(num) if not num then num=0; return - elseif num<0 then - num = -num; tex.write '-' + elseif num<0 then num = -num; texwrite '-' end local s = "" repeat - s = utfchar( - ltjs.get_stack_table(luatexja.stack_table_index.KSJ + num%10, - '', tex.getcount 'ltj@@stack')) .. s - num=math.floor(num/10) + s = utfchar(get_stack_table(KSJ + num%10, '', getcount(cnt_stack))) .. s + num=num//10 until num==0 - tex.write(s) + texwrite(s) end local function error_invalid_charcode(i) @@ -43,22 +43,22 @@ end -- \ucs: 単なる identity local function from_ucs(i) if type(i)~='number' then error_invalid_charcode(i); i=0 end - tex.write(i) + texwrite(i) end -- \kuten: 面区点 (それぞれで16進2桁を使用)=> Unicode 符号位置 local function from_kuten(i) if type(i)~='number' then error_invalid_charcode(i); i=0 end if (i%256==0)or(i%256>94) then - tex.write '0' - else - tex.write(tostring(jisx0208.table_jisx0208_uptex[math.floor(i/256)*94+(i%256)-94] or 0)) + texwrite '0' + else + texwrite(tostring(jisx0208.table_jisx0208_uptex[(i//256)*94+(i%256)-94] or 0)) end end -- \euc: EUC-JP による符号位置 => Unicode 符号位置 local function from_euc(i) - if type(i)~='number' then + if type(i)~='number' then error_invalid_charcode(i); i=0 elseif i>=0x10000 or i<0xa0a0 then i=0 @@ -75,10 +75,9 @@ end -- \sjis: Shift_JIS による符号位置 => Unicode 符号位置 local function from_sjis(i) if (type(i)~='number') or i>=0x10000 or i<0 then - error_invalid_charcode(i); tex.write '0'; return + error_invalid_charcode(i); texwrite '0'; return end - local c2 = math.floor(i/256) - local c1 = i%256 + local c2, c1 = i//256, i%256 local shift_jisx0213_s1a3_table = { { [false]= 1, [true]= 8}, { [false]= 3, [true]= 4}, @@ -113,7 +112,7 @@ luatexja.binary_pars.kansujichar = function(c, t) 'So I changed this one to zero.') c=0 end - return ltjs.get_stack_table(stack_table_index.KSJ + c, 0, t) + return get_stack_table(KSJ + c, 0, t) end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-debug.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-debug.lua index c337c014fe6..912242615a6 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-debug.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-debug.lua @@ -79,7 +79,7 @@ end local function pformat(fmt, ...) if type(fmt) == "string" then return do_pformat(fmt, ...) - else + else return tosource(fmt) end end @@ -105,7 +105,7 @@ do end local function print_measure() - stop_time_measure('RUN') + stop_time_measure 'RUN' local temp = {} for i,v in pairs(time_stat) do temp[#temp+1] = { i, v[1], v[2], v[2]/v[1] } @@ -121,10 +121,10 @@ do luatexja.base.start_time_measure = start_time_measure luatexja.base.stop_time_measure = stop_time_measure luatexbase.add_to_callback('stop_run', print_measure, 'luatexja.time_measure', 1) - luatexbase.add_to_callback('pre_linebreak_filter', - function(p) - start_time_measure('tex_linebreak'); return p - end, + luatexbase.add_to_callback('pre_linebreak_filter', + function(p) + start_time_measure 'tex_linebreak'; return p + end, 'measure_tex_linebreak', 20000) end end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua index 4a0ad3ab06e..5321f232f45 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua @@ -9,25 +9,32 @@ luatexja.direction = {} local attr_dir = luatexbase.attributes['ltj@dir'] local attr_icflag = luatexbase.attributes['ltj@icflag'] +local dnode = node.direct local cat_lp = luatexbase.catcodetables['latex-package'] -local to_node = node.direct.tonode -local to_direct = node.direct.todirect -local has_attr = node.direct.has_attribute -local set_attr = node.direct.set_attribute -local insert_before = node.direct.insert_before -local insert_after = node.direct.insert_after -local getid = node.direct.getid -local getsubtype = node.direct.getsubtype -local getlist = node.direct.getlist -local setfield = node.direct.setfield -local getfield = node.direct.getfield -local node_new = node.direct.new -local node_tail = node.direct.tail -local node_free = node.direct.free -local node_remove = node.direct.remove -local node_next = node.direct.getnext -local traverse = node.direct.traverse -local traverse_id = node.direct.traverse_id +local to_node = dnode.tonode +local to_direct = dnode.todirect +local get_attr = dnode.get_attribute +local set_attr = dnode.set_attribute +local insert_before = dnode.insert_before +local insert_after = dnode.insert_after +local getid = dnode.getid +local getsubtype = dnode.getsubtype +local getlist = dnode.getlist +local getfield = dnode.getfield +local getwhd = dnode.getwhd +local getvalue = node.direct.getdata +local setfield = dnode.setfield +local setwhd = dnode.setwhd +local setnext = dnode.setnext +local setlist = dnode.setlist +local setvalue = node.direct.setdata + +local node_new = dnode.new +local node_free = dnode.flush_node or dnode.free +local node_remove = dnode.remove +local node_next = dnode.getnext +local traverse = dnode.traverse +local traverse_id = dnode.traverse_id local start_time_measure, stop_time_measure = ltjb.start_time_measure, ltjb.stop_time_measure local abs = math.abs @@ -37,12 +44,11 @@ local id_hlist = node.id 'hlist' local id_vlist = node.id 'vlist' local id_whatsit = node.id 'whatsit' local sid_save = node.subtype 'pdf_save' -local sid_restore= node.subtype 'pdf_restore' -local sid_matrix = node.subtype 'pdf_setmatrix' local sid_user = node.subtype 'user_defined' +local getnest = tex.getnest local tex_nest = tex.nest -local tex_getcount = tex.getcount +local getcount = tex.getcount local ensure_tex_attr = ltjb.ensure_tex_attr local PROCESSED = luatexja.icflag_table.PROCESSED local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG @@ -56,21 +62,21 @@ local dir_math_mod = luatexja.dir_table.dir_math_mod local dir_node_auto = luatexja.dir_table.dir_node_auto local dir_node_manual = luatexja.dir_table.dir_node_manual local function get_attr_icflag(p) - return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG + return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG end local page_direction -- local dir_pool do - local node_copy = node.direct.copy + local node_copy = dnode.copy dir_pool = {} for _,i in pairs({dir_tate, dir_yoko, dir_dtou, dir_utod}) do local w = node_new(id_whatsit, sid_user) - set_attr(w, attr_dir, i) + dnode.setattributelist(w, nil) + set_attr(w, attr_dir, i); set_attr(w, attr_icflag, 0) setfield(w, 'user_id', DIR) - setfield(w, 'type', 110) - setfield(w, 'next', nil) + setfield(w, 'type', 110); setnext(w, nil) dir_pool[i] = function () return node_copy(w) end end end @@ -92,7 +98,7 @@ end local get_dir_count, get_adjust_dir_count do - local node_attr = node.has_attribute + local node_attr = node.get_attribute local function get_dir_count_inner(h) if h then if h.id==id_whatsit and h.subtype==sid_user and h.user_id==DIR then @@ -107,7 +113,7 @@ do end function get_dir_count() for i=tex_nest.ptr, 1, -1 do - local h = tex_nest[i].head.next + local h = getnest(i).head.next if h then local t = get_dir_count_inner(h) if t~=0 then return t end @@ -117,7 +123,7 @@ do end function get_adjust_dir_count() for i=tex_nest.ptr, 1, -1 do - local v = tex_nest[i] + local v = getnest(i) local h, m = v.head.next, v.mode if abs(m)== ltjs.vmode and h then local t = get_dir_count_inner(h) @@ -171,21 +177,20 @@ do local node_next_node, node_tail_node = node.next, node.tail local insert_after_node = node.insert_after function luatexja.direction.set_list_direction_hook(v) - local lv = tex_nest.ptr -- must be >= 1 if not v then v = get_dir_count() - if abs(tex_nest[lv-1].mode) == ltjs.mmode and v == dir_tate then + if abs(getnest(tex_nest.ptr-1).mode) == ltjs.mmode and v == dir_tate then v = dir_utod end elseif v=='adj' then v = get_adjust_dir_count() end - local h = tex_nest[lv].head + local h = getnest().head local hn = node.next(h) hn = (hn and hn.id==id_local) and hn or h local w = to_node(dir_pool[v]()) insert_after_node(h, hn, w) - tex_nest[lv].tail = node_tail_node(w) + getnest().tail = node_tail_node(w) ensure_tex_attr(attr_icflag, 0) ensure_tex_attr(attr_dir, 0) end @@ -194,13 +199,13 @@ do local lv = tex_nest.ptr if not v then v,name = get_dir_count(), nil - if lv>=1 and abs(tex_nest[lv-1].mode) == ltjs.mmode and v == dir_tate then + if lv>=1 and abs(getnest(lv-1).mode) == ltjs.mmode and v == dir_tate then v = dir_utod end elseif v=='adj' then v,name = get_adjust_dir_count(), nil end - local current_nest = tex_nest[lv] + local current_nest = getnest() if tex.currentgrouptype==6 then ltjb.package_error( 'luatexja', @@ -221,7 +226,7 @@ do page_direction = v -- for first call of \yoko (in luatexja-core.sty) else if luatexja.debug then - luatexja.ext_show_node_list(node.direct.tonode(h),'>> ', texio.write_nl) + luatexja.ext_show_node_list(dnode.tonode(h),'>> ', texio.write_nl) end ltjb.package_error( 'luatexja', @@ -283,7 +288,8 @@ do if hd then for p in traverse_id(15, hd) do -- unset if get_box_dir(p, 0)==0 then - setfield(p, 'head', create_dir_whatsit(getlist(p), 'fin_row', ltjs.list_dir)) + setfield(p, 'head', create_dir_whatsit(getfield(p, 'head'), 'fin_row', ltjs.list_dir)) + -- We cannot use setlist and getlist, since they don't support unset_node end end set_attr(hd, attr_icflag, PROCESSED_BEGIN_FLAG) @@ -307,7 +313,7 @@ do -- start 側は ltj-debug.lua に local new_dir = ltjs.list_dir for line in traverse_id(id_hlist, to_direct(h)) do - setfield(line, 'head', create_dir_whatsit(getlist(line), gc, new_dir) ) + setlist(line, create_dir_whatsit(getlist(line), gc, new_dir) ) end ensure_tex_attr(attr_dir, 0) return h @@ -329,7 +335,7 @@ do end end if hd==wh[1] then - ltjs.list_dir = has_attr(hd, attr_dir) + ltjs.list_dir = get_attr(hd, attr_dir) local x = node_next(hd) while x and getid(x)==id_glue and getsubtype(x)==3 do node_remove(hd,x); node_free(x); x = node_next(hd) @@ -351,7 +357,7 @@ do local n = node_next(hd) local w = create_dir_whatsit(hd, gc, ltjs.list_dir) -- move dir whatsit after hd - setfield(hd, 'next', w); setfield(w, 'next', n); + setnext(hd, w); setnext(w, n) return hd else return create_dir_whatsit(hd, gc, ltjs.list_dir) end @@ -361,6 +367,10 @@ end -- dir_node に包む方法を書いたテーブル local dir_node_aux do + local setkern = dnode.setkern + local setshift = dnode.setshift + local sid_restore= node.subtype 'pdf_restore' + local sid_matrix = node.subtype 'pdf_setmatrix' local floor = math.floor local get_h =function (w,h,d) return h end local get_d =function (w,h,d) return d end @@ -372,6 +382,21 @@ do local get_w_neg =function (w,h,d) return -w end local get_w =function (w,h,d) return w end local zero = function() return 0 end + local function gen_kern(arg, b, w,h,d,dw,dh,dd) + local nn = node_new(id_kern) + setkern(nn, arg(w, h, d, dw, dh, dd)); return nn + end + local function gen_whatsit(arg) + return node_new(id_whatsit, arg) + end + local function gen_rotate(arg) + local nn = node_new(id_whatsit, sid_matrix) + setfield(nn, 'data', arg); return nn + end + local function gen_box(arg, b, w,h,d,dw,dh,dd) + local nn = b; setnext(b, nil) + setshift(nn, arg(w, h, d, dw, dh, dd)); return nn + end dir_node_aux = { [dir_yoko] = { -- yoko を [dir_tate] = { -- tate 中で組む @@ -379,20 +404,20 @@ do height = get_w_half, depth = get_w_half_rem, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 1 -1 0' }, - { 'kern', function(w,h,d,nw,nh,nd) return -nd end }, - { 'box' , get_h}, - { 'kern', function(w,h,d,nw,nh,nd) return nd-w end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 1 -1 0' }, + { gen_kern, function(w,h,d,nw,nh,nd) return -nd end }, + { gen_box , get_h}, + { gen_kern, function(w,h,d,nw,nh,nd) return nd-w end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 1 -1 0' }, - { 'kern' , zero }, - { 'box' , function(w,h,d,nw,nh,nd) return -nh-nd end }, - { 'kern', get_h_d_neg}, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 1 -1 0' }, + { gen_kern , zero }, + { gen_box , function(w,h,d,nw,nh,nd) return -nh-nd end }, + { gen_kern, get_h_d_neg}, + { gen_whatsit, sid_restore }, }, }, [dir_dtou] = { -- dtou 中で組む @@ -400,19 +425,19 @@ do height = get_w, depth = zero, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 -1 1 0' }, - { 'kern', function(w,h,d,nw,nh,nd) return -nh end }, - { 'box', get_d_neg }, - { 'kern', function(w,h,d,nw,nh,nd) return nh-w end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 -1 1 0' }, + { gen_kern, function(w,h,d,nw,nh,nd) return -nh end }, + { gen_box, get_d_neg }, + { gen_kern, function(w,h,d,nw,nh,nd) return nh-w end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 -1 1 0' }, - { 'kern', get_h_d_neg }, - { 'box', zero }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 -1 1 0' }, + { gen_kern, get_h_d_neg }, + { gen_box, zero }, + { gen_whatsit, sid_restore }, }, }, }, @@ -422,19 +447,19 @@ do height = get_w, depth = zero, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 -1 1 0' }, - { 'kern', function (w,h,d,nw,nh,nd) return -nh end }, - { 'box' , get_d_neg }, - { 'kern', function (w,h,d,nw,nh,nd) return nh-w end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 -1 1 0' }, + { gen_kern, function (w,h,d,nw,nh,nd) return -nh end }, + { gen_box , get_d_neg }, + { gen_kern, function (w,h,d,nw,nh,nd) return nh-w end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 -1 1 0' }, - { 'kern', get_h_d_neg }, - { 'box', zero }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 -1 1 0' }, + { gen_kern, get_h_d_neg }, + { gen_box, zero }, + { gen_whatsit, sid_restore }, }, }, [dir_dtou] = { -- dtou 中で組む @@ -442,18 +467,18 @@ do height = get_d, depth = get_h, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '-1 0 0 -1' }, - { 'kern', get_w_neg }, - { 'box', function (w,h,d,nw,nh,nd) return h-nd end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '-1 0 0 -1' }, + { gen_kern, get_w_neg }, + { gen_box, function (w,h,d,nw,nh,nd) return h-nd end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'whatsit', sid_save }, - { 'rotate', '-1 0 0 -1' }, - { 'kern', get_h_d_neg }, - { 'box', get_w_neg }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '-1 0 0 -1' }, + { gen_kern, get_h_d_neg }, + { gen_box, get_w_neg }, + { gen_whatsit, sid_restore }, }, }, }, @@ -463,20 +488,20 @@ do height = get_w, depth = zero, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '0 1 -1 0' }, - { 'kern', function (w,h,d,nw,nh,nd) return -nd end }, - { 'box', get_h }, - { 'kern', function (w,h,d,nw,nh,nd) return nd-w end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 1 -1 0' }, + { gen_kern, function (w,h,d,nw,nh,nd) return -nd end }, + { gen_box, get_h }, + { gen_kern, function (w,h,d,nw,nh,nd) return nd-w end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'kern', zero }, - { 'whatsit', sid_save }, - { 'rotate', '0 1 -1 0' }, - { 'box', function (w,h,d,nw,nh,nd) return -nd-nh end }, - { 'kern', get_h_d_neg }, - { 'whatsit', sid_restore }, + { gen_kern, zero }, + { gen_whatsit, sid_save }, + { gen_rotate, '0 1 -1 0' }, + { gen_box, function (w,h,d,nw,nh,nd) return -nd-nh end }, + { gen_kern, get_h_d_neg }, + { gen_whatsit, sid_restore }, }, }, [dir_tate] = { -- tate 中で組む @@ -484,19 +509,19 @@ do height = get_d, depth = get_h, [id_hlist] = { - { 'whatsit', sid_save }, - { 'rotate', '-1 0 0 -1' }, - { 'kern', get_w_neg }, - { 'box', function (w,h,d,nw,nh,nd) return h-nd end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, '-1 0 0 -1' }, + { gen_kern, get_w_neg }, + { gen_box, function (w,h,d,nw,nh,nd) return h-nd end }, + { gen_whatsit, sid_restore }, }, [id_vlist] = { - { 'whatsit', sid_save }, - { 'rotate', ' -1 0 0 -1' }, - { 'kern', function (w,h,d,nw,nh,nd) return -nh-nd end }, - { 'box', get_w_neg }, - { 'kern', function (w,h,d,nw,nh,nd) return nh+nd-h-d end }, - { 'whatsit', sid_restore }, + { gen_whatsit, sid_save }, + { gen_rotate, ' -1 0 0 -1' }, + { gen_kern, function (w,h,d,nw,nh,nd) return -nh-nd end }, + { gen_box, get_w_neg }, + { gen_kern, function (w,h,d,nw,nh,nd) return nh+nd-h-d end }, + { gen_whatsit, sid_restore }, }, }, }, @@ -507,14 +532,13 @@ end -- 2nd ret val はその DIR whatsit function get_box_dir(b, default) start_time_measure 'get_box_dir' - local dir = has_attr(b, attr_dir) or 0 - local bh = getfield(b,'head') - -- b は insert node となりうるので getlist() は使えない + local dir = get_attr(b, attr_dir) or 0 + local bh = getfield(b, 'head') -- We cannot use getlist since b may be an unset_node. local c if bh~=0 then -- bh != nil for bh in traverse_id(id_whatsit, bh) do if getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR then - c = bh; dir = (dir==0) and has_attr(bh, attr_dir) or dir + c = bh; dir = (dir==0) and get_attr(bh, attr_dir) or dir end end end @@ -523,12 +547,13 @@ function get_box_dir(b, default) end do + local ltj_tempcnta = luatexbase.registernumber 'ltj@tempcnta' local getbox = tex.getbox local dir_backup function luatexja.direction.unbox_check_dir(is_copy) start_time_measure 'box_primitive_hook' local list_dir = get_dir_count()%dir_math_mod - local b = getbox(tex_getcount 'ltj@tempcnta') + local b = getbox(getcount(ltj_tempcnta)) if b and getlist(to_direct(b)) then local box_dir = get_box_dir(to_direct(b), dir_yoko) if box_dir%dir_math_mod ~= list_dir then @@ -548,7 +573,7 @@ do local d = hd nh, hd = node_remove(nh, hd) if is_copy==true and (not dir_backup) then - dir_backup = d; setfield(dir_backup, 'next', nil) + dir_backup = d; setnext(dir_backup, nil) else node_free(d) end @@ -556,7 +581,7 @@ do hd = node_next(hd) end end - setfield(bd, 'head', nh) + setlist(bd, nh) end end if luatexja.global_temp and tex.globaldefs~=luatexja.global_temp then @@ -565,12 +590,12 @@ do stop_time_measure 'box_primitive_hook' end function luatexja.direction.uncopy_restore_whatsit() - local b = getbox(tex_getcount 'ltj@tempcnta') + local b = getbox(getcount(ltj_tempcnta)) if b then local bd = to_direct(b) if dir_backup then - setfield(dir_backup, 'next', getlist(bd)) - setfield(bd, 'head', dir_backup) + setnext(dir_backup, getlist(bd)) + setlist(bd, dir_backup) dir_backup = nil end end @@ -587,23 +612,25 @@ local function unwrap_dir_node(b, head, box_dir) if head then nh = insert_before(head, b, bh) nh, nb = node_remove(nh, b) - setfield(b, 'next', nil) - node_free(b) + setnext(b, nil); node_free(b) end local shift_old, b_dir, wh = nil, get_box_dir(bh, 0) if wh then - node.direct.flush_list(getfield(wh, 'value')) - setfield(wh, 'value', nil) + dnode.flush_list(getvalue(wh)); setvalue(wh, nil) end return nh, nb, bh, b_dir end -- is_manual: 寸法変更に伴うものか? -local function create_dir_node(b, b_dir, new_dir, is_manual) +local create_dir_node +do + local getdir = dnode.getdir + local setdir = dnode.setdir + local setshift = dnode.setshift + +create_dir_node = function(b, b_dir, new_dir, is_manual) local info = dir_node_aux[b_dir%dir_math_mod][new_dir%dir_math_mod] - local w = getfield(b, 'width') - local h = getfield(b, 'height') - local d = getfield(b, 'depth') + local w, h, d = getwhd(b) local db = node_new(getid(b)) -- dir_node set_attr(db, attr_dir, new_dir + (is_manual and dir_node_manual or dir_node_auto)) @@ -611,13 +638,11 @@ local function create_dir_node(b, b_dir, new_dir, is_manual) set_attr(b, attr_icflag, PROCESSED) ensure_tex_attr(attr_dir, 0) ensure_tex_attr(attr_icflag, 0) - setfield(db, 'dir', getfield(b, 'dir')) - setfield(db, 'shift', 0) - setfield(db, 'width', info.width(w,h,d)) - setfield(db, 'height', info.height(w,h,d)) - setfield(db, 'depth', info.depth(w,h,d)) + setdir(db, getdir(b)); setshift(db, 0) + setwhd(db, info.width(w,h,d), info.height(w,h,d), info.depth(w,h,d)) return db end +end -- 異方向のボックスの処理 local make_dir_whatsit, process_dir_node @@ -633,15 +658,14 @@ do -- 既に b の中身にあるwhatsit if (box_dir<dir_node_auto) and (not dn) then bh = create_dir_whatsit(bh, 'make_dir_whatsit', dir_yoko) - dn = bh; setfield(b, 'head', bh) + dn = bh; setlist(b, bh) end if box_dir%dir_math_mod==new_dir then if box_dir>=dir_node_auto then -- dir_node としてカプセル化されている local _, dnc = get_box_dir(b, 0) if dnc then -- free all other dir_node - node.direct.flush_list(getfield(dnc, 'value')) - setfield(dnc, 'value', nil) + dnode.flush_list(getvalue(dnc)); setvalue(dnc, nil) end set_attr(b, attr_dir, box_dir%dir_math_mod + dir_node_auto) return head, node_next(b), b, true @@ -663,25 +687,19 @@ do end box_dir = box_dir%dir_math_mod local db - local dnh = getfield(dn, 'value') + local dnh = getvalue(dn) for x in traverse(dnh) do - if has_attr(x, attr_dir)%dir_math_mod == new_dir then - setfield(dn, 'value', to_node(node_remove(dnh, x))) + if get_attr(x, attr_dir)%dir_math_mod == new_dir then + setvalue(dn, to_node(node_remove(dnh, x))) db=x; break end end - node.direct.flush_list(getfield(dn, 'value')) - setfield(dn, 'value', nil) + dnode.flush_list(getvalue(dn)); setvalue(dn, nil) db = db or create_dir_node(b, box_dir, new_dir, false) - local w = getfield(b, 'width') - local h = getfield(b, 'height') - local d = getfield(b, 'depth') - local dn_w = getfield(db, 'width') - local dn_h = getfield(db, 'height') - local dn_d = getfield(db, 'depth') + local w, h, d = getwhd(b) nh, nb = insert_before(head, b, db), nil nh, nb = node_remove(nh, b) - setfield(b, 'next', nil); setfield(db, 'head', b) + setnext(b, nil); setlist(db, b) ret, flag = db, true return nh, nb, ret, flag end @@ -701,13 +719,13 @@ do end -- lastbox - local node_prev = (node.direct~=node) and node.direct.getprev or node.prev + local node_prev = dnode.getprev local id_glue = node.id 'glue' local function lastbox_hook() start_time_measure 'box_primitive_hook' - local bn = tex_nest[tex_nest.ptr].tail + local bn = getnest().tail if bn then - local b, head = to_direct(bn), to_direct(tex_nest[tex_nest.ptr].head) + local b, head = to_direct(bn), to_direct(getnest().head) local bid = getid(b) if bid==id_hlist or bid==id_vlist then local p = getlist(b) @@ -715,21 +733,20 @@ do if p and getid(p)==id_glue and getsubtype(p)==12 then -- tabskip local np = node_next(p); local npid = getid(np) if npid==id_hlist or npid==id_vlist then - setfield(b, 'head', create_dir_whatsit(p, 'align', get_box_dir(np, 0))) + setlist(b, create_dir_whatsit(p, 'align', get_box_dir(np, 0))) end end local box_dir = get_box_dir(b, 0) if box_dir>= dir_node_auto then -- unwrap dir_node local p = node_prev(b) local dummy1, dummy2, nb = unwrap_dir_node(b, nil, box_dir) - setfield(p, 'next', nb); tex_nest[tex_nest.ptr].tail = to_node(nb) - setfield(b, 'next', nil); setfield(b, 'head', nil) + setnext(p, nb); getnest().tail = to_node(nb) + setnext(b, nil); setlist(b, nil) node_free(b); b = nb end local _, wh = get_box_dir(b, 0) -- clean dir_node attached to the box if wh then - node.direct.flush_list(getfield(wh, 'value')) - setfield(wh, 'value', nil) + dnode.flush_list(getvalue(wh)); setvalue(wh, nil) end end end @@ -743,27 +760,25 @@ end -- \wd, \ht, \dp の代わり do local getbox, setdimen = tex.getbox, tex.setdimen + local ltj_tempdima = luatexbase.registernumber 'ltj@tempdima' local function get_box_dim_common(key, s, l_dir) -- s: not dir_node. local s_dir, wh = get_box_dir(s, dir_yoko) s_dir = s_dir%dir_math_mod if s_dir ~= l_dir then local not_found = true - for x in traverse(getfield(wh, 'value')) do - if l_dir == has_attr(x, attr_dir)%dir_node_auto then - setdimen('ltj@tempdima', getfield(x, key)) + for x in traverse(getvalue(wh)) do + if l_dir == get_attr(x, attr_dir)%dir_node_auto then + setdimen(ltj_tempdima, getfield(x, key)) not_found = false; break end end if not_found then - local w = getfield(s, 'width') - local h = getfield(s, 'height') - local d = getfield(s, 'depth') - setdimen('ltj@tempdima', - dir_node_aux[s_dir][l_dir][key](w,h,d)) + local w, h, d = getwhd(s) + setdimen(ltj_tempdima, dir_node_aux[s_dir][l_dir][key](w,h,d)) end else - setdimen('ltj@tempdima', getfield(s, key)) + setdimen(ltj_tempdima, getfield(s, key)) end end local function get_box_dim(key, n) @@ -776,12 +791,12 @@ do if b_dir<dir_node_auto then get_box_dim_common(key, s, l_dir) elseif b_dir%dir_math_mod==l_dir then - setdimen('ltj@tempdima', getfield(s, key)) + setdimen(ltj_tempdima, getfield(s, key)) else get_box_dim_common(key, getlist(s), l_dir) end else - setdimen('ltj@tempdima', 0) + setdimen(ltj_tempdima, 0) end tex.sprint(cat_lp, '\\ltj@tempdima') tex.globaldefs = gt @@ -797,19 +812,18 @@ do if s_dir ~= l_dir then if not wh then wh = create_dir_whatsit(getlist(s), 'set_box_dim', s_dir) - setfield(s, 'head', wh) + setlist(s, wh) end local db - local dnh = getfield(wh, 'value') + local dnh = getvalue(wh) for x in traverse(dnh) do - if has_attr(x, attr_dir)%dir_node_auto==l_dir then + if get_attr(x, attr_dir)%dir_node_auto==l_dir then db = x; break end end if not db then db = create_dir_node(s, s_dir, l_dir, true) - setfield(db, 'next', dnh) - setfield(wh, 'value',to_node(db)) + setnext(db, dnh); setvalue(wh, to_node(db)) end setfield(db, key, scan_dimen()) return false @@ -817,15 +831,12 @@ do setfield(s, key, scan_dimen()) if wh then -- change dimension of dir_nodes which are created "automatically" - local bw, bh, bd - = getfield(s,'width'), getfield(s, 'height'), getfield(s, 'depth') - for x in traverse(getfield(wh, 'value')) do - local x_dir = has_attr(x, attr_dir) + local bw, bh, bd = getwhd(s) + for x in traverse(getvalue(wh)) do + local x_dir = get_attr(x, attr_dir) if x_dir<dir_node_manual then local info = dir_node_aux[s_dir][x_dir%dir_node_auto] - setfield(x, 'width', info.width(bw,bh,bd)) - setfield(x, 'height', info.height(bw,bh,bd)) - setfield(x, 'depth', info.depth(bw,bh,bd)) + setwhd(x, info.width(bw,bh,bd), info.height(bw,bh,bd), info.depth(bw,bh,bd)) end end end @@ -849,16 +860,12 @@ do else local sid, b = getid(s), getlist(s) local info = dir_node_aux[get_box_dir(b,dir_yoko)%dir_math_mod][b_dir%dir_node_auto] - local bw, bh, bd - = getfield(b,'width'), getfield(b, 'height'), getfield(b, 'depth') - local sw, sh, sd - = getfield(s,'width'), getfield(s, 'height'), getfield(s, 'depth') + local bw, bh, bd = getwhd(b) + local sw, sh, sd = getwhd(s) if set_box_dim_common(key, b, l_dir) and b_dir<dir_node_manual then -- re-calculate dimension of s, if s is created "automatically" if b_dir<dir_node_manual then - setfield(s, 'width', info.width(bw,bh,bd)) - setfield(s, 'height', info.height(bw,bh,bd)) - setfield(s, 'depth', info.depth(bw,bh,bd)) + setwhd(s, info.width(bw,bh,bd), info.height(bw,bh,bd), info.depth(bw,bh,bd)) end end end @@ -889,7 +896,7 @@ do end do - local getbox, setbox, copy_list = tex.getbox, tex.setbox, node.direct.copy_list + local getbox, setbox, copy_list = tex.getbox, tex.setbox, dnode.copy_list -- raise, lower function luatexja.direction.raise_box() start_time_measure 'box_primitive_hook' @@ -923,6 +930,7 @@ end -- adjust do local id_adjust = node.id 'adjust' + local last_node = dnode.last_node local scan_keyword = token.scan_keyword function luatexja.direction.adjust_begin() if scan_keyword 'pre' then tex.sprint(cat_lp, '\\ltj@@vadjust@pre') @@ -931,7 +939,7 @@ do function luatexja.direction.check_adjust_direction() start_time_measure 'box_primitive_hook' local list_dir = get_adjust_dir_count() - local a = tex_nest[tex_nest.ptr].tail + local a = getnest().tail local ad = to_direct(a) if a and getid(ad)==id_adjust then local adj_dir = get_box_dir(ad) @@ -940,7 +948,7 @@ do 'luatexja', 'Direction Incompatible', "\\vadjust's argument and outer vlist must have same direction.") - node.direct.last_node() + node_free(last_node()) end end stop_time_measure 'box_primitive_hook' @@ -954,13 +962,13 @@ do function luatexja.direction.populate_insertion_dir_whatsit() start_time_measure 'box_primitive_hook' local list_dir = get_dir_count() - local a = tex_nest[tex_nest.ptr].tail + local a = getnest().tail local ad = to_direct(a) if (not a) or getid(ad)~=id_ins then a = node.tail(tex.lists.page_head); ad = to_direct(a) end if a and getid(ad)==id_ins then - local h = getfield(ad, 'head') + local h = getlist(ad) if getid(h)==id_whatsit and getsubtype(h)==sid_user and getfield(h, 'user_id')==DIR then local n = h; h = node_remove(h,h) @@ -972,7 +980,7 @@ do end end ensure_tex_attr(attr_dir, 0) - setfield(ad, 'head', h) + setlist(ad, h) end stop_time_measure 'box_primitive_hook' end @@ -980,25 +988,32 @@ end -- vsplit do - local split_dir_whatsit, split_dir_head + local split_dir_whatsit, split_dir_head, split_dir_at_2nd local cat_lp = luatexbase.catcodetables['latex-package'] local sprint, scan_int, tex_getbox = tex.sprint, token.scan_int, tex.getbox function luatexja.direction.vsplit() local n = scan_int(); local p = to_direct(tex_getbox(n)) - split_dir_head = nil + if split_dir_head then node_free(split_dir_head); split_dir_head = nil end + if split_dir_whatsit then split_dir_watsit = nil end if p then local bh = getlist(p) - if getid(bh)==id_whatsit and getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR + if getid(bh)==id_whatsit and getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR and node_next(bh) then - ltjs.list_dir = has_attr(bh, attr_dir) - local q = node_next(p) - setfield(p, 'head', node_remove(bh,bh,bh)) - split_dir_head = bh + ltjs.list_dir = get_attr(bh, attr_dir) + setlist(p, (node_remove(bh,bh))) + split_dir_head, split_dir_2nd = bh, false + else + local w = node_next(bh) + if getid(w)==id_whatsit and getsubtype(w)==sid_user and getfield(w, 'user_id')==DIR then + ltjs.list_dir = get_attr(w, attr_dir) + setlist(p, (node_remove(bh,w))) + split_dir_head, split_dir_2nd = w, true + end end end sprint(cat_lp, '\\ltj@@orig@vsplit' .. tostring(n)) - end + end local function dir_adjust_vpack(h, gc) start_time_measure 'direction_vpack' local hd = to_direct(h) @@ -1008,15 +1023,17 @@ do split_dir_whatsit = hd elseif gc=='split_off' then if split_dir_head then - ltjs.list_dir = has_attr(split_dir_head, attr_dir) - hd = insert_before(hd, hd, split_dir_head) + ltjs.list_dir = get_attr(split_dir_head, attr_dir) + if split_dir_2nd then hd = insert_after(hd, hd, split_dir_head) + else hd = insert_before(hd, hd, split_dir_head) + end split_dir_head=nil end if split_dir_whatsit then -- adjust direction of 'split_keep' set_attr(split_dir_whatsit, attr_dir, ltjs.list_dir) + split_dir_whatsit=nil end - split_dir_whatsit=nil elseif gc=='preamble' then split_dir_whatsit=nil else @@ -1038,7 +1055,7 @@ do local function dir_adjust_pre_output(h, gc) return to_node(create_dir_whatsit_vbox(to_direct(h), gc)) end - ltjb.add_to_callback('pre_output_filter', dir_adjust_pre_output, + ltjb.add_to_callback('pre_output_filter', dir_adjust_pre_output, 'ltj.direction', 10000) end @@ -1051,38 +1068,22 @@ do local function finalize_dir_node(db,new_dir) local b = getlist(db) while b and ((getid(b)~=id_hlist) and (getid(b)~=id_vlist)) do - local ob = b; b = node_remove(b,b); setfield(db, 'head', b); + local ob = b; b = node_remove(b,b); setlist(db, b); node_free(ob) end finalize_inner(b) - local w = getfield(b, 'width') - local h = getfield(b, 'height') - local d = getfield(b, 'depth') - local dn_w = getfield(db, 'width') - local dn_h = getfield(db, 'height') - local dn_d = getfield(db, 'depth') + local w, h, d = getwhd(b) + local dw, dh, dd = getwhd(db) local db_head, db_tail local t = dir_node_aux[get_box_dir(b, dir_yoko)%dir_math_mod][new_dir] t = t and t[getid(b)]; if not t then return end for _,v in ipairs(t) do - local cmd, arg, nn = v[1], v[2] - if cmd=='kern' then - nn = node_new(id_kern, 1) - setfield(nn, 'kern', arg(w, h, d, dn_w, dn_h, dn_d)) - elseif cmd=='whatsit' then - nn = node_new(id_whatsit, arg) - elseif cmd=='rotate' then - nn = node_new(id_whatsit, sid_matrix) - setfield(nn, 'data', arg) - elseif cmd=='box' then - nn = b; setfield(b, 'next', nil) - setfield(nn, 'shift', arg(w, h, d, dn_w, dn_h, dn_d)) - end + local nn = v[1](v[2], b, w, h, d, dw, dh, dd) if db_head then insert_after(db_head, db_tail, nn) db_tail = nn else - setfield(db, 'head', nn) + setlist(db, nn) db_head, db_tail = nn, nn end end @@ -1090,6 +1091,7 @@ do tex.setattribute(attr_dir, dir_yoko) local shipout_temp = node_new(id_hlist) + dnode.setattributelist(shipout_temp, nil) tex.setattribute(attr_dir, 0) finalize_inner = function (box) @@ -1105,17 +1107,17 @@ do end end end - local copy = node.direct.copy + local copy = dnode.copy function luatexja.direction.shipout_lthook (head) start_time_measure 'box_primitive_hook' local a = to_direct(head) local a_dir = get_box_dir(a, dir_yoko) if a_dir~=dir_yoko then local b = create_dir_node(a, a_dir, dir_yoko, false) - setfield(b, 'head', a); a = b + setlist(b, a); a = b end - setfield(shipout_temp, 'head', a); finalize_inner(shipout_temp) - a = copy(getlist(shipout_temp)); setfield(shipout_temp, 'head',nil) + setlist(shipout_temp, a); finalize_inner(shipout_temp) + a = copy(getlist(shipout_temp)); setlist(shipout_temp, nil) stop_time_measure 'box_primitive_hook' return to_node(a) end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua index 7f39b9b8d76..dc6ec46a56a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-inputbuf.lua @@ -8,12 +8,10 @@ luatexja.load_module 'charrange'; local ltjc = luatexja.charrange local utflen = utf.len local utfbyte = utf.byte local utfchar = utf.char -local node_new = node.new -local node_free = node.free local id_glyph = node.id 'glyph' local getcatcode, getcount = tex.getcatcode, tex.getcount local ltjc_is_japanese_char_curlist = ltjc.is_japanese_char_curlist - +local cnt_lineend = luatexbase.registernumber 'ltjlineendcomment' local substituter do local uchar = utf.char @@ -71,7 +69,7 @@ local function add_comment(buffer) if (te ~= -1) and (getcatcode(te)==5) then local ct = getcatcode(c) if (ct==11) or (ct==12) then - local lec = getcount 'ltjlineendcomment' + local lec = getcount(cnt_lineend) -- Is the catcode of \ltjlineendcomment (new comment char) is 14 (comment)? if ltjc_is_japanese_char_curlist(c) and (getcatcode(lec)==14) then stop_time_measure 'inputbuf'; return buffer .. utfchar(lec) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index 3d046f0c018..ed7ab6daa8a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2022-02-09', + date = '2022-08-29', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -19,25 +19,32 @@ local pairs = pairs --local to_node = node.direct.tonode --local to_direct = node.direct.todirect -local setfield = node.direct.setfield -local setglue = luatexja.setglue local getfield = node.direct.getfield local getid = node.direct.getid local getfont = node.direct.getfont local getlist = node.direct.getlist local getchar = node.direct.getchar +local getglue = node.direct.getglue local getsubtype = node.direct.getsubtype +local getshift = node.direct.getshift +local getwidth = node.direct.getwidth +local getdepth = node.direct.getdepth +local getpenalty = node.direct.getpenalty +local setfield = node.direct.setfield +local setglue = node.direct.setglue +local setshift = node.direct.setshift local if_lang_ja do local lang_ja = luatexja.lang_ja local getlang = node.direct.getlang -- glyph with font number 0 (\nullfont) is always considered an ALchar node - if_lang_ja = getlang - and function (n) return (getlang(n)==lang_ja)and(getfont(n)~=0) end - or function (n) return (getfield(n,'lang')==lang_ja)and(getfont(n)~=0) end + if_lang_ja = function (n) return (getlang(n)==lang_ja)and(getfont(n)~=0) end end - -local has_attr = node.direct.has_attribute +local setpenalty = node.direct.setpenalty +local setkern = node.direct.setkern +local call_callback = luatexbase.call_callback + +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute local insert_before = node.direct.insert_before local insert_after = node.direct.insert_after @@ -48,7 +55,7 @@ local ltjf_find_char_class = ltjf.find_char_class local node_new = luatexja.dnode_new local node_copy = node.direct.copy local node_tail = node.direct.tail -local node_free = node.direct.free +local node_free = node.direct.flush_node or node.direct.free local node_remove = node.direct.remove local node_inherit_attr = luatexja.node_inherit_attr @@ -96,7 +103,7 @@ local set_np_xspc_jachar_hbox local ltjs_orig_char_table = ltjs.orig_char_table local function get_attr_icflag(p) - return (has_attr(p, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG + return (get_attr(p, attr_icflag) or 0)%PROCESSED_BEGIN_FLAG end -------------------- Helper functions @@ -107,11 +114,12 @@ local function fast_find_char_class(c,m) end -- 文字クラスの決定 -local slow_find_char_class +local slow_find_char_class, skip_table_to_glue do local start_time_measure = ltjb.start_time_measure local stop_time_measure = ltjb.stop_time_measure - slow_find_char_class = function (c, m, oc) + local fast_get_stack_skip = ltjs.fast_get_stack_skip + function slow_find_char_class (c, m, oc) local cls = ltjf_find_char_class(oc, m) if oc~=c and c and cls==0 then return ltjf_find_char_class(c, m) @@ -119,20 +127,17 @@ do return cls end end -end - -local function skip_table_to_glue(n) - local g, st = node_new(id_glue), ltjs.fast_get_stack_skip(n) - setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order) - return g, (st.width==1073741823) + function skip_table_to_glue(n) + local g, st = node_new(id_glue), fast_get_stack_skip(n) + setglue(g, st[1], st[2], st[3], st[4], st[5]) + return g, (st[1]==1073741823) + end end -- penalty 値の計算 local add_penalty do -local setpenalty = node.direct.setpenalty or function(n, a) setfield(n,'penalty',a) end -local getpenalty = node.direct.getpenalty or function(n) return getfield(n,'penalty') end function add_penalty(p,e) local pp = getpenalty(p) if (pp>-10000) and (pp<10000) then @@ -206,7 +211,7 @@ local function check_box(box_ptr, box_end) if find_first_char then first_char = s; find_first_char = false end last_char = s; found_visible_node = true else - if getfield(p, 'shift')==0 then + if getshift(p)==0 then last_char = nil if check_box(getlist(p), nil) then found_visible_node = true end find_first_char = false @@ -264,13 +269,13 @@ luatexbase.create_callback("luatexja.jfmglue.whatsit_last_minute", "data", function (stat, Nq, Np) return false end) -- calc next Np -local calc_np +local calc_np do -- 001 ----------------------------------------------- local traverse = node.direct.traverse local function check_next_ickern(lp) local lx = Np.nuc - while lp and getid(lp) == id_kern and ( getsubtype(lp)==0 or + while lp and getid(lp) == id_kern and ( getsubtype(lp)==0 or getsubtype(lp)==3 or ITALIC == get_attr_icflag(lp)) do set_attr(lp, attr_icflag, IC_PROCESSED) lx, lp = lp, node_next(lp) @@ -295,7 +300,7 @@ local function calc_np_pbox(lp, last) else nc, lp = lp, node_next(lp) end - first, lpa = false, (lp and has_attr(lp, attr_icflag) or 0) + first, lpa = false, (lp and get_attr(lp, attr_icflag) or 0) -- get_attr_icflag() ではいけない! end Np.nuc = nc @@ -311,18 +316,20 @@ do -- 002 --------------------------------------- local attr_jchar_class = luatexbase.attributes['ltj@charclass'] local attr_jchar_code = luatexbase.attributes['ltj@charcode'] local font_getfont = font.getfont + local setwhd = node.direct.setwhd + local setdir = node.direct.setdir local function calc_np_notdef(lp) if not font_getfont(getfont(lp)).characters[getchar(lp)] then local ln = node_next(lp) - if ltju.specified_feature(getfont(lp), 'notdef') and ln and getid(ln)==id_glyph then + if ltju.specified_feature(getfont(lp), 'notdef') and ln and getid(ln)==id_glyph then set_attr(lp, attr_icflag, PROCESSED) - set_attr(ln, attr_jchar_code, has_attr(lp, attr_jchar_code) or getchar(lp)) - set_attr(ln, attr_jchar_class, has_attr(lp, attr_jchar_class) or 0) + set_attr(ln, attr_jchar_code, get_attr(lp, attr_jchar_code) or getchar(lp)) + set_attr(ln, attr_jchar_class, get_attr(lp, attr_jchar_class) or 0) Np.nuc, lp = ln, ln end end return lp - end + end function calc_np_aux_glyph_common(lp, acc_flag) Np.nuc, Np.first = lp, (Np.first or lp) if if_lang_ja(lp) then -- JAchar @@ -341,9 +348,9 @@ function calc_np_aux_glyph_common(lp, acc_flag) -- loop local first_glyph, last_glyph = lp set_attr(lp, attr_icflag, PROCESSED); Np.last = lp - local y_adjust = has_attr(lp,attr_ablshift) or 0 - local node_depth = getfield(lp, 'depth') + min(y_adjust, 0) - local adj_depth = (y_adjust>0) and (getfield(lp, 'depth') + y_adjust) or 0 + local y_adjust = get_attr(lp,attr_ablshift) or 0 + local node_depth = getdepth(lp) + min(y_adjust, 0) + local adj_depth = (y_adjust>0) and (getdepth(lp) + y_adjust) or 0 setfield(lp, 'yoffset', getfield(lp, 'yoffset') - y_adjust); lp = node_next(lp) local lx=lp while lx do @@ -354,9 +361,9 @@ function calc_np_aux_glyph_common(lp, acc_flag) if lid==id_glyph and not if_lang_ja(lx) then -- 欧文文字 last_glyph = lx; set_attr(lx, attr_icflag, PROCESSED); Np.last = lx - y_adjust = has_attr(lx,attr_ablshift) or 0 - node_depth = max(getfield(lx, 'depth') + min(y_adjust, 0), node_depth) - adj_depth = (y_adjust>0) and max(getfield(lx, 'depth') + y_adjust, adj_depth) or adj_depth + y_adjust = get_attr(lx,attr_ablshift) or 0 + node_depth = max(getdepth(lx) + min(y_adjust, 0), node_depth) + adj_depth = (y_adjust>0) and max(getdepth(lx) + y_adjust, adj_depth) or adj_depth setfield(lx, 'yoffset', getfield(lx, 'yoffset') - y_adjust); lx = node_next(lx) elseif lid==id_kern then local ls = getsubtype(lx) @@ -364,9 +371,9 @@ function calc_np_aux_glyph_common(lp, acc_flag) set_attr(lx, attr_icflag, PROCESSED) lx = node_next(lx) -- lx: アクセント本体 if getid(lx)==id_glyph then - setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (has_attr(lx,attr_ablshift) or 0)) + setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (get_attr(lx,attr_ablshift) or 0)) else -- アクセントは上下にシフトされている - setfield(lx, 'shift', getfield(lx, 'shift') + (has_attr(lx,attr_ablshift) or 0)) + setshift(lx, getshift(lx) + (get_attr(lx,attr_ablshift) or 0)) end set_attr(lx, attr_icflag, PROCESSED) lx = node_next(lx); set_attr(lx, attr_icflag, PROCESSED) @@ -385,8 +392,7 @@ function calc_np_aux_glyph_common(lp, acc_flag) local r if adj_depth>node_depth then r = node_new(id_rule,3,first_glyph) - setfield(r, 'width', 0); setfield(r, 'height', 0) - setfield(r, 'depth',adj_depth); setfield(r, 'dir', tex_dir) + setwhd(r, 0, 0, adj_depth); setdir(r, tex_dir) set_attr(r, attr_icflag, PROCESSED) end if last_glyph then @@ -397,7 +403,7 @@ function calc_np_aux_glyph_common(lp, acc_flag) Np.last_char = npn if r then local nf, nc = getfont(npn), getchar(npn) - local ct = (font.getfont(nf) or font.fonts[nf] ).characters[nc] + local ct = (font_getfont(nf) or font.fonts[nf] ).characters[nc] if not ct then -- variation selector node_free(r) elseif (ct.left_protruding or 0) == 0 then @@ -429,6 +435,7 @@ local sid_start_link = node.subtype 'pdf_start_link' local sid_start_thread = node.subtype 'pdf_start_thread' local sid_end_link = node.subtype 'pdf_end_link' local sid_end_thread = node.subtype 'pdf_end_thread' +local getvalue = node.direct.getdata calc_np_auxtable = { [id_glyph] = calc_np_aux_glyph_common, [id_hlist] = function(lp) @@ -436,7 +443,7 @@ calc_np_auxtable = { head, lp, op, flag = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm hlist') set_attr(op, attr_icflag, PROCESSED) Np.first = Np.first or op; Np.last = op; Np.nuc = op; - if (flag or getfield(op, 'shift')~=0) then + if (flag or getshift(op)~=0) then Np.id = id_box_like else Np.id = id_hlist @@ -461,7 +468,7 @@ calc_np_auxtable = { if lps==sid_user then if getfield(lp, 'user_id')==luatexja.userid_table.IHB then local lq = node_next(lp); - head = node_remove(head, lp); node_free(lp); non_ihb_flag = getfield(lp, 'value')~=1 + head = node_remove(head, lp); node_free(lp); non_ihb_flag = getvalue(lp)~=1 return false, lq; elseif getfield(lp, 'user_id')==luatexja.userid_table.JA_AL_BDD then local lq = node_next(lp); @@ -469,7 +476,7 @@ calc_np_auxtable = { return false, lq; else set_attr(lp, attr_icflag, PROCESSED) - luatexbase.call_callback("luatexja.jfmglue.whatsit_getinfo", + call_callback("luatexja.jfmglue.whatsit_getinfo", Np, lp, Nq) if Np.nuc then Np.id = id_pbox_w; Np.first = Np.nuc; Np.last = Np.nuc; @@ -501,8 +508,8 @@ calc_np_auxtable = { end, [id_glue] = function(lp) Np.first, Np.nuc, Np.last = (Np.first or lp), lp, lp; - Np.id = getid(lp); - local f = luatexbase.call_callback("luatexja.jfmglue.special_jaglue", lp) + Np.id = getid(lp); + local f = call_callback("luatexja.jfmglue.special_jaglue", lp) if f then set_attr(lp, attr_icflag, PROCESSED) end @@ -520,9 +527,9 @@ calc_np_auxtable = { Np.first = Np.first or lp set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp) if getid(lp)==id_glyph then -- アクセント本体 - setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0)) + setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (get_attr(lp,attr_ablshift) or 0)) else -- アクセントは上下にシフトされている - setfield(lp, 'shift', getfield(lp, 'shift') + (has_attr(lp,attr_ablshift) or 0)) + setshift(lp, getshift(lp) + (get_attr(lp,attr_ablshift) or 0)) end set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp) set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp) @@ -552,7 +559,7 @@ function calc_np(last, lp) local k -- We assume lp = node_next(Np.last) if Nq and Nq.id==id_pbox_w then - luatexbase.call_callback("luatexja.jfmglue.whatsit_last_minute", false, Nq, Np) + call_callback("luatexja.jfmglue.whatsit_last_minute", false, Nq, Np) end Np, Nq, non_ihb_flag = Nq, Np, true -- We clear `predefined' entries of Np before pairs() loop, @@ -560,13 +567,13 @@ function calc_np(last, lp) Np.post, Np.pre, Np.xspc, Np.gk = nil, nil, nil, nil Np.first, Np.id, Np.last, Np.met, Np.class= nil, nil, nil, nil Np.auto_kspc, Np.auto_xspc, Np.char, Np.nuc = nil, nil, nil, nil - -- auto_kspc, auto_xspc: normally true/false, + -- auto_kspc, auto_xspc: normally true/false, -- but the number 0 when Np is ''the beginning of the box/paragraph''. for k in pairs(Np) do Np[k] = nil end for k = 1,#Bp do Bp[k] = nil end while lp ~= last do - local lpa = has_attr(lp, attr_icflag) or 0 + local lpa = get_attr(lp, attr_icflag) or 0 -- unbox 由来ノードの検出 if (lpa>=PACKED) and (lpa%PROCESSED_BEGIN_FLAG<=BOXBDD) then if lpa%PROCESSED_BEGIN_FLAG == BOXBDD then @@ -598,6 +605,7 @@ do local dir_tate = luatexja.dir_table.dir_tate -- 和文文字のデータを取得 + local has_attr = node.direct.has_attribute local attr_jchar_class = luatexbase.attributes['ltj@charclass'] local attr_jchar_code = luatexbase.attributes['ltj@charcode'] local attr_autospc = luatexbase.attributes['ltj@autospc'] @@ -617,19 +625,21 @@ do Nx.post = table_current_stack[POST + c] or 0 Nx.xspc = table_current_stack[XSP + c] or 3 Nx.kcat = table_current_stack[KCAT + c] or 0 - Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1) + Nx.auto_kspc, Nx.auto_xspc + = not has_attr(x, attr_autospc, 0), not has_attr(x, attr_autoxspc, 0) return m, mc, cls end function set_np_xspc_jachar_hbox(Nx, x) local m = ltjf_font_metric_table[getfont(x)] - local c = has_attr(x, attr_jchar_code) or getchar(x) - Nx.met, Nx.char = m, c; Nx.class = has_attr(x, attr_jchar_class) or 0; + local c = get_attr(x, attr_jchar_code) or getchar(x) + Nx.met, Nx.char = m, c; Nx.class = get_attr(x, attr_jchar_class) or 0; local mc = m.char_type; Nx.char_type = mc Nx.pre = table_current_stack[PRE + c] or 0 Nx.post = table_current_stack[POST + c] or 0 Nx.xspc = table_current_stack[XSP + c] or 3 Nx.kcat = table_current_stack[KCAT + c] or 0 - Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1) + Nx.auto_kspc, Nx.auto_xspc + = not has_attr(x, attr_autospc, 0), not has_attr(x, attr_autoxspc, 0) end -- 欧文文字のデータを取得 @@ -652,7 +662,7 @@ do end Nx.met = nil Nx.xspc = table_current_stack[XSP + c] or 3 - Nx.auto_xspc = (has_attr(x, attr_autoxspc)==1) + Nx.auto_xspc = not has_attr(x, attr_autoxspc, 0) end local set_np_xspc_alchar = set_np_xspc_alchar -- change the information for the next loop @@ -686,13 +696,13 @@ luatexbase.create_callback('luatexja.adjust_jfmglue', 'simple', function(n) retu -- change penalties (or create a new penalty, if needed) local function handle_penalty_normal(post, pre, g) - luatexbase.call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) + call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) local a = (pre or 0) + (post or 0) if #Bp == 0 then if (a~=0 and not(g and getid(g)==id_kern)) then local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end - setfield(p, 'penalty', a); head = insert_before(head, Np.first, p) + setpenalty(p, a); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) end else for _, v in pairs(Bp) do add_penalty(v,a) end @@ -700,13 +710,13 @@ local function handle_penalty_normal(post, pre, g) end local function handle_penalty_always(post, pre, g) - luatexbase.call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) + call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) local a = (pre or 0) + (post or 0) if #Bp == 0 then if not (g and getid(g)==id_glue) or a~=0 then local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end - setfield(p, 'penalty', a); head = insert_before(head, Np.first, p) + setpenalty(p, a); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) end else for _, v in pairs(Bp) do add_penalty(v,a) end @@ -714,14 +724,14 @@ local function handle_penalty_always(post, pre, g) end local function handle_penalty_suppress(post, pre, g) - luatexbase.call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) + call_callback('luatexja.adjust_jfmglue', head, Nq, Np, Bp) if #Bp == 0 then if g and getid(g)==id_glue then local p = node_new(id_penalty, nil, Nq.nuc, Np.nuc) - setfield(p, 'penalty', 10000); head = insert_before(head, Np.first, p) + setpenalty(p, 10000); head = insert_before(head, Np.first, p) Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) end - else + else local a = (pre or 0) + (post or 0) for _, v in pairs(Bp) do add_penalty(v,a) end end @@ -733,7 +743,7 @@ local function handle_penalty_jwp() if a~=0 then local p = node_new(id_penalty, widow_Np.nuc) if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end - setfield(p, 'penalty', a); head = insert_before(head, widow_Np.first, p) + setpenalty(p, a); head = insert_before(head, widow_Np.first, p) widow_Bp[1]=p; set_attr(p, attr_icflag, KINSOKU) end else for _, v in pairs(widow_Bp) do add_penalty(v,a) end @@ -746,13 +756,13 @@ local function new_jfm_glue(mc, bc, ac) local g = mc[bc][ac] if g then if g[1] then - local k = node_new(id_kern, 1); setfield(k, 'kern', g[1]) + local k = node_new(id_kern, 1); setkern(k, g[1]) set_attr(k, attr_icflag, FROM_JFM) return k, g.ratio, false, false, false else local f = node_new(id_glue) set_attr(f, attr_icflag, g.priority) - setglue(f, g.width, g.stretch, g.shrink) + setglue(f, g[2], g[3], g[4]) return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink end end @@ -779,6 +789,7 @@ do local bg_ak = 2*id_glue - id_kern local bk_ag = 2*id_kern - id_glue local bk_ak = 2*id_kern - id_kern + local getkern = node.direct.getkern local function blend_diffmet(b, a, rb, ra) return round(luatexja.jfmglue.diffmet_rule((1-rb)*b+rb*a, (1-ra)*b+ra*a)) @@ -793,31 +804,30 @@ do return round(r/2.^(64*ro)), ro end end - local getglue = luatexja.getglue calc_ja_ja_aux = function (gb, ga, db, da) if luatexja.jfmglue.diffmet_rule ~= math.two_pleft and diffmet_rule ~= math.two_pright and luatexja.jfmglue.diffmet_rule ~= math.two_paverage then db, da = 0, 1 end if not gb then - if ga then gb = node_new(id_kern, 1); setfield(gb, 'kern', 0) + if ga then gb = node_new(id_kern, 1); setkern(gb, 0) else return nil end elseif not ga then - ga = node_new(id_kern, 1); setfield(ga, 'kern', 0) + ga = node_new(id_kern, 1); setkern(ga, 0) end local gbw, gaw, gbst, gast, gbsto, gasto, gbsh, gash, gbsho, gasho if getid(gb)==id_glue then gbw, gbst, gbsh, gbsto, gbsho = getglue(gb) else - gbw = getfield(gb, 'kern') + gbw = getkern(gb) end if getid(ga)==id_glue then gaw, gast, gash, gasto, gasho = getglue(ga) else - gaw = getfield(ga, 'kern') + gaw = getkern(ga) end if not (gbst or gast) then -- 両方とも kern - setfield(gb, 'kern', blend_diffmet(gbw, gaw, db, da)) + setkern(gb, blend_diffmet(gbw, gaw, db, da)) node_free(ga); return gb else local gr = gb @@ -848,8 +858,8 @@ do if kanjiskip_jfm_flag then local g = node_new(id_glue); local bk = qm.kanjiskip or null_skip_table - setglue(g, bn and (bn*bk[1]) or 0, - bp and (bp*bk[2]) or 0, + setglue(g, bn and (bn*bk[1]) or 0, + bp and (bp*bk[2]) or 0, bh and (bh*bk[3]) or 0, 0, 0) set_attr(g, attr_icflag, KANJI_SKIP_JFM) return g @@ -858,8 +868,8 @@ do local st = bp and (bp*getfield(kanji_skip, 'stretch')) or 0 local sh = bh and (bh*getfield(kanji_skip, 'shrink')) or 0 setglue(g, - bn and (bn*getfield(kanji_skip, 'width')) or 0, - st, sh, + bn and (bn*getwidth(kanji_skip)) or 0, + st, sh, (st==0) and 0 or getfield(kanji_skip, 'stretch_order'), (sh==0) and 0 or getfield(kanji_skip, 'shrink_order')) set_attr(g, attr_icflag, KANJI_SKIP_JFM) @@ -867,9 +877,9 @@ do end end end - + get_kanjiskip = function() - if Np.auto_kspc==0 or Nq.auto_kspc==0 then return nil + if Np.auto_kspc==0 or Nq.auto_kspc==0 then return nil elseif Np.auto_kspc or Nq.auto_kspc then local pm, qm = Np.met, Nq.met if (pm.char_type==qm.char_type) and (qm.var==pm.var) then @@ -877,15 +887,15 @@ do else local gb = get_kanjiskip_low(false, qm, 1, 1, 1) if gb then - return calc_ja_ja_aux(gb, - get_kanjiskip_low(false, pm, 1, 1, 1) or node_copy(kanji_skip), 0, 1) + return calc_ja_ja_aux(gb, + get_kanjiskip_low(false, pm, 1, 1, 1) or node_copy(kanji_skip), 0, 1) else local ga = get_kanjiskip_low(false, pm, 1, 1, 1) return (ga and calc_ja_ja_aux(node_copy(kanji_skip), ga, 0, 1)) or node_copy(kanji_skip) end end - else + else local g = node_new(id_glue) set_attr(g, attr_icflag, kanjiskip_jfm_flag and KANJI_SKIP_JFM or KANJI_SKIP) return g @@ -900,11 +910,11 @@ do return g, (Np.auto_kspc or Nq.auto_kspc) and get_kanjiskip_low(true, qm, kn, kp, kh) else local npn, nqn = Np.nuc, Nq.nuc - local gb, db, bn, bp, bh + local gb, db, bn, bp, bh = new_jfm_glue(qmc, Nq.class, slow_find_char_class(Np.char, qm, getchar(npn))) - local ga, da, an, ap, ah + local ga, da, an, ap, ah = new_jfm_glue(pmc, slow_find_char_class(Nq.char, pm, getchar(nqn)), @@ -942,22 +952,23 @@ do elseif flag then return node_copy(xkanji_skip) else - local g = node_new(id_glue); + local g = node_new(id_glue) + local w, st, sh, sto, sho = getglue(xkanji_skip) setglue(g, - bn and (bn*getfield(xkanji_skip, 'width')) or 0, - bp and (bp*getfield(xkanji_skip, 'stretch')) or 0, - bh and (bh*getfield(xkanji_skip, 'shrink')) or 0, - bp and getfield(xkanji_skip, 'stretch_order') or 0, - bh and getfield(xkanji_skip, 'shrink_order') or 0) + bn and (bn*w) or 0, + bp and (bp*st) or 0, + bh and (bh*sh) or 0, + bp and sto or 0, + bh and sho or 0) set_attr(g, attr_icflag, XKANJI_SKIP_JFM) return g end end end - + get_xkanjiskip = function(Nn) if Np.auto_xspc==0 or Nq.auto_xspc==0 then - return nil + return nil elseif (Nq.xspc>=2) and (Np.xspc%2==1) and (Nq.auto_xspc or Np.auto_xspc) then return get_xkanjiskip_low(true, Nn.met, 1, 1, 1) else @@ -999,7 +1010,7 @@ local function get_OA_skip(insert_ksp) local g, _, kn, kp, kh = new_jfm_glue( pm.char_type, fast_find_char_class( - (((Nq.id==id_glue)or(Nq.id==id_kern)) and 'glue' or 'jcharbdd'), pm), + (((Nq.id==id_glue)or(Nq.id==id_kern)) and 'glue' or 'jcharbdd'), pm), Np.class) local k if insert_ksp then @@ -1027,7 +1038,7 @@ local function handle_np_jachar(mode) local g, k if non_ihb_flag then g, k = calc_ja_ja_glue() end -- M->K if not g then g = get_kanjiskip() end - handle_penalty_normal(Nq.post, Np.pre, g); + handle_penalty_normal(Nq.post, Np.pre, g); real_insert(g); real_insert(k) elseif Nq.met then -- qid==id_hlist local g, k @@ -1037,7 +1048,7 @@ local function handle_np_jachar(mode) elseif Nq.pre then local g, k; if non_ihb_flag then g, k = get_NA_skip() end -- N_A->X if not g then g = get_xkanjiskip(Np) end - handle_penalty_normal((qid==id_hlist and 0 or Nq.post), Np.pre, g); + handle_penalty_normal((qid==id_hlist and 0 or Nq.post), Np.pre, g); real_insert(g); real_insert(k) else local g = non_ihb_flag and (get_OA_skip()) -- O_A @@ -1102,11 +1113,11 @@ do [id_hlist] = function() after_hlist(Nq) end, [id_pbox] = function() after_hlist(Nq) end, [id_disc] = function() after_hlist(Nq) end, - [id_glue] = function() - luatexbase.call_callback("luatexja.jfmglue.special_jaglue_after", Nq.nuc) + [id_glue] = function() + call_callback("luatexja.jfmglue.special_jaglue_after", Nq.nuc) end, [id_pbox_w]= function() - local hh = luatexbase.call_callback("luatexja.jfmglue.whatsit_after", false, Nq, Np, head) + local hh = call_callback("luatexja.jfmglue.whatsit_after", false, Nq, Np, head) -- hh: new head of false (nott processed) if hh then head = hh end end, @@ -1130,7 +1141,7 @@ local function handle_list_tail(mode, last) -- Insert \jcharwidowpenalty if widow_Np.first then handle_penalty_jwp() end else - Np = Nq + Np = Nq -- the current list is the contents of a hbox local npi, pm = Np.id, Np.met if npi == id_jglyph or (npi==id_pbox and pm) then @@ -1153,7 +1164,7 @@ local function handle_list_head(par_indented) set_attr(g, attr_icflag, BOXBDD) if getid(g)==id_glue and #Bp==0 then local h = node_new(id_penalty, nil, Np.nuc) - setfield(h, 'penalty', 10000); set_attr(h, attr_icflag, BOXBDD) + setpenalty(h, 10000); set_attr(h, attr_icflag, BOXBDD) end head = insert_before(head, Np.first, g) end @@ -1178,7 +1189,7 @@ do {}, {}, {first=nil}, { auto_kspc=nil, auto_xspc=nil, char=nil, class=nil, first=nil, id=nil, last=nil, met=nil, nuc=nil, - post=nil, pre=nil, xspc=nil, gk=nil }, + post=nil, pre=nil, xspc=nil, gk=nil }, { auto_kspc=nil, auto_xspc=nil, char=nil, class=nil, first=nil, id=nil, last=nil, met=nil, nuc=nil, post=nil, pre=nil, xspc=nil, gk=nil }, @@ -1194,31 +1205,28 @@ do local is_dir_tate = list_dir==dir_tate capsule_glyph = is_dir_tate and ltjw.capsule_glyph_tate or ltjw.capsule_glyph_yoko attr_ablshift = is_dir_tate and attr_tablshift or attr_yablshift - local TEMP = node_new(id_glue) - -- TEMP is a dummy node, which will be freed at the end of the callback. - -- ithout this node, set_attr(kanji_skip, ...) somehow creates an "orphaned" attribute list. - + local TEMP = node_new(id_glue) + -- TEMP is a dummy node, which will be freed at the end of the callback. + -- Without this node, set_attr(kanji_skip, ...) somehow creates an "orphaned" attribute list. do kanji_skip, kanjiskip_jfm_flag = skip_table_to_glue(KSK) set_attr(kanji_skip, attr_icflag, KANJI_SKIP) end - do xkanji_skip, xkanjiskip_jfm_flag = skip_table_to_glue(XSK) set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP) end - if mode then -- the current list is to be line-breaked: -- hbox from \parindent is skipped. local lp, par_indented, lpi, lps = head, 'boxbdd', getid(head), getsubtype(head) - while lp and + while lp and ((lpi==id_whatsit and lps~=sid_user) or ((lpi==id_hlist) and (lps==3)) or (lpi==id_local)) do if (lpi==id_hlist) and (lps==3) then Np.char, par_indented = 'parbdd', 'parbdd' - Np.width = getfield(lp, 'width') + Np.width = getwidth(lp) end lp=node_next(lp); lpi, lps = getid(lp), getsubtype(lp) end return lp, node_tail(head), par_indented, TEMP @@ -1240,7 +1248,7 @@ function luatexja.jfmglue.main(ahead, mode, dir) lp = calc_np(last, lp) if Np then handle_list_head(par_indented) - lp = calc_np(last,lp); + lp = calc_np(last,lp); while Np do adjust_nq(); local pid, pm = Np.id, Np.met @@ -1260,25 +1268,26 @@ function luatexja.jfmglue.main(ahead, mode, dir) end -- 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(kanji_skip); node_free(xkanji_skip); node_free(TEMP) return head end end do - local IHB = luatexja.userid_table.IHB + local IHB = luatexja.userid_table.IHB local BPAR = luatexja.userid_table.BPAR local BOXB = luatexja.userid_table.BOXB local node_prev = node.direct.getprev local node_write = node.direct.write + local setvalue = node.direct.setdata -- \inhibitglue, \disinhibitglue local function ihb_node(v) local tn = node_new(id_whatsit, sid_user) setfield(tn, 'user_id', IHB) setfield(tn, 'type', 100) - setfield(tn, 'value', v) + setvalue(tn, v) node_write(tn) end function luatexja.jfmglue.create_inhibitglue_node() @@ -1294,7 +1303,7 @@ do local tn = node_new(id_whatsit, sid_user) setfield(tn, 'user_id', BPAR) setfield(tn, 'type', 100) - setfield(tn, 'value', 1) + setvalue(tn, 1) node_write(tn) end @@ -1303,7 +1312,7 @@ do local tn = node_new(id_whatsit, sid_user) setfield(tn, 'user_id', BOXB) setfield(tn, 'type', 100) - setfield(tn, 'value', 1) + setvalue(tn, 1) node_write(tn) end @@ -1320,7 +1329,7 @@ do end Np.met = Nq.met; Np.pre = 0; Np.post = 0; Np.xspc = 0 Np.auto_xspc, Np.auto_kspc = 0, 0 - end + end return Np else return Np @@ -1374,38 +1383,42 @@ do local attr_yablshift = luatexbase.attributes['ltj@yablshift'] local attr_tablshift = luatexbase.attributes['ltj@tablshift'] local getcount, abs, scan_keyword = tex.getcount, math.abs, token.scan_keyword + local getnest = tex.getnest + local tex_getattr = tex.getattribute local get_current_jfont + local cnt_stack = luatexbase.registernumber 'ltj@@stack' do local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_curtfnt = luatexbase.attributes['ltj@curtfnt'] local dir_tate = luatexja.dir_table.dir_tate - local get_dir_count = ltjd.get_dir_count + local get_dir_count = ltjd.get_dir_count function get_current_jfont() - return tex.getattribute((get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) + return tex_getattr((get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) end end + local get_stack_skip = ltjs.get_stack_skip -- \insertxkanjiskip -- SPECIAL_JAGLUE のノード: -- * (X)KANJI_SKIP(_JFM): その場で値が決まっている -- * PROCESSED_BEGIN_FLAG + (X)KANJI_SKIP: 段落終了時に決める local function insert_k_skip_common(ind, name, ica, icb) - if abs(tex.nest[tex.nest.ptr].mode) ~= ltjs.hmode then return end + if abs(getnest().mode) ~= ltjs.hmode then return end local g = node_new(id_glue); set_attr(g, attr_icflag, SPECIAL_JAGLUE) - local is_late = scan_keyword("late") + local is_late = scan_keyword 'late' if not is_late then - local st = ltjs.get_stack_skip(ind, getcount('ltj@@stack')) - if st.width==1073741823 then + local st = get_stack_skip(ind, getcount(cnt_stack)) + if st[1]==1073741823 then local bk = ltjf_font_metric_table[get_current_jfont()][name] if bk then setglue(g, bk[1] or 0, bk[2] or 0, bk[3] or 0, 0, 0) end set_attr(g, attr_yablshift, icb); node_write(g); return end - setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order) + setglue(g, st[1], st[2], st[3], st[4], st[5]) set_attr(g, attr_yablshift, ica) else set_attr(g, attr_yablshift, PROCESSED_BEGIN_FLAG + ica) - set_attr(g, attr_tablshift, get_current_jfont()) + set_attr(g, attr_tablshift, get_current_jfont()) end node_write(g) end @@ -1416,7 +1429,6 @@ do insert_k_skip_common(KSK, "kanjiskip", KANJI_SKIP, KANJI_SKIP_JFM) end -- callback - local getglue = luatexja.getglue local function special_jaglue(lx) local lxi = get_attr_icflag(lx) if lxi==SPECIAL_JAGLUE then @@ -1430,22 +1442,22 @@ do if w~=1073741823 then setglue(lx, w, st, sh, sto, sho); set_attr(lx, attr_icflag, lxi) else - local m = ltjf_font_metric_table[has_attr(lx, attr_tablshift)] + local m = ltjf_font_metric_table[get_attr(lx, attr_tablshift)] setglue(lx, bk[1], bk[2], bk[3], 0, 0) set_attr(lx, attr_icflag, lxi_jfm) end end local function special_jaglue_after(lx) if get_attr_icflag(lx)==SPECIAL_JAGLUE then - lxi=has_attr(lx, attr_yablshift) + lxi=get_attr(lx, attr_yablshift) if lxi>=PROCESSED_BEGIN_FLAG then lxi = lxi%PROCESSED_BEGIN_FLAG if lxi == KANJI_SKIP then - special_jaglue_after_inner(lx, lxi, KANJI_SKIP_JFM, kanji_skip, - ltjf_font_metric_table[has_attr(lx, attr_tablshift)].kanjiskip or null_skip_table) + special_jaglue_after_inner(lx, lxi, KANJI_SKIP_JFM, kanji_skip, + ltjf_font_metric_table[get_attr(lx, attr_tablshift)].kanjiskip or null_skip_table) else -- lxi == XKANJI_SKIP - special_jaglue_after_inner(lx, lxi, XKANJI_SKIP_JFM, xkanji_skip, - ltjf_font_metric_table[has_attr(lx, attr_tablshift)].xkanjiskip or null_skip_table) + special_jaglue_after_inner(lx, lxi, XKANJI_SKIP_JFM, xkanji_skip, + ltjf_font_metric_table[get_attr(lx, attr_tablshift)].xkanjiskip or null_skip_table) end else set_attr(lx, attr_icflag, lxi) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index 70557c08a83..a14edd2b798 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2021-11-06', + date = '2022-08-20', description = 'Loader for Japanese fonts', }) @@ -18,17 +18,18 @@ local getid = node.direct.getid local to_direct = node.direct.todirect local node_new = node.direct.new -local node_free = node.direct.free -local has_attr = node.direct.has_attribute +local node_free = node.direct.flush_node or node.direct.free +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute local round = tex.round local font_getfont = font.getfont +local setkern = node.direct.setkern local attr_icflag = luatexbase.attributes['ltj@icflag'] local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_curtfnt = luatexbase.attributes['ltj@curtfnt'] -local id_glyph = node.id('glyph') -local id_kern = node.id('kern') +local id_glyph = node.id 'glyph' +local id_kern = node.id 'kern' local cat_lp = luatexbase.catcodetables['latex-package'] local FROM_JFM = luatexja.icflag_table.FROM_JFM @@ -118,18 +119,18 @@ function luatexja.jfont.define_jfm(to) v.end_adjust = nil elseif #(v.end_adjust)==0 then v.end_adjust = nil - else + else table.sort(v.end_adjust) end end else v.end_adjust = nil - if v.end_stretch and v.end_stretch~=0.0 then - v.end_adjust = (v.end_adjust or {}) + if v.end_stretch and v.end_stretch~=0.0 then + v.end_adjust = (v.end_adjust or {}) v.end_adjust[#(v.end_adjust)+1] = v.end_stretch end - if v.end_shrink and v.end_ahrink~=0.0 then - v.end_adjust = (v.end_adjust or {}) + if v.end_shrink and v.end_ahrink~=0.0 then + v.end_adjust = (v.end_adjust or {}) v.end_adjust[#(v.end_adjust)+1] = -v.end_shrink end if v.end_adjust then v.end_adjust[#(v.end_adjust)+1] = 0.0 end @@ -148,8 +149,8 @@ function luatexja.jfont.define_jfm(to) elseif xp and type(xp)~='number' then defjfm_res = nil else - xp = (xp or 0)*9+36 - if xp<0 or xp>=64 then defjfm_res=nil end + xp = (xp or 0)*9+36 + if xp<0 or xp>=64 then defjfm_res=nil end end x.priority = xp end @@ -169,8 +170,8 @@ function luatexja.jfont.define_jfm(to) end end if t.version<3 then - -- In version 3, 'jcharbdd' is divided into - -- 'alchar': ALchar (or math boundary) + -- In version 3, 'jcharbdd' is divided into + -- 'alchar': ALchar (or math boundary) -- 'nox_alchar': ALchar (or math boundary), where xkanjiskip won't inserted -- 'glue': glue/kern, 'jcharbdd': other cases (和文B, rule, ...) t.chars.alchar = t.chars.jcharbdd @@ -218,10 +219,9 @@ do if type(i) == 'number' then -- char_type for k,w in pairs(v.glue) do v[k] = { - nil, + nil, w[1], w[2], w[3], ratio=w.ratio, priority=FROM_JFM + w.priority, - width = w[1], stretch = w[2], shrink = w[3], kanjiskip_natural = w.kanjiskip_natural, kanjiskip_stretch = w.kanjiskip_stretch, kanjiskip_shrink = w.kanjiskip_shrink, @@ -279,7 +279,6 @@ end local load_jfont_metric, check_callback_order local font_extra_info = {} -- defined later do - local cstemp local global_flag -- true if \globaljfont, false if \jfont load_jfont_metric = function() if jfm_name=='' then @@ -300,13 +299,10 @@ do -- EXT local utfbyte = utf.byte - function luatexja.jfont.jfontdefX(g, dir, csname) + function luatexja.jfont.jfontdefX(g, dir) jfm_dir, is_def_jfont = dir, true - cstemp = csname:sub( (utfbyte(csname,1,1) == tex.escapechar) and 2 or 1, -1) - cstemp = cstemp:sub(1, ((cstemp:sub(-1,-1)==' ') and (cstemp:len()>=2)) and -2 or -1) global_flag = g and '\\global' or '' - tex.sprint(cat_lp, '\\expandafter\\font\\csname ', - (cstemp==' ') and '\\space' or cstemp, '\\endcsname') + tex.sprint(cat_lp, '\\expandafter\\font\\ltj@temp') end luatexbase.create_callback("luatexja.define_jfont", "data", function (ft, fn) return ft end) @@ -315,15 +311,12 @@ do local fastcopy=table.fastcopy function luatexja.jfont.jfontdefY() local j = load_jfont_metric(jfm_dir) - local fn = font.id(cstemp) - local f = font_getfont(fn) + local fn = token.get_next().mode; local f = font_getfont(fn) if not j then ltjb.package_error('luatexja', "bad JFM `" .. jfm_name .. "'", 'The JFM file you specified is not valid JFM file.\n'.. 'So defining Japanese font is cancelled.') - tex.sprint(cat_lp, global_flag, '\\expandafter\\let\\csname ', - (cstemp==' ') and '\\space' or cstemp, - '\\endcsname=\\relax') + tex.sprint(cat_lp, global_flag, '\\expandafter\\let\\ltj@temp\\relax') return end if not f then return end @@ -340,16 +333,15 @@ do } if auto_enable_vrt2 then local vert_name = ltju.exist_feature(fn, 'vrt2') and 'vrt2' or 'vert' - local rot = fmtable.rotation + local rot = fmtable.rotation ltju.enable_feature(fn, vert_name) ltju.loop_over_feat(f, {[vert_name]=true}, function (i,k) rot[i] = nil end) end fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn) font_metric_table[fn]=fmtable - tex.sprint(cat_lp, global_flag, '\\protected\\expandafter\\def\\csname ', - (cstemp==' ') and '\\space' or cstemp, '\\endcsname{\\ltj@cur'.. - (jfm_dir == 'yoko' and 'j' or 't') .. 'fnt', fn, '\\relax}') + tex.sprint(cat_lp, global_flag, '\\protected\\expandafter\\def\\ltj@temp', + '{\\ltj@cur'.. (jfm_dir == 'yoko' and 'j' or 't') .. 'fnt', fn, '\\relax}') jfm_spec = nil end end @@ -365,7 +357,7 @@ do to_be_checked[i]=nil if ltj_cb<lotf_cb then local f = ltb.remove_from_callback(n,'luaotfload.letterspace') - ltb.add_to_callback(n, f, 'luaotfload.letterspace', + ltb.add_to_callback(n, f, 'luaotfload.letterspace', ltb.priority_in_callback(n, 'luaotfload.node_processor') + 1) end end @@ -428,7 +420,7 @@ do local parser=luaotfload.parsers.font_request function is_feature_specified(s,fname) local t = lpegmatch(parser,s); return t and t.features and t.features[fname] - end + end -- extract jfm_name, jfm_spec and jfm_var -- normalize position of 'jfm=' and 'jfmvar=' keys local function extract_jfm_spec(name) @@ -461,7 +453,7 @@ do jfm_ksp = (is_feature_specified(name,'ltjksp')~=false) if jfm_dir == 'tate' then vert_activated = (is_feature_specified(name,'vert')~=false) and (is_feature_specified(name,'vrt2')~=false) - auto_enable_vrt2 + auto_enable_vrt2 = (is_feature_specified(name,'vert')==nil) and (is_feature_specified(name,'vrt2')==nil) else vert_activated, auto_enable_vrt2 = nil, nil @@ -797,7 +789,7 @@ do local lo, hi = 1, #t while lo < hi do local mi = ceil((lo+hi)/2) - if t[mi]<=i then lo=mi else hi=mi-1 end + if t[mi]<=i then lo=mi else hi=mi-1 end end return lo%2==1 end @@ -844,14 +836,14 @@ do local bname = tfmdata.psname or nameonly(tfmdata.filename) if not font_extra_basename[bname] then -- if the cache is present, read it - -- + -- local newtime = file_attributes(tfmdata.filename,"modification") local v = "extra_" .. string.lower(bname) local dest = load_cache( v, - function (t) + function (t) return (t.lotf_version~=luaotfload.version) - or (t.version~=cache_ver) or (t.modtime~=newtime) + or (t.version~=cache_ver) or (t.modtime~=newtime) end ) -- if the cache is not found or outdated, save the cache @@ -885,7 +877,7 @@ do dummytable.vorigin, dummytable.vheight = dtvo, dtvh end end - + local function prepare_extra_data_font(id, res, name) if type(res)=='table' and (res.psname or res.filename) then if (res.embedding=='no') and (type(name)=='string') and (name:sub(1,5)=='psft:') then @@ -938,19 +930,19 @@ do [0x3014]=0xFE39, [0x3015]=0xFE3A, [0x3010]=0xFE3B, [0x3011]=0xFE3C, [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40, [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44, - [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, + [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, } local vert_jpotf_table, vert_feat = {}, {vert=true} local utfbyte, utfsub = utf.byte, utf.sub luatexja.jfont.register_vert_replace = function(t) for i,v in pairs(t) do - local ic = (type(i)=='number') and i or + local ic = (type(i)=='number') and i or ((type(i)=='string') and utfbyte(utfsub(i,1,1)) or nil) if ic then - vert_jpotf_table[ic] = (type(v)=='number') and v or + vert_jpotf_table[ic] = (type(v)=='number') and v or ((type(v)=='string') and utfbyte(utfsub(v,1,1)) or nil) end - end + end end luatexbase.add_to_callback( @@ -1023,28 +1015,28 @@ do local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct local ensure_tex_attr = ltjb.ensure_tex_attr local node_write = node.direct.write - local font = font + local fonts, getnest = font.fonts, tex.getnest local new_ic_kern = function(g) return node_new(id_kern,3) end local dir_tate = luatexja.dir_table.dir_tate -- EXT: italic correction function luatexja.jfont.append_italic() - local p = to_direct(tex.nest[tex.nest.ptr].tail) + local p = to_direct(getnest().tail) local TEMP = node_new(id_kern) if p and getid(p)==id_glyph then if is_ucs_in_japanese_char(p) then local j = font_metric_table[ - has_attr(p, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) + get_attr(p, (get_dir_count()==dir_tate) and attr_curtfnt or attr_curjfnt) ] local g = new_ic_kern() - setfield(g, 'kern', j.char_type[find_char_class(getchar(p), j)].italic) + setkern(g, j.char_type[find_char_class(getchar(p), j)].italic) node_write(g); ensure_tex_attr(attr_icflag, 0) else local f = getfont(p) - local h = font_getfont(f) or font.fonts[f] + local h = font_getfont(f) or fonts[f] if h then - local g = new_ic_kern() if h.characters[getchar(p)] and h.characters[getchar(p)].italic then - setfield(g, 'kern', h.characters[getchar(p)].italic) + local g = new_ic_kern() + setkern(g, h.characters[getchar(p)].italic) node_write(g); ensure_tex_attr(attr_icflag, 0) end end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex b/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex index 179e621054d..e420750891d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.tex @@ -467,5 +467,5 @@ \directlua{% local s = table.copy(luatexja.stack.charprop_stack_table[0]) - luatexja.base.save_cache('ltj-kinsoku_default', {s, version=3}) + luatexja.base.save_cache('ltj-kinsoku_default', {s, version=4}) } diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua index f8b97c144b6..107ee804a88 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua @@ -6,24 +6,26 @@ luatexja.load_module 'direction'; local ltjd = luatexja.direction luatexja.lineskip = luatexja.lineskip or {} local to_direct = node.direct.todirect +local to_node = node.direct.tonode local ltjl = luatexja.lineskip local id_glue = node.id 'glue' local id_penalty = node.id 'penalty' local id_hlist = node.id 'hlist' -local setfield = node.direct.setfield -local getfield = node.direct.getfield local getlist = node.direct.getlist local node_new = node.direct.new local node_prev = node.direct.getprev local node_next = node.direct.getnext local getid = node.direct.getid local getsubtype = node.direct.getsubtype +local getdepth = node.direct.getdepth +local getheight = node.direct.getheight local texget = tex.get local node_getglue = node.getglue local setglue = node.direct.setglue +local setsubtype = node.direct.setsubtype local function copy_glue (new_glue, old_glue_name, subtype, new_w) - setfield(new_glue, 'subtype', subtype) + setsubtype(new_glue, subtype) local w,st,sp,sto,spo = texget(old_glue_name, true) setglue(new_glue, new_w or w, st, sp, sto, spo) end @@ -57,11 +59,11 @@ local function adjust_glue(nh) local p, n = node_prev(x), node_next(x) if p then local pid = getid(p) - while (id_glue<=pid) and (pid<=id_penalty) and node_prev(p) do + while (id_glue<=pid) and (pid<=id_penalty) and node_prev(p) do p = node_prev(p); pid = getid(p) end if pid==id_hlist and getid(n)==id_hlist then - local normal = bw - getfield(p, 'depth') - getfield(n, 'height') + local normal = bw - getdepth(p) - getheight(n) local lmin, adj = ltj_profiler(p, n, false, bw) ltj_skip(lmin or normal, x, adj, normal, bw) end @@ -77,17 +79,20 @@ do local p_dummy = ltjl.p_dummy local make_dir_whatsit = luatexja.direction.make_dir_whatsit local get_dir_count = luatexja.direction.get_dir_count -local node_write = node.direct.write +local getwhd = node.direct.getwhd +local setnext = node.direct.setnext +local getnest = tex.getnest local function dir_adjust_append_vlist(b, loc, prev, mirrored) local old_b = to_direct(b) - local new_b = loc=='box' and + local new_b = loc=='box' and make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b + local _, ht, dp = getwhd(new_b) if prev > -65536000 then local bw = texget('baselineskip', false) - local normal = bw - prev - getfield(new_b, mirrored and 'depth' or 'height') + local normal = bw - prev - (mirrored and dp or ht) local lmin, adj = nil, 0 - local tail = to_direct(tex.nest[tex.nest.ptr].tail) + local tail = to_direct(getnest().tail) if p_dummy~=ltj_profiler then while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do tail = node_prev(tail) @@ -95,17 +100,16 @@ local function dir_adjust_append_vlist(b, loc, prev, mirrored) end if tail then if getid(tail)==id_hlist and getid(new_b)==id_hlist then - if getfield(tail, 'depth')==prev then + if getdepth(tail)==prev then lmin, adj = ltj_profiler(tail, new_b, mirrored, bw) end end end local g = node_new(id_glue) - ltj_skip(lmin or normal, g, adj, normal, bw, loc); node_write(g) + ltj_skip(lmin or normal, g, adj, normal, bw, loc) + setnext(g, new_b); return to_node(g), (mirrored and ht or dp) + else return to_node(new_b), (mirrored and ht or dp) end - node_write(new_b) - tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth') - return nil -- do nothing on tex side end ltjb.add_to_callback('append_to_vlist_filter', dir_adjust_append_vlist, 'ltj.lineskip', 10000) end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-lotf_aux.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-lotf_aux.lua index bd3a602e648..cc2c613c407 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-lotf_aux.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-lotf_aux.lua @@ -18,7 +18,7 @@ function aux.exist_feature(id, name) return provides_feature(id, t.properties.script, t.properties.language, name) else return false end -end +end function aux.enable_feature(id, name) local t = getfont(id) @@ -57,7 +57,7 @@ local function get_asc_des(id) elseif t.hb then -- HARF local hbfont, u = t.hb.shared.font, t.hb.shared.upem local h = hbfont:get_h_extents() - if h and u then + if h and u then a, d = h.ascender and h.ascender/u, h.descender and -h.descender/u end end @@ -87,7 +87,7 @@ local function get_vmet_table(tfmdata, dest) end local rawdata = tfmdata.shared.rawdata local ascender = rawdata.metadata.ascender or 0 - local default_vheight + local default_vheight = rawdata.metadata.defaultvheight or (rawdata.metadata.descender and (ascender+rawdata.metadata.descender) or units) local units = tfmdata.units @@ -135,10 +135,10 @@ local function loop_over_feat(id, feature_name, func, universal) for _,i in pairs(t.resources.sequences) do if i.order[1] and feature_name[i.order[1]] then local f = i.features and i.features[i.order[1]] - if i.type == 'gsub_single' and i.steps + if i.type == 'gsub_single' and i.steps and f and (universal or (f[t.properties.script] and f[t.properties.script][t.properties.language])) then for _,j in pairs(i.steps) do - if type(j)=='table' then + if type(j)=='table' then if type(j.coverage)=='table' then for i,k in pairs(j.coverage) do local s = func(i,k); if s then return s end @@ -155,14 +155,14 @@ aux.loop_over_feat = loop_over_feat local vert_vrt2 = { vert=true, vrt2=true } function aux.replace_vert_variant(id, c) - return loop_over_feat(id, vert_vrt2, + return loop_over_feat(id, vert_vrt2, function (i,k) if i==c then return k end end) or c end --for name, func in pairs(aux) do --- if type(func)=="function" then +-- if type(func)=="function" then -- aux[name] = function(...) -- print('LOTF_AUX', name, ...); -- local a = func(...); print('RESULT', a); return a @@ -174,8 +174,8 @@ local search search = function (t, key, prefix) if type(t)=="table" then prefix = prefix or '' - for i,v in pairs(t) do - if i==key then print(prefix..'.'..i, v) + for i,v in pairs(t) do + if i==key then print(prefix..'.'..i, v) else search(v,key,prefix..'.'..tostring(i)) end end end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua index 2a7c0444c74..a8664d7cf32 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua @@ -14,8 +14,17 @@ local getfield = node.direct.getfield local getid = node.direct.getid local getsubtype = node.direct.getsubtype local getlist = node.direct.getlist --- getlist cannot be used for sub_box nodes. Use instead λp. getfield(p, 'head') local getchar = node.direct.getchar +local getnucleus = node.direct.getnucleus +local getsup = node.direct.getsup +local getsub = node.direct.getsub +local getshift = node.direct.getshift +local setnext = node.direct.setnext +local setnucleus = node.direct.setnucleus +local setsup = node.direct.setsup +local setsub = node.direct.setsub +local setlist = node.direct.setlist +local setshift = node.direct.setshift local to_node = node.direct.tonode local to_direct = node.direct.todirect @@ -24,10 +33,11 @@ local node_traverse = node.direct.traverse local node_new = node.direct.new local node_next = node.direct.getnext local node_remove = node.direct.remove -local node_free = node.direct.free -local has_attr = node.direct.has_attribute +local node_free = node.direct.flush_node or node.direct.free +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute -local tex_getcount = tex.getcount +local getcount = tex.getcount +local cnt_stack = luatexbase.registernumber 'ltj@@stack' local attr_jchar_class = luatexbase.attributes['ltj@charclass'] local attr_dir = luatexbase.attributes['ltj@dir'] @@ -66,33 +76,34 @@ local list_dir -- vcenter noad は軸に揃えるため,欧文ベースライン補正がかかる local function conv_vcenter(sb) - local h = getfield(sb, 'head'); local hd = getlist(h) - if getid(hd)==id_whatsit and getsubtype(hd)==sid_user + local h = getlist(sb) ; local hd = getlist(h) + if getid(hd)==id_whatsit and getsubtype(hd)==sid_user and getfield(hd, 'user_id')==DIR then local d = node_next(hd) - if getid(d)==id_vlist and has_attr(d, attr_dir)>=dir_node_auto then - node_free(hd); setfield(h, 'head', nil); node_free(h) - setfield(sb, 'head', d); set_attr(d, attr_icflag, 0) + if getid(d)==id_vlist and get_attr(d, attr_dir)>=dir_node_auto then + node_free(hd); setlist(h, nil); node_free(h) + setlist(sb, d); set_attr(d, attr_icflag, 0) end end return sb end local cjhh_A --- sty : 0 (display or text), 1 (script), >=2 (scriptscript) +local max, min = math.max, math.min +-- sty : -1 (display), 0 (text), 1 (script), >=2 (scriptscript) local function conv_jchar_to_hbox(head, sty) for p in node_traverse(head) do local pid = getid(p) if pid == id_simple or pid == id_accent then if getsubtype(p)==12 then - conv_vcenter(getfield(p, 'nucleus')) + conv_vcenter(getnucleus(p)) else - setfield(p, 'nucleus', cjh_A(getfield(p, 'nucleus'), sty)) + setnucleus(p, cjh_A(getnucleus(p), sty)) end - setfield(p, 'sub', cjh_A(getfield(p, 'sub'), sty+1)) - setfield(p, 'sup', cjh_A(getfield(p, 'sup'), sty+1)) + setsub(p, cjh_A(getsub(p), max(sty+1,1))) + setsup(p, cjh_A(getsup(p), max(sty+1,1))) elseif pid == id_choice then - setfield(p, 'display', cjh_A(getfield(p, 'display'), 0)) + setfield(p, 'display', cjh_A(getfield(p, 'display'), -1)) setfield(p, 'text', cjh_A(getfield(p, 'text'), 0)) setfield(p, 'script', cjh_A(getfield(p, 'script'), 1)) setfield(p, 'scriptscript', cjh_A(getfield(p, 'scriptscript'), 2)) @@ -100,15 +111,17 @@ local function conv_jchar_to_hbox(head, sty) setfield(p, 'num', cjh_A(getfield(p, 'num'), sty+1)) setfield(p, 'denom', cjh_A(getfield(p, 'denom'), sty+1)) elseif pid == id_radical then - setfield(p, 'nucleus', cjh_A(getfield(p, 'nucleus'), sty)) - setfield(p, 'sub', cjh_A(getfield(p, 'sub'), sty+1)) - setfield(p, 'sup', cjh_A(getfield(p, 'sup'), sty+1)) + setnucleus(p, cjh_A(getnucleus(p), sty)) + setsub(p, cjh_A(getsub(p), max(sty+1,1))) + setsup(p, cjh_A(getsup(p), max(sty+1,1))) if getfield(p, 'degree') then - setfield(p, 'degree', cjh_A(getfield(p, 'degree'), sty + 1)) + setfield(p, 'degree', cjh_A(getfield(p, 'degree'), 2)) end elseif pid == id_style then local ps = getfield(p, 'style') - if ps == "display'" or ps == 'display' or ps == "text'" or ps == 'text' then + if ps == "display'" or ps == 'display' then + sty = -1 + elseif ps == "text'" or ps == 'text' then sty = 0 elseif ps == "script'" or ps == 'script' then sty = 1 @@ -124,47 +137,48 @@ local MJS = luatexja.stack_table_index.MJS local MJSS = luatexja.stack_table_index.MJSS local capsule_glyph_math = ltjw.capsule_glyph_math local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct +local setfont = node.direct.setfont +local setchar = node.direct.setchar cjh_A = function (p, sty) if not p then return nil else local pid = getid(p) if pid == id_sub_mlist then - if getfield(p, 'head') then - setfield(p, 'head', conv_jchar_to_hbox(getfield(p, 'head'), sty)) + if getlist(p) then + setlist(p, conv_jchar_to_hbox(getlist(p), sty)) end elseif pid == id_mchar then - local pc, fam = getchar (p), has_attr(p, attr_jfam) or -1 + local pc, fam = getchar (p), get_attr(p, attr_jfam) or -1 if (not is_math_letters[pc]) and is_ucs_in_japanese_char(p) and fam>=0 then - local f = ltjs.get_stack_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack')) + local f = ltjs.get_stack_table(MJT + 0x100 * min(max(sty,0),2) + fam, -1, getcount(cnt_stack)) if f ~= -1 then local q = node_new(id_sub_box) - local r = node_new(id_glyph); setfield(r, 'next', nil) - setfield(r, 'char', pc); setfield(r, 'font', f); setfield(r, 'subtype', 256) - local k = has_attr(r,attr_ykblshift) or 0; set_attr(r, attr_ykblshift, 0) - -- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避 + local r = node_new(id_glyph, 256); setnext(r, nil); setfont(r, f, pc) local met = ltjf_font_metric_table[f] - r = capsule_glyph_math(r, met, met.char_type[ltjf_find_char_class(pc, met)]); - setfield(q, 'head', r); node_free(p); p=q; set_attr(r, attr_yablshift, k) + r = capsule_glyph_math( + r, met, met.char_type[ltjf_find_char_class(pc, met)], sty) + setlist(q, r); node_free(p); p=q; end end - elseif pid == id_sub_box and getfield(p, 'head') then + elseif pid == id_sub_box and getlist(p) then -- \hbox で直に与えられた内容は上下位置を補正する必要はない - local h = getfield(p, 'head'); h = ltjd_make_dir_whatsit(h, h, list_dir, 'math') - setfield(p, 'head', h); set_attr(h, attr_icflag, PROCESSED) + local h = getlist(p); h = ltjd_make_dir_whatsit(h, h, list_dir, 'math') + setlist(p, h); setshift(h, getshift(h)-get_attr(h, attr_yablshift)) + --set_attr(h, attr_icflag, PROCESSED) end end return p end do - local function mlist_callback_ltja(n) + local function mlist_callback_ltja(n, display_type) local n = to_direct(n); list_dir = ltjd_get_dir_count() if getid(n)==id_whatsit and getsubtype(n)==sid_user and getfield(n, 'user_id') == DIR then local old_n = n; n = node_remove(n, n) node_free(old_n); if not n then return nil end end - return to_node(conv_jchar_to_hbox(n, 0)) + return to_node(conv_jchar_to_hbox(n, (display_type=='display') and -1 or 0)) end -- LaTeX 2020-02-02 seems to have pre_mlist_to_hlist_filter callback if luatexbase.callbacktypes['pre_mlist_to_hlist_filter'] then diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua index 770749f9ea5..11f68c6ba92 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua @@ -21,13 +21,19 @@ local getid = node.direct.getid local getfont = node.direct.getfont local getchar = node.direct.getchar local getsubtype = node.direct.getsubtype +local getvalue = node.direct.getdata +local setchar = node.direct.setchar +local setfont = node.direct.setfont +local setlang = node.direct.setlang +local setvalue = node.direct.setdata + local to_node = node.direct.tonode local to_direct = node.direct.todirect local node_new = node.direct.new local node_remove = node.direct.remove local node_next = node.direct.getnext -local node_free = node.direct.free -local has_attr = node.direct.has_attribute +local node_free = node.direct.flush_node or node.direct.free +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute local unset_attr = node.direct.unset_attribute local node_insert_after = node.direct.insert_after @@ -81,7 +87,7 @@ local function get_ucs_from_rmlgbm(c) elseif v<0xF0000 then -- 素直に Unicode にマップ可能 return v else -- privete use area - local r, aj = nil, ltjr_cidfont_data["Adobe-Japan1"] + local r, aj = nil, ltjr_cidfont_data["Adobe-Japan1"] -- 先に ltj_vert_table を見る for i,w in pairs(aj.ltj_vert_table) do if w==v then r=i; break end @@ -116,7 +122,7 @@ end local function append_jglyph(char) local p = node_new(id_whatsit,sid_user) setfield(p, 'user_id', OTF); setfield(p, 'type', 100) - setfield(p, 'value', char); node_write(p) + setvalue(p, char); node_write(p) end local myutf @@ -162,12 +168,10 @@ local function extract(head) if getsubtype(p)==sid_user then local puid = getfield(p, 'user_id') if puid==OTF then - local g = node_new(id_glyph) - setfield(g, 'subtype', 0) - setfield(g, 'char', getfield(p, 'value')) - local v = has_attr(p, attr_curfnt); setfield(g, 'font', v) - setfield(g, 'lang', lang_ja) - set_attr(g, attr_kblshift, has_attr(p, attr_kblshift)) + local g = node_new(id_glyph, 0) + setfont(g, get_attr(p, attr_curfnt), getvalue(p)) + setlang(g, lang_ja) + set_attr(g, attr_kblshift, get_attr(p, attr_kblshift)) head = node_insert_after(head, p, g) head = node_remove(head, p) node_free(p); p = g diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua index 073cc1ee398..508de5bb993 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua @@ -17,23 +17,24 @@ local getfont = node.direct.getfont local getchar = node.direct.getchar local getfield = node.direct.getfield local getsubtype = node.direct.getsubtype -local getlang = node.direct.getlang or function (n) return getfield(n,'lang') end +local getlang = node.direct.getlang local pairs = pairs local floor = math.floor +local get_attr = node.direct.get_attribute local has_attr = node.direct.has_attribute local set_attr = node.direct.set_attribute local node_traverse = node.direct.traverse local node_remove = node.direct.remove local node_next = node.direct.getnext -local node_free = node.direct.free +local node_free = node.direct.flush_node or node.direct.free local node_end_of_math = node.direct.end_of_math -local tex_getcount = tex.getcount +local getcount = tex.getcount -local id_glyph = node.id('glyph') -local id_math = node.id('math') -local id_whatsit = node.id('whatsit') -local sid_user = node.subtype('user_defined') +local id_glyph = node.id 'glyph' +local id_math = node.id 'math' +local id_whatsit = node.id 'whatsit' +local sid_user = node.subtype 'user_defined' local attr_dir = luatexbase.attributes['ltj@dir'] local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] @@ -51,9 +52,9 @@ local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG local dir_tate = luatexja.dir_table.dir_tate local lang_ja = luatexja.lang_ja -local setlang = node.direct.setlang or function(n,l) setfield(n,'lang',l) end -local setfont = node.direct.setfont or function(n,l) setfield(n,'font',l) end -local setchar = node.direct.setchar or function(n,l) setfield(n,'char',l) end +local setlang = node.direct.setlang +local setfont = node.direct.setfont +local setchar = node.direct.setchar ------------------------------------------------------------------------ -- MAIN PROCESS STEP 1: replace fonts @@ -72,8 +73,8 @@ do if uid==STCK then wt[#wt+1] = p; node_remove(head, p) elseif uid==DIR then - if has_attr(p, attr_icflag)<PROCESSED_BEGIN_FLAG then - ltjs.list_dir = has_attr(p, attr_dir) + if get_attr(p, attr_icflag)<PROCESSED_BEGIN_FLAG then + ltjs.list_dir = get_attr(p, attr_dir) else -- こっちのケースは通常使用では起こらない wtd[#wtd+1] = p; node_remove(head, p) end @@ -82,13 +83,13 @@ do return node_next(p) end, } - setmetatable(suppress_hyphenate_ja_aux, + setmetatable(suppress_hyphenate_ja_aux, { __index = function() return node_next end, }) - local id_boundary = node.id('boundary') + local id_boundary = node.id 'boundary' local node_new, insert_before = node.direct.new, node.direct.insert_before - local setsubtype = node.direct.setsubtype or function(n,l) setfield(n,'subtype',l) end + local setsubtype = node.direct.setsubtype local function suppress_hyphenate_ja (h) - start_time_measure('ltj_hyphenate') + start_time_measure 'ltj_hyphenate' head = to_direct(h) for i = 1,#wt do wt[i]=nil end for i = 1,#wtd do wtd[i]=nil end @@ -109,7 +110,7 @@ do setfield(b, 'type', 100); setfield(b, 'user_id', JA_AL_BDD); insert_before(head, p, b) end - local pf = has_attr(p, attr_curjfnt) + local pf = get_attr(p, attr_curjfnt) pf = (pf and pf>0 and pf) or getfont(p) setfont(p, ltjf_replace_altfont(pf, pc)) setlang(p, lang_ja) @@ -125,9 +126,9 @@ do p = (suppress_hyphenate_ja_aux[pid])(p) end end - stop_time_measure('ltj_hyphenate'); start_time_measure('tex_hyphenate') + stop_time_measure 'ltj_hyphenate'; start_time_measure 'tex_hyphenate' lang.hyphenate(h, nil) - stop_time_measure('tex_hyphenate') + stop_time_measure 'tex_hyphenate' return h end @@ -135,24 +136,31 @@ do end -- mode: true iff this function is called from hpack_filter +local set_box_stack_level +do local ltjs_report_stack_level = ltjs.report_stack_level local ltjf_font_metric_table = ltjf.font_metric_table local font_getfont = font.getfont -local function set_box_stack_level(head, mode) - local box_set, cl = 0, tex.currentgrouplevel + 1 +local traverse_id = node.direct.traverse_id +local cnt_stack = luatexbase.registernumber 'ltj@@stack' +local texget, getvalue = tex.get, node.direct.getdata +function set_box_stack_level(head, mode) + local box_set = 0 if mode then - for _,p in pairs(wt) do - if getfield(p, 'value')==cl then box_set = 1 end; node_free(p) + local cl = (texget 'currentgrouplevel') + 1 + for i=1,#wt do + local p = wt[i] + if getvalue(p)==cl then box_set = 1 end; node_free(p) end else - for _,p in pairs(wt) do node_free(p) end + for i=1,#wt do node_free(wt[i]) end end - ltjs_report_stack_level(tex_getcount('ltj@@stack') + box_set) + ltjs_report_stack_level(getcount(cnt_stack) + box_set) for _,p in pairs(wtd) do node_free(p) end if ltjs.list_dir == dir_tate then - for p in node.direct.traverse_id(id_glyph,to_direct(head)) do + for p in traverse_id(id_glyph,to_direct(head)) do if has_attr(p, attr_icflag, 0) and getlang(p)==lang_ja then - local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , ltjs_orig_char_table[p]) + local nf = ltjf_replace_altfont( get_attr(p, attr_curtfnt) or getfont(p) , ltjs_orig_char_table[p]) setfont(p, nf) if ltjf_font_metric_table[nf].vert_activated then local pc = getchar(p); pc = ltjf_font_metric_table[nf].vform[pc] @@ -163,6 +171,7 @@ local function set_box_stack_level(head, mode) end return head end +end -- CALLBACKS ltjb.add_to_callback('hpack_filter', diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua index 49f2018e4dc..36fb7f78778 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua @@ -1,7 +1,7 @@ -- -- ltj-rmlgbm.lua -- -luatexja.load_module('base'); local ltjb = luatexja.base +luatexja.load_module 'base'; local ltjb = luatexja.base local cidfont_data = {} local cache_chars = {} @@ -224,7 +224,7 @@ local cidf_vert_processor do local traverse_id, is_node = node.direct.traverse_id, node.is_node local to_direct = node.direct.todirect - local id_glyph = node.id('glyph') + local id_glyph = node.id 'glyph' local getfont = node.direct.getfont local getchar = node.direct.getchar local setchar = node.direct.setchar @@ -234,7 +234,7 @@ do local fontdata = font_getfont(fnum) if head and luatexja.jfont.font_metric_table[fnum] and luatexja.jfont.font_metric_table[fnum].vert_activated then local vt = fontdata.ltj_vert_table - local nh = is_node(head) and to_direct(head) or head + local nh = is_node(head) and to_direct(head) or head for n in traverse_id(id_glyph, head) do if getfont(n)==fnum then local c = getchar(n); setchar(n, vt[c] or c) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua index 7fa7ea927e7..047b53ab58c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.ruby', - date = '2022-06-25', + date = '2022-08-29', description = 'Ruby annotation', }) luatexja.ruby = {} @@ -13,21 +13,38 @@ luatexja.load_module 'base'; local ltjb = luatexja.base local to_node = node.direct.tonode local to_direct = node.direct.todirect -local setfield = node.direct.setfield -local setglue = luatexja.setglue local getfield = node.direct.getfield local getid = node.direct.getid local getfont = node.direct.getfont local getlist = node.direct.getlist local getchar = node.direct.getchar local getsubtype = node.direct.getsubtype +local getkern = node.direct.getkern +local getwidth = node.direct.getwidth +local getheight = node.direct.getheight +local getdepth = node.direct.getdepth +local getwhd = node.direct.getwhd +local getvalue = node.direct.getdata +local setfield = node.direct.setfield +local setglue = node.direct.setglue +local setkern = node.direct.setkern +local setnext = node.direct.setnext +local setshift = node.direct.setshift +local setwidth = node.direct.setwidth +local setheight = node.direct.setheight +local setdepth = node.direct.setdepth +local setwhd = node.direct.setwhd +local setlist = node.direct.setlist +local setvalue = node.direct.setdata local node_new = node.direct.new local node_remove = node.direct.remove local node_next = node.direct.getnext -local node_copy, node_free, node_tail = node.direct.copy, node.direct.free, node.direct.tail -local has_attr, set_attr = node.direct.has_attribute, node.direct.set_attribute +local node_copy, node_tail = node.direct.copy, node.direct.tail +local node_free = node.direct.flush_node or node.direct.free +local get_attr, set_attr = node.direct.get_attribute, node.direct.set_attribute local insert_before, insert_after = node.direct.insert_before, node.direct.insert_after +local hpack = node.direct.hpack local id_hlist = node.id 'hlist' local id_vlist = node.id 'vlist' @@ -125,7 +142,7 @@ function luatexja.ruby.read_old_break_info() local real_file = kpse.find_file(fname) if real_file then dofile(real_file) end cache_handle = io.open(fname, 'w') - if cache_handle then + if cache_handle then cache_handle:write('local lrob=luatexja.ruby.old_break_info\n') end end @@ -143,7 +160,7 @@ end -- ルビ組版が行われている段落/hboxでの設定が使われる. -- ルビ文字を格納しているボックスでの設定ではない! local function get_attr_icflag(p) - return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG + return (get_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG end local concat do @@ -157,25 +174,22 @@ do end set_attr(nh, attr_icflag, get_attr_icflag(nh) + PROCESSED_BEGIN_FLAG) - setfield(node_tail(h), 'next', nh) - setfield(f, 'head', nil); node_free(f) - setfield(b, 'head', nil); node_free(b) + setnext(node_tail(h), nh) + setlist(f, nil); node_free(f) + setlist(b, nil); node_free(b) local g = luatexja.jfmglue.main(h,false) - return node.direct.hpack(g) + return hpack(g) else return f end elseif b then return b else - local h = node_new(id_hlist) - setfield(h, 'subtype', 0) - setfield(h, 'width', 0) - setfield(h, 'height', 0) - setfield(h, 'depth', 0) + local h = node_new(id_hlist, 0) + setwhd(h, 0, 0, 0) setfield(h, 'glue_set', 0) setfield(h, 'glue_order', 0) - setfield(h, 'head', nil) + setlist(h, nil) return h end end @@ -183,9 +197,7 @@ end local function expand_3bits(num) local t = {}; local a = num - for i = 1, 10 do - t[i] = a%8; a = floor(a/8) - end + for i = 1, 10 do t[i], a = a%8, a//8 end return t end ---------------------------------------------------------------- @@ -205,23 +217,22 @@ do -- pre, middle, post: 伸縮比率 -- prenw, postnw: 前後の自然長 (sp) local h = getlist(box); - local hh, hd = getfield(box, 'height'), getfield(box, 'depth') + local _, hh, hd = getwhd(box) local hx = h while hx do - local hic = has_attr(hx, attr_icflag) or 0 + local hic = get_attr(hx, attr_icflag) or 0 if (hic == KANJI_SKIP) or (hic == KANJI_SKIP_JFM) or (hic == XKANJI_SKIP) or (hic == XKANJI_SKIP_JFM) or ((hic<=FROM_JFM+63) and (hic>=FROM_JFM)) then -- この 5 種類の空白をのばす if getid(hx) == id_kern then - local k = node_new(id_glue) - setglue(k, getfield(hx, 'kern'), round(middle*65536), 0, + local k = node_new(id_glue, 0) + setglue(k, getkern(hx), round(middle*65536), 0, 2, 0) - setfield(k, 'subtype', 0); h = insert_after(h, hx, k); h = node_remove(h, hx); node_free(hx); hx = k else -- glue - setglue(hx, getfield(hx, 'width'), round(middle*65536), 0, + setglue(hx, getwidth(hx), round(middle*65536), 0, 2, 0) end end @@ -236,10 +247,9 @@ do setglue(k, postnw, round(post*65536), 0, 2, 0) insert_after(h, node_tail(h), k); -- hpack - setfield(box, 'head', nil); node_free(box) - box = node.direct.hpack(h, new_width, 'exactly') - setfield(box, 'height', hh) - setfield(box, 'depth', hd) + setlist(box, nil); node_free(box) + box = hpack(h, new_width, 'exactly') + setheight(box, hh); setdepth(box, hd) return box end end @@ -255,9 +265,8 @@ local function texiface_low(rst, rtlr, rtlp) local w = node_new(id_whatsit, sid_user) 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', 108) - setfield(wv, 'value', rst); rst.count = floor(#rtlr) + setvalue(w, to_node(wv)); setvalue(wv, rst); rst.count = #rtlr setfield(wv, 'user_id', RUBY_PRE) -- dummy local n = wv for i = 1, #rtlr do @@ -280,7 +289,7 @@ function luatexja.ruby.texiface(rst, rtlr, rtlp) else local f, eps = true, rst.eps for i = 1,#rtlr do - if getfield(rtlr[i], 'width') > getfield(rtlp[i], 'width') + eps then + if getwidth(rtlr[i]) > getwidth(rtlp[i]) + eps then f = false; break end end @@ -304,12 +313,12 @@ end -- r, p の中身のノードは再利用される 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 rwidth = getwidth(r) + local sumprot = rwidth - getwidth(p) -- >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 + local intmode = (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_tbl.pre<0) and (tmp_tbl.post<0) then @@ -332,18 +341,17 @@ local function enlarge_parent(r, p, tmp_tbl, no_begin, no_end) if n < sumprot then pre_intrusion = n/2; post_intrusion = n/2 else - pre_intrusion = floor(sumprot/2); post_intrusion = sumprot - pre_intrusion + pre_intrusion = sumprot//2; post_intrusion = sumprot - pre_intrusion end p = enlarge(p, rwidth, ppre, pmid, ppost, pre_intrusion, post_intrusion) pre_intrusion = min(mapre, pre_intrusion + round(ppre*getfield(p, 'glue_set')*65536)) post_intrusion = min(mapost, post_intrusion + round(ppost*getfield(p, 'glue_set')*65536)) end - setfield(r, 'shift', -pre_intrusion) + setshift(r, -pre_intrusion) local rwidth = rwidth - pre_intrusion - post_intrusion - setfield(r, 'width', rwidth) - setfield(p, 'width', rwidth) + setwidth(r, rwidth); setwidth(p, rwidth) local ps = getlist(p) - setfield(ps, 'width', getfield(ps, 'width') - pre_intrusion) + setwidth(ps, getwidth(ps) - pre_intrusion) local orig_post_intrusion, post_jfmgk = post_intrusion, false if no_end then if orig_post_intrusion > tmp_tbl.after_jfmgk then @@ -366,51 +374,50 @@ local function new_ruby_box(r, p, tmp_tbl, no_begin, no_end) 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.mode/0x100000); rsmash = (imode%2 ==1) - imode = floor(imode/2); rpost = imode%8; + imode = tmp_tbl.mode//0x100000; rsmash = (imode%2 ==1) + imode = 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 + if getwidth(r) > getwidth(p) then -- change the width of p r, p, post_intrusion, post_jfmgk = 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) + elseif getwidth(r) < getwidth(p) then -- change the width of r + r = enlarge(r, getwidth(p), rpre, rmid, rpost, 0, 0) post_intrusion = 0 local need_repack = false -- margin が大きくなりすぎた時の処理 if round(rpre*getfield(r, 'glue_set')*65536) > max_margin then local ps = getlist(r); need_repack = true - setfield(ps, 'width', max_margin) + setwidth(ps, max_margin) setfield(ps, 'stretch', 1) -- 全く伸縮しないのも困る end if round(rpost*getfield(r, 'glue_set')*65536) > max_margin then local ps = node_tail(getlist(r)); need_repack = true - setfield(ps, 'width', max_margin) + setwidth(ps, max_margin) setfield(ps, 'stretch', 1) -- 全く伸縮しないのも困る end if need_repack then local rt = r - r = node.direct.hpack(getlist(r), getfield(r, 'width'), 'exactly') - setfield(rt, 'head', nil); node_free(rt); + r = hpack(getlist(r), getwidth(r), 'exactly') + setlist(rt, nil); node_free(rt); end 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.intergap) + setwhd(a, 0, 0, 0); setkern(k, 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) + insert_after(r, k, p); setnext(p, nil) + if tmp_tbl.rubydepth >= 0 then setdepth(r, tmp_tbl.rubydepth) end + if tmp_tbl.baseheight >= 0 then setheight(p, tmp_tbl.baseheight) end + a = node.direct.vpack(r); setshift(a, 0) set_attr(a, attr_ruby, post_intrusion) set_attr(a, attr_ruby_post_jfmgk, post_jfmgk and 1 or 0) - if rsmash or getfield(a, 'height')<getfield(p, 'height') then + if rsmash or getheight(a)<getheight(p) then local k = node_new(id_kern, 1) - setfield(k, 'kern', -getfield(a, 'height')+getfield(p, 'height')) - setfield(a, 'head', k); insert_before(r, r, k) - setfield(a, 'height', getfield(p, 'height')) + setkern(k, -getheight(a)+getheight(p)) + setlist(a, k); insert_before(r, r, k) + setheight(a, getheight(p)) end - return a, getfield(r, 'width'), post_intrusion, post_jfmgk + return a, getwidth(r), post_intrusion, post_jfmgk end @@ -418,7 +425,7 @@ end local post_intrusion_backup, post_jfmgk_backup local max_allow_pre, max_allow_post - +local flush_list = node.direct.flush_list -- 中付き熟語ルビ,cmp containers -- 「文字の構成を考えた」やつはどうしよう local function pre_low_cal_box(w, cmp) @@ -428,8 +435,8 @@ local function pre_low_cal_box(w, cmp) -- kf[i] : container 1--i からなる行末形 -- kf[cmp+i] : container i--cmp からなる行頭形 -- kf[2cmp+1] : 行中形 - local wv = getfield(w, 'value') - local rst = getfield(wv, 'value') + local wv = getvalue(w) + local rst = getvalue(wv) local mdt -- nt*: node temp local coef = {} -- 連立一次方程式の拡大係数行列 local rtb = expand_3bits(rst.stretch) @@ -473,8 +480,8 @@ local function pre_low_cal_box(w, cmp) -- w.value の node list 更新. local nt = wv - node.direct.flush_list(node_next(wv)) - for i = 1, 2*cmp+1 do setfield(nt, 'next', kf[i]); nt = kf[i] end + flush_list(node_next(wv)) + for i = 1, 2*cmp+1 do setnext(nt, kf[i]); nt = kf[i] end if cmp==1 then solve_1(coef) elseif cmp==2 then solve_2(coef) @@ -506,10 +513,8 @@ local function pre_low_app_node(head, w, cmp, coef, ht, dp) nt = w for i = 1, cmp do -- rule - local nta = node_new(id_rule); - setfield(nta, 'width', coef[i*2][2*cmp+2]) - setfield(nta, 'height', ht); setfield(nta, 'depth', dp) - setfield(nta, 'subtype', 0) + local nta = node_new(id_rule, 0); + setwhd(nta, coef[i*2][2*cmp+2], ht, dp) insert_after(head, nt, nta) set_attr(nta, attr_ruby, 2*i+1) -- glue @@ -534,10 +539,10 @@ 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') - local rst = getfield(nv, 'value') + local nv = getvalue(n) + local rst = getvalue(nv) max_allow_pre = rst.pre or 0 - local atr = has_attr(n, attr_ruby) or 0 + local atr = get_attr(n, attr_ruby) or 0 if max_allow_pre < 0 then -- 直前のルビで intrusion がおこる可能性あり. -- 前 run のデータが残っていればそれを使用, @@ -561,7 +566,7 @@ local function pre_high(ahead) local coef = pre_low_cal_box(n, rst.count) local s = node_tail(nv) --ルビ文字 head, n = pre_low_app_node( - head, n, rst.count, coef, getfield(s, 'height'), getfield(s, 'depth') + head, n, rst.count, coef, getheight(s), getdepth(s) ) else n = first_whatsit(node_next(n)) @@ -578,7 +583,7 @@ luatexbase.add_to_callback('hpack_filter', pre_high, 'ltj.ruby.pre', 100) local post_lown do local function write_aux(wv, num, bool) - local id = has_attr(wv, attr_ruby_id) + local id = get_attr(wv, attr_ruby_id) or 0 if id>0 and cache_handle then cache_handle:write( 'lrob[' .. tostring(id) .. ']=' .. num .. '\nlrob[' .. tostring(-id) .. ']=' .. tostring(bool) .. '\n') @@ -588,35 +593,35 @@ do post_lown = function (rs, rw, cmp, ch) -- ch: the head of `current' hlist if #rs ==0 or not rw then return ch end - local hn = has_attr(rs[1], attr_ruby) - local fn = has_attr(rs[#rs], attr_ruby) - local wv = getfield(rw, 'value') + local hn = get_attr(rs[1], attr_ruby) + local fn = get_attr(rs[#rs], attr_ruby) + local wv = getvalue(rw) if hn==1 then if fn==2*cmp+2 then local hn = node_tail(wv) node_remove(wv, hn) insert_after(ch, rs[1], hn) set_attr(hn, attr_icflag, PROCESSED) - write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk))-- 行中形 + write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk))-- 行中形 else local deg, hn = (fn-1)/2, wv for i = 1, deg do hn = node_next(hn) end; node_remove(wv, hn) - setfield(hn, 'next', nil) + setnext(hn, nil) insert_after(ch, rs[1], hn) set_attr(hn, attr_icflag, PROCESSED) - write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk)) + write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk)) end else local deg, hn = max((hn-1)/2,2), wv for i = 1, cmp+deg-1 do hn = node_next(hn) end -- -1 is needed except the case hn = 3, -- because a ending-line form is removed already from the list - node_remove(wv, hn); setfield(hn, 'next', nil) + node_remove(wv, hn); setnext(hn, nil) insert_after(ch, rs[1], hn) set_attr(hn, attr_icflag, PROCESSED) if fn == 2*cmp-1 then - write_aux(wv, has_attr(hn, attr_ruby), has_attr(hn, attr_ruby_post_jfmgk)) + write_aux(wv, get_attr(hn, attr_ruby), get_attr(hn, attr_ruby_post_jfmgk)) end end for i = 1,#rs do @@ -629,11 +634,12 @@ do end end +local traverse_id = node.direct.traverse_id local function post_high_break(head) local rs = {} -- rs: sequence of ruby_nodes, local rw = nil -- rw: main whatsit local cmp = -2 -- dummy - for h in node.direct.traverse_id(id_hlist, to_direct(head)) do + for h in traverse_id(id_hlist, to_direct(head)) do for i = 1, #rs do rs[i] = nil end local ha = getlist(h) while ha do @@ -642,23 +648,23 @@ local function post_high_break(head) or (hai == id_rule and getsubtype(ha)==0) or (hai == id_whatsit and getsubtype(ha)==sid_user and getfield(ha, 'user_id', RUBY_POST))) - and has_attr(ha, attr_ruby) or 0 + and get_attr(ha, attr_ruby) or 0 if i==0 then ha = node_next(ha) elseif i==1 then - setfield(h, 'head', post_lown(rs, rw, cmp, getlist(h))) + setlist(h, post_lown(rs, rw, cmp, getlist(h))) for i = 2, #rs do rs[i] = nil end -- rs[1] is set by the next statement rs[1], rw = ha, nil; ha = node_next(ha) elseif i==2 then rw = ha - cmp = getfield(getfield(rw, 'value'), 'value').count + cmp = getvalue(getvalue(rw)).count local hb, hc = node_remove(getlist(h), rw) - setfield(h, 'head', hb); ha = hc + setlist(h, hb); ha = hc else -- i>=3 rs[#rs+1] = ha; ha = node_next(ha) end end - setfield(h, 'head', post_lown(rs, rw, cmp, getlist(h))) + setlist(h, post_lown(rs, rw, cmp, getlist(h))) end return head end @@ -674,7 +680,7 @@ local function post_high_hbox(ahead) or (hai == id_rule and getsubtype(ha)==0) or (hai == id_whatsit and getsubtype(ha)==sid_user and getfield(ha, 'user_id', RUBY_POST))) - and has_attr(ha, attr_ruby) or 0 + and get_attr(ha, attr_ruby) or 0 if i==0 then ha = node_next(ha) elseif i==1 then @@ -683,7 +689,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').count + cmp = getvalue(getvalue(rw)).count head, ha = node_remove(head, rw) else -- i >= 3 rs[#rs+1] = ha; ha = node_next(ha) @@ -702,13 +708,13 @@ luatexbase.add_to_callback('hpack_filter', post_high_hbox, 'ltj.ruby.post_hbox', do local RIPRE = luatexja.stack_table_index.RIPRE local RIPOST = luatexja.stack_table_index.RIPOST - local abs = math.abs + local abs = math.abs local function whatsit_callback(Np, lp, Nq) if Np.nuc then return Np 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 lpv = getvalue(lp) + local rst = getvalue(lpv) 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 @@ -759,8 +765,8 @@ do 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 + if getid(p)==id_kern then t[index] = t[index] + getkern(p) + else t[index] = t[index] + getwidth(p) end end end local RIPOST = luatexja.stack_table_index.RIPOST @@ -774,9 +780,9 @@ do Np.first = last_glue next_cluster_array[Nq.nuc] = last_glue -- ルビ処理用のグルー end - local nqnv = getfield(Nq.nuc, 'value') - local rst = getfield(nqnv, 'value') - if Nq.gk then + local nqnv = getvalue(Nq.nuc) + local rst = getvalue(nqnv) + 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 @@ -794,11 +800,11 @@ do end rst.post = p end - Np.prev_ruby = has_attr(getfield(Nq.nuc, 'value'), attr_ruby_id) + Np.prev_ruby = get_attr(getvalue(Nq.nuc), attr_ruby_id) -- 前のクラスタがルビであったことのフラグ else -- 直前が文字以外 - local nqnv = getfield(Nq.nuc, 'value') - local rst = getfield(nqnv, 'value') + local nqnv = getvalue(Nq.nuc) + local rst = getvalue(nqnv) if rst.post < 0 then -- auto rst.post = 0 end @@ -812,8 +818,8 @@ do "luatexja.ruby.np_info_after", 1) 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 + local rst = getvalue(getvalue(Nq.nuc)) + 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 diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua index 0e8e39f0717..dd83d7e3d5b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua @@ -15,21 +15,23 @@ local getfont = node.direct.getfont local getlist = node.direct.getlist local getchar = node.direct.getchar local getsubtype = node.direct.getsubtype -local getwidth = node.direct.getwidth or function(n) return getfield(n,'width') end -local getdepth = node.direct.getdepth or function(n) return getfield(n,'depth') end -local getwhd = node.direct.getwhd or function(n) - return getfield(n,'width'), getfield(n,'height'),getfield(n,'depth') end +local getwidth = node.direct.getwidth +local getshift = node.direct.getshift +local getoffsets = node.direct.getoffsets +local getheight = node.direct.getheight +local getdepth = node.direct.getdepth +local getwhd = node.direct.getwhd -local setwhd = node.direct.setwhd or function(n,w,h,d) - setfield(n,'width',w); setfield(n,'height',h); setfield(n,'depth',d) end -local setchar = node.direct.setchar or function(n,c) setfield(n,'char',c) end -local setnext = node.direct.setnext or function(n,c) setfield(n,'next',c) end -local setdir = node.direct.setdir or function(n,c) setfield(n,'dir',c) end -local setkern = node.direct.setkern or function(n,c) setfield(n,'kern',c) end -local setoffsets = node.direct.setoffsets or function(n,x,y) - setfield(n,'xoffset',x); setfield(n,'yoffset',y) end -local getoffsets = node.direct.getoffsets or function(n) - return getfield(n,'xoffset'), getfield(n,'yoffset') end +local setwhd = node.direct.setwhd +local setchar = node.direct.setchar +local setnext = node.direct.setnext +local setdir = node.direct.setdir +local setkern = node.direct.setkern +local setshift = node.direct.setshift +local setoffsets = node.direct.setoffsets +local setheight = node.direct.setheight +local setdepth = node.direct.setdepth +local setlist = node.direct.setlist local node_traverse_id = node.direct.traverse_id local node_traverse = node.direct.traverse @@ -37,7 +39,7 @@ local node_copy = node.direct.copy local node_remove = node.direct.remove local node_tail = node.direct.tail local node_next = node.direct.getnext -local has_attr = node.direct.has_attribute +local get_attr = node.direct.get_attribute local set_attr = node.direct.set_attribute local node_insert_before = node.direct.insert_before local node_insert_after = node.direct.insert_after @@ -56,6 +58,7 @@ local sid_restore = node.subtype 'pdf_restore' local sid_matrix = node.subtype 'pdf_setmatrix' local dir_tate = luatexja.dir_table.dir_tate +local attr_yablshift = luatexbase.attributes['ltj@yablshift'] local attr_ykblshift = luatexbase.attributes['ltj@ykblshift'] local attr_tkblshift = luatexbase.attributes['ltj@tkblshift'] local attr_icflag = luatexbase.attributes['ltj@icflag'] @@ -71,7 +74,7 @@ do local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG local floor = math.floor get_pr_begin_flag = function (p) - local i = has_attr(p, attr_icflag) or 0 + local i = get_attr(p, attr_icflag) or 0 return i - i%PROCESSED_BEGIN_FLAG end end @@ -97,7 +100,7 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir) if not char_data then return node_next(p), head, p end fshift.down = char_data.down; fshift.left = char_data.left fshift = call_callback("luatexja.set_width", fshift, met, char_data) - local kbl = has_attr(p, attr_ykblshift) or 0 + local kbl = get_attr(p, attr_ykblshift) or 0 -- -- f*: whd specified in JFM local pwidth, pheight,pdepth = getwhd(p) @@ -142,8 +145,7 @@ local function capsule_glyph_yoko(p, met, char_data, head, dir) setnext(p, nil) local box = node_new(id_hlist, nil, p) setwhd(box, fwidth, fheight, fdepth) - setfield(box, 'head', p) - setfield(box, 'shift', kbl) + setlist(box, p); setshift(box, kbl) setdir(box, dir) set_attr(box, attr_icflag, PACKED) head = q and node_insert_before(head, q, box) @@ -158,7 +160,7 @@ luatexja.setwidth.capsule_glyph_yoko = capsule_glyph_yoko local function capsule_glyph_tate_rot(p, met, char_data, head, dir, asc) fshift.down = char_data.down; fshift.left = char_data.left fshift = call_callback("luatexja.set_width", fshift, met, char_data) - local kbl = has_attr(p, attr_tkblshift) or 0 + local kbl = get_attr(p, attr_tkblshift) or 0 -- f*: whd specified in JFM local pwidth, pheight,pdepth = getwhd(p) local fwidth = char_data.width or pwidth @@ -172,8 +174,7 @@ local function capsule_glyph_tate_rot(p, met, char_data, head, dir, asc) setnext(p, nil) local box = node_new(id_hlist, nil, p) setwhd(box, fwidth, fheight, fdepth) - setfield(box, 'head', p) - setfield(box, 'shift', kbl) + setlist(box, p); setshift(box, kbl) setdir(box, dir) set_attr(box, attr_icflag, PACKED) head = q and node_insert_before(head, q, box) @@ -192,8 +193,8 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) if met.rotation and met.vert_activated then local f = font_getfont(pf) local r, l = met.rotation[pc], f.properties and f.properties.language - if ((r==true) or (type(r)=="table" and not r[l])) and (has_attr(p, attr_vert_ori) or 0)<=0 then - return capsule_glyph_tate_rot(p, met, char_data, head, dir, + if ((r==true) or (type(r)=="table" and not r[l])) and (get_attr(p, attr_vert_ori) or 0)<=0 then + return capsule_glyph_tate_rot(p, met, char_data, head, dir, 0.5*(get_ascender(pf)-get_descender(pf))) end end @@ -213,12 +214,11 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) fshift = call_callback("luatexja.set_width", fshift, met, char_data) local fheight = char_data.height or 0 local fdepth = char_data.depth or 0 - local y_shift = xo + (has_attr(p,attr_tkblshift) or 0) + local y_shift = xo + (get_attr(p,attr_tkblshift) or 0) local q head, q = node_remove(head, p) local box = node_new(id_hlist, nil, p) - setwhd(box, fwidth, fheight, fdepth) - setfield(box, 'shift', y_shift) + setwhd(box, fwidth, fheight, fdepth); setshift(box, y_shift) setdir(box, dir) -- print(yo, ascender, char_data.align, fwidth-pwidth) setoffsets(p, -fshift.down, @@ -230,7 +230,7 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) local k2 = node_new(id_kern, 1); setkern(k2, pwnh) local k3 = node_new(id_kern, 1); setkern(k3, -getwidth(p)-pwnh) local wr = node_new(id_whatsit, sid_restore) - setfield(box, 'head', ws) + setlist(box, ws) setnext(ws, wm); setnext(wm, k2); setnext(k2, p); setnext(p, k3); setnext(k3, wr); @@ -243,26 +243,41 @@ local function capsule_glyph_tate(p, met, char_data, head, dir) end luatexja.setwidth.capsule_glyph_tate = capsule_glyph_tate -local function capsule_glyph_math(p, met, char_data) +do +local font_getfont, famfont = font.getfont, node.family_font +local cap_math_aux = { + [-1]=function() return 1 end, [0]=function() return 1 end, + [1]=function() + local sf, tf = famfont(2,1), famfont(2,0) + return font_getfont(sf).size/font_getfont(tf).size + end, + [2]=function() + local ssf, tf = famfont(2,2), famfont(2,0) + return font_getfont(ssf).size/font_getfont(tf).size + end +} +setmetatable(cap_math_aux, {__index=function(t,k) return t[2] end}) +local function capsule_glyph_math(p, met, char_data, sty) if not char_data then return nil end local fwidth, pwidth = char_data.width, getwidth(p) fwidth = fwidth or pwidth fshift.down = char_data.down; fshift.left = char_data.left fshift = call_callback("luatexja.set_width", fshift, met, char_data) local fheight, fdepth = char_data.height, char_data.depth - local y_shift - = - getfield(p, 'yoffset') + (has_attr(p,attr_ykblshift) or 0) + local y_shift = - getfield(p, 'yoffset') + + cap_math_aux[sty]()* + ((get_attr(p,attr_ykblshift) or 0) - (get_attr(p,attr_yablshift) or 0)) setfield(p, 'yoffset', -fshift.down) setfield(p, 'xoffset', getfield(p, 'xoffset') + char_data.align*(fwidth-pwidth) - fshift.left) local box = node_new(id_hlist, nil, p); setwhd(box, fwidth, fheight, fdepth) - setfield(box, 'head', p) - setfield(box, 'shift', y_shift) + setlist(box, p); setshift(box, y_shift) setdir(box, tex.mathdir) set_attr(box, attr_icflag, PACKED) return box end luatexja.setwidth.capsule_glyph_math = capsule_glyph_math +end -- 数式の位置補正 function luatexja.setwidth.apply_ashift_math(head, last, attr_ablshift) @@ -270,19 +285,18 @@ function luatexja.setwidth.apply_ashift_math(head, last, attr_ablshift) local pid = getid(p) if p==last then return - elseif (has_attr(p, attr_icflag) or 0) ~= PROCESSED then + elseif (get_attr(p, attr_icflag) or 0) ~= PROCESSED then if pid==id_hlist or pid==id_vlist then - setfield(p, 'shift', getfield(p, 'shift') + (has_attr(p,attr_ablshift) or 0)) + setshift(p, getshift(p) + (get_attr(p,attr_ablshift) or 0)) elseif pid==id_rule then - local v = has_attr(p,attr_ablshift) or 0 - setfield(p, 'height', getfield(p, 'height')-v) - setfield(p, 'depth', getdepth(p)+v) + local v = get_attr(p,attr_ablshift) or 0 + setheight(p, getheight(p)-v); setdepth(p, getdepth(p)+v) set_attr(p, attr_icflag, PROCESSED) elseif pid==id_glyph then -- 欧文文字; 和文文字は pid == id_hlist の場合で処理される -- (see conv_jchar_to_hbox_A in ltj-math.lua) setfield(p, 'yoffset', - getfield(p, 'yoffset') - (has_attr(p,attr_ablshift) or 0)) + getfield(p, 'yoffset') - (get_attr(p,attr_ablshift) or 0)) end set_attr(p, attr_icflag, PROCESSED) end @@ -300,7 +314,7 @@ do if not head then return end local y_adjust, node_depth, adj_depth = 0, 0, 0 for lp in node_traverse_id(id_glyph, head) do - y_adjust = has_attr(lp,attr_ablshift) or 0 + y_adjust = get_attr(lp,attr_ablshift) or 0 local ld = getdepth(lp) node_depth = max(ld + min(y_adjust, 0), node_depth) adj_depth = (y_adjust>0) and max(ld + y_adjust, adj_depth) or adj_depth diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua index a0cd2e286ec..ca83781473d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.stack', - date = '2020-07-30', + date = '2022-08-20', description = 'LuaTeX-ja stack system', }) luatexja.stack = {} @@ -20,28 +20,31 @@ local STCK = luatexja.userid_table.STCK local fastcopy = table.fastcopy local setcount, getcount = tex.setcount, tex.getcount local scan_int, scan_keyword = token.scan_int, token.scan_keyword +local getnest = tex.getnest +local cnt_stack = luatexbase.registernumber 'ltj@@stack' +local cnt_grplvl = luatexbase.registernumber 'ltj@@group@level' ltjs.hmode = 0 -- dummy -local charprop_stack_table={}; +local charprop_stack_table={} ltjs.charprop_stack_table = charprop_stack_table charprop_stack_table[0]={} local function get_stack_level() - local i = getcount 'ltj@@stack' + local i = getcount(cnt_stack) local j = tex.currentgrouplevel - if j > getcount 'ltj@@group@level' then + if j > getcount(cnt_grplvl) then i = i+1 -- new stack level local gd = tex.globaldefs if gd~=0 then tex.globaldefs = 0 end -- 'tex.globaldefs = 0' is local even if \globaldefs > 0. - setcount('ltj@@group@level', j) + setcount(cnt_grplvl, j) for k,v in pairs(charprop_stack_table) do -- clear the stack above i if k>=i then charprop_stack_table[k]=nil end end charprop_stack_table[i] = fastcopy(charprop_stack_table[i-1]) - setcount('ltj@@stack', i) + setcount(cnt_stack, i) if gd~=0 then tex.globaldefs = gd end - if tex.nest[tex.nest.ptr].mode == -ltjs.hmode then -- rest. hmode のみ + if getnest().mode == -ltjs.hmode then -- rest. hmode のみ local g = node_new(id_whatsit, sid_user) g.user_id=STCK; g.type=100; g.value=j; node.write(g) end @@ -54,9 +57,7 @@ local function set_stack_table(m, p) local i = get_stack_level() charprop_stack_table[i][m] = p if luatexja.isglobal=='global' then - for j,v in pairs(charprop_stack_table) do - charprop_stack_table[j][m] = p - end + for j,v in pairs(charprop_stack_table) do v[m] = p end end end ltjs.set_stack_table = set_stack_table @@ -90,25 +91,22 @@ function ltjs.set_stack_font(m,c,p) end -- EXT: sp: glue_spec +local getglue = node.getglue function ltjs.set_stack_skip(m,sp) local i = get_stack_level() if not sp then return end - if not charprop_stack_table[i][m] then - charprop_stack_table[i][m] = {} + local w,st,sh,sto,sho = getglue(sp) + if charprop_stack_table[i][m] then + local c = charprop_stack_table[i][m] + c[1], c[2], c[3], c[4], c[5] = w, st, sh, sto, sho + else + charprop_stack_table[i][m] = { w,st,sh,sto,sho } end - charprop_stack_table[i][m].width = sp.width - charprop_stack_table[i][m].stretch = sp.stretch - charprop_stack_table[i][m].shrink = sp.shrink - charprop_stack_table[i][m].stretch_order = sp.stretch_order - charprop_stack_table[i][m].shrink_order = sp.shrink_order if luatexja.isglobal=='global' then for j,v in pairs(charprop_stack_table) do - if not charprop_stack_table[j][m] then charprop_stack_table[j][m] = {} end - charprop_stack_table[j][m].width = sp.width - charprop_stack_table[j][m].stretch = sp.stretch - charprop_stack_table[j][m].shrink = sp.shrink - charprop_stack_table[j][m].stretch_order = sp.stretch_order - charprop_stack_table[j][m].shrink_order = sp.shrink_order + if not v[m] then v[m] = { true,true,true,true,true } end + local c = v[m] + c[1], c[2], c[3], c[4], c[5] = w, st, sh, sto, sho end end end @@ -119,23 +117,21 @@ local orig_char_table = {} ltjs.orig_char_table = orig_char_table ltjs.list_dir = nil -- dummy ltjs.table_current_stack = nil -- dummy +local dummy_skip_table = { 0,0,0,0,0 } function ltjs.report_stack_level(bsl) ltjs.table_current_stack = charprop_stack_table[bsl] return bsl end function ltjs.fast_get_stack_skip(m) - return ltjs.table_current_stack[m] - or { width = 0, stretch = 0, shrink = 0, stretch_order = 0, shrink_order = 0 } + return ltjs.table_current_stack[m] or dummy_skip_table end -- For other situations, use the following instead: function ltjs.get_stack_skip(m, idx) - return charprop_stack_table[idx][m] - or { width = 0, stretch = 0, shrink = 0, stretch_order = 0, shrink_order = 0 } + return charprop_stack_table[idx][m] or dummy_skip_table end function ltjs.get_stack_table(mc, d, idx) - local i = charprop_stack_table[idx][mc] - return i or d + return charprop_stack_table[idx][mc] or d end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls index fe5479e1560..0f7b19dbd23 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjarticle} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -152,8 +152,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo index efa8ef2f85c..f99115309df 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjbk10.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xpt{15}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo index 43d476b568b..ec5d954a592 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjbk11.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xipt{15.5}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo index b6ca4c9d743..12f95621bad 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjbk12.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xiipt{16.5}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls index 57a12a96806..492f002c310 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjbook} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -162,8 +162,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls index 4fcb494f9dd..7015898978e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjreport} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -160,8 +160,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls index ea6dc8c455c..5de7ff1e774 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjsarticle} - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] \def\jsc@clsname{ltjsarticle} \def\Cjascale{0.924715} \RequirePackage{luatexja} @@ -249,13 +249,15 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -285,8 +287,8 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \newskip\jsc@smallskipamount \jsc@smallskipamount=3\jsc@mpt plus 1\jsc@mpt minus 1\jsc@mpt \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls index 43bedbc8787..99480233056 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjsbook} - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] \def\jsc@clsname{ltjsbook} \def\Cjascale{0.924715} \RequirePackage{luatexja} @@ -257,13 +257,15 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -293,8 +295,8 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \newskip\jsc@smallskipamount \jsc@smallskipamount=3\jsc@mpt plus 1\jsc@mpt minus 1\jsc@mpt \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo index 86dec802d58..1a7730f26a4 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjsize10.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xpt{15}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo index 09fdbba37a6..8d54bfb3050 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjsize11.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xipt{15.5}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo index a14fe5b90b0..7bb389a0578 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjsize12.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xiipt{16.5}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls index be94fcc2879..231be8bf2ef 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjskiyou} - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] \def\jsc@clsname{ltjskiyou} \def\Cjascale{0.924715} \RequirePackage{luatexja} @@ -248,13 +248,15 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -284,8 +286,8 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \newskip\jsc@smallskipamount \jsc@smallskipamount=3\jsc@mpt plus 1\jsc@mpt minus 1\jsc@mpt \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls index f4f11d0de0e..2723db71cac 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjspf} - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] \def\jsc@clsname{ltjspf} \def\Cjascale{0.903375} \RequirePackage{luatexja} @@ -247,13 +247,15 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -283,8 +285,8 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \newskip\jsc@smallskipamount \jsc@smallskipamount=3\jsc@mpt plus 1\jsc@mpt minus 1\jsc@mpt \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls index 6f5a71a175a..5fb4691762f 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls @@ -38,7 +38,7 @@ %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjsreport} - [2022/04/11 ltjsclasses ] + [2022/09/12 ltjsclasses ] \def\jsc@clsname{ltjsreport} \def\Cjascale{0.924715} \RequirePackage{luatexja} @@ -253,13 +253,15 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \begingroup\catcode`\%=12\relax \directlua{ local getdimen, mpt=tex.getdimen, tex.getdimen('jsc@mpt')/65536 + local floor, cnt_dimen_at = math.floor, luatexbase.registernumber 'dimen@' + local print_scaled, sprint = luatexja.print_scaled, tex.sprint local t = lua.get_functions_table() t[\the\ltjs@@magnify@font@calc] = function() - tex.sprint(-2,math.floor(0.5+mpt*getdimen('dimen@'))) + sprint(-2,floor(0.5+mpt*getdimen(cnt_dimen_at))) end function luatexja.ltjs_unmagnify_fsize(a) - local s = luatexja.print_scaled(math.floor(0.5+a/mpt*65536)) - tex.sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) + local s = print_scaled(floor(0.5+a/mpt*65536)) + sprint(-2, (s:match('%.0$')) and s:sub(1,-3) or s ) end } \endgroup @@ -289,8 +291,8 @@ option, since LuaTeX does not support \string\mag\MessageBreak in pdf output}% \newskip\jsc@smallskipamount \jsc@smallskipamount=3\jsc@mpt plus 1\jsc@mpt minus 1\jsc@mpt \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls index dda265d17c9..21a647a45ac 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjtarticle} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -153,8 +153,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo index c054ab7e979..1d637abec23 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtbk10.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xpt{17}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo index 1a17e33fd09..3c0c1e53f34 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtbk11.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xipt{17}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo index 8490cc959a2..48d7a6444ef 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtbk12.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xiipt{18}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls index ab691218856..4243dcf837b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjtbook} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -163,8 +163,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls b/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls index 7042c0a3f35..05847ad8af2 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesClass{ltjtreport} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} \newcounter{@paper} @@ -161,8 +161,8 @@ \fi \setlength\columnseprule{0\p@} \iftombow - \newlength{\stockwidth} - \newlength{\stockheight} + \ifdefined\stockwidth\else\newlength{\stockwidth}\fi + \ifdefined\stockheight\else\newlength{\stockheight}\fi \setlength{\stockwidth}{\paperwidth} \setlength{\stockheight}{\paperheight} \advance \stockwidth 2in diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo index c0d9d8131f1..5df2dc37f6a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtsize10.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xpt{17}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo index 2df513b5767..d6bfbd0dae2 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtsize11.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xipt{17}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo index 69079d5ae4b..a3fb5a97fc3 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo +++ b/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo @@ -23,7 +23,7 @@ %% File: ltjclasses.dtx \NeedsTeXFormat{LaTeX2e} \ProvidesFile{ltjtsize12.clo} - [2022-04-11 v1.8f-ltj-22 + [2022-09-12 v1.8f-ltj-23 Standard LuaLaTeX-ja file (size option)] \renewcommand{\normalsize}{% \@setfontsize\normalsize\@xiipt{18}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index cc49fbd4798..c1f8c2c622e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -65,7 +65,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-core}[2022-01-12 Core of LuaTeX-ja] + \ProvidesPackage{luatexja-core}[2022-08-24 Core of LuaTeX-ja] \fi %</LaTeX> %% Load prerequisite packages. @@ -97,10 +97,10 @@ \expandafter\endinput\fi\relax %% Check LuaTeX version. -\ifnum\luatexversion<100 +\ifnum\luatexversion<110 \@PackageError{luatexja-core} {This LuaTeX engine is too old for this package;\MessageBreak - at least 1.0.0 is needed} + at least 1.10.0 is needed} {Package loading is aborted now.\MessageBreak} \expandafter\endinput\fi\relax @@ -125,10 +125,6 @@ \newdimen\ltj@dimen@jQ \ltj@dimen@jQ=0.25mm \let\jQ=\ltj@dimen@jQ \let\jH=\jQ -%%%%%%%% error message -\def\ltj@defnum{0} -\def\ltj@defdimen{0} - %%%%%%%% Attributes for Japanese typesetting. \newattribute\ltj@icflag % attribute for italic correction \newattribute\ltj@curjfnt % index for ``current horizontal Japanese font'' @@ -148,7 +144,6 @@ \newlanguage\ltj@@japanese \ltj@dir\z@ \ltj@icflag\z@ -\ltj@charclass\z@ \ltj@curjfnt\m@ne \ltj@curtfnt\m@ne \ltj@yablshift\z@ @@ -156,15 +151,18 @@ \ltj@tablshift\z@ \ltj@tkblshift\z@ +\newcount\ltj@tempcnta\newdimen\ltj@tempdima +\newcount\ltj@@stack \newcount\ltj@@group@level +\ltj@@group@level\z@\ltj@@stack\z@ + %%%%%%%% Attributes for character ranges -\newcount\ltj@tempcnta \ltj@tempcnta\z@ \loop\ifnum\ltj@tempcnta<7 \expandafter\newattribute% \csname ltj@kcat\the\ltj@tempcnta\endcsname - \csname ltj@kcat\the\ltj@tempcnta\endcsname=0 \advance\ltj@tempcnta\@ne \repeat +\csname ltj@kcat0\endcsname=\z@ %%%%%%%% Loading luatexja.lua @@ -225,21 +223,21 @@ %%%%%%%% \jfont\CS={...:...;jfm=metric;...}, \globaljfont \protected\def\jfont#1{% - \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko','\luatexluaescapestring{\noexpand#1}')}} + \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'yoko')}} \protected\def\globaljfont#1{% - \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko','\luatexluaescapestring{\noexpand#1}')}} + \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'yoko')}} \newluafunction\ltj@@jfont@inner \directlua{ local t = lua.get_functions_table() t[\the\ltj@@jfont@inner] = luatexja.jfont.jfontdefY } -\def\ltj@@jfont{\luafunction\ltj@@jfont@inner} +\def\ltj@@jfont{\expandafter\expandafter\expandafter\luafunction\expandafter\ltj@@jfont@inner\ltj@temp} %%%%%%%% \tfont\CS={...:...;jfm=metric;...}, \globaltfont \protected\def\tfont#1{% - \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'tate','\luatexluaescapestring{\noexpand#1}')}} + \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(false, 'tate')}} \protected\def\globaltfont#1{% - \afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'tate','\luatexluaescapestring{\noexpand#1}')}} + \def\ltj@temp{#1}\afterassignment\ltj@@jfont\directlua{luatexja.jfont.jfontdefX(true, 'tate')}} %%%%%%%% \zw, \zh \newluafunction\ltj@zw@inner @@ -264,17 +262,17 @@ \newluafunction\ltj@@ins@xk@inner \newluafunction\ltj@@ins@k@inner \directlua{ - local t = lua.get_functions_table() + local t, ltjj = lua.get_functions_table(), luatexja.jfmglue t[\the\ltj@reset@globaldefs@inner] = function() luatexja.global_temp = tex.globaldefs; tex.globaldefs = 0 end t[\the\ltj@restore@globaldefs@inner] = function() tex.globaldefs = luatexja.global_temp end - t[\the\ltj@@disihb@inner] = luatexja.jfmglue.create_disinhibitglue_node - t[\the\ltj@@ihb@inner] = luatexja.jfmglue.create_inhibitglue_node - t[\the\ltj@@fakeparbegin@inner] = luatexja.jfmglue.create_beginpar_node - t[\the\ltj@@fakeboxbdd@inner] = luatexja.jfmglue.create_boxbdd_node - t[\the\ltj@@ins@xk@inner] = luatexja.jfmglue.insert_xk_skip - t[\the\ltj@@ins@k@inner] = luatexja.jfmglue.insert_k_skip + t[\the\ltj@@disihb@inner] = ltjj.create_disinhibitglue_node + t[\the\ltj@@ihb@inner] = ltjj.create_inhibitglue_node + t[\the\ltj@@fakeparbegin@inner] = ltjj.create_beginpar_node + t[\the\ltj@@fakeboxbdd@inner] = ltjj.create_boxbdd_node + t[\the\ltj@@ins@xk@inner] = ltjj.insert_xk_skip + t[\the\ltj@@ins@k@inner] = ltjj.insert_k_skip } \protected\luadef\ltj@reset@globaldefs \ltj@reset@globaldefs@inner \protected\luadef\ltj@restore@globaldefs\ltj@restore@globaldefs@inner @@ -307,17 +305,14 @@ } %%%%%%%% \ltjsetparameter -\newcount\ltj@@stack \newcount\ltj@@group@level -\ltj@@group@level\z@\ltj@@stack\z@ - \setbox\z@\hbox{% \directlua{% This value depends on the version of LuaTeX. - luatexja.stack.hmode = -tex.nest[tex.nest.ptr].mode + luatexja.stack.hmode = -tex.getnest().mode }% } \setbox\z@\vbox{% \directlua{% This value depends on the version of LuaTeX. - luatexja.stack.vmode = -tex.nest[tex.nest.ptr].mode + luatexja.stack.vmode = -tex.getnest().mode }% } \setbox\z@\box\voidb@x @@ -328,9 +323,6 @@ \define@key[ltj]{japaram}{postbreakpenalty}{\ltj@@set@stack{POST}{-10000}{10000}#1\relax} \def\ltj@@set@stack#1#2#3{% \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1,#2,#3)}} -%\def\ltj@@set@stack#1,#2:#3#4#5{% -% \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#3, -% \ltj@safe@num@or{nil}{#1},\ltj@safe@num@or{nil}{#2},#4,#5)}} % jatextfont = {<char_code>, <font_cs>} % only horizontal font is supported @@ -357,18 +349,16 @@ % {y,t}{ja,al}baselineshift = <dimen> % yjabaselineshift = <dimen> -\define@key[ltj]{japaram}{yalbaselineshift}{% - \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@yablshift'], token.scan_dimen())}#1\relax} -\define@key[ltj]{japaram}{yjabaselineshift}{% - \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@ykblshift'], token.scan_dimen())}#1\relax} -\define@key[ltj]{japaram}{talbaselineshift}{% - \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@tablshift'], token.scan_dimen())}#1\relax} -\define@key[ltj]{japaram}{tjabaselineshift}{% - \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@tkblshift'], token.scan_dimen())}#1\relax} +\def\ltj@set@blshift@#1{\directlua{% + local n = token.scan_dimen() + tex.setattribute(luatexja.isglobal, + luatexbase.attributes['#1'], (n==0) and 0 or n) + %次期バージョンで ... and -0x7FFFFFFF or ... に変える +}} +\define@key[ltj]{japaram}{yalbaselineshift}{\ltj@set@blshift@{ltj@yablshift}#1\relax} +\define@key[ltj]{japaram}{yjabaselineshift}{\ltj@set@blshift@{ltj@ykblshift}#1\relax} +\define@key[ltj]{japaram}{talbaselineshift}{\ltj@set@blshift@{ltj@tablshift}#1\relax} +\define@key[ltj]{japaram}{tjabaselineshift}{\ltj@set@blshift@{ltj@tkblshift}#1\relax} % jaxspmode = {<char_code>, <mode>} % mode: inhibit, preonly, postonly, allow @@ -392,7 +382,7 @@ % autospacing = <bool> (default: true) \define@boolkey[ltj]{japaram}{autospacing}[true]{% \ifltj@japaram@autospacing - \directlua{luatexja.ext_print_global()}\ltj@autospc\@ne + \directlua{luatexja.ext_print_global()}\unsetattribute\ltj@autospc \else \directlua{luatexja.ext_print_global()}\ltj@autospc\z@ \fi} @@ -400,7 +390,7 @@ % autoxspacing = <bool> (default: true) \define@boolkey[ltj]{japaram}{autoxspacing}[true]{% \ifltj@japaram@autoxspacing - \directlua{luatexja.ext_print_global()}\ltj@autoxspc\@ne + \directlua{luatexja.ext_print_global()}\unsetattribute\ltj@autoxspc \else \directlua{luatexja.ext_print_global()}\ltj@autoxspc\z@ \fi} @@ -516,7 +506,7 @@ t[\the\ltj@alljachar@inner] = function() font.current(get_attr(attr_curjfnt)); tex.language=lang_ja; for i=0,6 do - set_attr(luatexbase.attributes['ltj@kcat' .. floor(i)],0) + set_attr(luatexbase.attributes['ltj@kcat' .. floor(i)], 0) end end } @@ -646,7 +636,7 @@ \setbox\z@\hbox{% \primitive\everymath{}% $\directlua{% This value depends on the version of LuaTeX. - luatexja.stack.mmode = -tex.nest[tex.nest.ptr].mode + luatexja.stack.mmode = -tex.getnest().mode }$% } \setbox\z@\box\voidb@x diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 8da4251882c..e8f4053c401 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -39,21 +39,6 @@ do return node_inherit_attr(node_new(id, subtype), b, a) end end -do - local setfield = node.direct.setfield - luatexja.setglue = node.direct.setglue or - function(g,w,st,sh,sto,sho) - setfield(g,'width', w or 0); setfield(g,'stretch',st or 0); setfield(g,'shrink', sh or 0) - setfield(g,'stretch_order',sto or 0) - setfield(g,'shrink_order', sho or 0) - end - local getfield = node.direct.getfield - luatexja.getglue = node.direct.getglue or - function(g) - return getfield(g,'width'), getfield(g,'stretch'), getfield(g,'shrink'), - getfield(g,'stretch_order'), getfield(g,'shrink_order') - end -end --- 以下は全ファイルで共有される定数 local icflag_table = {} @@ -120,7 +105,7 @@ if tex.outputmode==0 then 'Use lua*tex instead dvilua*tex.') end load_module 'rmlgbm'; local ltjr = luatexja.rmlgbm -- must be 1st -if luatexja_debug then load_module('debug') end +if luatexja_debug then load_module 'debug' end load_module 'lotf_aux'; local ltju = luatexja.lotf_aux load_module 'charrange'; local ltjc = luatexja.charrange load_module 'stack'; local ltjs = luatexja.stack @@ -171,12 +156,12 @@ local function print_glue(d,order) end local function print_spec(p) - local out=print_scaled(p.width)..'pt' - if p.stretch~=0 then - out=out..' plus '..print_glue(p.stretch,p.stretch_order) + local out=print_scaled(p.width or p[1])..'pt' + if (p.stretch or p[2])~=0 then + out=out..' plus '..print_glue(p.stretch or p[2], p.stretch_order or p[4]) end - if p.shrink~=0 then - out=out..' minus '..print_glue(p.shrink,p.shrink_order) + if (p.shrink or p[3])~=0 then + out=out..' minus '..print_glue(p.shrink or p[3], p.shrink_order or p[5]) end return out end @@ -185,14 +170,16 @@ end ------------------------------------------------------------------------ -- CODE FOR GETTING/SETTING PARAMETERS ------------------------------------------------------------------------ +local getcount, texwrite = tex.getcount, tex.write +local cnt_stack = luatexbase.registernumber 'ltj@@stack' -- EXT: print parameters that don't need arguments do local tex_getattr = tex.getattribute - local function getattr(a) - local r = tex_getattr(a) - return (r==-0x7FFFFFFF) and 0 or r - end + local function getattr(a, d) + local r = tex_getattr(a); d = d or 0 + return (r==-0x7FFFFFFF) and d or r + end luatexja.unary_pars = { yalbaselineshift = function(t) return print_scaled(getattr('ltj@yablshift'))..'pt' @@ -216,10 +203,10 @@ do return ltjs.get_stack_table(stack_ind.JWP, 0, t) end, autospacing = function(t) - return getattr('ltj@autospc') + return getattr('ltj@autospc', 1) end, autoxspacing = function(t) - return getattr('ltj@autoxspc') + return getattr('ltj@autoxspc', 1) end, differentjfm = function(t) local f, r = luatexja.jfmglue.diffmet_rule, '???' @@ -235,7 +222,7 @@ do end, direction = function() local v = ltjd.get_dir_count() - if math.abs(tex.nest[tex.nest.ptr].mode) == ltjs.mmode and v == dir_table.dir_tate then + if math.abs(tex.getnest().mode) == ltjs.mmode and v == dir_table.dir_tate then v = dir_table.dir_utod end return v @@ -248,9 +235,9 @@ do function luatexja.ext_get_parameter_unary() local k= scan_arg() if unary_pars[k] then - tex.write(tostring(unary_pars[k](tex.getcount('ltj@@stack')))) + texwrite(tostring(unary_pars[k](getcount(cnt_stack)))) end - ltjb.stop_time_measure('get_par') + ltjb.stop_time_measure 'get_par' end end @@ -269,8 +256,8 @@ do c=0 -- external range 217 == internal range 0 elseif c==31*ltjc.ATTR_RANGE then c=0 end - -- 負の値は <U+0080 の文字の文字範囲,として出てくる.この時はいつも欧文文字なので 1 を返す - return (c<0) and 1 or ltjc.get_range_setting(c) + -- 負の値は <U+0080 の文字の文字範囲,として出てくる.この時はいつも欧文文字なので 1 を返す + if c<0 then return 1 else return (ltjc.get_range_setting(c)==0) and 0 or 1 end end, prebreakpenalty = function(c, t) return ltjs.get_stack_table(stack_ind.PRE + ltjb.in_unicode(c, true), 0, t) @@ -303,9 +290,9 @@ do binary_pars.alxspmode = binary_pars.jaxspmode function luatexja.ext_get_parameter_binary(k, c) if binary_pars[k] then - tex.write(tostring(binary_pars[k](c,tex.getcount('ltj@@stack')))) + texwrite(tostring(binary_pars[k](c, getcount(cnt_stack)))) end - ltjb.stop_time_measure('get_par') + ltjb.stop_time_measure 'get_par' end end @@ -329,10 +316,10 @@ do ensure_tex_attr(attr_icflag, 0) if gc == 'fin_row' then return head else - start_time_measure('jfmglue') + start_time_measure 'jfmglue' slide(head); local p = ltjj.main(to_direct(head),mode, dir) - stop_time_measure('jfmglue') + stop_time_measure 'jfmglue' return to_node(p) end end @@ -363,13 +350,14 @@ end -- lastnodechar do - local id_glyph = node.id('glyph') + local getnest = tex.getnest + local id_glyph = node.id 'glyph' function luatexja.pltx_composite_last_node_char() - local n = tex.nest[tex.nest.ptr].tail + local n = getnest() local r = '-1' if n then if n.id==id_glyph then - while n.componetns and n.subtype and n.subtype%4 >= 2 do + while n.components and n.subtype and n.subtype%4 >= 2 do n = node.tail(n) end r = tostring(n.char) @@ -380,7 +368,7 @@ do end do - local cache_ver = 3 -- must be same as ltj-kinsoku.tex + local cache_ver = 4 -- must be same as ltj-kinsoku.tex local cache_outdate_fn = function (t) return t.version~=cache_ver end local t = ltjs.charprop_stack_table function luatexja.load_kinsoku() @@ -401,29 +389,29 @@ do local node_type = node.type local node_next = node.next -local has_attr = node.has_attribute +local get_attr = node.get_attribute -local id_penalty = node.id('penalty') -local id_glyph = node.id('glyph') -local id_glue = node.id('glue') -local id_kern = node.id('kern') -local id_hlist = node.id('hlist') -local id_vlist = node.id('vlist') -local id_rule = node.id('rule') -local id_math = node.id('math') -local id_whatsit = node.id('whatsit') -local sid_user = node.subtype('user_defined') +local id_penalty = node.id 'penalty' +local id_glyph = node.id 'glyph' +local id_glue = node.id 'glue' +local id_kern = node.id 'kern' +local id_hlist = node.id 'hlist' +local id_vlist = node.id 'vlist' +local id_rule = node.id 'rule' +local id_math = node.id 'math' +local id_whatsit = node.id 'whatsit' +local sid_user = node.subtype 'user_defined' local prefix, inner_depth local utfchar = utf.char local function debug_show_node_X(p,print_fn, limit, inner_depth) local k = prefix local s - local pt, pic = node_type(p.id), (has_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG + local pt, pic = node_type(p.id), (get_attr(p, attr_icflag) or 0) % icflag_table.PROCESSED_BEGIN_FLAG local base = prefix .. string.format('%X', pic) .. ' ' .. pt .. ' ' .. tostring(p.subtype) .. ' ' if pt == 'glyph' then - s = base .. ' ' - .. (p.char<0xF0000 and utfchar(p.char) or '') + s = base .. ' ' + .. (p.char<0xF0000 and utfchar(p.char) or '') .. string.format(' (U+%X) ', p.char) .. tostring(p.font) .. ' (' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')x' .. print_scaled(p.width) @@ -436,11 +424,11 @@ local function debug_show_node_X(p,print_fn, limit, inner_depth) if pt=='ins' then s = base .. '(' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')' - .. ', dir=' .. tostring(node.has_attribute(p, attr_dir)) + .. ', dir=' .. tostring(node.get_attribute(p, attr_dir)) else s = base .. '(' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')x' .. print_scaled(p.width) - .. ', dir=' .. tostring(node.has_attribute(p, attr_dir)) + .. ', dir=' .. tostring(node.get_attribute(p, attr_dir)) end if (p.shift or 0)~=0 then s = s .. ', shifted ' .. print_scaled(p.shift) @@ -468,7 +456,7 @@ local function debug_show_node_X(p,print_fn, limit, inner_depth) elseif pt=='rule' then s = base .. '(' .. print_scaled(p.height) .. '+' .. print_scaled(p.depth) .. ')x' .. print_scaled(p.width) - .. ', dir=' .. tostring(node.has_attribute(p, attr_dir)) + .. ', dir=' .. tostring(node.get_attribute(p, attr_dir)) print_fn(s) elseif pt=='disc' then print_fn(s) @@ -532,7 +520,7 @@ local function debug_show_node_X(p,print_fn, limit, inner_depth) else s = s .. ' userid:' .. t .. '(node list)' if p.user_id==uid_table.DIR then - s = s .. ' dir: ' .. tostring(node.has_attribute(p, attr_dir)) + s = s .. ' dir: ' .. tostring(node.get_attribute(p, attr_dir)) end print_fn(s) local bid = inner_depth diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty index 7353d8aa089..0772c0fe3e3 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty @@ -27,7 +27,7 @@ \newif\ifltj@disablejfam %%%% VERSION -\def\LuaTeXjaversion{20220810.0} +\def\LuaTeXjaversion{20221002.0} %% Check if LaTeX is used. \begingroup\expandafter\expandafter\expandafter\endgroup diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty index 1e9abe047bc..f1435f71525 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty @@ -557,6 +557,7 @@ {Use \string\KanjiEncodingPair, falling back to `\reserved@b'...}% \expandafter\edef\reserved@a{\reserved@b}% \fi} + \def\set@fontsize#1#2#3{% \@defaultunits\@tempdimb#2pt\relax\@nnil \edef\f@size{\strip@pt\@tempdimb}% diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty index c766ec46858..12605ff11b5 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-atbegshi}[2021-04-29 Patching \string\shipout\space hooks for LuaTeX-ja] +\ProvidesPackage{lltjp-atbegshi}[2022-08-12 Patching \string\shipout\space hooks for LuaTeX-ja] % concept: execute all hooks inside yoko direction \vbox @@ -37,6 +37,7 @@ % however, an infinite loop occurs if we uncomment the line below % so we can't. %\box_use:N \l__platex_shipout_dummy_box + \box_clear:N \l__platex_shipout_dummy_box } } @@ -53,6 +54,7 @@ \vbox_set:Nn \l__platex_shipout_dummy_box { \platex_direction_yoko: \__platex_original_shipout_execute_cont: } + \box_clear:N \l__platex_shipout_dummy_box } } \fi: @@ -104,7 +106,7 @@ {\setbox8\vbox\bgroup\yoko\let\AtBegShi@OrgProtect\protect} \pxabgs@patch@cmd\pxabgs@AtBegShi@Output {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox}% - {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox\egroup} + {\AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox\egroup\setbox8\box\voidb@x} \pxabgs@patch@cmd\pxabgs@AtBegShi@Output {% \begingroup diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-everyshi.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-everyshi.sty index e9510e24870..c1c07441d48 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-everyshi.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-everyshi.sty @@ -12,7 +12,7 @@ \@EveryShipout@Hook \@EveryShipout@AtNextHook \global\setbox\luatexoutputbox=\box\luatexoutputbox - }% + }\setbox8\box\voidb@x% \gdef\@EveryShipout@AtNextHook{}% \@EveryShipout@Org@Shipout\box\luatexoutputbox } diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty index 4d2d3505531..af27cae8a06 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-tascmac.sty @@ -1,13 +1,9 @@ % % lltjp-tascmac.sty % based on tascmac.sty [2016/04/15 v2.0b (community edition)] -% \tbaselineshift=\z@ ==> \ltj@tablshift=\z@ -% \ybaselineshift=\z@ ==> \ltj@yablshift=\z@ -% \dimen...=\tbaselineshift ==> \dimen...=\ltj@tablshift sp -% \dimen...=\ybaselineshift ==> \dimen...=\ltj@yablshift sp \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-tascmac}[2020/12/24 Patch to (t)ascmac for LuaTeX-ja] +\ProvidesPackage{lltjp-tascmac}[2022-08-24 Patch to (t)ascmac for LuaTeX-ja] \RequirePackage{tascmac} @@ -30,9 +26,13 @@ } %% boxnote environment +\def\ltj@backup@attr#1#2{\ifnum#1=-"7FFFFFFF #2\z@\else #2=#1sp\fi#1=0 } +\def\ltj@restore@attr#1#2{#1#2} +%\def\ltj@backup@attr#1#2{\ifnum#1=-"7FFFFFFF #2\z@\else #2=#1sp\fi\unsetattribute#1} +%\def\ltj@restore@attr#1#2{\ifdim#2=\z@ \unsetattribute#1\else #1#2\fi} \def\boxnote{\par\vspace{.3\baselineskip}% - \@saveybaselineshift\ltj@yablshift sp\ltj@yablshift\z@ - \@savetbaselineshift\ltj@tablshift sp\ltj@tablshift\z@ + \ltj@backup@attr\ltj@yablshift\@saveybaselineshift + \ltj@backup@attr\ltj@tablshift\@savetbaselineshift \setbox\@nbox=\hbox{\@ascgrp\vrule width1.08pt depth35pt b\hss a\hss b} \@whiledim \wd\@nbox<\hsize \do{ \setbox\@nbox=\hbox{\@ascgrp\unhbox\@nbox \hss a\hss b}} @@ -40,12 +40,13 @@ \vrule width1.08pt depth35pt}% \@bw=\wd\@nbox\advance\@bw -40pt \begin{lrbox}{\@nbody}\begin{minipage}{\@bw}% (KN:1998/02/27) - \ltj@yablshift\@saveybaselineshift \ltj@tablshift\@savetbaselineshift}% + \ltj@restore@attr\ltj@yablshift\@saveybaselineshift + \ltj@restore@attr\ltj@tablshift\@savetbaselineshift}% %% screen environment \def\screen{% - \@saveybaselineshift\ltj@yablshift sp\ltj@yablshift\z@ - \@savetbaselineshift\ltj@tablshift sp\ltj@tablshift\z@ + \ltj@backup@attr\ltj@yablshift\@saveybaselineshift + \ltj@backup@attr\ltj@tablshift\@savetbaselineshift \@ifnextchar[{\@screen}{\@screen[0]}} \def\@screen[#1]{\ifcase#1\def\@r{20}\def\@s{9.8pt}\def\@sx{10pt}\or \def\@r{18}\def\@s{8.8pt}\def\@sx{9pt}\or @@ -58,26 +59,29 @@ \def\@r{4}\def\@s{1.8pt}\def\@sx{2pt}\fi \par\vspace{.3\baselineskip}\@scw\linewidth \advance\@scw -\@r pt \setbox\scb@x=\hbox to\@scw\bgroup\begin{minipage}{\@scw}% (KN:1998/02/27) - \ltj@yablshift\@saveybaselineshift \ltj@tablshift\@savetbaselineshift}% + \ltj@restore@attr\ltj@yablshift\@saveybaselineshift + \ltj@restore@attr\ltj@tablshift\@savetbaselineshift}% %% itembox environment \def\@itembox[#1]#2{% - \@saveybaselineshift\ltj@yablshift sp\ltj@yablshift\z@ - \@savetbaselineshift\ltj@tablshift sp\ltj@tablshift\z@ + \ltj@backup@attr\ltj@yablshift\@saveybaselineshift + \ltj@backup@attr\ltj@tablshift\@savetbaselineshift \par\vspace{.3\baselineskip}% \setbox\@iboxstr=\hbox{% - \ltj@yablshift\@saveybaselineshift \ltj@tablshift\@savetbaselineshift #2}% + \ltj@restore@attr\ltj@yablshift\@saveybaselineshift + \ltj@restore@attr\ltj@tablshift\@savetbaselineshift #2}% \@itemh\ht\@iboxstr\advance\@itemh\dp\@iboxstr \vspace{.5\@itemh}\bgroup\@scw\linewidth \advance\@scw-20pt\@iboxpos={#1}% \setbox\scb@x=\hbox to\@scw\bgroup\begin{minipage}{\@scw}% - \ltj@yablshift\@saveybaselineshift - \ltj@tablshift\@savetbaselineshift + \ltj@restore@attr\ltj@yablshift\@saveybaselineshift + \ltj@restore@attr\ltj@tablshift\@savetbaselineshift \vspace*{.5\@itemh}}% %% \keytop \def\@keytop[#1]#2{% {\setbox0=\hbox{\shortstack{#2}}\ltj@yablshift\z@\ltj@tablshift\z@% + %\unsetattribute\ltj@yablshift\unsetattribute\ltj@tablshift% \dimen0=\wd0\advance\dimen0 5pt\dimen1=\dp0\advance\dimen1 2.5pt% \setbox\scscb@x=\hbox to\dimen0{% \@scw\wd0\hfil\vtop{\offinterlineskip @@ -92,6 +96,7 @@ %% \mask \def\mask#1#2{{\setbox\@bwsp=\hbox{#1}% +% \setbox0=\hbox{\unsetattribute\ltj@yablshift\unsetattribute\ltj@tablshift \@ascgrp#2}% \setbox0=\hbox{\ltj@yablshift\z@\ltj@tablshift\z@ \@ascgrp#2}% \dimen0=\wd\@bwsp\dimen1=\ht\@bwsp\advance\dimen1\dp\@bwsp\dimen2=-\dimen1 \setdim@{\dimen0}{\wd0}\setdim@{\dimen1}{\ht0}% @@ -104,6 +109,7 @@ %% \maskbox \def\Maskbox#1#2#3#4#5#6{{% +% \setbox0=\hbox{\unsetattribute\ltj@yablshift\unsetattribute\ltj@tablshift \@ascgrp#3}% \setbox0=\hbox{\ltj@yablshift\z@\ltj@tablshift\z@ \@ascgrp#3}% \dimen0=#1\@setdim{\dimen0}{\wd0}\dimen1=#2\@setdim{\dimen1}{\ht0}% \ifx#4c\skip0=0pt plus1fil\skip1=\skip0\fi @@ -119,12 +125,13 @@ %% shadebox environment \def\shadebox{\par\vspace{.3\baselineskip}% - \@saveybaselineshift\ltj@yablshift sp\ltj@yablshift\z@ - \@savetbaselineshift\ltj@tablshift sp\ltj@tablshift\z@ + \ltj@backup@attr\ltj@yablshift\@saveybaselineshift + \ltj@backup@attr\ltj@tablshift\@savetbaselineshift \dimen0\linewidth \advance\dimen0-20pt \advance\dimen0-2\fboxrule \advance\dimen0-\shaderule \setbox\@tempboxa=\hbox\bgroup\minipage{\dimen0}% - \ltj@yablshift\@saveybaselineshift \ltj@tablshift\@savetbaselineshift} + \ltj@restore@attr\ltj@yablshift\@saveybaselineshift + \ltj@restore@attr\ltj@tablshift\@savetbaselineshift}% %% \yen % |