diff options
23 files changed, 651 insertions, 677 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README index 717a7d0df5a..44bb796c0ff 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 20180803.0 +The LuaTeX-ja Package 20180825.0 -------------------------------- Copyright (c) 2011--2018 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -22,7 +22,7 @@ Installation 0. Please make sure that your TeX distribution is up-to-date. This version of LuaTeX-ja requires - - LuaTeX beta-0.85.0 or later + - LuaTeX 1.0.0 or later - luaotfload v2.6 - adobemapping (Adobe CMap files) - everysel package @@ -33,16 +33,16 @@ Installation - filehook package - stfloats package - IPAex fonts (http://ipafont.ipa.go.jp/) - Hence this version does not work in TeX Live 2015 (or earlier). + Hence this version does not work in TeX Live 2016 (or earlier). -1. If you are using TeX Live 2016 or later, you can install LuaTeX-ja via tlmgr. +1. If you are using TeX Live 2018 or later, you can install LuaTeX-ja via tlmgr. 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20180803.0 in the Git repository by + or tagged as 20180825.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20180803.0;sf=tgz> + ;a=snapshot;h=refs/tags/20180825.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -87,4 +87,4 @@ Notes * src/*.{ins.dtx} and src/ltj-kinsoku_make.tex are not needed in regular use. -Last commit date: Fri Aug 3 13:24:03 2018 +0900 +Last commit date: Sat Aug 25 09:04:32 2018 +0900 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 81a1fdf43fc..77f7763e705 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 3b81dd9b308..e1696751733 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 465ef208443..7c27d29b680 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx @@ -640,7 +640,7 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %<en>The following packages are needed for the \LuaTeX-ja\ package. %<ja>\LuaTeX-jaパッケージの動作には次のパッケージ類が必要である. \begin{itemize} -\item \LuaTeX\ beta-0.85.0 (or later) +\item \LuaTeX\ 1.0.0 (or later) \item \Pkg{luaotfload} v2.6 (or later) \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files) \item \Pkg{etoolbox}, \Pkg{everysel} (if you want to use \LuaTeX-ja with \LaTeXe) @@ -649,9 +649,9 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %<en>\item \emph{IPAex fonts} (\url{http://ipafont.ipa.go.jp/}) %<ja>\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})} \end{itemize} -%<en>In summary, \LuaTeX-ja version 20160404.0 (or~later) no longer supports \TeX~Live~2015. +%<en>In summary, \LuaTeX-ja version 20180825.0 (or~later) no longer supports \TeX~Live~2016. %<*ja> -要約すると,バージョン20160404.0以降の\LuaTeX-jaは\TeX~Live~2015以前では動作しない\footnote{% +要約すると,バージョン20180825.0以降の\LuaTeX-jaは\TeX~Live~2016以前では動作しない\footnote{% もっとも,自分で\LuaTeX のバイナリをSubversionリポジトリからビルドしていれば話は別である. }. %</ja> @@ -679,21 +679,6 @@ IPAex fonts are also available in these distributions. W32\TeX においてはIPAexフォントは \texttt{luatexja.tar.xz} 内にある. %</ja> -% %<*ja> -% 例えば\TeX~Live~2015を利用しているなら,\LuaTeX-jaは\TeX~Live manager (\texttt{tlmgr})を -% 使ってインストールすることができる. -% \begin{lstlisting} -% $ tlmgr install luatexja -% \end{lstlisting} -% %</ja> -% %<*en> -% If you are using \TeX~Live~2015, you can install \LuaTeX-ja -% from \TeX~Live manager (\texttt{tlmgr}): -% \begin{lstlisting} -% $ tlmgr install luatexja -% \end{lstlisting} -% %</en> - %<en>\paragraph{Manual installation} %<ja>\paragraph{手動インストール方法} @@ -6850,12 +6835,12 @@ for making the difference obvious.} %<*ja> この追加パッケージは以下の機能を提供する.詳細な仕様については\ref{sec-adjspec}章を参照してほしい. \begin{description} -\item[行末文字の位置調整] + \item[行末文字の位置調整] \pTeX では,(是非はともかく)「行末の読点はぶら下げか二分取りか全角取りのいずれかに」のように 行末文字と実際の行末の位置関係を2通り以上にすることは面倒であった. 和文フォントメトリックだけでは「常に行末の読点はぶら下げ」といったことしかできず, 前の文に書いたことを実現するには -\begin{lstlisting} + \begin{lstlisting} \def\。{% \penalty10000 % 禁則ペナルティ \hbox to0pt{。\hss}\penalty0 % ぶら下げの場合 @@ -6865,48 +6850,184 @@ for making the difference obvious.} \end{lstlisting} のような命令を定義し,文中の全ての句点を \lstinline+\。+ で書くことが必要だった. -\Pkg{luatexja-adjust}パッケージは,上で述べた行末文字と実際の行末との位置関係を -2通り以上から自動的に選択する機能を提供する. -\pdfTeX と同じように,「\TeX による行分割の後で行末文字の位置を補正する」方法と - 「行分割の過程で行末文字の位置を考慮に入れる」方法を選べるようにした( -\Pkg{luatexja-adjust}パッケージの既定では前者). + \Pkg{luatexja-adjust}パッケージは,上で述べた行末文字と実際の行末との位置関係を + 2通り以上から自動的に選択する機能を提供する. + \pdfTeX と同じように,「\TeX による行分割の後で行末文字の位置を補正する」方法と + 「行分割の過程で行末文字の位置を考慮に入れる」方法を選べるようにした + (\Pkg{luatexja-adjust}パッケージの既定では前者). -\item[優先順位付きの行長調整] -\pTeX では,行長調整において優先度の概念が存在しなかったため,図 -\ref{fig:adj}上段における半角分の半端は,\autoref{fig:adj}中段のように,鍵 -括弧周辺の空白と和文間空白(\Param{kanjiskip})の両方によって負担される.し -かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい -ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文 -文字はベタ組で組まれる(\autoref{fig:adj}下段)ことになっている. -\Pkg{luatexja-adjust}パッケージの提供する第2の機能は, -\cite{jlreq}や\cite{x4051}における規定のような,優先順位付き -の行長調整である. -\begin{itemize} - \item 優先度付き行長調整は,段落を行分割した後に個々の行について行われるものである. -そのため,行分割の位置は変化することはない. + \item[優先順位付きの行長調整] + \pTeX では,行長調整において優先度の概念が存在しなかったため,図 + \ref{fig:adj}上段における半角分の半端は,\autoref{fig:adj}中段のように,鍵 + 括弧周辺の空白と和文間空白(\Param{kanjiskip})の両方によって負担される.し + かし,「日本語組版処理の要件」\cite{jlreq}やJIS~X~4051~\cite{x4051}におい + ては,このような状況では半端は鍵括弧周辺の空白のみで負担し,その他の和文 + 文字はベタ組で組まれる(\autoref{fig:adj}下段)ことになっている. + \Pkg{luatexja-adjust}パッケージの提供する第2の機能は, + \cite{jlreq}や\cite{x4051}における規定のような,優先順位付き + の行長調整である. + \begin{itemize} + \item 優先度付き行長調整は,段落を行分割した後に個々の行について行われるものである. + そのため,行分割の位置は変化することはない. + + \verb+\hbox{...}+ といった「途中で改行できない水平ボックス」では(たとえ幅が指定されていても)無効である. + \item 優先度付き行長調整を行うと,和文処理グルーの自然長は変化しないが,伸び量や縮み量は + 一般に変化する.そのため,既に組まれた段落を \cs{unhbox} などを利用して組み直す処理を + 行う場合には注意が必要である. + \end{itemize} + + \item[「中身までみた」行送り計算] + 複数行に渡る文章を組版するときには行間に空きが入ることが普通である. + \TeX では各行が一つずつの水平ボックスをなしていることを思い出すと,隣り合った + 2つの行(つまり水平ボックス)の間の空きは次のようにして決まるのだった: + \begin{itemize} + \item 「通常に組んだときの行間」$d$を,\cs{baselineskip}から + 「前の行」の深さと「次の行」の高さを加えたものを引いた値とする. + \item $d\ge\cs{lineskiplimit}$の場合, + 標準の行送り\cs{baselineskip}で組んでも十分な間隔があると判断され, + 2行の間には長さ$d$の空白が挿入される.つまり行送りは\cs{baselineskip}. + \item {\catcode`\<=12$d<\cs{lineskiplimit}$}の場合, + 2行の間には長さ\cs{lineskip}の空白が挿入される. + そのため(設定値によるが,多くの場合)行送りは\cs{baselineskip}より広がる. + \end{itemize} -\verb+\hbox{...}+ といった「途中で改行できない水平ボックス」では(たとえ幅が指定されていても)無効である. - \item 優先度付き行長調整を行うと,和文処理グルーの自然長は変化しないが,伸び量や縮み量は -一般に変化する.そのため,既に組まれた段落を \cs{unhbox} などを利用して組み直す処理を -行う場合には注意が必要である. -\end{itemize} + \begin{figure}[t] + \noindent\centering + \begin{minipage}[b]{18\zw} + \ltjenableadjust[profile=false, linestep=false] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (a)} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{18\zw} + \ltjenableadjust[profile] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (b)} + \end{minipage}\par + \caption{高い行が連続したときの状況}\label{fig:linegap1} + \end{figure} + + ここで,\TeX は行送りの決定で「高さ・深さを取っているものが + 行のどの水平位置にあるか」は一切考慮しないことに注意してほしい.そのため, + \autoref{fig:linegap1}~(a)のように「必要以上に行間が空いて見える」状況が起こることがある. + + \Pkg{luatexja-adjust}パッケージでは,「通常に組んだときの行間」$d$を + 各行の中身の文字・グルー・ボックスの寸法を勘案して計算するという方法を + 利用できるようにした.この機能を使うと,\autoref{fig:linegap1}~(b)のように + 行間の空きが必要以上に大きくなることを避けることができる. + \begin{itemize} + \item 段落中の隣り合った二行だけでなく,行間の空きは + 新たに水平ボックス$h$を(内部・外部問わず)垂直モードで追加した時にも自動で挿入される. + その場合には,前段落で述べた「中身までみる」処理は + \begin{itemize} + \item 現在のリストにおける最後のノード + \footnote{最後のノードが\cs{parskip}によるグルーであった場合のみ + さらに一つ前のノードを参照する}が水平ボックス$h'$であり,かつ + \item \cs{prevdepth}の値とその$h'$の深さの値が一致している + \end{itemize} + 場合にのみ発動するようにしている. + \item 行の中身に水平ボックス$h''$が入ってくることもあるが,その場合は$h''$の中身までは参照しない. + 参照するようにしてしまうと,\cs{smash}など手動で行った高さ・深さ調整の意味がなくなってしまうからである. + \end{itemize} + + \begin{figure}[t] + \noindent\centering + \begin{minipage}[b]{16\zw} + \ltjenableadjust[profile] + ……だから,①より$\dfrac{a^2}{b}= \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (a): 無効} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=0.25} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (b): $0.25$\cs{baselineskip}刻み} + \end{minipage}\par\medskip + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=0.5} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (c): 0.5\cs{baselineskip}刻み} + \end{minipage}% + \kern2\zw + \begin{minipage}[b]{16\zw} + \ltjsetparameter{linestep_factor=1} + \ltjenableadjust[profile, linestep] + ……だから,①より$\dfrac{a^2}{b} = \dfrac{1+\sqrt{5}}2$.\\ + よって$b=\dfrac{1-\sqrt{5}}2$である.\\ + これを②式に代入すると…… + \par\vskip\abovecaptionskip + \ltjenableadjust[profile=false, linestep=false] + \par\centering\leavevmode{\small (d): \cs{baselineskip}刻み} + \end{minipage}\par + \caption{段階的な行送り増加}\label{fig:linegap2} + \end{figure} + + \item[段階的な行送り調整] + 既に述べたように, + 「通常に組んだときの行間」$d$が\cs{lineskiplimit}より小さい場合,\TeX 標準では + 行間は\cs{lineskip}となるのだった. + このとき行送りは「前の行の深さ」,「次の行の高さ」,\cs{lineskip}の3つの和になるわけだが, + 場合によっては行送りを「\cs{baselineskip}の整数倍」などと切りのいい値に揃えたいという状況が + 考えられなくもない. + + \Pkg{luatexja-adjust}パッケージでは,{\catcode`\<=12$d<\cs{lineskiplimit}$}のときに + 行送りを\cs{baselineskip}の\Param{linestep\_factor}倍ずつ増減させて + \begin{quote} + 行間が\cs{lineskip}以上となるような, + 最小の$(1+k\cdot \Param{linestep\_factor})\cs{baselineskip}$($k$は整数)の値 + \end{quote} + とする機能を利用できるようにした. + \autoref{fig:linegap2}の(a)がこの機能を無効にした状況で,(b),~(c),~(d)が + それぞれ\Param{linestep\_factor}を0.25,~0.5,~1とした状況である. + + なお,この機能は表組時(\cs{halign},~\cs{valign})には無効である. + \LaTeX における表組環境(tabular, arrayなど)では,\cs{baselineskip},~\cs{lineskip}はどちらも0に設定されているので + (代わりに各行に\cs{@arstrut}という支柱が入る)ために意味がないことと, + 数式を内部で表組を使って組むalign環境などではかえって行間が不揃いになってしまうからである. \end{description} -\Pkg{luatexja-adjust}パッケージは,上記で述べた2機能を有効化/無効化するための +\Pkg{luatexja-adjust}パッケージは,上記で述べた4機能を有効化/無効化するための 以下の命令を提供する.これらはすべてグローバルに効力を発揮する. \begin{cslist} \item[\cs{ltjenableadjust[...]}] -\verb+...+ に指定したkey-valueリストに従い,「行末文字の位置調整」「優先順位付きの行長調整」を有効化/無効化する. +\verb+...+ に指定したkey-valueリストに従い,「行末文字の位置調整」「優先順位付きの行長調整」 + 「『中身までみた』行送り計算」「段階的な行送り調整」を有効化/無効化する. 指定できるキーは以下の通り. \begin{description} \item[\texttt{lineend=[false,true,extended]}] 行末文字の位置調整の機能を無効化(\texttt{false}),「行分割後に調整」の形で有効化(\texttt{true}), - 「行分割の仮定で考慮」(\texttt{extended})する. + 「行分割の仮定で考慮」の形で有効化(\texttt{extended})する. \item[\texttt{priority=[false,true]}] - 優先順位付きの行長調整を無効化(\texttt{false}),または有効化(\texttt{true})する. + 優先順位付きの行長調整を無効化(\texttt{false}),または有効化(\texttt{true}). + \item[\texttt{profile=[false,true]}] + 「中身までみた」行送り計算を無効化(\texttt{false}),または有効化(\texttt{true}). + \item[\texttt{linestep=[false,true]}] + 段階的な行送り調整を無効化(\texttt{false}),または有効化(\texttt{true}). \end{description} -両キーともキー名のみを指定した場合は値として\texttt{true}が指定されたものと扱われる. +どのキーともキー名のみを指定した場合は値として\texttt{true}が指定されたものと扱われる. 互換性の為,オプション無しでただ\cs{ltjenableadjust}が呼び出された場合は, \begin{lstlisting} @@ -6917,13 +7038,13 @@ for making the difference obvious.} \item[\cs{ltjdisableadjust}] \Pkg{luatexja-adjust}パッケージの機能を無効化する. \begin{lstlisting} -\ltjenableadjust[lineend=false,priority=false] +\ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false] \end{lstlisting} と同義. \end{cslist} -また,優先順位付きの行長調整のために,次の2パラメータが\cs{ltjsetparameter}内で -追加される.両パラメータともグローバルに効力を発揮する. +また,優先順位付きの行長調整のために,次の3パラメータが\cs{ltjsetparameter}内で +追加される.いずれもグローバルに効力を発揮する. \begin{cslist}[style=standard] \item[\DParam{stretch\_priority}\,=\{<list>\}] \Param{kanjiskip}, \Param{xkanjiskip},および「\textbf{JAglue}以外のグルー」を, @@ -6942,8 +7063,14 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50} \item[\DParam{shrink\_priority}\,=\{<list>\}] 同様に,「行を自然長より縮める」場合の調整に用いる優先度を指定する. それ以外は\Param{stretch\_priority}と指定の形式は変わらない. + + \item[\DParam{linestep\_factor}\,=<float>] + 段階的な行送り調整の際,\cs{baselineskip}の何倍単位で行送りを変えるかを指定する. + 0を指定すると無効になるのと変わらない.また負数を指定すると, + その絶対値が指定されたかのように扱われる. + 初期値は0.5(つまり半行単位)である. \end{cslist} -初期値は\Param{stretch\_priority}, \Param{shrink\_priority}とも +\Param{stretch\_priority}, \Param{shrink\_priority}の初期値はどちらも \begin{lstlisting} {kanjiskip=-35,xkanjiskip=-25,others=50} \end{lstlisting} @@ -7448,12 +7575,12 @@ since we use same font for both series of gothic. いため, 「ゴシック体の中字」も同時に変更されることになる. %</ja> -\item[90jis] -%<en>Use 90JIS glyph variants if possible. -%<ja>出来る限り90JISの字形を使う. -\item[jis2004] -%<en>Use JIS2004 glyph variants if possible. -%<ja>出来る限りJIS2004の字形を使う. +\item[jis90\textrm{,~}90jis] +%<en>Use JIS~X~0208:1990 glyph variants if possible. +%<ja>出来る限りJIS~X~0208:1990の字形を使う. +\item[jis2004\textrm{,~}2004jis] +%<en>Use JIS~X~0213:2004 glyph variants if possible. +%<ja>出来る限りJIS~X~0213:2004の字形を使う. \item[jfm\_yoko=<jfm>] %<*en> Use the JFM \texttt{jfm-<jfm>.lua} for horizontal direction, instead of \texttt{jfm-ujis.lua}~(default JFM). @@ -7477,14 +7604,14 @@ Use the JFM \texttt{jfm-<jfm>.lua} for vertical direction, instead of \texttt{jf \end{cslist} %<*en> -Note that \texttt{90jis} and \texttt{jis2004} only affect with mincho, +Note that \texttt{jis90},~\texttt{90jis}, \texttt{jis2004}~and~\texttt{2004jis} only affect with mincho, gothic (and, possibly rounded gothic) families defined by this package. -We didn't taken account of when both \texttt{90jis} and \texttt{jis2004} are specified. +We didn't taken account of when more than one options among them are specified. %</en> %<*ja> -\texttt{90jis}と\texttt{jis2004}については本パッケージで定義された +\texttt{jis90},~\texttt{90jis}, \texttt{jis2004},~\texttt{2004jis}については本パッケージで定義された 明朝体・ゴシック体(・丸ゴシック体)にのみ有効である. -両オプションが同時に指定された場合の動作については全く考慮していない. +これら4オプションのうち複数が同時に指定された場合の動作については全く考慮していない. %</ja> %<en>\subsubsection{Presets which support multi weights} @@ -7857,17 +7984,17 @@ Note that HG~Mincho~E, HG~Gothic~E, HG Soei Kaku Gothic UB, and HG Maru Gothic P are internally specified by: \begin{description} \item[default] by font name (\texttt{HGMinchoE}, etc.). -\item[{\tt 90jis}] by file name (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}). -\item[{\tt jis2004}] by file name (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}). +\item[\texttt{jis90}, \texttt{90jis}] by file name (\texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}). +\item[\texttt{jis2004}, \texttt{2004jis}] by file name (\texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}). \end{description} %</en> %<*ja> なお,HG明朝E・HGゴシックE・HG創英角ゴシックUB・HG丸ゴシック体PROの4つについては,内部で \begin{description} \item[標準] フォント名(\texttt{HGMinchoE} など) -\item[{\tt 90jis}指定時] ファイル名 (% +\item[\texttt{jis90}, \texttt{90jis}指定時] ファイル名 (% \texttt{hgrme.ttc}, \texttt{hgrge.ttc}, \texttt{hgrsgu.ttc}, \texttt{hgrsmp.ttf}) -\item[{\tt jis2004}指定時] ファイル名 (% +\item[\texttt{jis2004}, \texttt{2004jis}指定時] ファイル名 (% \texttt{hgrme04.ttc}, \texttt{hgrge04.ttc}, \texttt{hgrsgu04.ttc}, \texttt{hgrsmp04.ttf}) \end{description} として指定を行っているので注意すること. @@ -7877,11 +8004,11 @@ are internally specified by: %<ja>\subsubsection{新たなプリセットの定義} %<*ja> -バージョン********.0以降では,自分で新たなプリセットを定義することが出来るようになった. +バージョン20170904.0以降では,自分で新たなプリセットを定義することが出来るようになった. 以下に説明する2命令はプリアンブルでしか実行できない. %</ja> %<*en> -From version~********.0, one can define new presets using \cs{ltjnewpreset}, +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} diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty index 0416a3ebd77..57d9835caf5 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty @@ -64,7 +64,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-adjust}[2017/05/05] + \ProvidesPackage{luatexja-adjust}[2018/07/24] \fi %</LaTeX> % Load core module if not yet. @@ -85,26 +85,31 @@ %%------------------ %! Main part of luatexja-adjust -\ifnum\luatexversion>90 - \RequireLuaTeXjaSubmodule{adjust} -\else - \RequireLuaTeXjaSubmodule{adjust_85} -\fi - +\RequireLuaTeXjaSubmodule{adjust} \newcount\ltjadj@status@le +\newcount\ltjadj@status@lp \newcount\ltjadj@status@pr +\newcount\ltjadj@status@ls \let\ltj@adjust@temp=\relax \define@choicekey[ltj]{adjust}{lineend}[\@@temp\ltj@adjust@temp]% {false,true,extended}[true]{% \ifnum\ltj@adjust@temp=-1 \else\ltjadj@status@le=\ltj@adjust@temp\fi\relax} \define@boolkey[ltj]{adjust}{priority}[true]{% \ltjadj@status@pr=\ifltj@adjust@priority1\else0\fi\relax} +\define@boolkey[ltj]{adjust}{profile}[true]{% + \ltjadj@status@lp=\ifltj@adjust@profile1\else0\fi\relax} +\define@boolkey[ltj]{adjust}{linestep}[true]{% + \ltjadj@status@ls=\ifltj@adjust@linestep1\else0\fi\relax} + \protected\def\@@ltjenableadjust[#1]{% \setkeys[ltj]{adjust}{#1}% - \directlua{luatexja.adjust.enable_cb(\the\ltjadj@status@le, \the\ltjadj@status@pr)}\ignorespaces + \directlua{luatexja.adjust.enable_cb( + \the\ltjadj@status@le, \the\ltjadj@status@pr, + \the\ltjadj@status@lp, \the\ltjadj@status@ls)}\ignorespaces } -\protected\def\ltjdisableadjust{\ltjenableadjust[lineend=false,priority=false]} +\protected\def\ltjdisableadjust{% + \ltjenableadjust[lineend=false,priority=false,profile=false,linestep=false]} \protected\def\ltjenableadjust{% \ltx@ifnextchar[{\@@ltjenableadjust}{\@@ltjenableadjust[lineend,priority]}}%] @@ -127,6 +132,8 @@ stretch_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, shrink_priority={kanjiskip=-35, xkanjiskip=-25, others=50}, } +\define@key[ltj]{japaram}{linestep_factor}{% + \directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax} %%------------------ all done diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty index b2eabb12fb4..4e577aad5ea 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty @@ -88,7 +88,9 @@ % 漢字字形 \tl_new:N \l_ltjpreset_kanji_shape_tl \ltjpreset_declare_option:nn{90jis}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis +\ltjpreset_declare_option:nn{jis90}{ \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS1990 }} % 90jis \ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 +\ltjpreset_declare_option:nn{2004jis}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004 % font preset \prop_new:N \g_ltjpreset_font_prop diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua index 7131bbc7b77..d9bd77a3ea8 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua @@ -1,10 +1,12 @@ -- -- ltj-adjust.lua -- +luatexja.load_module('base'); local ltjb = luatexja.base luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('direction'); local ltjd = luatexja.direction +luatexja.load_module('lineskip'); local ltjl = luatexja.lineskip luatexja.adjust = luatexja.adjust or {} local to_node = node.direct.tonode @@ -401,10 +403,11 @@ do return to_node(head) end local is_reg = false - function enable_cb(status_le, status_pr) + function enable_cb(status_le, status_pr, status_lp, status_ls) if (status_le>0 or status_pr>0) and (not is_reg) then - luatexbase.add_to_callback('post_linebreak_filter', - adjust_width, 'Adjust width', 100) + ltjb.add_to_callback('post_linebreak_filter', + 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 luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') @@ -412,7 +415,7 @@ do end if status_le==2 then if not luatexbase.in_callback('luatexja.adjust_jfmglue', 'luatexja.adjust') then - luatexbase.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust') + ltjb.add_to_callback('luatexja.adjust_jfmglue', insert_lineend_kern, 'luatexja.adjust') end myaw_step1, myaw_step1_last = dummy, aw_step1_last else @@ -426,9 +429,13 @@ do end end myaw_step2 = (status_pr>0) and aw_step2 or aw_step2_dummy + luatexja.lineskip.setting( + status_lp>0 and 'profile' or 'dummy', + status_ls>0 and 'step' or 'dummy' + ) end function disable_cb() -- only for compatibility - enable_cs(0) + enable_cs(0,0,0,0) end luatexja.adjust.enable_cb=enable_cb luatexja.adjust.disable_cb=disable_cb @@ -437,3 +444,81 @@ end luatexja.unary_pars.adjust = function(t) return is_reg and 1 or 0 end + +-- ----------------------------------- +luatexja.adjust.step_factor = 0.5 +do + local insert = table.insert + local rangedimensions, max = node.direct.rangedimensions, math.max + function ltjl.p_profile(before, after, mirrored, bw) + local t = {} + do + local w_acc, d_before = 0, 0 + local x = getlist(before); local xn = node_next(x) + while x do + local w, d + if xn then w, _, d= rangedimensions(before,x,xn) + else w, _, d= rangedimensions(before,x) end + if d~=d_before then + d_before = d; t[w_acc] = t[w_acc] or {} + if t[w_acc][1] then t[w_acc][1]=max(t[w_acc][1],d) + else t[w_acc][1]=d end + end + w_acc = w_acc + w + x = xn; if x then xn = node_next(x) end + end + end + do + local w_acc, h_before = 0, 0 + local x = getlist(after); local xn = node_next(x) + while x do + local w, h, d + if xn then w, h, d = rangedimensions(after,x,xn) + else w, h,d = rangedimensions(after,x) end + if mirrored then h=d end + if h~=h_before then + h_before = h; t[w_acc] = t[w_acc] or {} + if t[w_acc][2] then t[w_acc][2]=max(t[w_acc][2],h) + else t[w_acc][2]=h end + end + w_acc = w_acc + w + x = xn; if x then xn = node_next(x) end + end + end + local t2 = {} + for i,v in pairs(t) do insert(t2, { i, v[1], v[2] } ) end + table.sort(t2, function(a,b) return a[1]<b[1] end) + do + local dmax, d, hmax, h, lmin = 0, 0, 0, 0, 1/0 + for i,v in ipairs(t2) do + d, h = (v[2] or d), (v[3] or h) + if d>dmax then dmax=d end + if h>hmax then hmax=h end + 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') + - getfield(after, mirrored and 'depth' or 'height') + end + end +end + +do + local ltja = luatexja.adjust + local copy_glue = ltjl.copy_glue + local floor, max = math.floor, math.max + function ltjl.l_step(dist, g, adj, normal, bw, loc) + if loc=='alignment' then + return ltjl.l_dummy(dist, g, adj, normal, bw, loc) + end + if dist < tex.lineskiplimit then + local f = max(1, bw*ltja.step_factor) + copy_glue(g, tex.baselineskip, 1, normal - f * floor((dist-tex.lineskip.width)/f)) + else + copy_glue(g, tex.baselineskip, 2, normal) + end + end +end + + diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua deleted file mode 100644 index db85d8f3260..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua +++ /dev/null @@ -1,291 +0,0 @@ --- --- luatexja/otf.lua --- -luatexja.load_module('jfont'); local ltjf = luatexja.jfont -luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue -luatexja.load_module('stack'); local ltjs = luatexja.stack -luatexja.load_module('direction'); local ltjd = luatexja.direction - -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 is_zero_glue = node.direct.is_zero_glue or - function(g) - return (getfield(g,'width')==0)and (getfield(g,'stretch')==0)and(getfield(g,'shrink')==0) - end -local getlist = node.direct.getlist -local getid = node.direct.getid -local getfont = node.direct.getfont -local getsubtype = node.direct.getsubtype - -local node_traverse_id = node.direct.traverse_id -local node_new = node.direct.new -local node_copy = node.direct.copy -local node_hpack = node.direct.hpack -local node_next = node.direct.getnext -local node_free = node.direct.free -local node_prev = node.direct.getprev -local node_tail = node.direct.tail -local has_attr = node.direct.has_attribute -local set_attr = node.direct.set_attribute -local insert_after = node.direct.insert_after - -local id_glyph = node.id('glyph') -local id_kern = node.id('kern') -local id_hlist = node.id('hlist') -local id_glue = node.id('glue') -local id_whatsit = node.id('whatsit') -local attr_icflag = luatexbase.attributes['ltj@icflag'] -local attr_jchar_class = luatexbase.attributes['ltj@charclass'] -local lang_ja = luatexja.lang_ja - -local ltjf_font_metric_table = ltjf.font_metric_table -local round, pairs = tex.round, pairs - -local PACKED = luatexja.icflag_table.PACKED -local FROM_JFM = luatexja.icflag_table.FROM_JFM -local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP -local KANJI_SKIP_JFM = luatexja.icflag_table.KANJI_SKIP_JFM -local XKANJI_SKIP = luatexja.icflag_table.XKANJI_SKIP -local XKANJI_SKIP_JFM = luatexja.icflag_table.XKANJI_SKIP_JFM - -local priority_table = { - FROM_JFM + 2, - FROM_JFM + 1, - FROM_JFM, - FROM_JFM - 1, - FROM_JFM - 2, - XKANJI_SKIP, - KANJI_SKIP -} - -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 - end -end - --- box 内で伸縮された glue の合計値を計算 - -local function get_stretched(q, go, gs) - if gs == 1 then -- stretching - if getfield(q, 'stretch_order') == go then - return getfield(q, 'stretch') - else return 0 - end - else -- shrinking - if getfield(q, 'shrink_order') == go then - return getfield(q, 'shrink') - else return 0 - end - end -end - -local res = {} -local gs_used_line = {} -local function get_total_stretched(p, line) - local go, gf, gs - = getfield(p, 'glue_order'), getfield(p, 'glue_set'), getfield(p, 'glue_sign') - if go ~= 0 then return nil end - res[0], res.glue_set, res.name = 0, gf, (gs==1) and 'stretch' or 'shrink' - for i=1,#priority_table do res[priority_table[i]]=0 end - if gs ~= 1 and gs ~= 2 then return res, 0 end - local total = 0 - for q in node_traverse_id(id_glue, getlist(p)) do - local a, ic = get_stretched(q, go, gs), get_attr_icflag(q) - if ic == KANJI_SKIP_JFM then ic = KANJI_SKIP - elseif ic == XKANJI_SKIP_JFM then ic = XKANJI_SKIP - end - if type(res[ic]) == 'number' then - -- kanjiskip, xkanjiskip は段落内で spec を共有しているが, - -- それはここでは望ましくないので,各 glue ごとに異なる spec を使う. - -- 本当は各行ごとに glue_spec を共有させたかったが,安直にやると - -- ref_count が 0 なので Double-free が発生する.どうする? - -- JFM グルーはそれぞれ異なる glue_spec を用いているので,問題ない. - if (ic == KANJI_SKIP or ic == XKANJI_SKIP) and getsubtype(q)==0 then - local qs = getfield(q, 'spec') - if is_zero_glue(q) then - if (gs_used_line[qs] or 0)<line then - setfield(q, 'spec', node_copy(qs)) - local f = node_new(id_glue); setfield(f, 'spec', qs); node_free(f) - -- decrese qs's reference count - else - gs_used_line[qs] = line - end - end - end - res[ic], total = res[ic] + a, total + a - else - res[0], total = res[0] + a, total + a - end - end - return res, total -end - -local function clear_stretch(p, ic, name) - for q in node_traverse_id(id_glue, getlist(p)) do - local f = get_attr_icflag(q) - if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) - or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then - local qs = getfield(q, 'spec') - if getfield(qs, 'writable') then - setfield(qs, name..'_order', 0) - setfield(qs, name, 0) - end - end - end -end - -local set_stretch_table = {} -local function set_stretch(p, after, before, ic, name) - if before > 0 then - local ratio = after/before - for i,_ in pairs(set_stretch_table) do - set_stretch_table[i] = nil - end - for q in node_traverse_id(id_glue, getlist(p)) do - local f = get_attr_icflag(q) - if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) - or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then - local qs, do_flag = getfield(q, 'spec'), true - for i=1,#set_stretch_table do - if set_stretch_table[i]==qs then do_flag = false end - end - if getfield(qs, 'writable') and getfield(qs, name..'_order')==0 and do_flag then - setfield(q, name, getfield(qs, name)*ratio) - set_stretch_table[#set_stretch_table+1] = qs - end - end - end - end -end - --- step 1: 行末に kern を挿入(句読点,中点用) -local ltjd_glyph_from_packed = ltjd.glyph_from_packed -local function aw_step1(p, res, total) - local head = getlist(p) - local x = node_tail(head); if not x then return false end - -- x: \rightskip - x = node_prev(x); if not x then return false end - local xi, xc = getid(x) - if xi == id_glue and getsubtype(x) == 15 then - -- 段落最終行のときは,\penalty10000 \parfillskip が入るので, - -- その前の node が本来の末尾文字となる - x = node_prev(node_prev(x)); xi = getid(x) - end - -- local xi = getid(x) - -- while (get_attr_icflag(x) == PACKED) - -- and ((xi == id_penalty) or (xi == id_kern) or (xi == id_kern)) do - -- x = node_prev(x); xi = getid(x) - -- end - if xi == id_glyph and getfield(x, 'lang')==lang_ja then - -- 和文文字 - xc = x - elseif xi == id_hlist and get_attr_icflag(x) == PACKED then - -- packed JAchar - xc = ltjd_glyph_from_packed(x) - while getid(xc) == id_whatsit do xc = node_next(xc) end -- これはなんのために? - else - return false-- それ以外は対象外. - end - local xk = ltjf_font_metric_table[getfont(xc)] - .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0 - - if xk>0 and total>=xk then - total = total - xk - local kn = node_new(id_kern) - setfield(kn, 'kern', (res.name=='shrink' and -1 or 1) * xk) - set_attr(kn, attr_icflag, FROM_JFM) - insert_after(head, x, kn) - return true - else return false - end -end - --- step 2: 行中の glue を変える -local function aw_step2(p, res, total, added_flag) - if total == 0 then -- もともと伸縮の必要なし - if added_flag then -- 行末に kern 追加したので,それによる補正 - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', 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')) - node_free(f) - return - end - elseif total <= res[0] then -- 和文処理グルー以外で足りる - for _,v in pairs(priority_table) do clear_stretch(p, v, res.name) end - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', 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')) - node_free(f) - else - total = total - res[0] - for i = 1, #priority_table do - local v = priority_table[i] - if total <= res[v] then - for j = i+1,#priority_table do - clear_stretch(p, priority_table[j], res.name) - end - set_stretch(p, total, res[v], v, res.name); break - end - total = total - res[v] - end - local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') - setfield(f, 'head', 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')) - node_free(f) - end -end - - -local ltjs_fast_get_stack_skip = ltjs.fast_get_stack_skip -local function adjust_width(head) - if not head then return head end - local line = 1 - for p in node_traverse_id(id_hlist, to_direct(head)) do - line = line + 1 - local res, total = get_total_stretched(p, line) - -- this is the same table as the table which is def'd in l. 92 - if res and res.glue_set<1 then - total = round(total * res.glue_set) - aw_step2(p, res, total, aw_step1(p, res, total)) - end - end - for i,_ in pairs(gs_used_line) do - gs_used_line[i] = nil - end - return to_node(head) -end - -do - luatexja.adjust = luatexja.adjust or {} - local is_reg = false - function luatexja.adjust.enable_cb() - if not is_reg then - luatexbase.add_to_callback('post_linebreak_filter', - adjust_width, 'Adjust width', 100) - is_reg = true - end - end - function luatexja.adjust.disable_cb() - if is_reg then - luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') - is_reg = false - end - end -end - -luatexja.unary_pars.adjust = function(t) - return is_reg and 1 or 0 -end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua index aa97c7028b2..107d27a897a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua @@ -1059,45 +1059,7 @@ do end end --- append_to_vlist filter -do - local id_glue = node.id('glue') - local 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 -local setglue = luatexja.setglue - local function copy_glue (new_glue, old_glue, subtype, new_w) - setfield(new_glue, 'subtype', subtype) - local w,st,sp,sto,spo = getglue(to_direct(old_glue)) - setglue(new_glue, new_w or w, st, sp, sto, spo) - end - local node_write = node.direct.write - local function dir_adjust_append_vlist(b, loc, prev, mirrored) - local old_b = to_direct(b) - local new_b = loc=='box' and - make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b - - if prev > -65536000 then - local d = tex.baselineskip.width - prev - - getfield(new_b, mirrored and 'depth' or 'height') - local g = node_new(id_glue) - if d < tex.lineskiplimit then - copy_glue(g, tex.lineskip, 1) - else - copy_glue(g, tex.baselineskip, 2, d); - end - node_write(g) - 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.direction', 10000) -end +-- append_to_vlist filter: done in ltj-lineskip.lua -- finalize (executed just before \shipout) -- we supply correct pdfsavematrix nodes etc. inside dir_node diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index 895cf9ca496..9c051701557 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 = '2018/02/18', + date = '2018/08/11', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -280,17 +280,19 @@ local function check_next_ickern(lp) end local function calc_np_pbox(lp, last) - local first, lpa, nc = (not Np.first), KINSOKU, nil + local first, nc = (not Np.first), nil + --local lpa = get_attr_icflag(lp)==PACKED and PACKED or KINSOKU -- KINSOKU: dummy + local lpa = get_attr_icflag(lp) Np.first = Np.first or lp; Np.id = id_pbox set_attr(lp, attr_icflag, get_attr_icflag(lp)); while lp ~=last and (lpa>=PACKED) and (lpa<BOXBDD) do local lpi = getid(lp) - if lpi==id_hlist or lpi==id_vlist then + if lpa==PACKED then + if lpi==id_rule then lp = node_next(lp) end + nc, lp = lp, node_next(lp) + elseif lpi==id_hlist or lpi==id_vlist then head, lp, nc = ltjd_make_dir_whatsit(head, lp, list_dir, 'jfm pbox') Np.first = first and nc or Np.first - elseif (lpi==id_rule) and (lpa==PACKED) then - lp = node_next(lp) - nc, lp = lp, node_next(lp) else nc, lp = lp, node_next(lp) end @@ -722,7 +724,7 @@ local function new_jfm_glue(mc, bc, ac) return node_copy(g[1]), g.ratio, false, false, false else local f = node_new(id_glue) - set_attr(f, attr_icflag, g.priority) + set_attr(f, attr_icflag, g.priority) setglue(f, g.width, g.stretch, g.shrink) return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index a4aa4cd26c1..ad29ad432a2 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -55,7 +55,9 @@ local function norm_val(a) end end -function luatexja.jfont.define_jfm(t) +local fastcopy=table.fastcopy +function luatexja.jfont.define_jfm(to) + local t = fastcopy(to) local real_char -- Does current character class have the 'real' character? if t.dir~=jfm_dir then defjfm_res= nil; return @@ -1188,3 +1190,4 @@ luatexja.jfont.metrics = metrics luatexja.jfont.font_metric_table = font_metric_table luatexja.jfont.find_char_class = find_char_class +luatexja.jfont.update_jfm_cache = update_jfm_cache diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty index 26258bad3cf..6b8fa81b904 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-latex.sty @@ -12,38 +12,13 @@ \def\luatexjalatexLoaded{\endinput} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ltj-latex}[2018/06/15 LaTeX support of LuaTeX-ja] - -% LaTeX2e 2017/05/01 で行われる対策 -% 本 sty からは 2018/05/01 削除予定 -\ifx\document@default@language \@undefined - \let\document@default@language\m@ne -\fi -\ifx\l@nohyphenation \@undefined - \newlanguage\l@nohyphenation -\fi +\ProvidesPackage{ltj-latex}[2018/08/24 LaTeX support of LuaTeX-ja] % cleanup at end of the document %\let\ltj@@orig@end=\@@end %\protected\def\@@end{% % \directlua{luatexja.ext_cleanup()}\ltj@@orig@end} -% Globally add to the head of a macro (cf. LaTeX2e's \g@addto@macro) -\long\def\ltj@g@addto@macro#1#2{% - \begingroup - \def\ltj@tmpa{#2} - \toks@\expandafter\expandafter\expandafter{\expandafter\ltj@tmpa#1} - \xdef#1{\the\toks@} - \endgroup} - -\def\ltj@AtBeginDocument{\ltj@g@addto@macro\@begindocumenthook} - -\def\ltj@pkgpatch#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\usepackage{lltjp-#1}}{}}} - -% similar to \ltj@pkgpatch, but this is used .sty which -% can be reloaded inside the document by \input. -\def\ltj@pkgpatchA#1{\ltj@AtBeginDocument{\@ifpackageloaded{#1}{\input{lltjp-#1.sty}}{}}} - \endlinechar=13 %%% patch for LaTeX @@ -51,6 +26,33 @@ \usepackage{lltjdefs} \usepackage{lltjcore} +%%% patching commands +\RequirePackage{filehook} + +\def\ltj@pkgpatch@im#1{% + \@ifnextchar[{\ltj@pkgpatch@im@{#1}}{\ltj@pkgpatch@im@{#1}[lltjp-#1]}}%] +\def\ltj@pkgpatch@im@#1[#2]{% + \AtEndOfPackageFile*{#1}{% + \@ifpackageloaded{#2}{}{% + \@namedef{ver@#2.\@pkgextension}{0000/00/00}%dummy + \if\catcode`@=11\let\ltj@temp\relax\else + \edef\ltj@temp{\noexpand\catcode`@=\the\catcode`@\relax}\makeatletter + \fi + \@@input{#2.\@pkgextension}\ltj@temp + }% + }% +} + +\def\ltj@pkgpatch#1{% + \@ifnextchar[{\ltj@pkgpatch@@{#1}}{\ltj@pkgpatch@@{#1}[lltjp-#1]}}%] +\def\ltj@pkgpatch@@#1[#2]{% + \gpreto\@begindocumenthook{% + \@ifpackageloaded{#1}{% + \@ifpackageloaded{#2}{}{\RequirePackage{#2}}% + }{}% + }% +} + %%% default parameters \directlua{ local s = kpse.find_file('ltj-kinsoku.lua', 'tex') @@ -67,34 +69,20 @@ \expandafter\let\csname JY3/mc/m/n/10\endcsname\relax %%% patch for packages -\ltj@pkgpatch{listings} -\ltj@pkgpatch{unicode-math} -\ltj@pkgpatch{xunicode} -\ltj@pkgpatch{fontspec} -\ltj@pkgpatch{footmisc} +\ltj@pkgpatch@im{listings} +\ltj@pkgpatch{xunicode} %% at \begin{document} +\ltj@pkgpatch@im{fontspec} +\ltj@pkgpatch{footmisc} %% at \begin{document} \ltj@pkgpatch{tascmac} -\ltj@AtBeginDocument{\@ifpackageloaded{ascmac}{% - \edef\ltj@asc@temp{\noexpand\catcode`\noexpand\@=\the\catcode`\@}% - \makeatletter\input{lltjp-tascmac.sty}% - \ltj@asc@temp\let\ltj@asc@temp=\relax -}{}}% ascmac -\ltj@pkgpatch{stfloats} -\ltj@pkgpatch{preview} -\ltj@pkgpatch{array} +\ltj@pkgpatch{ascmac}[lltjp-tascmac] +\ltj@pkgpatch@im{stfloats} +\ltj@pkgpatch{preview} %% at \begin{document} + % (preview package has delayed option) +\ltj@pkgpatch{array} %% at \begin{document} +\ltj@pkgpatch@im{unicode-math} +\ltj@pkgpatch@im{siunitx} \RequirePackage{lltjp-geometry} -\RequirePackage{filehook} -\AtEndOfPackageFile*{fontspec}{% - \input{lltjp-fontspec-immediate.sty} - % \RequirePackage だと fontspec にオプション指定したときにエラー出る -} - -\@ifpackageloaded{siunitx}{% - \chardef\ltj@patch@siunitx@execute\z@\input{lltjp-siunitx.sty}% -}{% - \AtBeginOfPackageFile*{siunitx}{\input{lltjp-siunitx.sty}}% -} -\AtEndOfPackageFile*{siunitx}{\csname __ltj_siunitx_patch:\endcsname} %%------------------ all done \ltj@latex@AtEnd diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua new file mode 100644 index 00000000000..f5c439e559d --- /dev/null +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-lineskip.lua @@ -0,0 +1,116 @@ +-- +-- ltj-lineskip.lua +-- +luatexja.load_module('base'); local ltjb = luatexja.base +luatexja.load_module('direction'); local ltjd = luatexja.direction +luatexja.lineskip = luatexja.lineskip or {} + +local to_direct = node.direct.todirect +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 node_getglue = node.getglue +local setglue = node.direct.setglue +local function copy_glue (new_glue, old_glue, subtype, new_w) + setfield(new_glue, 'subtype', subtype) + local w,st,sp,sto,spo = node_getglue(old_glue) + setglue(new_glue, new_w or w, st, sp, sto, spo) +end +ltjl.copy_glue = copy_glue + +function ltjl.p_dummy(before, after) + return nil, 0 +end +function ltjl.l_dummy(dist, g, adj, normal, bw, loc) + if dist < tex.lineskiplimit then + copy_glue(g, tex.lineskip, 1, tex.lineskip.width + adj) + else + copy_glue(g, tex.baselineskip, 2, normal) + end +end + +local ltj_profiler, ltj_skip = ltjl.p_dummy, ltjl.l_dummy +function ltjl.setting(profiler, skip_method) + ltj_profiler = ltjl['p_'..tostring(profiler)] or ltjl.p_dummy + ltj_skip = ltjl['l_'..tostring(skip_method)] or ltjl.l_dummy +end + +do + local traverse_id = node.direct.traverse_id + local function adjust_glue(nh) + local h = to_direct(nh) + local bw = tex.baselineskip.width + for x in traverse_id(id_glue, h) do + local xs = getsubtype(x) + if (xs==1) or (xs==2) then + 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 + 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 lmin, adj = ltj_profiler(p, n, false, bw) + ltj_skip(lmin or normal, x, adj, normal, bw) + end + end + end + end + return true + end + ltjb.add_to_callback('post_linebreak_filter', + adjust_glue, 'ltj.lineskip', 10000) +end + +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 function dir_adjust_append_vlist(b, loc, prev, mirrored) + local old_b = to_direct(b) + local new_b = loc=='box' and + make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b + if prev > -65536000 then + local bw = tex.baselineskip.width + local normal = bw - prev + - getfield(new_b, mirrored and 'depth' or 'height') + local lmin, adj = nil, 0 + local tail = to_direct(tex.nest[tex.nest.ptr].tail) + if p_dummy~=ltj_profiler then + while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do + tail = node_prev(tail) + end + end + if tail then + if getid(tail)==id_hlist and getid(new_b)==id_hlist then + if getfield(tail, 'depth')==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) + 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-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua index 22c7b85e2e3..b1688235ab8 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua @@ -252,6 +252,7 @@ local function texiface_low(rst, rtlr, rtlp) setfield(w, 'value', to_node(wv)) setfield(wv, 'type', 100) setfield(wv, 'value', floor(#rtlr)) + setfield(wv, 'user_id', RUBY_PRE) -- dummy set_attr(wv, attr_ruby, rst.rubyzw) set_attr(wv, attr_ruby_maxmargin, rst.maxmargin) set_attr(wv, attr_ruby_maxprep, rst.pre) diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index 51adc9bed85..e57739d0c21 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -101,10 +101,10 @@ \expandafter\endinput\fi\relax %% Check LuaTeX version. -\ifnum\luatexversion<85 +\ifnum\luatexversion<100 \@PackageError{luatexja-core} {This LuaTeX engine is too old for this package;\MessageBreak - at least beta-0.85.0 is needed} + at least 1.0.0 is needed} {Package loading is aborted now.\MessageBreak} \expandafter\endinput\fi\relax diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 2fc116003f3..59204dfdef0 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -102,13 +102,14 @@ if luatexja_debug then load_module('debug') end load_module('charrange'); local ltjc = luatexja.charrange load_module('stack'); local ltjs = luatexja.stack load_module('direction'); local ltjd = luatexja.direction -- +1 hlist +1 attr_list +load_module('lineskip'); local ltjl = luatexja.lineskip -- +1 hlist +1 attr_list load_module('jfont'); local ltjf = luatexja.jfont load_module('inputbuf'); local ltji = luatexja.inputbuf load_module('pretreat'); local ltjp = luatexja.pretreat load_module('setwidth'); local ltjw = luatexja.setwidth load_module('jfmglue'); local ltjj = luatexja.jfmglue -- +1 glue +1 gs +1 attr_list load_module('math'); local ltjm = luatexja.math -load_module('base'); local ltjb = luatexja.base +load_module('base'); local ltjb = luatexja.base local attr_jchar_class = luatexbase.attributes['ltj@charclass'] diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty index d3c77f3708c..acaa035fd59 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty @@ -34,10 +34,10 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja}[2018/07/28 Japanese Typesetting with Lua(La)TeX] + \ProvidesPackage{luatexja}[2018/08/25 Japanese Typesetting with Lua(La)TeX] \fi %</LaTeX> %%%% VERSION -\def\LuaTeXjaversion{20180803.0} +\def\LuaTeXjaversion{20180825.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty deleted file mode 100644 index a0ee7b6dba4..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty +++ /dev/null @@ -1,131 +0,0 @@ -% -% lltjp-fontspec-immediate.sty -% - -\NeedsTeXFormat{LaTeX2e} -%%% \ProvidesPackage{lltjp-fontspec-immediate}[2017/08/07 Patch to fontspec for LuaTeX-ja] - -\RequirePackage{fontspec,luatexja} -\ExplSyntaxOn - -% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl -\ifdefined \g__fontspec_nfss_enc_tl \else - \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl } -\fi - -%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont -\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later -\cs_set:Nn \__fontspec_main_setmainfont:nn - { - \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} - \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setmainfont_hook:nn {#1} {#2} - \normalfont - } -\cs_set:Nn \__fontspec_main_setsansfont:nn - { - \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2} - \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setsansfont_hook:nn {#1} {#2} - \normalfont - } -\cs_set:Nn \__fontspec_main_setmonofont:nn - { - \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2} - \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \__fontspec_setmonofont_hook:nn {#1} {#2} - \normalfont - } -}{ %% <= 2.6g -\DeclareDocumentCommand \setmainfont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} - \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -\DeclareDocumentCommand \setsansfont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} - \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_sffamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -\DeclareDocumentCommand \setmonofont { O{} m O{} } - { - \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} - \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } - \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% - \exp_not:N \selectfont - } - } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } -} -\ExplSyntaxOff -\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} -\endinput - diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty index 4db2ffe8a4c..32e4ef0b8ab 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty @@ -1,28 +1,137 @@ % -% lltjp-fontspec.sty +% lltjp-fontspec.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-fontspec}[2017/08/07 Patch to fontspec for LuaTeX-ja] \RequirePackage{fontspec,luatexja} \ExplSyntaxOn -\@ifpackagelater{fontspec}{2017/01/01}{ - \cs_set:Nn \fontspec_visible_space: +% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl +\ifdefined \g__fontspec_nfss_enc_tl \else + \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl } +\fi + +%%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont +\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h or later +\cs_set:Nn \__fontspec_main_setmainfont:nn + { + \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} + \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmainfont_hook:nn {#1} {#2} + \normalfont + } +\cs_set:Nn \__fontspec_main_setsansfont:nn + { + \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2} + \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \sffamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setsansfont_hook:nn {#1} {#2} + \normalfont + } +\cs_set:Nn \__fontspec_main_setmonofont:nn + { + \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2} + \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \ttfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmonofont_hook:nn {#1} {#2} + \normalfont + } +}{ %% <= 2.6g +\DeclareDocumentCommand \setmainfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2} + \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%% + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } +\DeclareDocumentCommand \setsansfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2} + \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } { - \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \ltjalchar"2423\scan_stop: } - { \fontspec_visible_space_fallback: } + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_sffamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%% + \exp_not:N \selectfont } -}{ - \cs_set:Nn \fontspec_visible_space: + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } +\DeclareDocumentCommand \setmonofont { O{} m O{} } + { + \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2} + \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family + \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } { - \font_glyph_if_exist:NnTF \font {"2423} - { \ltjalchar"2423\scan_stop: } - { \fontspec_visible_space_fallback: } + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } + \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%% + \exp_not:N \selectfont } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \normalfont + \ignorespaces + } } + +\cs_set:Nn \fontspec_visible_space: + { + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \ltjalchar"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } + \def\verb { \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore @@ -32,11 +141,11 @@ \@ifstar\__fontspecsverb\@verb } - -%%%%%%%% shapes in \em \cs_set:Npn \emshape { \gtfamily \itshape } \cs_set:Npn \eminnershape { \mcfamily \upshape } \ExplSyntaxOff \expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} + \endinput + diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty index e0470a2cbee..abcf05b9e79 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty @@ -1,9 +1,8 @@ % -% lltjp-listings.sty +% lltjp-listings.sty 2018-08-25 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-listings}[2017/05/05 Patch to listings for LuaTeX-ja] \RequirePackage{listings,luatexbase-cctb} %%%%%%%%%%%%%%%% Japanese support @@ -387,6 +386,13 @@ \fi}} \endgroup +%%%%%%%%%%%%%%%% texcl +\lst@AddToHook{AfterBeginComment} + {\ifnum\lst@mode=\lst@TeXLmode + \catcode`\^^M=13\relax + \catcode\ltjlineendcomment=9\relax + \fi} + %%%%%%%%%%%%%%%% \lstloadaspects{writefile} \begingroup \catcode`\^^I=11 diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty index 738760c1bba..d629fd3cb1e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-siunitx.sty @@ -1,5 +1,5 @@ % -% lltjp-siunitx.sty +% lltjp-siunitx.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} @@ -18,17 +18,13 @@ \__ltj_siunix_patch_inner:n { l__siunitx_#1_math } \__ltj_siunix_patch_inner:n { l__siunitx_#1_text } } -\cs_new:Nn \__ltj_siunitx_patch: { - \AtBeginDocument { - \__ltj_siunix_patch_inner:n { c__siunitx_minus } - \__ltj_siunix_patch_inner:n { c__siunitx_mu } - \__ltj_siunix_patch_inner_math:n { angstrom } - \__ltj_siunix_patch_inner_math:n { arcminute } - \__ltj_siunix_patch_inner_math:n { arcsecond } - \__ltj_siunix_patch_inner_math:n { ohm } - } +\AtBeginDocument { + \__ltj_siunix_patch_inner:n { c__siunitx_minus } + \__ltj_siunix_patch_inner:n { c__siunitx_mu } + \__ltj_siunix_patch_inner_math:n { angstrom } + \__ltj_siunix_patch_inner_math:n { arcminute } + \__ltj_siunix_patch_inner_math:n { arcsecond } + \__ltj_siunix_patch_inner_math:n { ohm } } -\ifdefined\ltj@patch@siunitx@executed\__ltj_siunitx_patch:\fi - \ExplSyntaxOff \endinput diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty index 34228479510..6f7590c2a4d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-stfloats.sty @@ -1,9 +1,8 @@ % -% lltjp-stfloats.sty +% lltjp-stfloats.sty 2017-05-05 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-stfloats}[2017/05/05 Patch to stfloats for LuaTeX-ja] \RequirePackage{stfloats,luatexja} \RequirePackage{etoolbox} diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty index acca226a7f0..9c8bbfca9f9 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty @@ -1,49 +1,41 @@ % -% lltjp-unicode-math.sty +% lltjp-unicode-math.sty 2018-08-24 % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-unicode-math}[2018/01/14 Patch to unicode-math for LuaTeX-ja] \RequirePackage{unicode-math,luatexja,etoolbox} \ExplSyntaxOn -\group_begin: - \bool_new:N \__lltjp_um_patch_mathgroup_bool - \bool_set_true:N \__lltjp_um_patch_mathgroup_bool - \cs_gset:Nn \__um_define_math_chars: { - \group_begin: - \cs_set:Npn \__um_sym:nnn ##1##2##3 - { - \tl_if_in:nnT - { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } - {##3} - { - \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} } - \ltjsetmathletter{ ##1 } - } - } - \__um_input_math_symbol_table: - \group_end: - } - -\bool_if:NT \__lltjp_um_patch_mathgroup_bool { - \cs_gset:Npn \use@mathgroup #1 #2 - { - %\typeout{UM <#1><#2>} - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! +\cs_set:Nn \__um_define_math_chars: { + \group_begin: + \cs_set:Npn \__um_sym:nnn ##1##2##3 { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% - \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi - \math@egroup + \ltjsetmathletter{ ##1 } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} + { + \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} } + } } + \__um_input_math_symbol_table: + \group_end: +} +\cs_set:Npn \use@mathgroup #1 #2 +{ + %\typeout{UM <#1><#2>} + \mode_if_math:T % <- not sure + { + \math@bgroup + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% + \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi + \math@egroup } } -\group_end: \ifcsname jsc@mag@xrealtrue \endcsname \else \expandafter\expandafter\expandafter \ExplSyntaxOff \expandafter \endinput |