diff options
author | Norbert Preining <norbert@preining.info> | 2020-01-28 03:01:26 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-01-28 03:01:26 +0000 |
commit | fdd916a9e0d94bbf49f74c3b796e1bab88964d4c (patch) | |
tree | 606c1be4716998b353277312e85239fb2739d7c8 /macros/luatex/generic/luatexja | |
parent | 685e467506870702d416d2317ce1d808e8f3fb60 (diff) |
CTAN sync 202001280301
Diffstat (limited to 'macros/luatex/generic/luatexja')
25 files changed, 636 insertions, 430 deletions
diff --git a/macros/luatex/generic/luatexja/README b/macros/luatex/generic/luatexja/README index ecd65df1e4..f0d4a0e9b4 100644 --- a/macros/luatex/generic/luatexja/README +++ b/macros/luatex/generic/luatexja/README @@ -1,6 +1,6 @@ -The LuaTeX-ja Package 20191118.0 +The LuaTeX-ja Package 20200127.0 -------------------------------- -Copyright (c) 2011--2019 The LuaTeX-ja project +Copyright (c) 2011--2020 The LuaTeX-ja project License: modified BSD (see COPYING) LuaTeX-ja is a macro package for typesetting Japanese documents with LuaTeX. @@ -22,7 +22,7 @@ Installation 0. Please make sure that your TeX distribution is up-to-date. This version of LuaTeX-ja requires - - LuaTeX 1.0.0 or later + - LuaTeX 1.07.0 (or later) - luaotfload (v3.1 or later recommended) - adobemapping (Adobe CMap files) - everysel package @@ -38,14 +38,14 @@ Installation One might be able to typeset documents without an error, but with some unwanted results. -1. If you are using TeX Live 2019 or later, you can install LuaTeX-ja via tlmgr. +1. If you are using TeX Live 2019, 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 20191118.0 in the Git repository by + or tagged as 20200127.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20191118.0;sf=tgz> + ;a=snapshot;h=refs/tags/20200127.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 * src/*.{ins.dtx} and src/ltj-kinsoku_make.tex are not needed in regular use. -Last commit date: Mon Nov 18 21:38:16 2019 +0900 +Last commit date: Mon Jan 27 16:16:24 2020 +0900 diff --git a/macros/luatex/generic/luatexja/doc/lltjp-geometry.pdf b/macros/luatex/generic/luatexja/doc/lltjp-geometry.pdf Binary files differindex 2f0d74960c..1ff22ae348 100644 --- a/macros/luatex/generic/luatexja/doc/lltjp-geometry.pdf +++ b/macros/luatex/generic/luatexja/doc/lltjp-geometry.pdf diff --git a/macros/luatex/generic/luatexja/doc/lltjp-geometry.tex b/macros/luatex/generic/luatexja/doc/lltjp-geometry.tex index 2006e4994e..1b2aa5ed59 100644 --- a/macros/luatex/generic/luatexja/doc/lltjp-geometry.tex +++ b/macros/luatex/generic/luatexja/doc/lltjp-geometry.tex @@ -1,17 +1,17 @@ -%#! luajitlatex +%#! lualatex \documentclass[a4paper,10pt]{ltjsarticle} \usepackage[textwidth=45\zw, lines=45, footskip=2\zh, verbose]{geometry} -\usepackage{listings,amsmath,booktabs,lltjext} -\usepackage[match]{luatexja-fontspec} +\usepackage{listings,amsmath,booktabs,lltjext,bxghost} \usepackage{unicode-math} -\setmathfont{XITS Math} -\setmainfont{TeX Gyre Termes} -\setsansfont[Scale=0.95]{TeX Gyre Heros} -\usepackage[kozuka-pr6n]{luatexja-preset}\normalsize +\setmathfont{Latin Modern Math} +\usepackage[match]{luatexja-fontspec} +\usepackage[haranoaji]{luatexja-preset} +\setmonojfont{HaranoAjiGothic-Regular} +\normalsize \def\emph#1{\textbf{\textgt{\mathversion{bold}#1}}} \def\headfont{\normalfont\bfseries\gtfamily} \def\pTeX{p\kern-.05em\TeX} -\def\cs#1{\text{\texttt{\char`\\#1}}} +\def\cs#1{\text{\eghostguarded{\texttt{\char`\\#1}}}} \protected\def\Pkg#1{\textsf{#1}} \protected\def\>{\hskip\ltjgetparameter{xkanjiskip}} \lstset{ @@ -244,7 +244,7 @@ $5\,\textrm{pt} + 3.41666\,\textrm{pt}=8.41666\,\textrm{pt}$である.} \Pkg{lltjp-geometry}では \begin{quote} \texttt{lines}オプション指定時,\cs{topskip}の値を最低でも - \emph{\cs{tstrutbox}の高さ($\cs{baselineskip}/2$)}まで引き上げる + \emph{\cs{tstrutbox}の高さ}($\cs{baselineskip}/2$)まで引き上げる \end{quote} という挙動にした.見かけ上は\cs{topskip}の値制限が緩くなったが,前節で述べたように 欧文フォントのベースラインは和文に合うように下にずらされるので, @@ -278,8 +278,8 @@ $5\,\textrm{pt} + 3.41666\,\textrm{pt}=8.41666\,\textrm{pt}$である.} \cs{topskip}だけ左にずれたところにあり, 一方ページの最終行のベースラインは本文領域の左端にある. 縦組和文フォントのベースラインは文字の左右中央を通ることから, -従って,\emph{見た目で言えば,右余白の方が$\cs{topskip}=8.5\,\textrm{pt}$だけ -大きい}ということになってしまう\footnote{% +従って,\emph{見た目で言えば,右余白の方が\cs{topskip}}~($=8.5\,\textrm{pt}$)% +\emph{だけ大きい}ということになってしまう\footnote{% 同様に,横組で \texttt{vcentering}を指定すると,見かけでは $\cs{topskip}-\cs{Cht}+\cs{Cdp}$だけ上余白が大きいように見える. }. diff --git a/macros/luatex/generic/luatexja/doc/ltjclasses.pdf b/macros/luatex/generic/luatexja/doc/ltjclasses.pdf Binary files differindex d2ba59b005..82b5a12e8a 100644 --- a/macros/luatex/generic/luatexja/doc/ltjclasses.pdf +++ b/macros/luatex/generic/luatexja/doc/ltjclasses.pdf diff --git a/macros/luatex/generic/luatexja/doc/ltjltxdoc.pdf b/macros/luatex/generic/luatexja/doc/ltjltxdoc.pdf Binary files differindex f963ecb767..2fbbb67664 100644 --- a/macros/luatex/generic/luatexja/doc/ltjltxdoc.pdf +++ b/macros/luatex/generic/luatexja/doc/ltjltxdoc.pdf diff --git a/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf b/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf Binary files differindex 43d9e9b1c3..e7b415f52b 100644 --- a/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf +++ b/macros/luatex/generic/luatexja/doc/ltjsclasses.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf Binary files differindex eb9e2513e3..5a23c46595 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-en.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-en.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf Binary files differindex 4be46efdc5..15bf08d241 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-ja.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf Binary files differindex 935ed02930..2c11e1f774 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf +++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.pdf diff --git a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex index 4d4be4f4f1..40657a363f 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex +++ b/macros/luatex/generic/luatexja/doc/luatexja-ruby.tex @@ -1,16 +1,20 @@ -%#! luajitlatex +%#! lualatex %%% a test of ruby. \documentclass[a4paper,10pt]{ltjsarticle} -\usepackage{luatexja-otf,amsmath} +\usepackage{luatexja-otf,amsmath,bxghost} +\usepackage[no-math]{fontspec} \usepackage[match]{luatexja-fontspec} -\usepackage[kozuka-pr6n]{luatexja-preset}\normalsize +\usepackage[haranoaji]{luatexja-preset}\normalsize +\setmonojfont{HaranoAjiGothic-Regular.otf} +\usepackage{unicode-math} +\setmathfont{Latin Modern Math} + \def\emph#1{\textbf{\textgt{#1}}} \def\headfont{\normalfont\bfseries\gtfamily} -\setmonojfont{KozGoPr6N-Regular.otf} - -\usepackage[textwidth=45\zw, lines=45, footskip=6mm]{geometry} +\def\cs#1{\eghostguarded{\texttt{\textbackslash#1}}} +\usepackage[textwidth=45\zw, lines=45, footskip=2\zh]{geometry} \advance\leftmargini-1\zw\advance\leftmarginii-1\zw -\protected\def\Param#1{\underline{\smash{\textsf{\mdseries #1}}}} +\protected\def\Param#1{\eghostguarded{\underline{\smash{\textsf{\mdseries #1}}}}} \usepackage{luatexja-ruby,showexpl,booktabs} \lstset{ @@ -30,17 +34,17 @@ } \def\Node#1#2{\,\vcenter{\hbox{\fboxsep=1pt\fbox{\vbox{\small\halign{\hfil##\hfil\cr - #1\mathstrut\cr\noalign{\hrule height.4pt}\strut#2\cr}}}}\,}} + #1\mathstrut\cr\noalign{\smallskip\hrule height.4pt\smallskip}\strut\<#2\cr}}}}}\,} \def\LuaTeX{Lua\TeX} % 三分ルビ用 \DeclareFontShape{JY3}{mc}{mc}{n}{<-> [0.92487] - KozMinPr6N-Regular:extend=0.67;jfm=ujisc33}{} + HaranoAjiMincho-Regular:extend=0.67;jfm=ujisc33}{} \title{\textsf{luatexja-ruby}パッケージ} \begin{document} \catcode`\<=13 -\def<#1>{{\normalfont\rm\itshape$\langle$#1\/$\rangle$}} +\def<#1>{{\rmfamily\mdseries\itshape$\langle$#1\/$\rangle$}} %\fontsize{13.19873}{15}\selectfont% \maketitle @@ -76,17 +80,17 @@ plain \LuaTeX でのロードはまだサポートしておらず, \end{quotation} \subsection{\ruby{命|令}{めい|れい}} -\paragraph{\tt\textbackslash ltjruby} +\paragraph{\cs{ltjruby}} ルビ出力用命令の本体.\verb+\ruby+ という別名を定義している. \begin{quote} -\tt \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\} +\ttfamily \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\} \end{quote} のように使用する. 第2・第3引数内の「\verb+|+」はグループの区切りを表す.詳細は\ref{ssec:grp}\nobreak 小節を参照. <option>には以下の内容をkey-valueリストで指定可能である: \begin{description} -\def\makelabel#1{\tt#1} +\def\makelabel#1{\ttfamily\bfseries #1} \item[pre=<real>] 前進入許容量をルビ全角単位で指定. 負の長さを指定した場合は,ルビの状況や直前の文字に応じた自動指定を意味する. 既定値は負(つまり,自動指定). @@ -102,13 +106,13 @@ plain \LuaTeX でのロードはまだサポートしておらず, \item[bit 2--3] ルビ文字の突出量$x$から実際の前進入量$b$,後進入量$a$の計算方法を指定する. 親文字の文字数が$k+1$,親文字の前に入る空白量・間の空白量・後ろの空白量の比が$p:q:r$のとき, \begin{description} - \item[00] $b=\min\{B, xp/[p+kq+r]\}$, \ $a=\min\{A, xr/[p+kq+r]\}$ - \item[01] $b=\min(B, x)$, \ $a=\min[A, \max(x-b,0)]$ - \item[10] $a=\min(A, x)$, \ $b=\min[B, \max(x-a,0)]$ + \item[00] $b=\min(B, xp/(p+kq+r))$, \ $a=\min(A, xr/(p+kq+r))$ + \item[01] $b=\min(B, x)$, \ $a=\min(A, \max(x-b,0))$ + \item[10] $a=\min(A, x)$, \ $b=\min(B, \max(x-a,0))$ \item[11] $M=\min(B,A)$とおく.もし$x\le 2M$ならば$b=a=x/2$.そうでなければ \[ - b=\min\left(B, M + \frac{(x-2M)p}{p+kp+r}\right),\qquad - a=\min\left(A, M + \frac{(x-2M)r}{p+kp+r}\right) + b=\min\left(B, M + \frac{(x-2M)p}{p+kq+r}\right),\qquad + a=\min\left(A, M + \frac{(x-2M)r}{p+kq+r}\right) \] \end{description} @@ -208,7 +212,7 @@ plain \LuaTeX でのロードはまだサポートしておらず, 普通はこの2つのうちいずれかを設定するだけで足りるだろう. \begin{description} -\def\makelabel#1{\tt#1} +\def\makelabel#1{\ttfamily\bfseries #1} \item[naka] 以下のオプションを同時に設定する.主に中付きルビを組むときに用いる. \begin{verbatim} mode=1, stretch={1}{2}{1}, stretchruby={1}{2}{1} @@ -219,7 +223,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \end{verbatim} \end{description} -\paragraph{\tt\textbackslash ltjsetruby\{<option>\}} +\paragraph{\cs{ltjsetruby}\{<option>\}} <option>の既定値を指定する.\textsf{luatexja-ruby}読み込み時の値は 各項目の所で既に説明してあるが,次のようになっている. \begin{verbatim} @@ -232,9 +236,9 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \paragraph{\texttt{\textbackslash ltjsetparamater} に追加されるキー} \begin{description} -\item[\Param{rubypreintrusion}\tt =\{<chr\_code>, <pre\_int>\}] +\item[\Param{rubypreintrusion}\ttfamily =\{<chr\_code>, <pre\_int>\}] 文字<chr\_code> に,その\textbf{直後}のルビによって掛けられるルビ文字列の最大長をルビ全角単位で指定. -\item[\Param{rubypostintrusion}\tt =\{<chr\_code>, <post\_int>\}] +\item[\Param{rubypostintrusion}\ttfamily =\{<chr\_code>, <post\_int>\}] 文字<chr\_code> に,その\textbf{直前}のルビによって掛けられるルビ文字列の最大長をルビ全角単位で指定. \end{description} 既定値は,\Param{rubypreintrusion},~\Param{rubypostintrusion}とも @@ -249,7 +253,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \paragraph{\texttt{\textbackslash ltjkenten}} 圏点を出力する命令で,\verb+\kenten+ という別名を定義している. \begin{quote} - \tt \textbackslash ltjkenten[<option>]\{親文字\} + \ttfamily\cs{ltjkenten}[<option>]\{親文字\} \end{quote} のように使用する.複数文字に圏点をつける場合でも,\verb+\ltjruby+ のように「\texttt{|}」を使って 文字を区切る\textbf{必要はない}ことに注意してほしい. @@ -260,7 +264,7 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \subsection{グループの\ruby{指|定}{し|てい}} \label{ssec:grp} \begin{quote} -\tt \textbackslash ltjruby[<option>]\{親|文|字\}\{おや|も|じ\} +\ttfamily\cs{ltjruby}[<option>]\{親|文|字\}\{おや|も|じ\} \end{quote} のように,\verb+\ltjruby+\ の第2・第3引数内の「\verb+|+」はグループの区切りを表す. グループの数は両者で一致しなければならず, @@ -279,7 +283,6 @@ mode=9, stretch={1}{2}{1}, stretchruby={0}{0}{1} \ltjruby{普}{ふ}\ltjruby{通}{つう}\ltjruby{車}{しや} \end{verbatim} -\newpage 複数グループかつ上記の条件を満たさない場合は, 所謂「可動グループルビ」であり,ルビの前後や各グループの切れ目で行分割が可能となる. 例えば diff --git a/macros/luatex/generic/luatexja/doc/luatexja.dtx b/macros/luatex/generic/luatexja/doc/luatexja.dtx index 19332cfb06..7b6f8fe5f5 100644 --- a/macros/luatex/generic/luatexja/doc/luatexja.dtx +++ b/macros/luatex/generic/luatexja/doc/luatexja.dtx @@ -31,8 +31,7 @@ %<ja> Scale=MatchLowercase, FakeStretch=1.137121, ItalicFont=iosevka-slab-oblique, BoldFont=iosevka-slab-bold, BoldItalicFont=iosevka-slab-bolditalic, -%<en> ]{iosevka-slab-regular} -%<ja> ]{iosevka-slab-light} +]{iosevka-slab-regular} \setsansfont[Scale=MatchLowercase,Ligatures=TeX,RawFeature=-notdef]{Linux Biolinum O} \usepackage[match]{luatexja-fontspec} \usepackage[kozuka-pr6n]{luatexja-preset} @@ -368,15 +367,22 @@ For more detailed information, see Part~\ref{part-imp} or other sections of this \ltjsetparameter{talbaselineshift=0.1\zw} \dimen0=\ltjgetparameter{talbaselineshift} \ltjsetparameter{prebreakpenalty={`ぁ,100}} -\ifnum\ltjgetparemeter{direction}=4 ... \fi +\ifnum\ltjgetparameter{direction}=4 ... \fi \end{lstlisting} %<*en> Note that \pTeX\ adds new two useful units, namely \texttt{zw}~and~\texttt{zh}. -As shown above, they are changed by \cs{zw}~and~\cs{zh} respectively, in \LuaTeX-ja. +As shown above, \emph{they are changed to \cs{zw}~and~\cs{zh} respectively} in \LuaTeX-ja.% +\footnote{\LuaTeX-ja 20200127.0 introduces \cs{ltj@zw}~and~\cs{ltj@zh}, which are copy of + \cs{zw}~and~\cs{zh}.} %</en> %<*ja> -特に注意してほしいのは,\pTeX で追加された \texttt{zw} と \texttt{zh} という単位は -\LuaTeX-ja では使用できず,\cs{zw}, \cs{zh} と制御綴の形にしないといけないという点である. +特に注意してほしいのは,\pTeX で追加された\texttt{zw}と\texttt{zh}という単位は +\LuaTeX-ja では使用できず,\emph{\cs{zw}, \cs{zh} と制御綴の形にしないといけない}という点である +\footnote{% + 別のパッケージやユーザが\cs{zw},~\cs{zh}を書き換えてしまうことに対応するため, + \LuaTeX-ja 20200127.0以降では,\cs{ltj@zw},~\cs{ltj@zh}がそれぞれ\cs{zw},~\cs{zh}の + コピーとして定義されている. +}. %</ja> %<*en> @@ -646,7 +652,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 \href{http://www.luatex.org/}{\LuaTeX}\ 1.0.0 (or later) +\item \href{http://www.luatex.org/}{\LuaTeX}\ 1.07.0 (or later) \item recent \href{https://github.com/latex3/luaotfload}{\Pkg{luaotfload}} (v3.1 or later recommended) \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files) \item \href{https://github.com/josephwright/etoolbox/}{\Pkg{etoolbox}}, @@ -657,7 +663,6 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %<ja>\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})} \end{itemize} - %<*en> Now \LuaTeX-ja is available from CTAN (in the \texttt{macros/luatex/generic/luatexja} directory), and @@ -871,6 +876,31 @@ and finally delete the temporary directory. コピーし,その中で\LuaTeX-jaの初回起動を行い,作業用ディレクトリを消す作業をしている. %</ja> +\item +%<*en> +Note that when \LuaTeX-ja is loaded in plain \LuaTeX~nor \LaTeX~2019-10-01, +we cannot use color specification on font loading, such as +\begin{lstlisting} + \font\hoge=lmroman10-regular.otf:color=FF0000 % \font primitive + \DeclareFontShape{TU}{...}{...}{...}{<-> lmsans10-boldoblique:color=005599}{} % NFSS + \setmainfont{texgyretermes}[Color=220022] % fontspec +\end{lstlisting} +This is because codes for shifting baseline in math mode (\LuaTeX-ja) collide with and prevents loading +codes for font color (\Pkg{luaotfload}) in these environments. +\emph{We recommend to use \LaTeX\ 2020-02-02}, since we can avoid this collision in \LaTeX\ 2020-02-02. +%</en> +%<*ja> +なお,\LuaTeX-jaをplain~\LuaTeX や\LaTeX\ 2019-10-01以前の環境下で用いる場合, +以下のような\emph{フォント読み込み時の色指定}(\cs{textcolor}命令ではなく!)\emph{は利用できない}. +\begin{lstlisting} + \font\hoge=lmroman10-regular.otf:color=FF0000 % \font primitive + \DeclareFontShape{TU}{...}{...}{...}{<-> lmsans10-boldoblique:color=005599}{} % NFSS + \setmainfont{texgyretermes}[Color=220022] % fontspec +\end{lstlisting} +これは,\LuaTeX-jaによる数式内のベースライン補正(\ref{ssec:baseline}節)のコードが +\Pkg{luaotfload}パッケージのフォント色処理のコードと衝突するためである. +\LaTeX\ 2020-02-02以降では衝突回避のための仕組みが備わっているので.\emph{\LaTeX\ 2020-02-02以降での使用を勧める}. +%</ja> \end{itemize} %<en>\subsection{Using in plain \TeX} @@ -1002,12 +1032,24 @@ plfonts.dtx} and \texttt{pldefs.ltx}). \begin{center}\small \begin{tabular}{lllc} \toprule -\textbf{classification}&&&\textbf{commands}\\\midrule +\textbf{classification}&\textbf{commands}&&\textbf{family}\\\midrule \emph{mincho} (明朝体)&\verb+\textmc{...}+&\verb+{\mcfamily ...}+&\cs{mcdefault}\\ \emph{gothic} (\textgt{ゴシック体})&\verb+\textgt{...}+&\verb+{\gtfamily ...}+&\cs{gtdefault}\\ +(Japanese counterpart for typewriter font)&---&---&\cs{jttdefault}\\ \bottomrule \end{tabular} \end{center} + Here \cs{jttdefault} specifies the Japanese font family in \cs{verb}~or~\texttt{verbatim} + environment, and its default value is \cs{mcdefault} (mincho family).% + \footnote{% + When \Pkg{ltjsclasses} classes are used, or + \Pkg{luatexja-fontspec} (or \Pkg{luatexja-preset}) is loaded with \texttt{match} option, + \cs{ttfamily} changes the current Japanese font amily to \cs{jttdefault}. + These classes and packages also redefine \cs{jttdefault} to + \cs{gtdefault} (\emph{gothic}~family). + } \LuaTeX-ja does not define commands to only switch current Japanese font family to + \cs{jttdefault}. + \item By default, the following fonts are used for these two families. \begin{center}\small @@ -1024,17 +1066,26 @@ By default, the following fonts are used for these two families. There is no italic nor slanted shape for these \texttt{mc}~and~\texttt{gt}. %</en> %<*ja> -\item \pLaTeX と同様に,標準では「明朝体」「ゴシック体」の2種類を用いる: +\item \pLaTeX と同様に,標準では「明朝体」「ゴシック体」の2種類を用いる. \begin{center}\small \begin{tabular}{llll} \toprule -\emph{字体}&&&\emph{ファミリ名}\\\midrule +\emph{字体}&\emph{命令}&&\emph{ファミリ名}\\\midrule 明朝体&\verb+\textmc{...}+&\verb+{\mcfamily ...}+&\cs{mcdefault}\\ \textgt{ゴシック体}&\verb+\textgt{...}+&\verb+{\gtfamily ...}+&\cs{gtdefault}\\ +(タイプライタ体と合わせる和文)&---&&\cs{jttdefault}\\ \bottomrule \end{tabular} \end{center} - \newpage + \cs{jttdefault}は\cs{verb}や\texttt{verbatim}環境中の和文文字に使われる和文フォントファミリであり, + 標準値は\cs{mcdefault},つまり明朝体である + \footnote{% + \Pkg{ltjsclasses}を使用したり,また\Pkg{luatexja-fontspec}や\Pkg{luatexja-preset}パッケージを + \texttt{match}オプションを指定して読み込んだときは,単なる\cs{ttfamily}によっても和文フォントが + \cs{jttdefault}に変更される.また,これらのクラスファイルやパッケージは + \cs{jttdefault}を \cs{gtdefault}(ゴシック体)に再定義する. + }.和文フォントファミリ(のみ)を\cs{jttdefault}に切り替える命令は準備していない. + \item 標準では,次のフォントが用いられる: \begin{center}\small \begin{tabular}{lllll} @@ -1074,28 +1125,6 @@ By default, the following fonts are used for these two families. 直に書くことができる(但し\autoref{para:jachar_in_math}ページの記述も参照). その際には明朝体(\texttt{mc})で出力される. %</ja> -%<*en> - \item \cs{jttdefault}% - \footnote{% - When \Pkg{ltjsclasses} classes are used, or - \Pkg{luatexja-fontspec} (or \Pkg{luatexja-preset}) is loaded with \texttt{match} option, - \cs{ttfamily} changes the current Japanese font amily to \cs{jttdefault}. - These classes and packages also redefine \cs{jttdefault} to - \cs{gtdefault} (\emph{gothic}~family). - } specifies the Japanese font family in \cs{verb}~or~\texttt{verbatim} environment. - The default value of \cs{jttdefault} is \cs{mcdefault}, so the mincho family is used. -%</en> -%<*ja> - \item \cs{verb} や \texttt{verbatim} 環境中の和文文字に使われる和文フォントファミリは - \ \cs{jttdefault} で指定する% - \footnote{% - \Pkg{ltjsclasses}を使用したり,あるいは \texttt{match} オプションを指定して\Pkg{luatexja-fontspec}% - や\Pkg{luatexja-preset}パッケージを読み込んだときは,単なる \cs{ttfamily} によっても和文フォントが - \ \cs{jttdefault}\ に変更される.また,これらのクラスファイルやパッケージは - \ \cs{jttdefault}\ を \cs{gtdefault}(ゴシック体)に再定義する. - }.標準値は \cs{mcdefault},つまり明朝体として用いるのと - 同じフォントファミリである. -%</ja> %<*en> \item If you use the \Pkg{beamer} class with the default font theme (which uses sans serif @@ -1345,7 +1374,7 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ \item 和文フォントのシェイプを定義するには,通常の \cs{DeclareFontShape} を使えば良い: %</ja> \begin{lstlisting} -\DeclareFontShape{JY3}{mc}{bx}{n}{<-> s*KozMinPr6N-Bold:jfm=ujis;-kern}{} +\DeclareFontShape{JY3}{mc}{b}{n}{<-> s*KozMinPr6N-Bold:jfm=ujis;-kern}{} % Kozuka Mincho Pr6N Bold \end{lstlisting} %<*ja> @@ -1479,14 +1508,14 @@ counterparts of original commands in the \Pkg{fontspec} package \begin{tabular}{>{\bfseries}lllll} \toprule Japanese fonts -&\cs{jfontspec}&\cs{setmainjfont}&\cs{setsansjfont}&\cs{setmonojfont}$^*$\\ +&\cs{jfontspec}&\cs{setmainjfont}&\cs{setsansjfont}&\cs{setmonojfont}\\ Alphabetic fonts &\cs{fontspec}&\cs{setmainfont}&\cs{setsansfont}&\cs{setmonofont}\\ \midrule Japanese fonts -&\cs{newjfontfamily}&\cs{renewjfontfamily}$^{**}$&\cs{setjfontfamily}$^{**}$\\ +&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}\\ Alphabetic fonts -&\cs{newfontfamily}&\cs{renewfontfamily}$^{**}$&\cs{setfontfamily}$^{**}$\\ +&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}\\ \midrule Japanese fonts &\cs{newjfontface}&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ @@ -1494,15 +1523,6 @@ Alphabetic fonts &\cs{newfontface}&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ \bottomrule \end{tabular}\par} -\medskip -\fakefn{$^*$}{% - \cs{setmonojfont} is defined if and only if \texttt{match} option is specified.} -\fakefn{$^{**}$}{% - \cs{renewfontfamily}~and~\cs{setfontfamily} are new commands - in \Pkg{fontspec}~v2.6h (2018/7/30). - Hence, \Pkg{luatexja-fontspec} define \cs{renewjfontfamily}~and~\cs{setjfontfamily} - only when \Pkg{fontspec}~v2.6h (or later) is used. -} \end{table} %</en> %<*ja> @@ -1513,14 +1533,14 @@ Alphabetic fonts \begin{tabular}{lllll} \toprule \emph{和文} -&\cs{jfontspec}&\cs{setmainjfont}&\cs{setsansjfont}&\cs{setmonojfont}$^*$\\ +&\cs{jfontspec}&\cs{setmainjfont}&\cs{setsansjfont}&\cs{setmonojfont}\\ \emph{欧文} &\cs{fontspec}&\cs{setmainfont}&\cs{setsansfont}&\cs{setmonofont}\\ \midrule \emph{和文} -&\cs{newjfontfamily}&\cs{renewjfontfamily}$^{**}$&\cs{setjfontfamily}$^{**}$\\ +&\cs{newjfontfamily}&\cs{renewjfontfamily}&\cs{setjfontfamily}\\ \emph{欧文} -&\cs{newfontfamily}&\cs{renewfontfamily}$^{**}$&\cs{setfontfamily}$^{**}$\\ +&\cs{newfontfamily}&\cs{renewfontfamily}&\cs{setfontfamily}\\ \midrule \emph{和文} &\cs{newjfontface}&\cs{defaultjfontfeatures}&\cs{addjfontfeatures}\\ @@ -1528,17 +1548,6 @@ Alphabetic fonts &\cs{newfontface}&\cs{defaultfontfeatures}&\cs{addfontfeatures}\\ \bottomrule \end{tabular}\par} - -\medskip -\fakefn{$^*$}{\cs{setmonojfont} は \texttt{match} オプションが -指定された時のみ定義される.} -\fakefn{$^{**}$}{% - \cs{renewfontfamily} と \cs{setfontfamily} は - \Pkg{fontspec}~v2.6h (2018/7/30)で新たに追加された命令である. - そのため,\Pkg{luatexja-fontspec}が \cs{renewjfontfamily} と \cs{setjfontfamily} を - 定義するのはv2.6h以降の\Pkg{fontspec}を使用した時のみになっている. -} - \end{table} %</ja> @@ -1549,18 +1558,12 @@ Alphabetic fonts %<*en> If this option is specified, usual family-changing commands such as \cs{rmfamily},~\cs{textrm}, \cs{sffamily},~\dots\ also change Japanese font family. - -Note that \emph{\cs{setmonojfont} is defined -if and only if this \texttt{\textup{match}} option is specified}. %</en> %<*ja> このオプションが指定されると,「\pLaTeXe 新ドキュメントクラス」のように\ \cs{rmfamily}, \verb+\textrm{...}+, \cs{sffamily} 等が 欧文フォントだけでなく和文フォントも変更するようになる. - -\emph{なお,\cs{setmonojfont} はこの \texttt{match} オプションが -指定された時のみ定義される.}この命令は標準の「タイプライタ体に対応する和文フォント」を指定する. %</ja> \item[pass=<opts>] @@ -1602,12 +1605,8 @@ This means that two lines below are equivalent, for example. \usepackage[no-math]{fontspec}\usepackage{luatexja-fontspec} \usepackage[no-math]{luatexja-fontspec} \end{lstlisting} - - %<*en> -The reason that \cs{setmonojfont} is not defined by default is that -it is popular for Japanese fonts that nearly all Japanese glyphs have same -widths. Also note that kerning information in a font is not used +Note that kerning information in a font is not used (that is, \texttt{kern} feature is set off) by default in these seven (or~eight) commands. This is because of the compatibility with previous versions of \LuaTeX-ja (see \ref{para-kern}). @@ -1615,9 +1614,7 @@ This is because of the compatibility with previous versions of \LuaTeX-ja Below is an example of \cs{jfontspec}. %</en> %<*ja> -標準で \cs{setmonojfont} コマンドが定義されないのは, -和文フォントではほぼ全ての和文文字のグリフが等幅であるのが伝統的であったことによる. -また,これらの和文用のコマンドではフォント内のペアカーニング情報は標準では使用されない, +これらの和文用のコマンドではフォント内のペアカーニング情報は標準では使用されない, 言い換えれば \texttt{kern} featureは標準では無効化となっている. これは以前のバージョンの\LuaTeX-jaとの互換性のためである(\ref{para-kern}節を参照). @@ -2328,6 +2325,7 @@ parameters to \texttt{true}/\texttt{false}, respectively. %<en>\subsection{Shifting the baseline} %<ja>\subsection{ベースラインの移動} +\label{ssec:baseline} %<*en> To make a match between a Japanese font and an alphabetic font, sometimes shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved @@ -8463,42 +8461,44 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the 新たに<name>という名称のプリセットを定義する.この名称は, すでに定義されているプリセット名や, \ref{sssec:ltjpreset-general}で定義されているオプション,さらに - 次の9つと重複してはならない. + 次の11個と重複してはならない. \begin{quote} \ttfamily - mc mc-l mc-m mc-bx gt gt-m gt-bx gt-eb mg-m + mc mc-l mc-m mc-b mc-bx gt gt-m gt-b gt-bx gt-eb mg-m \end{quote} <specification>は,プリセット名や以下のキー達のコンマ区切りリストを指定する: \begin{description} \item[\ttfamily mc-l=<font>] 明朝体細字(\cs{mcfamily}\cs{ltseries}) \item[\ttfamily mc-m=<font>] 明朝体中字(\cs{mcfamily}\cs{mdseries}) - \item[\ttfamily mc-bx=<font>] 明朝体太字(\cs{mcfamily}\cs{bfseries}) + \item[\ttfamily mc-b=<font>] 明朝体太字(\cs{mcfamily}\cs{bfseries}) + \item[\ttfamily mc-bx=<font>] \texttt{mc-b=<font>}と同義. \item[\ttfamily gt-m=<font>] ゴシック体中字(\cs{gtfamily}\cs{mdseries}) - \item[\ttfamily gt-bx=<font>] ゴシック体太字(\cs{gtfamily}\cs{bfseries}) + \item[\ttfamily gt-b=<font>] ゴシック体太字(\cs{gtfamily}\cs{bfseries}) + \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>] 明朝体の細字・中字・太字全部を設定. 以下を指定したことと同じである: \begin{quote} - \ttfamily mc-l=<font>, mc-m=<font>, mc-bx=<font> + \ttfamily mc-l=<font>, mc-m=<font>, mc-b=<font> \end{quote} \item[\ttfamily gt=<font>] ゴシック体の中字・太字・極太全部を設定. 以下を指定したことと同じである: \begin{quote} - \ttfamily gt-m=<font>, gt-bx=<font>, gt-eb=<font> + \ttfamily gt-m=<font>, gt-b=<font>, gt-eb=<font> \end{quote} \end{description} なお,パッケージ読み込み時に \texttt{deluxe} が有効でない場合は, - 上記9キーのうち\texttt{mc}, \texttt{gt}しか実質的に意味を持たない. + 上記11キーのうち\texttt{mc}, \texttt{gt}しか実質的に意味を持たない. %</ja> %<*en> Define new preset~<name>. This <name> cannot be same as other presets, options described in Subsubsection~\ref{sssec:ltjpreset-general}, nor - following nine strings: + following 11~strings: \begin{quote} - \ttfamily - mc mc-l mc-m mc-bx gt gt-m gt-bx gt-eb mg-m + \ttfamily + mc mc-l mc-m mc-b mc-bx gt gt-m gt-b gt-bx gt-eb mg-m \end{quote} <specification> is a comma-separated list which consists of @@ -8506,22 +8506,24 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the \begin{description} \item[\ttfamily mc-l=<font>] mincho light \item[\ttfamily mc-m=<font>] mincho medium - \item[\ttfamily mc-bx=<font>] mincho bold + \item[\ttfamily mc-b=<font>] mincho bold + \item[\ttfamily mc-bx=<font>] synonym for \texttt{mc-b=<font>} \item[\ttfamily gt-m=<font>] gothic medium - \item[\ttfamily gt-bx=<font>] gothic bold + \item[\ttfamily gt-b=<font>] gothic bold + \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>] Same as \begin{quote} - \ttfamily mc-l=<font>, mc-m=<font>, mc-bx=<font> + \ttfamily mc-l=<font>, mc-m=<font>, mc-b=<font> \end{quote} \item[\ttfamily gt=<font>] Same as \begin{quote} - \ttfamily gt-m=<font>, gt-bx=<font>, gt-eb=<font> + \ttfamily gt-m=<font>, gt-b=<font>, gt-eb=<font> \end{quote} \end{description} If \texttt{deluxe} is not specified at loading the package, - only \texttt{mc}~and~\texttt{gt} keys (among above 9~keys) have a meaning. + only \texttt{mc}~and~\texttt{gt} keys (among above 11~keys) have a meaning. %</en> \item[\cs{ltjnewpreset}*\{<name>\}\{<specification>\}] %<*ja> @@ -8543,7 +8545,7 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the \cs{ltjapplypreset}で実際に使うときに定義されていれば良い. そのため,次のような記述も可能である: \begin{lstlisting} - \ltjnewpreset{hoge}{piyo,mc-bx=HiraMinProN-W6} + \ltjnewpreset{hoge}{piyo,mc-b=HiraMinProN-W6} \ltjnewpreset{piyo}{mg-m=HiraMaruProN-W4} \ltjapplypreset{hoge} \end{lstlisting} @@ -8562,7 +8564,7 @@ and use them by \cs{ltjapplypreset}. These two commands can only be used in the Note that \cs{ltjnewpreset} does not ``expand'' the definition to define a preset. This means that one can write as the following: \begin{lstlisting} - \ltjnewpreset{hoge}{piyo,mc-bx=HiraMinProN-W6} + \ltjnewpreset{hoge}{piyo,mc-b=HiraMinProN-W6} \ltjnewpreset{piyo}{mg-m=HiraMaruProN-W4} \ltjapplypreset{hoge} \end{lstlisting} @@ -8626,7 +8628,7 @@ This \cs{jH} is the same \cs{dimen} register as \cs{jQ}. 等しい.この \cs{jH} は \cs{jQ} と同じ寸法レジスタを指す. %</ja> -\dim{ltj@zw} +\dim{ltj@dimen@zw} %<*en> A temporal register for the ``full-width'' of current Japanese font. The command \cs{zw} sets this register to the correct value, and @@ -8638,7 +8640,7 @@ The command \cs{zw} sets this register to the correct value, and 「このレジスタ自体を返す」. %</ja> -\dim{ltj@zh} +\dim{ltj@dimen@zh} %<*en> A temporal register for the ``full-height'' (usually the sum of height of imaginary body and its depth) of current Japanese font. The command \cs{zh} sets this register to the correct value, and @@ -9939,6 +9941,10 @@ x+y&($\Param{diffrentjfm}=\texttt{both}$). という3ノードを考える(それぞれ単独でクラスタをなす). この場合,$p$と$q$の間は,実フォントが異なるにもかかわらず2.の状況となる一方で, $q$と$r$の間は(実フォントが同じなのに)\texttt{jfmvar} キーの内容が異なるので3.の状況となる. + + なお,JFMで\texttt{kanjiskip\_natural}, \texttt{kanjiskip\_stretch},\ +\texttt{kanjiskip\_shrink}キーが指定されていた場合は,…… + \item[\Param{kanjiskip}~{[K]}] 上の[M]において空白が定まらなかった場合, 以下で定めた量「右空白」として採用する. この段階においては,\cs{inhibitglue} は効力を持たないため, diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty index bb6b5f0bd1..0c44c62e2a 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-fontspec-27c.sty @@ -3,21 +3,15 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luatexja-fontspec-27c}[2019/11/15 fontspec support of LuaTeX-ja] +\ProvidesPackage{luatexja-fontspec-27c}[2020/01/26 fontspec support of LuaTeX-ja] \RequirePackage{l3keys2e} \ExplSyntaxOn %%%%%%%% Change Japanese font family by \rmfamily or not -\cs_new:Npn \__ltj_fontspec_match_cmd { +\bool_if:NT \__ltj_fontspec_match_bool { \renewcommand\jttdefault{\gtdefault} \@ltj@match@familytrue - \DeclareDocumentCommand \setmonojfont { O{} m O{} } { - \__ltj_fontspec_set_family:Nnn \jttdefault {##1,##3}{##2} - \normalfont - } } -\bool_if:NT \__ltj_fontspec_match_bool \__ltj_fontspec_match_cmd - %%%%%%%% Messages \msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored} { @@ -336,6 +330,11 @@ \normalfont } +\DeclareDocumentCommand \setmonojfont { O{} m O{} } { + \__ltj_fontspec_set_family:Nnn \jttdefault {#1,#3}{#2} + \normalfont +} + \DeclareDocumentCommand \newjfontfamily { m O{} m O{} } { \cs_set_eq:NN \fontspec_set_family:Nnn \__ltj_fontspec_set_family:Nnn \newfontfamily #1 [#2,#4] {#3} diff --git a/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty index e126f6f90f..050f78e915 100644 --- a/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty +++ b/macros/luatex/generic/luatexja/src/addons/luatexja-preset.sty @@ -1,5 +1,5 @@ % luatexja-preset.sty -\ProvidesPackage{luatexja-preset}[2019/03/26 Japanese font presets] +\ProvidesPackage{luatexja-preset}[2020/01/26 Japanese font presets] \RequirePackage{expl3,l3keys2e} \RequirePackage{luatexja} @@ -98,13 +98,17 @@ mc .code:n = \prop_put:Nnn \g__ltjpreset_font_prop { mc-l } {#1} \prop_put:Nnn \g__ltjpreset_font_prop { mc-m } {#1} - \prop_put:Nnn \g__ltjpreset_font_prop { mc-bx } {#1}, + \prop_put:Nnn \g__ltjpreset_font_prop { mc-b } {#1}, mc .groups:n = { preset }, mc .value_required:n = true, + mc-bx .code:n = + \prop_put:Nnn \g__ltjpreset_font_prop { mc-b } {#1}, gt .code:n = \prop_put:Nnn \g__ltjpreset_font_prop { gt-u } {#1} \prop_put:Nnn \g__ltjpreset_font_prop { gt-d } {#1} - \prop_put:Nnn \g__ltjpreset_font_prop { gt-bx } {#1} + \prop_put:Nnn \g__ltjpreset_font_prop { gt-b } {#1} \prop_put:Nnn \g__ltjpreset_font_prop { gt-eb } {#1}, + gt-bx .code:n = + \prop_put:Nnn \g__ltjpreset_font_prop { gt-b } {#1}, gt-m .code:n = % gtfamily , medium series \prop_put:Nnn \g__ltjpreset_font_prop { gt-u } {#1} \prop_put:Nnn \g__ltjpreset_font_prop { gt-d } {#1}, @@ -120,20 +124,20 @@ } \ltjpreset_define_preset_prop:n { mc-l } \ltjpreset_define_preset_prop:n { mc-m } -\ltjpreset_define_preset_prop:n { mc-bx } +\ltjpreset_define_preset_prop:n { mc-b } \ltjpreset_define_preset_prop:n { gt-u } \ltjpreset_define_preset_prop:n { gt-d } -\ltjpreset_define_preset_prop:n { gt-bx } +\ltjpreset_define_preset_prop:n { gt-b } \ltjpreset_define_preset_prop:n { gt-eb} \ltjpreset_define_preset_prop:n { mg-m } \cs_new:Nn \__ltjpreset_set_uni:nn { - mc = #1, gt = #2, mc-bx = #2, mg-m = #2, + mc = #1, gt = #2, mc-b = #2, mg-m = #2, __custom = false, __office = false, __noembed = false, } \cs_new:Npn \__ltjpreset_set_office:nn #1 #2{ - mc = #1, mc-bx = HGMinchoE , - gt-d = HGGothicM , gt-bx = HGGothicE , + mc = #1, mc-b = HGMinchoE , + gt-d = HGGothicM , gt-b = HGGothicE , gt-u = #2 , gt-eb = HGSoeiKakugothicUB , mg-m = HGMaruGothicMPRO, __custom = false, __office = true, __noembed = false, @@ -152,24 +156,24 @@ % 小塚 (Adobe) %% Pro \ltjpreset_declare_preset:nx{kozuka-pro}{ - mc-m = KozMinPro-Regular, mc-bx = KozMinPro-Bold, - gt-d = KozGoPro-Regular, gt-bx = KozGoPro-Bold, + mc-m = KozMinPro-Regular, mc-b = KozMinPro-Bold, + gt-d = KozGoPro-Regular, gt-b = KozGoPro-Bold, gt-u = KozGoPro-Medium, gt-eb = KozGoPro-Heavy, mg-m = KozGoPro-Heavy, mc-l = KozMinPro-Light, __custom = false, __office = false, __noembed = false, } %% Pr6 \ltjpreset_declare_preset:nx{kozuka-pr6}{ - mc-m = KozMinProVI-Regular, mc-bx = KozMinProVI-Bold, - gt-d = KozGoProVI-Regular, gt-bx = KozGoProVI-Bold, + mc-m = KozMinProVI-Regular, mc-b = KozMinProVI-Bold, + gt-d = KozGoProVI-Regular, gt-b = KozGoProVI-Bold, gt-u = KozGoProVI-Medium, gt-eb = KozGoProVI-Heavy, mg-m = KozGoProVI-Heavy, mc-l = KozMinProVI-Light, __custom = false, __office = false, __noembed = false, } %% Pr6N \ltjpreset_declare_preset:nx{kozuka-pr6n}{ - mc-m = KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold, - gt-d = KozGoPr6N-Regular, gt-bx = KozGoPr6N-Bold, + mc-m = KozMinPr6N-Regular, mc-b = KozMinPr6N-Bold, + gt-d = KozGoPr6N-Regular, gt-b = KozGoPr6N-Bold, gt-u = KozGoPr6N-Medium, gt-eb = KozGoPr6N-Heavy, mg-m = KozGoPr6N-Heavy, mc-l = KozMinPr6N-Light, __custom = false, __office = false, __noembed = false, @@ -177,15 +181,15 @@ % ヒラギノ (OSX) \ltjpreset_declare_preset:nx{hiragino-pro}{ - mc-m = HiraMinPro-W3, mc-bx = HiraMinPro-W6, - gt-d = HiraKakuPro-W3, gt-bx = HiraKakuPro-W6, + mc-m = HiraMinPro-W3, mc-b = HiraMinPro-W6, + gt-d = HiraKakuPro-W3, gt-b = HiraKakuPro-W6, gt-u = HiraKakuPro-W6, gt-eb = HiraKakuStd-W8, mg-m = HiraMaruPro-W4, mc-l = HiraMinPro-W2, __custom = false, __office = false, __noembed = false, } \ltjpreset_declare_preset:nx{hiragino-pron}{ - mc-m = HiraMinProN-W3, mc-bx = HiraMinProN-W6, - gt-d = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6, + mc-m = HiraMinProN-W3, mc-b = HiraMinProN-W6, + gt-d = HiraKakuProN-W3, gt-b = HiraKakuProN-W6, gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8, mg-m = HiraMaruProN-W4, mc-l = HiraMinProN-W2, __custom = false, __office = false, __noembed = false, @@ -194,21 +198,21 @@ % モリサワ \ltjpreset_declare_preset:nx{bizud}{ mc = BIZ-UDMinchoM.ttc, - gt-d = BIZ-UDGothicR.ttc, gt-bx = BIZ-UDGothicB.ttc, + gt-d = BIZ-UDGothicR.ttc, gt-b = BIZ-UDGothicB.ttc, gt-u = BIZ-UDGothicR.ttc, gt-eb = BIZ-UDGothicB.ttc, mg-m = BIZ-UDGothicB.ttc, __custom = false, __office = false, __noembed = false, } \ltjpreset_declare_preset:nx{morisawa-pro}{ - mc = A-OTF-RyuminPro-Light.otf, mc-bx = A-OTF-FutoMinA101Pro-Bold.otf, - gt-d = A-OTF-GothicBBBPro-Medium.otf , gt-bx = A-OTF-FutoGoB101Pro-Bold.otf, + mc = A-OTF-RyuminPro-Light.otf, mc-b = A-OTF-FutoMinA101Pro-Bold.otf, + gt-d = A-OTF-GothicBBBPro-Medium.otf , gt-b = A-OTF-FutoGoB101Pro-Bold.otf, gt-u = A-OTF-GothicBBBPro-Medium.otf , gt-eb = A-OTF-MidashiGoPro-MB31.otf, mg-m = A-OTF-Jun101Pro-Light.otf, __custom = false, __office = false, __noembed = false, } \ltjpreset_declare_preset:nx{morisawa-pr6n}{ - mc = A-OTF-RyuminPr6N-Light.otf, mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf, - gt-d = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = A-OTF-FutoGoB101Pr6N-Bold.otf, + mc = A-OTF-RyuminPr6N-Light.otf, mc-b = A-OTF-FutoMinA101Pr6N-Bold.otf, + gt-d = A-OTF-GothicBBBPr6N-Medium.otf , gt-b = A-OTF-FutoGoB101Pr6N-Bold.otf, gt-u = A-OTF-GothicBBBPr6N-Medium.otf , gt-eb = A-OTF-MidashiGoPr6N-MB31.otf, mg-m = A-OTF-Jun101Pr6N-Light.otf, __custom = false, __office = false, __noembed = false, @@ -216,16 +220,16 @@ % 游明朝/游ゴシック (Win8.1) \ltjpreset_declare_preset:nx{yu-win}{ - mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold, - gt-d = YuGothic-Regular, gt-bx = YuGothic-Bold, + mc-m = YuMincho-Regular, mc-b = YuMincho-Demibold, + gt-d = YuGothic-Regular, gt-b = YuGothic-Bold, gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold, mg-m = YuGothic-Bold, mc-l = YuMincho-Light, __custom = false, __office = false, __noembed = false, } % Win10 \ltjpreset_declare_preset:nx{yu-win10}{ - mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold, - gt-d = YuGothic-Regular, gt-bx = YuGothic-Bold, + mc-m = YuMincho-Regular, mc-b = YuMincho-Demibold, + gt-d = YuGothic-Regular, gt-b = YuGothic-Bold, gt-u = YuGothic-Medium, gt-eb = YuGothic-Bold, mg-m = YuGothic-Bold, mc-l = YuMincho-Light, __custom = false, __office = false, __noembed = false, @@ -234,24 +238,24 @@ % Yu fonts in OSX % according to http://support.apple.com/kb/HT5944 \ltjpreset_declare_preset:nx{yu-osx}{ - mc = YuMincho~Medium, mc-bx = YuMincho~Demibold, + mc = YuMincho~Medium, mc-b = YuMincho~Demibold, gt-d = YuGothic~Medium, gt-u = YuGothic~Medium, - gt-bx = YuGothic~Bold, gt-eb = YuGothic~Bold, + gt-b = YuGothic~Bold, gt-eb = YuGothic~Bold, mg-m = YuGothic~Bold, __custom = false, __office = false, __noembed = false, } % moga-mobo \ltjpreset_declare_preset:nx{moga-mobo}{ - mc = Moga90Mincho, mc-bx = Moga90Mincho~Bold, - gt-d = Moga90Gothic, gt-bx = Moga90Gothic~Bold, + mc = Moga90Mincho, mc-b = Moga90Mincho~Bold, + gt-d = Moga90Gothic, gt-b = Moga90Gothic~Bold, gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold, mg-m = Mobo90Gothic, __custom = false, __office = false, __noembed = false, } \ltjpreset_declare_preset:nx{moga-mobo-ex}{ - mc = MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold, - gt-d = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold, + mc = MogaEx90Mincho, mc-b = MogaEx90Mincho~Bold, + gt-d = MogaEx90Gothic, gt-b = MogaEx90Gothic~Bold, gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold, mg-m = MoboEx90Gothic, __custom = false, __office = false, __noembed = false, @@ -260,7 +264,7 @@ % Ume fones \ltjpreset_declare_preset:nx{ume}{ mc = Ume~Mincho, - gt-d = Ume~Gothic, gt-bx = Ume~Gothic~O5, + gt-d = Ume~Gothic, gt-b = Ume~Gothic~O5, gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5, mg-m = Ume~Gothic~O4, __custom = false, __office = false, __noembed = false, @@ -269,9 +273,9 @@ % Source Han {Serif,Sans} \ltjpreset_declare_preset:nx{sourcehan}{ mc-m = Source~Han~Serif~Regular, - mc-bx = Source~Han~Serif~Bold, + mc-b = Source~Han~Serif~Bold, gt-d = Source~Han~Sans~Regular, - gt-bx = Source~Han~Sans~Bold, + gt-b = Source~Han~Sans~Bold, gt-u = Source~Han~Sans~Medium, gt-eb = Source~Han~Sans~Heavy, mg-m = Source~Han~Sans~Heavy, @@ -280,9 +284,9 @@ } \ltjpreset_declare_preset:nx{sourcehan-jp}{ mc-m = Source~Han~Serif~JP~Regular, - mc-bx = Source~Han~Serif~JP~Bold, + mc-b = Source~Han~Serif~JP~Bold, gt-d = Source~Han~Sans~JP~Regular, - gt-bx = Source~Han~Sans~JP~Bold, + gt-b = Source~Han~Sans~JP~Bold, gt-u = Source~Han~Sans~JP~Medium, gt-eb = Source~Han~Sans~JP~Heavy, mg-m = Source~Han~Sans~JP~Heavy, @@ -291,9 +295,9 @@ } \ltjpreset_declare_preset:nx{noto-otc}{ mc-m = Noto~Serif~CJK~Regular, - mc-bx = Noto~Serif~CJK~Bold, + mc-b = Noto~Serif~CJK~Bold, gt-d = Noto~Sans~CJK~Regular, - gt-bx = Noto~Sans~CJK~Bold, + gt-b = Noto~Sans~CJK~Bold, gt-u = Noto~Sans~CJK~Medium, gt-eb = Noto~Sans~CJK~Black, mg-m = Noto~Sans~CJK~Black, @@ -302,9 +306,9 @@ } \ltjpreset_declare_preset:nx{noto-otf}{ mc-m = Noto~Serif~CJK~JP~Regular, - mc-bx = Noto~Serif~CJK~JP~Bold, + mc-b = Noto~Serif~CJK~JP~Bold, gt-d = Noto~Sans~CJK~JP~Regular, - gt-bx = Noto~Sans~CJK~JP~Bold, + gt-b = Noto~Sans~CJK~JP~Bold, gt-u = Noto~Sans~CJK~JP~Medium, gt-eb = Noto~Sans~CJK~JP~Black, mg-m = Noto~Sans~CJK~JP~Black, @@ -315,9 +319,9 @@ % HaranoAji {Mincho, Gothic} \ltjpreset_declare_preset:nx{haranoaji}{ mc-m = HaranoAjiMincho-Regular.otf, - mc-bx = HaranoAjiMincho-Bold.otf, + mc-b = HaranoAjiMincho-Bold.otf, gt-d = HaranoAjiGothic-Regular.otf, - gt-bx = HaranoAjiGothic-Bold.otf, + gt-b = HaranoAjiGothic-Bold.otf, gt-u = HaranoAjiGothic-Medium.otf, gt-eb = HaranoAjiGothic-Heavy.otf, mg-m = HaranoAjiGothic-Heavy.otf, @@ -392,18 +396,18 @@ %%%% リストからの展開 \cs_set:Nx \__ltjpreset_font_mc_l: { \prop_item:Nn \g__ltjpreset_font_prop { mc-l } } \cs_set:Nx \__ltjpreset_font_mc_m: { \prop_item:Nn \g__ltjpreset_font_prop { mc-m } } - \cs_set:Nx \__ltjpreset_font_mc_bx: { \prop_item:Nn \g__ltjpreset_font_prop { mc-bx } } + \cs_set:Nx \__ltjpreset_font_mc_b: { \prop_item:Nn \g__ltjpreset_font_prop { mc-b } } \cs_set:Nx \__ltjpreset_font_gt_m: { \prop_item:Nn \g__ltjpreset_font_prop { gt-d } } \cs_set:Nx \__ltjpreset_font_gt_u: { \prop_item:Nn \g__ltjpreset_font_prop { gt-u } } - \cs_set:Nx \__ltjpreset_font_gt_bx: { \prop_item:Nn \g__ltjpreset_font_prop { gt-bx } } + \cs_set:Nx \__ltjpreset_font_gt_b: { \prop_item:Nn \g__ltjpreset_font_prop { gt-b } } \cs_set:Nx \__ltjpreset_font_gt_eb: { \prop_item:Nn \g__ltjpreset_font_prop { gt-eb } } \cs_set:Nx \__ltjpreset_font_mg_m: { \prop_item:Nn \g__ltjpreset_font_prop { mg-m } } %% HG 系フォント + JIS2004/90JIS のときはフォント名を置換 \bool_if:nT { !\g__ltjpreset_custom_bool && \g__ltjpreset_office_bool } { \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 } \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl { - \cs_set:Nx \__ltjpreset_font_mc_bx: { hgrme04.ttc } - \cs_set:Nx \__ltjpreset_font_gt_bx: { hgrge04.ttc } + \cs_set:Nx \__ltjpreset_font_mc_b: { hgrme04.ttc } + \cs_set:Nx \__ltjpreset_font_gt_b: { hgrge04.ttc } \cs_set:Nx \__ltjpreset_font_gt_eb: { hgrsgu04.ttc } \cs_set:Nx \__ltjpreset_font_mg_m: { hgrsmp04.ttf } \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_u: @@ -411,8 +415,8 @@ } \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 } \tl_if_eq:NNT \l__ltjpreset_kanji_shape_tl \l_tmpa_tl { - \cs_set:Nx \__ltjpreset_font_mc_bx: { hgrme.ttc } - \cs_set:Nx \__ltjpreset_font_gt_bx: { hgrge.ttc } + \cs_set:Nx \__ltjpreset_font_mc_b: { hgrme.ttc } + \cs_set:Nx \__ltjpreset_font_gt_b: { hgrge.ttc } \cs_set:Nx \__ltjpreset_font_gt_eb: { hgrsgu.ttc } \cs_set:Nx \__ltjpreset_font_mg_m: { hgrsmp.ttf } } @@ -426,14 +430,14 @@ %% bold オプションの処理 \bool_if:NTF \g__ltjpreset_deluxe_bool { \bool_if:NT \g__ltjpreset_bold_bool { - \cs_set_eq:NN \__ltjpreset_font_mc_bx: \__ltjpreset_font_gt_bx: + \cs_set_eq:NN \__ltjpreset_font_mc_b: \__ltjpreset_font_gt_b: } }{ \bool_if:NTF \g__ltjpreset_bold_bool - { \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_bx: } + { \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_b: } { \cs_set_eq:NN \__ltjpreset_font_gt_m: \__ltjpreset_font_gt_u: } - \cs_set_eq:NN \__ltjpreset_font_gt_bx: \__ltjpreset_font_gt_m: - \cs_set_eq:NN \__ltjpreset_font_mc_bx: \__ltjpreset_font_gt_m: + \cs_set_eq:NN \__ltjpreset_font_gt_b: \__ltjpreset_font_gt_m: + \cs_set_eq:NN \__ltjpreset_font_mc_b: \__ltjpreset_font_gt_m: } } @@ -475,9 +479,9 @@ %%%%%%%% deluxe (\mgfamily はあとで定義) \bool_if:NTF \g__ltjpreset_deluxe_bool { \cs_new:Nn \__ltjpreset_check_deluxe_existence: { - \__ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx } - \__ltjpreset_substitute:nnnn { mg } { m } { gt } { bx } - \__ltjpreset_substitute:nnnn { mc } { l } { mc } { m } + \__ltjpreset_substitute:nnnn { gt } { eb } { gt } { b } + \__ltjpreset_substitute:nnnn { mg } { m } { gt } { b } + \__ltjpreset_substitute:nnnn { mc } { l } { mc } { m } } \def\ltdefault{l} \DeclareRobustCommand\ltseries { \not@math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont } @@ -555,7 +559,7 @@ \DeclareKanjiFamily{JT3}{\gtdefault}{} \unless\ifltj@disablejfam \SetSymbolFont{mincho}{normal}{JY3}{\mcdefault}{m}{n} - \SetSymbolFont{mincho}{bold}{JY3}{\mcdefault}{bx}{n} + \SetSymbolFont{mincho}{bold}{JY3}{\mcdefault}{b}{n} \DeclareMathAlphabet{\mathgt}{JY3}{\gtdefault}{m}{n} \fi \bool_if:NT \g__ltjpreset_deluxe_bool { @@ -572,11 +576,11 @@ \tl_set:Nx \l__ltjpreset_kanji_shape_tl { ;+jp04 } } \__ltjpreset_define_family:nnn {mc} {m} {\__ltjpreset_font_mc_m:} - \__ltjpreset_define_family:nnn {mc} {bx} {\__ltjpreset_font_mc_bx:} - \__ltjpreset_define_family:nnn {mc} {b} {\__ltjpreset_font_mc_bx:} + \__ltjpreset_define_family:nnn {mc} {bx} {\__ltjpreset_font_mc_b:} + \__ltjpreset_define_family:nnn {mc} {b} {\__ltjpreset_font_mc_b:} \__ltjpreset_define_family:nnn {gt} {m} {\__ltjpreset_font_gt_m:} - \__ltjpreset_define_family:nnn {gt} {bx} {\__ltjpreset_font_gt_bx:} - \__ltjpreset_define_family:nnn {gt} {b} {\__ltjpreset_font_gt_bx:} + \__ltjpreset_define_family:nnn {gt} {bx} {\__ltjpreset_font_gt_b:} + \__ltjpreset_define_family:nnn {gt} {b} {\__ltjpreset_font_gt_b:} \normalfont \bool_if:NT \g__ltjpreset_deluxe_bool { \__ltjpreset_define_family:nnn {mc} {l} {\__ltjpreset_font_mc_l:} @@ -622,12 +626,12 @@ } }, } - BoldFont = \__ltjpreset_font_mc_bx: \tl_use:N \l__ltjpreset_add_features_tl, + BoldFont = \__ltjpreset_font_mc_b: \tl_use:N \l__ltjpreset_add_features_tl, \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn { UprightFeatures = { \ltjpreset_define_family_hook_fontspec:nnn { mc } { m } { \__ltjpreset_font_mc_m: } }, BoldFeatures = { \ltjpreset_define_family_hook_fontspec:nnn - { mc } { bx } { \__ltjpreset_font_mc_bx: } }, + { mc } { b } { \__ltjpreset_font_mc_b: } }, } ] { \__ltjpreset_font_mc_m: } \setsansjfont [ @@ -639,12 +643,12 @@ } }, } - BoldFont = \__ltjpreset_font_gt_bx: \tl_use:N \l__ltjpreset_add_features_tl, + BoldFont = \__ltjpreset_font_gt_b: \tl_use:N \l__ltjpreset_add_features_tl, \cs_if_exist:NT \ltjpreset_define_family_hook_fontspec:nnn { UprightFeatures = { \ltjpreset_define_family_hook_fontspec:nnn { gt } { m } { \__ltjpreset_font_gt_m: } }, BoldFeatures = { \ltjpreset_define_family_hook_fontspec:nnn - { gt } { bx } { \__ltjpreset_font_gt_bx: } }, + { gt } { b } { \__ltjpreset_font_gt_b: } }, } ] { \__ltjpreset_font_gt_m: } \bool_if:NT \g__ltjpreset_deluxe_bool { diff --git a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua index 685cea7191..d3f9d99aa2 100644 --- a/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua +++ b/macros/luatex/generic/luatexja/src/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2019/09/26', + date = '2020/01/23', description = 'Insertion process of JFM glues, [x]kanjiskip and others', }) luatexja.jfmglue = luatexja.jfmglue or {} @@ -557,6 +557,8 @@ function calc_np(last, lp) Np.post, Np.pre, Np.xspc = 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, + -- 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 @@ -782,56 +784,50 @@ do local function blend_diffmet(b, a, rb, ra) return round(luatexja.jfmglue.diffmet_rule((1-rb)*b+rb*a, (1-ra)*b+ra*a)) end + local blend_diffmet_inf + do + local abs, log, log264, floor = math.abs, math.log, math.log(2)*64, math.floor + blend_diffmet_inf = function (b, a, bo, ao, rb, ra) + local nb, na = (bo and b*2.0^(64*bo) or 0), (ao and a*2.0^(64*ao) or 0) + local r = luatexja.jfmglue.diffmet_rule((1-rb)*nb+rb*na, (1-ra)*nb+ra*na) + local ro = (r~=0) and floor(log(abs(r))/log264+0.0625) or 0 + 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); setfield(gb, 'kern', 0) else return nil end elseif not ga then ga = node_new(id_kern, 1); setfield(ga, 'kern', 0) end - - local k = 2*getid(gb) - getid(ga) - if k == bg_ag then - -- 両方とも glue. - setglue(gb, blend_diffmet( - getfield(gb, 'width'), getfield(ga, 'width'), db, da), - blend_diffmet( - getfield(gb, 'stretch'), getfield(ga, 'stretch'), db, da), - -blend_diffmet( - -getfield(gb, 'shrink'), -getfield(ga, 'shrink'), db, da)) - node_free(ga) - return gb - elseif k == bk_ak then - -- 両方とも kern. - setfield(gb, 'kern', blend_diffmet( - getfield(gb, 'kern'), getfield(ga, 'kern'), db, da)) - node_free(ga) - return gb - elseif k == bk_ag then - -- gb: kern, ga: glue - setglue(ga, blend_diffmet( - getfield(gb, 'kern'), getfield(ga, 'width'), db, da), - blend_diffmet( - 0, getfield(ga, 'stretch'), db, da), - -blend_diffmet( - 0, -getfield(ga, 'shrink'), db, da)) - node_free(gb) - return ga, 0, 0, 0 + 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') + end + if getid(ga)==id_glue then + gaw, gast, gash, gasto, gasho = getglue(ga) + else + gaw = getfield(ga, 'kern') + end + if not (gbst or gast) then -- 両方とも kern + setfield(gb, 'kern', blend_diffmet(gbw, gaw, db, da)) + node_free(ga); return gb else - -- gb: glue, ga: kern - setglue(gb, blend_diffmet( - getfield(gb, 'width'), getfield(ga, 'kern'), db, da), - blend_diffmet( - getfield(gb, 'stretch'), 0, db, da), - -blend_diffmet( - -getfield(gb, 'shrink'), 0, db, da)) - node_free(ga) - return gb + local gr = gb + if not gbst then gr = ga; node_free(gb) else node_free(ga) end + gbw = blend_diffmet(gbw or 0, gaw or 0, db, da) -- 結果の自然長 + gbst, gbsto = blend_diffmet_inf(gbst, gast, gbsto, gasto, db, da) -- 伸び + gbsh, gbsho = blend_diffmet_inf(-(gbsh or 0), -(gash or 0), gbsho, gasho, db, da) -- -(縮み) + setglue(gr, gbw, gbst, -gbsh, gbsto, gbsho) + return gr end end end @@ -846,7 +842,10 @@ do local KANJI_SKIP_JFM = luatexja.icflag_table.KANJI_SKIP_JFM get_kanjiskip_low = function(flag, qm, bn, bp, bh) - if flag or (qm.with_kanjiskip and (bn or bp or bh)) then + -- flag = false: kanjiskip そのもの(パラメータ or JFM) + -- ノード kanji_skip のコピーで良い場合は nil が帰る + -- flag = true: JFM グルーに付随する kanjiskip 自然長/伸び/縮み分 + if qm.with_kanjiskip and (bn or bp or bh) then if kanjiskip_jfm_flag then local g = node_new(id_glue); local bk = qm.kanjiskip or null_skip_table @@ -856,14 +855,14 @@ do set_attr(g, attr_icflag, KANJI_SKIP_JFM) return g elseif flag then - return node_copy(kanji_skip) - else - local g = node_new(id_glue); + local g = node_new(id_glue) + 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, - bp and (bp*getfield(kanji_skip, 'stretch')) or 0, - bh and (bh*getfield(kanji_skip, 'shrink')) or 0, - 0, 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) return g end @@ -876,11 +875,17 @@ do 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 - return get_kanjiskip_low(true, qm, 1, 1, 1) + return get_kanjiskip_low(false, qm, 1, 1, 1) or node_copy(kanji_skip) else - local gb = get_kanjiskip_low(true, qm, 1, 1, 1) - local ga = get_kanjiskip_low(true, pm, 1, 1, 1) - return calc_ja_ja_aux(gb, ga, 0, 1) + 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) + 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 local g = node_new(id_glue) @@ -894,7 +899,7 @@ do local qmc, pmc = qm.char_type, pm.char_type if (qmc==pmc) and (qm.var==pm.var) then local g, _, kn, kp, kh = new_jfm_glue(qmc, Nq.class, Np.class) - return g, (Np.auto_kspc or Nq.auto_kspc) and get_kanjiskip_low(false, qm, kn, kp, kh) + 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 @@ -908,11 +913,11 @@ do Np.class) local g = calc_ja_ja_aux(gb, ga, db, da) local k - if (pmc==qmc) and (qm.var==pm.var) then - gb = get_kanjiskip_low(false, qm, bn, bp, bh) - ga = get_kanjiskip_low(false, pm, an, ap, ah) - k = calc_ja_ja_aux(gb, ga, db, da) - end + --if (pmc==qmc) and (qm.var==pm.var) then + gb = get_kanjiskip_low(true, qm, bn, bp, bh) + ga = get_kanjiskip_low(true, pm, an, ap, ah) + k = calc_ja_ja_aux(gb, ga, db, da) + --end return g, k end end @@ -946,7 +951,8 @@ do 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, - 0, 0) + bp and getfield(xkanji_skip, 'stretch_order') or 0, + bh and getfield(xkanji_skip, 'shrink_order') or 0) set_attr(g, attr_icflag, XKANJI_SKIP_JFM) return g end @@ -1005,7 +1011,7 @@ local function get_OA_skip(is_kanji) Np.class) local k if is_kanji==0 then - k = combine_spc('auto_kspc') and get_kanjiskip_low(false, pm, kn, kp, kh) + k = combine_spc('auto_kspc') and get_kanjiskip_low(true, pm, kn, kp, kh) end return g, k end @@ -1017,7 +1023,7 @@ local function get_OB_skip(is_kanji) (((Np.id==id_glue)or(Np.id==id_kern)) and 'glue' or 'jcharbdd'), qm)) local k if is_kanji==0 then - k = combine_spc('auto_kspc') and get_kanjiskip_low(false, qm, kn, kp, kh) + k = combine_spc('auto_kspc') and get_kanjiskip_low(true, qm, kn, kp, kh) end return g, k end diff --git a/macros/luatex/generic/luatexja/src/ltj-math.lua b/macros/luatex/generic/luatexja/src/ltj-math.lua index cd24e2294a..b6ef1a9dd3 100644 --- a/macros/luatex/generic/luatexja/src/ltj-math.lua +++ b/macros/luatex/generic/luatexja/src/ltj-math.lua @@ -165,17 +165,27 @@ function (p, sty) return p end -luatexbase.add_to_callback('mlist_to_hlist', - function (n, display_type, penalties) - n = to_direct(n); list_dir = ltjd_get_dir_count() - if getid(n)==id_whatsit and getsubtype(n)==sid_user and +do + local function mlist_callback_ltja(n) + 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 node.mlist_to_hlist( - to_node(conv_jchar_to_hbox(n, 0)), - display_type, penalties) - end,'ltj.mlist_to_hlist', 1) + 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)) + end + -- LaTeX 2020-02-02 seems to have pre_mlist_to_hlist_filter callback + if luatexbase.callbacktypes['pre_mlist_to_hlist_filter'] then + luatexbase.add_to_callback('pre_mlist_to_hlist_filter', + mlist_callback_ltja, 'ltj.mlist_to_hlist_pre', 1) + else + local mlist_to_hlist = node.mlist_to_hlist + luatexbase.add_to_callback('mlist_to_hlist', + function (n, display_type, penalties) + return mlist_to_hlist(mlist_callback_ltja(n),display_type, penalties) + end,'ltj.mlist_to_hlist', 1) + end +end luatexja.math = { is_math_letters = is_math_letters } diff --git a/macros/luatex/generic/luatexja/src/ltjclasses.dtx b/macros/luatex/generic/luatexja/src/ltjclasses.dtx index 590ff597a2..9da4e2b748 100644 --- a/macros/luatex/generic/luatexja/src/ltjclasses.dtx +++ b/macros/luatex/generic/luatexja/src/ltjclasses.dtx @@ -5,7 +5,7 @@ % % Copyright 1995-2001 ASCII Corporation. % Copyright (c) 2010 ASCII MEDIA WORKS -% Copyright (c) 2016-2018 Japanese TeX Development Community +% Copyright (c) 2016-2020 Japanese TeX Development Community % % This file is part of the pLaTeX2e system (community edition). % ------------------------------------------------------------- @@ -123,6 +123,11 @@ % \changes{v1.8b-ltj-17}{2019/08/12}{disablejfamの``Unused global option(s)''警告を出さないようにした} % \changes{v1.8c}{2019/10/17}{フォントサイズ変更命令をrobustに % (sync with classes.dtx 2019/08/27 v1.4j)} +% \changes{v1.8d}{2019/10/25}{Don't use \cs{MakeRobust} if +% in rollback prior to 2015 +% (sync with classes.dtx 2019/10/25 v1.4k)} +% \changes{v1.8e}{2020/01/03}{Normalize label fonts +% (sync with classes.dtx 2019/12/20 v1.4l)} % \fi % % \iffalse @@ -152,7 +157,7 @@ %<11pt&bk>\ProvidesFile{ltjtbk11.clo} %<12pt&bk>\ProvidesFile{ltjtbk12.clo} %</tate> - [2019/10/17 v1.8c-ltj-17 + [2020/01/13 v1.8e-ltj-17 %<article|report|book> Standard LuaLaTeX-ja class] %<10pt|11pt|12pt> Standard LuaLaTeX-ja file (size option)] %<*driver> @@ -162,12 +167,18 @@ \begingroup \suppressfontnotfounderror=1 \global\font\testfont=file:KozMinPr6N-Regular.otf + \global\font\testfonta=file:HaranoAjiMincho-Regular.otf \endgroup -\ifx\testfont\nullfont +\ifx\testfonta\nullfont\ifx\testfont\nullfont \usepackage[ipaex,nfssonly]{luatexja-preset} \else \usepackage[kozuka-pr6n,nfssonly]{luatexja-preset} +\fi\else + \usepackage[haranoaji,nfssonly]{luatexja-preset} \fi +\let\testfont\undefined\let\testfonta\undefined +\usepackage{unicode-math} +\setmathfont{Latin Modern Math} \def\pLaTeX{p\kern-.05em\LaTeX} \usepackage[unicode]{hyperref} \title{Lua\LaTeX-ja用\texttt{jclasses}互換クラス} @@ -725,10 +736,17 @@ % カーネルの定義を|\renewcommand|した後に|\MakeRobust|を使っている理由は、 % ログに |LaTeX Info: Redefining \normalsize on input line ...| という % メッセージを出したくないからです。 +% ただし、\textsf{latexrelease}パッケージで2015/01/01より +% 昔の日付に巻き戻っている場合は|\MakeRobust|が定義されていません。 % \changes{v1.8c}{2019/10/17}{フォントサイズ変更命令をrobustに % (sync with classes.dtx 2019/08/27 v1.4j)} +% \changes{v1.8d}{2019/10/25}{Don't use \cs{MakeRobust} if +% in rollback prior to 2015 +% (sync with classes.dtx 2019/10/25 v1.4k)} % \begin{macrocode} -\MakeRobust\normalsize +\ifx\MakeRobust\@undefined \else + \MakeRobust\normalsize +\fi % \end{macrocode} % \end{macro} % \end{macro} @@ -3485,17 +3503,20 @@ % itemize環境のそれぞれの項目のラベルは、 % |\labelenumi| \ldots\ |\labelenumiv|で生成されます。 % \changes{v1.1a}{1997/01/28}{Bug fix: \cs{labelitemii}.} +% \changes{v1.8e}{2020/01/03}{Normalize label fonts +% (sync with classes.dtx 2019/12/20 v1.4l)} % \begin{macrocode} -\newcommand{\labelitemi}{\textbullet} +\newcommand{\labelitemi}{\labelitemfont \textbullet} \newcommand{\labelitemii}{% \ifnum\ltjgetparameter{direction}=3 - {\textcircled{~}} + {\labelitemfont \textcircled{~}} \else - {\normalfont\bfseries\textendash} + {\labelitemfont \bfseries\textendash} \fi } -\newcommand{\labelitemiii}{\textasteriskcentered} -\newcommand{\labelitemiv}{\textperiodcentered} +\newcommand{\labelitemiii}{\labelitemfont \textasteriskcentered} +\newcommand{\labelitemiv}{\labelitemfont \textperiodcentered} +\newcommand\labelitemfont{\normalfont} % \end{macrocode} % \end{macro} % \end{macro} diff --git a/macros/luatex/generic/luatexja/src/ltjltxdoc.dtx b/macros/luatex/generic/luatexja/src/ltjltxdoc.dtx index 0a5c2b370f..9d4bf2114a 100644 --- a/macros/luatex/generic/luatexja/src/ltjltxdoc.dtx +++ b/macros/luatex/generic/luatexja/src/ltjltxdoc.dtx @@ -4,8 +4,11 @@ % Original: jltxdoc.dtx % % Copyright 1995,1996,1997 ASCII Corporation. +% Copyright (c) 2010 ASCII MEDIA WORKS +% Copyright (c) 2016 Japanese TeX Development Community +% Copyright (c) 2016-2017 Japanese TeX Development Community % -% This file is part of pLaTeX2e system. +% This file is part of the pLaTeX2e system (community edition). % ------------------------------------- % % \fi @@ -31,7 +34,19 @@ %<*driver> \documentclass{ltjltxdoc} \GetFileInfo{ltjltxdoc.cls} -\usepackage[kozuka-pr6n]{luatexja-preset} +\begingroup + \suppressfontnotfounderror=1 + \global\font\testfont=file:KozMinPr6N-Regular.otf + \global\font\testfonta=file:HaranoAjiMincho-Regular.otf +\endgroup +\ifx\testfonta\nullfont\ifx\testfont\nullfont + \usepackage[ipaex,nfssonly]{luatexja-preset} +\else + \usepackage[kozuka-pr6n,nfssonly]{luatexja-preset} +\fi\else + \usepackage[haranoaji,nfssonly]{luatexja-preset} +\fi +\let\testfont\undefined\let\testfonta\undefined \usepackage{unicode-math} \setmathfont{Latin Modern Math} \title{Lua\LaTeX-jaドキュメント記述用クラス} diff --git a/macros/luatex/generic/luatexja/src/ltjsclasses.dtx b/macros/luatex/generic/luatexja/src/ltjsclasses.dtx index be67a2f68e..f00552dfd8 100644 --- a/macros/luatex/generic/luatexja/src/ltjsclasses.dtx +++ b/macros/luatex/generic/luatexja/src/ltjsclasses.dtx @@ -44,7 +44,7 @@ %<*driver> \ProvidesFile{ltjsclasses.dtx} %</driver> - [2019/08/12 ltjsclasses ] + [2019/11/23 ltjsclasses ] %<*driver> \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{} \documentclass[disablejfam]{ltjsarticle} @@ -53,12 +53,18 @@ \begingroup \suppressfontnotfounderror=1 \global\font\testfont=file:KozMinPr6N-Regular.otf + \global\font\testfonta=file:HaranoAjiMincho-Regular.otf \endgroup -\ifx\testfont\nullfont +\ifx\testfonta\nullfont\ifx\testfont\nullfont \usepackage[ipaex,nfssonly]{luatexja-preset} \else \usepackage[kozuka-pr6n,nfssonly]{luatexja-preset} -\fi +\fi\else + \usepackage[haranoaji,nfssonly]{luatexja-preset} +\fi +\let\testfont\undefined\let\testfonta\undefined +\usepackage{unicode-math} +\setmathfont{Latin Modern Math} \ltjsetparameter{alxspmode={`\*,allow}} \ltjsetparameter{alxspmode={`\\,allow}} %%%%\usepackage{unicode-math} diff --git a/macros/luatex/generic/luatexja/src/luatexja-core.sty b/macros/luatex/generic/luatexja/src/luatexja-core.sty index ba13695352..d870df0e28 100644 --- a/macros/luatex/generic/luatexja/src/luatexja-core.sty +++ b/macros/luatex/generic/luatexja/src/luatexja-core.sty @@ -124,10 +124,10 @@ \def\ltj@loaded{hoge} -\newdimen\ltj@zw -\newdimen\ltj@zh -\newdimen\jQ \jQ=0.25mm -\let\jH=\jQ +\newdimen\ltj@dimen@zw +\newdimen\ltj@dimen@zh +\newdimen\ltj@dimen@jQ \ltj@dimen@jQ=0.25mm +\let\jQ=\ltj@dimen@jQ \let\jH=\jQ %%%%%%%% error message \def\ltj@defnum{0} @@ -229,11 +229,13 @@ \newluafunction\ltj@zh@inner \directlua{ local t, setdimen, ltjf = lua.get_functions_table(), tex.setdimen, luatexja.jfont - t[\the\ltj@zw@inner] = function() setdimen('ltj@zw', ltjf.get_zw()) end - t[\the\ltj@zh@inner] = function() setdimen('ltj@zh', ltjf.get_zh()) end + t[\the\ltj@zw@inner] = function() setdimen('ltj@dimen@zw', ltjf.get_zw()) end + t[\the\ltj@zh@inner] = function() setdimen('ltj@dimen@zh', ltjf.get_zh()) end } -\protected\def\zw{\luafunction\ltj@zw@inner\ltj@zw} -\protected\def\zh{\luafunction\ltj@zh@inner\ltj@zh} +\protected\def\ltj@zw{\luafunction\ltj@zw@inner\ltj@dimen@zw} +\protected\def\ltj@zh{\luafunction\ltj@zh@inner\ltj@dimen@zh} +\let\zw=\ltj@zw +\let\zh=\ltj@zh %%%%%%%% \inhibitglue \newluafunction\ltj@reset@globaldefs@inner diff --git a/macros/luatex/generic/luatexja/src/luatexja.lua b/macros/luatex/generic/luatexja/src/luatexja.lua index 5ad31b3a6f..767659a1c3 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.lua +++ b/macros/luatex/generic/luatexja/src/luatexja.lua @@ -402,7 +402,7 @@ end local prefix, inner_depth local utfchar = utf.char -local function debug_show_node_X(p,print_fn, limit) +local function debug_show_node_X(p,print_fn, limit, inner_depth) local k = prefix local s local pt=node_type(p.id) @@ -451,7 +451,7 @@ local function debug_show_node_X(p,print_fn, limit) prefix, inner_depth = prefix.. '.', inner_depth + 1 if inner_depth < limit then for q in node.traverse(p.head) do - debug_show_node_X(q, print_fn, limit) + debug_show_node_X(q, print_fn, limit, inner_depth) end end prefix=k @@ -466,15 +466,15 @@ local function debug_show_node_X(p,print_fn, limit) if inner_depth < limit then prefix, inner_depth = k.. 'p.', inner_depth + 1 for q in node.traverse(p.pre) do - debug_show_node_X(q, print_fn, limit) + debug_show_node_X(q, print_fn, limit, inner_depth) end prefix = k.. 'P.' for q in node.traverse(p.post) do - debug_show_node_X(q, print_fn, limit) + debug_show_node_X(q, print_fn, limit, inner_depth) end prefix = k.. 'R.' for q in node.traverse(p.replace) do - debug_show_node_X(q, print_fn, limit) + debug_show_node_X(q, print_fn, limit, inner_depth) end end prefix=k @@ -532,7 +532,7 @@ local function debug_show_node_X(p,print_fn, limit) prefix, inner_depth =prefix.. '.', inner_depth + 1 if inner_depth < limit then for q in node.traverse(p.value) do - debug_show_node_X(q, print_fn, limit) + debug_show_node_X(q, print_fn, limit, inner_depth) end end prefix, inner_depth = k, bid @@ -553,13 +553,13 @@ local function debug_show_node_X(p,print_fn, limit) elseif pt=='noad' then s = base ; print_fn(s) if p.nucleus then - prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn, limit); + prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn, limit, inner_depth); end if p.sup then - prefix = k .. '^'; debug_show_node_X(p.sup, print_fn, limit); + prefix = k .. '^'; debug_show_node_X(p.sup, print_fn, limit, inner_depth); end if p.sub then - prefix = k .. '_'; debug_show_node_X(p.sub, print_fn, limit); + prefix = k .. '_'; debug_show_node_X(p.sub, print_fn, limit, inner_depth); end prefix = k; elseif pt=='math_char' then @@ -570,7 +570,7 @@ local function debug_show_node_X(p,print_fn, limit) if p.head then prefix = k .. '.'; for q in node.traverse(p.head) do - debug_show_node_X(q, print_fn) + debug_show_node_X(q, print_fn, limit, inner_depth) end end else @@ -583,7 +583,7 @@ function luatexja.ext_show_node_list(head,depth,print_fn, lim) inner_depth = 0 if head then while head do - debug_show_node_X(head, print_fn, lim or 1/0); head = node_next(head) + debug_show_node_X(head, print_fn, lim or 1/0, inner_depth); head = node_next(head) end else print_fn(prefix .. ' (null list)') @@ -593,7 +593,7 @@ function luatexja.ext_show_node(head,depth,print_fn, lim) prefix = depth inner_depth = 0 if head then - debug_show_node_X(head, print_fn, lim or 1/0) + debug_show_node_X(head, print_fn, lim or 1/0, inner_depth) else print_fn(prefix .. ' (null list)') end diff --git a/macros/luatex/generic/luatexja/src/luatexja.sty b/macros/luatex/generic/luatexja/src/luatexja.sty index 82a5615306..5b53dcabae 100644 --- a/macros/luatex/generic/luatexja/src/luatexja.sty +++ b/macros/luatex/generic/luatexja/src/luatexja.sty @@ -35,13 +35,13 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja}[2019/09/26 Japanese Typesetting with Lua(La)TeX] + \ProvidesPackage{luatexja}[2020/01/27 Japanese Typesetting with Lua(La)TeX] \DeclareOption{disablejfam}{\ltj@disablejfamtrue} \DeclareOption*{} \ProcessOptions\relax \fi %</LaTeX> %%%% VERSION -\def\LuaTeXjaversion{20191118.0} +\def\LuaTeXjaversion{20200127.0} \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty index 13bbc63ce1..a6b71f3b6a 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjcore.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjcore.sty @@ -205,6 +205,7 @@ \language\l@nohyphenation \@ifstar\@sverb\@verb} \fi +\patchcmd{\do@noligs}{\kern\z@}{\vadjust{}}{}{} % reported by p_typo \gdef\@stopfield{% \inhibitglue\@tempskipa\lastskip\unskip \hskip\@tempskipa\color@endgroup\egroup} diff --git a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty index 204adbc62e..347f66b468 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjdefs.sty @@ -32,7 +32,13 @@ \newcommand\kanjiencodingdefault{JY3} \newcommand\kanjifamilydefault{\mcdefault} \newcommand\kanjiseriesdefault{\mddefault} -\newcommand\kanjishapedefault{\updefault} +\ifdefined\shapedefault + %% LaTeX 2020-02-02 + \newcommand\kanjishapedefault{\shapedefault} +\else + %% LaTeX 2019-10-01 + \newcommand\kanjishapedefault{\updefault} +\fi \DeclareKanjiFamily{JY3}{mc}{} \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdmcfont:jfm=\ltj@stdyokojfm}{} @@ -40,8 +46,8 @@ \DeclareFontShape{JY3}{gt}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdgtfont:jfm=\ltj@stdyokojfm}{} \DeclareFontShape{JY3}{mc}{bx}{n}{<-> ssub*gt/m/n}{} \DeclareFontShape{JY3}{gt}{bx}{n}{<-> ssub*gt/m/n}{} -\DeclareFontShape{JY3}{mc}{b}{n}{<-> ssub*mc/bx/n}{} -\DeclareFontShape{JY3}{gt}{b}{n}{<-> ssub*gt/bx/n}{} +\DeclareFontShape{JY3}{mc}{b}{n}{<-> ssub*gt/m/n}{} +\DeclareFontShape{JY3}{gt}{b}{n}{<-> ssub*gt/m/n}{} \DeclareKanjiFamily{JT3}{mc}{} \DeclareFontShape{JT3}{mc}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdmcfont:jfm=\ltj@stdtatejfm}{} @@ -49,8 +55,8 @@ \DeclareFontShape{JT3}{gt}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdgtfont:jfm=\ltj@stdtatejfm}{} \DeclareFontShape{JT3}{mc}{bx}{n}{<-> ssub*gt/m/n}{} \DeclareFontShape{JT3}{gt}{bx}{n}{<-> ssub*gt/m/n}{} -\DeclareFontShape{JT3}{mc}{b}{n}{<-> ssub*mc/bx/n}{} -\DeclareFontShape{JT3}{gt}{b}{n}{<-> ssub*gt/bx/n}{} +\DeclareFontShape{JT3}{mc}{b}{n}{<-> ssub*gt/m/n}{} +\DeclareFontShape{JT3}{gt}{b}{n}{<-> ssub*gt/m/n}{} \KanjiEncodingPair{JY3}{JT3} \DeclareRelationFont{JY3}{gt}{m}{}{TU}{lmr}{bx}{} @@ -77,25 +83,51 @@ \DeclareMathAlphabet{\mathgt}{JY3}{gt}{m}{n} \fi +\ifdefined\@rmfamilyhook +%%%% LaTeX 2020-02-02 +\edef\bfseries@mc{\bfdefault} +\edef\bfseries@gt{\bfdefault} +\def\bfseries@jtt{\bfseries@mc} +\edef\mdseries@mc{\mddefault} +\edef\mdseries@gt{\mddefault} +\def\mdseries@jtt{\mdseries@mc} +\fi + \newif\if@ltj@match@family \@ltj@match@familyfalse \def\verbatim@font{\normalfont\ttfamily\kanjifamily\jttdefault\selectfont} -\DeclareRobustCommand\rmfamily - {\not@math@alphabet\rmfamily\mathrm - \romanfamily\rmdefault - \if@ltj@match@family\kanjifamily\mcdefault\fi\selectfont} -\DeclareRobustCommand\sffamily - {\not@math@alphabet\sffamily\mathsf - \romanfamily\sfdefault - \if@ltj@match@family\kanjifamily\gtdefault\fi\selectfont} -\DeclareRobustCommand\ttfamily - {\not@math@alphabet\ttfamily\mathtt - \romanfamily\ttdefault - \if@ltj@match@family\kanjifamily\jttdefault\fi\selectfont} + +\def\@ltj@hook@family#1#2{ % #1: csname #2: contents + \ifcsname @#1hook\endcsname % LaTeX 2020-02-02 + \csappto{@#1hook}{#2}% + \else % LaTeX 2019-10-01 + \ifcsname #1 \endcsname + \expandafter\patchcmd\csname #1 \endcsname{\selectfont}{#2\selectfont}{}{}% + \else + \PackageWarningNoLine{luatexja}{% + Patching to \expandafter\string\csname #1\endcsname\space failed + }% + \fi + \fi +} +\@ltj@hook@family{rmfamily}{% + \if@ltj@match@family + \prepare@family@series@update@kanji{mc}\mcdefault + \fi +} +\@ltj@hook@family{sffamily}{% + \if@ltj@match@family + \prepare@family@series@update@kanji{gt}\gtdefault + \fi +} +\@ltj@hook@family{ttfamily}{% + \if@ltj@match@family + \prepare@family@series@update@kanji{jtt}\jttdefault + \fi +} + %%% \eminnershape -\DeclareRobustCommand\em - {\@nomath\em \ifdim \fontdimen\@ne\font >\z@ - \eminnershape \else \gtfamily \itshape \fi} +\expandafter\patchcmd\csname em \endcsname{\itshape}{\gtfamily\itshape}{}{} \def\eminnershape{\mcfamily \upshape} \ltjdefcharrange{1}{"80-"36F, "1E00-"1EFF} diff --git a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty index 0f572b52fc..f2d78fb653 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjfont.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjfont.sty @@ -3,8 +3,9 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjfont}[2019/09/25 Patch to NFSS2 for LuaTeX-ja] +\ProvidesPackage{lltjfont}[2020/01/26 Patch to NFSS2 for LuaTeX-ja] +%% patching \DeclareTextComposite \def\ltj@chardef@text@cmd#1{% \let\@ifdefinable\@@ifdefinable% \edef\ltj@chardef@text@cmd@name{\expandafter\@gobble\string#1}% @@ -23,13 +24,11 @@ \@dec@text@cmd\ltj@chardef@text@cmd#1{#2}#3\relax } -\ifdefined\UnicodeEncodingName - \let\ltj@temp@DeclareTextComposite=\DeclareTextComposite - \def\DeclareTextComposite#1#2#3#4{}% - \input{tuenc.def} - \let\DeclareTextComposite=\ltj@temp@DeclareTextComposite - \expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} -\fi +\let\ltj@temp@DeclareTextComposite=\DeclareTextComposite +\def\DeclareTextComposite#1#2#3#4{}% +\input{tuenc.def} +\let\DeclareTextComposite=\ltj@temp@DeclareTextComposite +\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{} \let\k@encoding\@empty @@ -568,12 +567,93 @@ \edef\k@family{#1}\edef\f@family{#1}% \fi\fi } + +\ifdefined\@rmfamilyhook +%%%% LaTeX 2020-02-02 +\DeclareRobustCommand\romanseriesforce[1]{\edef\f@series{#1}} +\DeclareRobustCommand\kanjiseriesforce[1]{\edef\k@series{#1}} +\DeclareRobustCommand\fontseriesforce[1]{\kanjiseries{#1}\romanseries{#1}} +\DeclareRobustCommand\romanshapeforce[1]{\edef\f@shape{#1}} +\DeclareRobustCommand\kanjishapeforce[1]{\edef\k@shape{#1}} +\DeclareRobustCommand\fontshapeforce[1]{\kanjishape{#1}\romanshape{#1}} + +\def\merge@font@kanji@series#1{% + \expandafter\expandafter\expandafter + \merge@font@kanji@series@ + \csname series@\k@series @#1\endcsname + {#1}% + \@nil +} +\def\set@target@kanji@series#1{% + \edef\k@series{#1}% + \edef\k@series{\expandafter\series@drop@one@m\k@series mm\series@drop@one@m}% +} +\def\merge@font@kanji@series@#1#2#3\@nil{% + \def\@reserveda{#3}% + \ifx\@reserveda\@empty + \set@target@kanji@series{#2}% + \else + \begingroup\let\f@encoding\k@encoding\let\f@family\k@family + \maybe@load@fontshape\endgroup + \edef\@reserveda{\k@encoding /\k@family /#1/\k@shape}% + \ifcsname \@reserveda \endcsname + \set@target@kanji@series{#1}% + \else + \ifcsname \k@encoding /\k@family /#2/\k@shape \endcsname + \set@target@kanji@series{#2}% + {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% + \else + \set@target@kanji@series{#3}% + {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% + \fi + \fi + \fi +} +\def\merge@font@kanji@shape#1{% + \expandafter\expandafter\expandafter + \merge@font@kanji@shape@ + \csname shape@\k@shape @#1\endcsname + {#1}% + \@nil +} +\def\merge@font@kanji@shape@#1#2#3\@nil{% + \def\@reserveda{#3}% + \ifx\@reserveda\@empty + \edef\k@shape{#2}% + \else + \maybe@load@fontshape + \edef\@reserveda{\k@encoding /\k@family /\k@series/#1}% + \ifcsname \@reserveda\endcsname + \edef\k@shape{#1}% + \else + \ifcsname \k@encoding /\k@family /\k@series/#2\endcsname + \edef\k@shape{#2}% + {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% + \else + \edef\k@shape{#3}% + {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}% + \fi + \fi + \fi +} +\DeclareRobustCommand\romanseries[1]{\merge@font@series{#1}} +\DeclareRobustCommand\kanjiseries[1]{\merge@font@kanji@series{#1}} +\DeclareRobustCommand\fontseries[1]{% + \merge@font@series{#1}\merge@font@kanji@series{#1}} +\DeclareRobustCommand\romanshape[1]{\merge@font@shape{#1}} +\DeclareRobustCommand\kanjishape[1]{\merge@font@kanji@shape{#1}} +\DeclareRobustCommand\fontshape[1]{% + \merge@font@shape{#1}\merge@font@kanji@shape{#1}} +\else +%%%% LaTeX 2019-10-01 \DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}} \DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}} \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}} \DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}} \DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}} \DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}} +\fi +%%%% \DeclareRobustCommand\usekanji[4]{% \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}% \selectfont\ignorespaces} @@ -586,22 +666,89 @@ \else\useroman{#1}{#2}{#3}{#4}% \fi} \DeclareRobustCommand\normalfont{% - \kanjiencoding{\kanjiencodingdefault}% - \kanjifamily{\kanjifamilydefault}% - \kanjiseries{\kanjiseriesdefault}% - \kanjishape{\kanjishapedefault}% - \romanencoding{\encodingdefault}% - \romanfamily{\familydefault}% - \romanseries{\seriesdefault}% - \romanshape{\shapedefault}% - \selectfont\ignorespaces} + \useroman\encodingdefault\familydefault\seriesdefault\shapedefault + \usekanji\kanjiencodingdefault\kanjifamilydefault\kanjiseriesdefault\kanjishapedefault + \ignorespaces} \let\reset@font\normalfont + +\ifdefined\@rmfamilyhook +%%%% LaTeX 2020-02-02 +\let\prepare@family@series@update@kanji=\prepare@family@series@update +\patchcmd\prepare@family@series@update{\fontfamily}{\romanfamily}{}{} +\patchcmd\prepare@family@series@update@kanji{\fontfamily}{\kanjifamily}{}{} +\patchcmd\prepare@family@series@update@kanji{\f@series}{\k@series}{}{} +\patchcmd\prepare@family@series@update@kanji{\maybe@load@fontshape} + {\begingroup\let\f@encoding\k@encoding\let\f@family\k@family + \maybe@load@fontshape\endgroup}{}{} +\patchcmd\prepare@family@series@update@kanji{\@meta@family@list}{\@meta@family@kanji@list}{}{} +\def\@meta@family@kanji@list{\@elt{mc}\@elt{gt}\@elt{jtt}} +\DeclareRobustCommand\bfseries{% + \not@math@alphabet\bfseries\mathbf + \expand@font@defaults + \romanseries{% + \ifx\f@family\rmdef@ult \bfseries@rm + \else\ifx\f@family\sfdef@ult \bfseries@sf + \else\ifx\f@family\ttdef@ult \bfseries@tt + \else \bfdefault + \fi\fi\fi + }% + \kanjiseries{% + \ifx\k@family\mcdef@ult \bfseries@mc + \else\ifx\k@family\gtdef@ult \bfseries@gt + \else\ifx\k@family\jttdef@ult\bfseries@jtt + \else \bfdefault + \fi\fi\fi + }% + \selectfont +} +\DeclareRobustCommand\mdseries{% + \not@math@alphabet\mdseries\relax + \expand@font@defaults + \romanseries{% + \ifx\f@family\rmdef@ult \mdseries@rm + \else\ifx\f@family\sfdef@ult \mdseries@sf + \else\ifx\f@family\ttdef@ult \mdseries@tt + \else \mddefault + \fi\fi\fi + }% + \kanjiseries{% + \ifx\k@family\mcdef@ult \mdseries@mc + \else\ifx\k@family\gtdef@ult \mdseries@gt + \else\ifx\k@family\jttdef@ult\mdseries@jtt + \else \mddefault + \fi\fi\fi + }% + \selectfont +} +\appto\expand@font@defaults{% + \edef\mcdef@ult{\mcdefault}% + \edef\gtdef@ult{\gtdefault}% + \edef\jttdef@ult{\jttdefault}% + \edef\kanjidef@ult{\kanjifamilydefault}% +} +\appto\init@series@setup{% + \ifx\kanjidef@ult\mcdef@ult \mcfamily + \else\ifx\kanjidef@ult\gtdef@ult \gtfamily + \else\ifx\kanjidef@ult\jttdef@ult \jttfamily + \fi\fi\fi +} +\fi +\ifdefined\prepare@family@series@update@kanji\else +%%%% LaTeX 2019-10-01 +\def\prepare@family@series@update@kanji#1{\kanjifamily} +\fi + \DeclareRobustCommand\mcfamily{% \unless\ifltj@disablejfam\not@math@alphabet\mcfamily\mathmc\fi - \kanjifamily\mcdefault\selectfont} + \prepare@family@series@update@kanji{mc}\mcdefault + \selectfont} \DeclareRobustCommand\gtfamily{% \unless\ifltj@disablejfam\not@math@alphabet\gtfamily\mathgt\fi - \kanjifamily\gtdefault\selectfont} + \prepare@family@series@update@kanji{gt}\gtdefault + \selectfont} + + + \let\romanprocess@table\process@table \def\kanjiprocess@table{% \kanjiencoding{\kanjiencodingdefault}% diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-fontspec.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-fontspec.sty index 9f630754bd..617eedaf9d 100644 --- a/macros/luatex/generic/luatexja/src/patches/lltjp-fontspec.sty +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-fontspec.sty @@ -1,5 +1,5 @@ % -% lltjp-fontspec.sty 2019-10-21 +% lltjp-fontspec.sty 2020-01-13 % \NeedsTeXFormat{LaTeX2e} @@ -7,13 +7,30 @@ \RequirePackage{fontspec} \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}{2019/10/19}{ %% 2.7d or later +\@ifpackagelater{fontspec}{2020/01/09}{ %% 2.7e or later + \tl_replace_all:cnn { rmfamily~ } { \fontfamily }{ \romanfamily } + \tl_replace_all:cnn { sffamily~ } { \fontfamily }{ \romanfamily } + \tl_replace_all:cnn { ttfamily~ } { \fontfamily }{ \romanfamily } + \cs_if_exist:NF \@rmfamilyhook { + \tl_replace_all:cnn { rmfamily~ } { \selectfont } { + \if@ltj@match@family + \prepare@family@series@update@kanji{mc}\mcdefault + \fi\selectfont + } + \tl_replace_all:cnn { sffamily~ } { \selectfont } { + \if@ltj@match@family + \prepare@family@series@update@kanji{gt}\gtdefault + \fi\selectfont + } + \tl_replace_all:cnn { ttfamily~ } { \selectfont } { + \if@ltj@match@family + \prepare@family@series@update@kanji{jtt}\jttdefault + \fi\selectfont + } + } +%% end of 2.7e (or later) +}{\@ifpackagelater{fontspec}{2019/10/19}{ %% 2.7d \cs_set:Nn \__fontspec_main_setmainfont:nn { \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} @@ -71,7 +88,8 @@ \__fontspec_setmonofont_hook:nn {#1} {#2} \normalfont } -}{\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h <= and <= 2.7c +%% end of 2.7d +}{%% 2.7c \cs_set:Nn \__fontspec_main_setmainfont:nn { \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} @@ -129,58 +147,7 @@ \__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:eeT {\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:eeT {\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:eeT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } - \normalfont - \ignorespaces - } +%% end of 2.7d }} \cs_set:Nn \fontspec_visible_space: @@ -190,19 +157,6 @@ { \fontspec_visible_space_fallback: } } -\AtBeginDocument{ - \cs_if_exist:NF \verbvisiblespace { - % >= LaTeX2e <2018-12-01> does not need the following patch - \def\verb - { - \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\__fontspecsverb\@verb - } - } -} \cs_set:Npn \emshape { \gtfamily \itshape } \cs_set:Npn \eminnershape { \mcfamily \upshape } |