summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-07 22:13:27 +0000
committerKarl Berry <karl@freefriends.org>2019-01-07 22:13:27 +0000
commitbd1875cde7b10d9c50c1919729a178ffa0ca77d1 (patch)
treec39000513338bd200b3fb39221b2091798957cb5 /Master
parent0a0336d2291164dec0f697dc2941c1bfa06069e1 (diff)
luatexja (7jan19)
git-svn-id: svn://tug.org/texlive/trunk@49635 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/README10
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdfbin463972 -> 468936 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdfbin846152 -> 854263 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx126
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua107
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua25
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja.sty4
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty151
11 files changed, 319 insertions, 112 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README
index a826fe9bc2b..f8ff7a69640 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/README
+++ b/Master/texmf-dist/doc/luatex/luatexja/README
@@ -1,6 +1,6 @@
-The LuaTeX-ja Package 20181103.0
+The LuaTeX-ja Package 20190107.0
--------------------------------
-Copyright (c) 2011--2018 The LuaTeX-ja project
+Copyright (c) 2011--2019 The LuaTeX-ja project
License: modified BSD (see COPYING)
LuaTeX-ja is a macro package for typesetting Japanese documents with LuaTeX.
@@ -40,9 +40,9 @@ Installation
2. If you must/want to install manually:
a. Download the source archive from CTAN,
- or tagged as 20181103.0 in the Git repository by
+ or tagged as 20190107.0 in the Git repository by
<http://git.osdn.jp/view?p=luatex-ja/luatexja.git
- ;a=snapshot;h=refs/tags/20181103.0;sf=tgz>
+ ;a=snapshot;h=refs/tags/20190107.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: Sat Nov 3 09:59:06 2018 +0900
+Last commit date: Mon Jan 7 17:43:21 2019 +0900
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
index 8b237916f78..c91da6367d8 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
index 617341fd7a2..4b62b39883d 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
index de3c5f576a6..f00243bc811 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
@@ -1120,7 +1120,7 @@ By default, the following fonts are used for these two families.
However, above settings are not sufficient for Japanese-based
documents. To typeset Japanese-based documents, you are better to use
class files other than \texttt{article.cls}, \texttt{book.cls}, and so on. At
-the present, we have the counterparts of \Pkg{jclasses} (standard
+the present, \LuaTeX-ja has the counterparts of \Pkg{jclasses} (standard
classes in \pLaTeX) and \Pkg{jsclasses} (classes by Haruhiko
Okumura), namely, \Pkg{ltjclasses}\footnote{%
\texttt{ltjarticle.cls},~\texttt{ltjbook.cls}, \texttt{ltjreport.cls},
@@ -1149,7 +1149,7 @@ so \Pkg{ltjsclasses} uses the \texttt{nomag*} option\footnote{Same effect as
},
\Pkg{ltjsclasses}\footnote{%
\texttt{ltjsarticle.cls},~\texttt{ltjsbook.cls}, \texttt{ltjsreport.cls},~\texttt{ltjskiyou.cls}.}%
-がそれぞれ用意されている.
+がそれぞれ\LuaTeX-ja標準で用意されている.
元々の\Pkg{jsclasses}では本文のフォントサイズを設定するのに\cs{mag}プリミティブが使われていたが,
\LuaTeX~beta-0.87.0以降ではPDF出力時の\cs{mag}のサポートが廃止された.
@@ -2865,6 +2865,10 @@ Down-TO-Upの意味なのだろう.\cs{dtou} を使用する機会はないだ
ただし,現在のモードが非制限水平モードや(文中,別行立て問わず)数式モードであるときには
組方向を変更することは出来ない.
また,縦組中の数式内のボックスは\pTeX と同じように組方向が \cs{utod} となる.
+
+なお,\LaTeX の下で\LuaTeX-jaを使用する場合,組方向変更命令には
+「新たな組方向下での和文フォントを必要なら読み込み(・選択する)」という
+処理が付け加えられている(\ref{ssec:ltx-jfm}節参照).
%</ja>
%<*en>
@@ -5973,6 +5977,77 @@ are typeset by \cs{piyo}.
%<en>\section{Commands for \LaTeXe}
%<ja>\section{\LaTeXe 用の命令}
+%<*en>
+\subsection{Loading Japanese fonts in \LaTeXe}
+\label{ssec:ltx-jfm}
+From versoin~20190107,
+\emph{\LuaTeX-ja does not load Japanese fonts for horizontal direction and
+ that for vertical direction at same time},
+to reduce the number of loaded fonts.
+This will save time for typesetting and memory consumption of Lua side (\cite{tc18ltja}).
+
+\begin{itemize}
+ \item \cs{selectfont} loads (and chooses) only the Japanese font for current direction,
+ and does not load the Japanese font for other direction
+ (\LuaTeX-ja only detects its size and JFM, to calculate the amount of shifting the baseline).
+
+ \item Direction changing commands (\cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod}) are patched to
+ include the following process:
+ \begin{quote}
+ If the Japanese font for new direction is not loaded,
+ \LuaTeX-ja loads it automatically.
+ \end{quote}
+ Original commands are saved as \cs{ltj@@orig@yoko} etc.
+
+ \item Specifying Japanese font command which is
+ defined by \cs{jfont},~\cs{tfont}, or~\cs{DeclareFixedFont} directly
+ actually loads (and selects) the Japanese font.
+ For example, \textbf{JAchar}s in \cs{box0} will be typeset in \cs{HOGE},
+ in the following code:
+\begin{lstlisting}
+ % in horizontal direction (\yoko)
+ \DeclareFixedFont\HOGE{JT3}{gt}{m}{n}{12} % JT3: for vertical direction
+ \HOGE
+ \setbox0=\hbox{\tate あいう}
+\end{lstlisting}
+ \end{itemize}
+%</en>
+
+%<*ja>
+\subsection{\LaTeXe 下での和文フォントの読み込み}
+\label{ssec:ltx-jfm}
+バージョン20190107以降では,\LaTeXe の下で\LuaTeX-jaを使用した際に,
+\emph{横組用和文フォントと縦組み用和文フォントを両方一度に読み込み・選択せずに,
+ 実際にそれぞれを使う組方向になったときに行う}という方針にした.
+これは実際に読み込むフォント数を削減することで,
+タイプセットにかかる時間と(主にLuaの)メモリ消費を削減するためである(\cite{tc18ltja}).
+
+\begin{itemize}
+ \item \cs{selectfont}は横組用・縦組用和文フォントのうち,現在の組方向で使う方を
+ 実際に読み込み(・選択し),そうでない方は「フォントサイズとJFMのみ\LuaTeX-jaが把握している状態」
+ (以下,\emph{JFM把握状態})とする.
+
+ \item 組方向変更命令\cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod}には
+ \begin{quote}
+ 新たな組方向での和文フォントが読み込まれていない(JFM把握状態)ならば,
+ 現在のエンコーディング・ファミリ・シリーズ・シェイプから改めて読み込む(または選択する)
+ \end{quote}
+ 処理が付け加えられている.
+ もとの「組方向を変更するだけ」の命令は\cs{ltj@@orig@yoko}のように\texttt{ltj@@orig@}が前についた
+ 命令に保存されている.
+
+ \item \cs{jfont},~\cs{tfont},~\cs{DeclareFixedFont}で定義された和文フォントは
+ その時点で実際にフォントが読み込まれる.すなわち,以下のコードにおいて,
+ \cs{box0}中の\textbf{JAchar}は\cs{HOGE}でタイプセットされる.
+\begin{lstlisting}
+ % in horizontal direction (\yoko)
+ \DeclareFixedFont\HOGE{JT3}{gt}{m}{n}{12} % JT3: for vertical direction
+ \HOGE
+ \setbox0=\hbox{\tate あいう}
+\end{lstlisting}
+ \end{itemize}
+%</ja>
+
%<en>\subsection{Patch for NFSS2}
%<ja>\subsection{NFSS2へのパッチ}
\label{ssec:nfsspat}
@@ -7105,7 +7180,7 @@ for making the difference obvious.}
と同義.
\end{cslist}
-また,優先順位付きの行長調整のために,次の3パラメータが\cs{ltjsetparameter}内で
+また,次のパラメータが\cs{ltjsetparameter}内で
追加される.いずれもグローバルに効力を発揮する.
\begin{cslist}[style=standard]
\item[\DParam{stretch\_priority}\,=\{<list>\}]
@@ -7121,22 +7196,30 @@ stretch_priority={kanjiskip=-35,xkanjiskip=-25,others=50}
\texttt{others}キーが「\textbf{JAglue}以外のグルー」を表す.
各キーの値は,JFMグルーにおける「優先度$i$」を$10i$に対応させた整数値であり,
大きい方が先に伸ばされることを意味している.
+ 初期値は
+\begin{lstlisting}
+{kanjiskip=-35,xkanjiskip=-25,others=50}
+\end{lstlisting}
+であり,「優先度$-4$」と指定されているJFMグルーが最も伸びにくいようになっている.
\item[\DParam{shrink\_priority}\,=\{<list>\}]
同様に,「行を自然長より縮める」場合の調整に用いる優先度を指定する.
-それ以外は\Param{stretch\_priority}と指定の形式は変わらない.
+それ以外は\Param{stretch\_priority}と指定の形式は変わらない(初期値も変わらない).
\item[\DParam{linestep\_factor}\,=<float>]
- 段階的な行送り調整の際,\cs{baselineskip}の何倍単位で行送りを変えるかを指定する.
+ 段階的な行送り調整の際,\cs{baselineskip}の自然長の何倍単位で行送りを変えるかを指定する.
0を指定すると無効になるのと変わらない.また負数を指定すると,
その絶対値が指定されたかのように扱われる.
初期値は0.5(つまり半行単位)である.
+
+ \item[\DParam{profile\_hgap\_factor}\,=<float>]
+ 「中身まで見た」行送り計算の際,
+ 前の行にある深さが大きいものと次の行にある高さが大きいものが
+ 水平方向にどれだけ離れていないといけないかを
+ 「\cs{lineskip}の自然長の何倍か」で指定する.
+ 負数を指定すると,その絶対値が指定されたかのように扱われる.
+ 初期値は1(つまり\cs{lineskip}(の自然長))である.
\end{cslist}
-\Param{stretch\_priority}, \Param{shrink\_priority}の初期値はどちらも
-\begin{lstlisting}
-{kanjiskip=-35,xkanjiskip=-25,others=50}
-\end{lstlisting}
-であり,「優先度$-4$」と指定されているJFMグルーが最も伸び(縮み)にくいようになっている.
%</ja>
\subsection{\Pkg{luatexja-ruby}}
@@ -8282,18 +8365,23 @@ Current number of Japanese font family for math formulas.
\attr{ltj@curjfnt}
%<*en>
-The font index of current Japanese font for horizontal direction.
+If this attribute is a positive number, it stores the font number of current Japanese font for horizontal direction.
+If this attribute is negative, it means that the Japanese font for horizontal direction is
+not loaded---\LuaTeX-ja only knows its size and JFM.
%</en>
%<*ja>
-現在の横組用和文フォントのフォント番号.
+基本的には現在の横組用和文フォントのフォント番号を格納しているが,
+\LaTeX 下で使用する場合は($-2$以下の)負数となることがある.
+ 負数の場合は「横組用和文フォントは実際には読み込まれておらず,そのフォントサイズとJFMだけが
+ \LuaTeX-jaが把握している」状態を表す.
%</ja>
\attr{ltj@curtfnt}
%<*en>
-The font index of current Japanese font for vertical direction.
+Similar to \cs{ltj@curjfnt}, but with current Japanese font for vertical direction.
%</en>
%<*ja>
-現在の縦組用和文フォントのフォント番号.
+縦組用和文フォントに関する\cs{ltj@curjfnt}と同様の値.
%</ja>
\attr{ltj@charclass}
@@ -10994,11 +11082,11 @@ TUG 2013, October 2013.
Requirements for Japanese Text Layout (W3C Working Group Note), 2011, 2012. \newblock
\url{http://www.w3.org/TR/jlreq/}%
%<ja> \\日本語訳の書籍版:W3C日本語組版タスクフォース(編),『W3C技術ノート 日本語組版処理の要件』,東京電機大学出版局,2012.
-\bibitem{min10} 乙部厳己.min10フォントについて.\\\null\hfill
+\bibitem{min10} 乙部厳己.「min10フォントについて」\\\null\hfill
\url{http://argent.shinshu-u.ac.jp/~otobe/tex/files/min10.pdf}
-\bibitem{x4051} 日本工業規格(Japanese Industrial Standard). JIS~X~4051,
-日本語文書の組版方法(Formatting rules for Japanese documents), 1993, 1995, 2004.
-\bibitem{ptexdoc} 濱野尚人,田村明史,倉沢良一.\TeX の出版への応用—縦組み機能の組み込み—.
+\bibitem{x4051} 日本工業規格(Japanese Industrial Standard). 「JIS~X~4051,
+日本語文書の組版方法(Formatting rules for Japanese documents)」, 1993, 1995, 2004.
+\bibitem{ptexdoc} 濱野尚人,田村明史,倉沢良一.「\TeX の出版への応用—縦組み機能の組み込み—」.
\\\null\hfill\texttt{.../texmf-dist/doc/ptex/base/ptexdoc.pdf}
\bibitem{ptextug} Hisato Hamano. \newblock
\textit{Vertical Typesetting with \TeX}, TUGBoat~\textbf{11}(3), 346--352, 1990.
@@ -11007,6 +11095,8 @@ ISO 32000-1:2008, \textit{Document management -- Portable document format -- Par
1.7}, 2008. \newblock
\\\null\hfill
\url{http://www.iso.org/iso/iso\_catalogue/catalogue_tc/catalogue\_detail.htm?csnumber=51502}
+\bibitem{tc18ltja} 北川弘典.「\LuaTeX-jaの近況」,\TeX Conf~2018.\\
+ \url{https://osdn.net/projects/luatex-ja/wiki/Documentation/attach/tc18ltja.pdf}
\end{thebibliography}
\end{document}
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 57d9835caf5..c4cc54c2f9e 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
@@ -134,6 +134,8 @@
}
\define@key[ltj]{japaram}{linestep_factor}{%
\directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax}
+\define@key[ltj]{japaram}{profile_hgap_factor}{%
+ \directlua{luatexja.adjust.profile_hgap_factor = math.abs(#1)}\relax}
%%------------------ all done
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
index 382e7602a71..3d7e31e0c40 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
@@ -445,56 +445,83 @@ luatexja.unary_pars.adjust = function(t)
return is_reg and 1 or 0
end
+-- ----------------------------------
+do
+ local max, ins, sort = math.max, table.insert, table.sort
+ local function insert(package, ind, d, b, e)
+ local bound = package[2]
+ bound[b], bound[e]=true, true
+ ins(package[1], {b,e,[ind]=d})
+ end
+ local function flatten(package)
+ local bd={} for i,_ in pairs(package[2]) do ins(bd,{i}) end
+ sort(bd, function (a,b) return a[1]<b[1] end)
+ local bdc=#bd; local t = package[1]
+ sort(t, function (a,b) return a[1]<b[1] end)
+ local bdi =1
+ for i=1,#t do
+ while bd[bdi][1]<t[i][1] do bdi=bdi+1 end
+ local j = bdi
+ while j<bdc and bd[j+1][1]<=t[i][2] do
+ for k,w in pairs(t[i]) do
+ if k>=3 then
+ bd[j][k]=bd[j][k] and max(bd[j][k],w) or w
+ end
+ end
+ j=j+1
+ end
+ end
+ package[2]=nil; package[1]=nil; package.flatten, package.insert=nil, nil
+ bd[#bd]=nil
+ return bd
+ end
+ function init_range()
+ return {{},{}, insert=insert, flatten=flatten}
+ end
+end
+
-- -----------------------------------
luatexja.adjust.step_factor = 0.5
+luatexja.unary_pars.linestep_factor = function(t)
+ return luatexja.adjust.step_factor
+end
+luatexja.adjust.profile_hgap_factor = 1
+luatexja.unary_pars.profile_hgap_factor = function(t)
+ return luatexja.adjust.profile_hgap_factor
+end
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 = getfield(before,'shift'), 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 = getfield(after,'shift'), 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
+ local function profile_inner(box, range, ind, vmirrored, adj)
+ local w_acc, d_before = getfield(box,'shift'), 0
+ local x = getlist(box); local xn = node_next(x)
+ while x do
+ local w, h, d
+ if xn then w, h, d= rangedimensions(box,x,xn)
+ else w, h, d= rangedimensions(box,x) end
+ if vmirrored then h=d end
+ local w_new = w_acc + w
+ if w>=0 then
+ range:insert(ind, h, w_acc-adj, w_new)
+ else
+ range:insert(ind, h, w_new-adj, w_acc)
end
+ w_acc = w_new; x = xn; if x then xn = node_next(x) 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)
+ end
+ function ltjl.p_profile(before, after, mirrored, bw)
+ local range, tls
+ = init_range(), luatexja.adjust.profile_hgap_factor*tex.lineskip.width
+ profile_inner(before, range, 3, true, tls)
+ profile_inner(after, range, 4, mirrored, tls)
+ range = range:flatten()
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)
+ for i,v in ipairs(range) do
+ d, h = (v[3] or 0), (v[4] or 0)
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
+ if bw-h-d<lmin then lmin=bw-h-d end
end
if lmin==1/0 then lmin = bw end
return lmin,
@@ -513,7 +540,7 @@ do
return ltjl.l_dummy(dist, g, adj, normal, bw, loc)
end
if dist < tex.lineskiplimit then
- local f = max(1, bw*ltja.step_factor)
+ 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)
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
index 372b39784d2..76ec21262a2 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
@@ -3,7 +3,7 @@
--
luatexbase.provides_module({
name = 'luatexja.jfont',
- date = '2018/11/01',
+ date = '2018/12/15',
description = 'Loader for Japanese fonts',
})
@@ -198,8 +198,9 @@ do
return new
else return nil end
end
+ local size_cache_num = 1
update_jfm_cache = function (j,sz)
- if metrics[j].size_cache[sz] then return end
+ if metrics[j].size_cache[sz] then return metrics[j].size_cache[sz].index end
local t = {}
metrics[j].size_cache[sz] = t
t.chars = metrics[j].chars
@@ -233,6 +234,9 @@ do
t.zw = round(metrics[j].zw*sz)
t.zh = round(metrics[j].zh*sz)
t.size = sz
+ size_cache_num = size_cache_num + 1
+ t.index = size_cache_num
+ return size_cache_num
end
end
@@ -267,10 +271,11 @@ end
-- LOADING JAPANESE FONTS
------------------------------------------------------------------------
+local load_jfont_metric
do
local cstemp
local global_flag -- true if \globaljfont, false if \jfont
- local function load_jfont_metric()
+ load_jfont_metric = function()
if jfm_file_name=='' then
ltjb.package_error('luatexja',
'no JFM specified',
@@ -452,6 +457,18 @@ do
luatexbase.create_callback('luatexja.define_font', 'simple', function (n) return n end)
otfl_fdr= luatexbase.remove_from_callback('define_font', 'luaotfload.define_font')
luatexbase.add_to_callback('define_font',luatexja.font_callback,"luatexja.font_callback", 1)
+
+ local match, sp = string.match, tex.sp
+ local function load_jfmonly(spec, dir)
+ local spec, size = match(spec,'(.+)%s+at%s*([%.%w]*)')
+ size = sp(size); extract_metric(spec)
+ jfm_dir = dir
+ local i = load_jfont_metric()
+ local j = -update_jfm_cache(i, size)
+ font_metric_table[j]=metrics[i].size_cache[s]
+ tex.sprint(cat_lp, '\\ltj@cur' .. (dir=='yoko' and 'j' or 't') .. 'fnt' .. tostring(j) .. '\\relax')
+ end
+ luatexja.jfont.load_jfmonly = load_jfmonly
end
------------------------------------------------------------------------
@@ -640,7 +657,7 @@ do
-- EXT
function luatexja.jfont.does_alt_set(bbase)
aftl_base = alt_font_table_latex[bbase]
- tex.sprint(cat_lp, '\\if' .. (aftl_base and 'true' or 'false'))
+ tex.sprint(cat_lp, aftl_base and '\\@firstofone' or '\\@gobble')
end
-- EXT
function luatexja.jfont.print_aftl_address()
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
index 88aad543be6..1729c9e7f03 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
@@ -103,7 +103,9 @@ do
while pid==id_glyph do
local pc = getchar(p)
if has_attr(p, attr_icflag, 0) and is_ucs_in_japanese_char(p, pc) then
- setfont(p, ltjf_replace_altfont(has_attr(p, attr_curjfnt) or getfont(p), pc))
+ local pf = has_attr(p, attr_curjfnt)
+ pf = (pf and pf>0 and pf) or getfont(p)
+ setfont(p, ltjf_replace_altfont(pf, pc))
setlang(p, lang_ja)
ltjs_orig_char_table[p] = pc
end
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
index 3dff4e6848c..060b3226ad3 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
@@ -208,7 +208,7 @@ do
local hh, hd = getfield(box, 'height'), getfield(box, 'depth')
local hx = h
while hx do
- local hic = has_attr(hx, attr_icflag)
+ local hic = has_attr(hx, attr_icflag) or 0
if (hic == KANJI_SKIP) or (hic == KANJI_SKIP_JFM)
or (hic == XKANJI_SKIP) or (hic == XKANJI_SKIP_JFM)
or ((hic<=FROM_JFM+63) and (hic>=FROM_JFM)) then
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
index 496e4c86960..0ce05322b59 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
@@ -35,13 +35,13 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja}[2018/09/30 Japanese Typesetting with Lua(La)TeX]
+ \ProvidesPackage{luatexja}[2019/01/07 Japanese Typesetting with Lua(La)TeX]
\DeclareOption{disablejfam}{\ltj@disablejfamtrue}
\DeclareOption*{}
\ProcessOptions\relax
\fi %</LaTeX>
%%%% VERSION
-\def\LuaTeXjaversion{20181103.0}
+\def\LuaTeXjaversion{20190107.0}
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 6560f3fa3fe..515f7dfdbfb 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
@@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjfont}[2018/10/08 Patch to NFSS2 for LuaTeX-ja]
+\ProvidesPackage{lltjfont}[2018/12/15 Patch to NFSS2 for LuaTeX-ja]
\def\ltj@chardef@text@cmd#1{%
\let\@ifdefinable\@@ifdefinable%
@@ -75,13 +75,13 @@
\fi\fi
}
-\def\ystrut{\relax\hbox{\yoko
+\def\ystrut{\relax\hbox{\ltj@@orig@yoko
\ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi}}
-\def\tstrut{\relax\hbox{\tate
+\def\tstrut{\relax\hbox{\ltj@@orig@tate
\ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
-\def\dstrut{\relax\hbox{\dtou
+\def\dstrut{\relax\hbox{\ltj@@orig@dtou
\ifmmode\copy\dstrutbox\else\unhcopy\dstrutbox\fi}}
-\def\zstrut{\relax\hbox{\utod
+\def\zstrut{\relax\hbox{\ltj@@orig@utod
\ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
{%
@@ -243,18 +243,24 @@
\gdef\f@baselineskip{#5pt}}
\@onlypreamble\DeclareKanjiSubstitution
\@onlypreamble\DeclareErrorKanjiFont
+
+\newif\ifltjselectfont@force@define
\def\DeclareFixedFont#1#2#3#4#5#6{%
\begingroup
\math@fontsfalse
\every@math@size{}%
\fontsize{#6}\z@
\directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{#2}')}\ifin@%
+ \ltjselectfont@force@definetrue
\usekanji{#2}{#3}{#4}{#5}%
\global\let#1\getjfont
+ \ltjselectfont@force@definefalse
\else
\directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{#2}')}\ifin@%
+ \ltjselectfont@force@definetrue
\usekanji{#2}{#3}{#4}{#5}%
\global\let#1\gettfont
+ \ltjselectfont@force@definefalse
\else
\useroman{#2}{#3}{#4}{#5}%
\global\expandafter\let\expandafter#1\the\font
@@ -314,6 +320,8 @@
\expandafter\expandafter\expandafter\let
\expandafter\expandafter\csname ltj@@orig@selectfont\endcsname\csname selectfont\space\endcsname
\@EverySelectfont@Init
+%\let\ltj@@font@info\@font@info
+%\let\ltj@@font@warning\@font@warning
\def\@EverySelectfont@Init{%
\expandafter\let\csname selectfont\space \endcsname \ltj@@orig@selectfont
\ltj@@EverySelectfont@Init
@@ -321,22 +329,26 @@
\def\ltj@selectfont@tate{%
\let\k@encoding\ct@encoding
\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
- \pickup@tfont\font@name
- \ltj@@does@alt@set{\curr@kfontshape}%
- % alt fonts の定義
- \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr@kfontshape}')}%
- % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
- \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ \pickup@tfont
+ \ifnum\ltjgetparameter{direction}=3 \font@name
+ \ltj@@does@alt@set{\curr@kfontshape}{%
+ % alt fonts の定義
+ \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr@kfontshape}')}%
+ % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ }%
\fi}
\def\ltj@selectfont@yoko{%
\let\k@encoding\cy@encoding
\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
- \pickup@jfont\font@name
- \ltj@@does@alt@set{\curr@kfontshape}%
- % alt fonts の定義
- \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr@kfontshape}')}%
- % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
- \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ \pickup@jfont
+ \unless\ifnum\ltjgetparameter{direction}=3 \font@name
+ \ltj@@does@alt@set{\curr@kfontshape}{%
+ % alt fonts の定義
+ \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr@kfontshape}')}%
+ % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ }%
\fi}
\def\ltj@selectfont@patch{%
\directlua{luatexja.base.start_time_measure('selectfont')}%
@@ -354,8 +366,6 @@
\fi
\fi
\global\let\ltj@afont@name=\font@name
- %\ifnum3=\ltjgetparameter{direction}\relax \ltj@selectfont@tate
- %\else \ltj@selectfont@yoko\fi
\ltj@selectfont@tate\ltj@selectfont@yoko
%
\edef\tmp@item{{\k@encoding}}\expandafter\def\expandafter\k@encoding\tmp@item
@@ -381,6 +391,24 @@
}
\EverySelectfont{\ltj@selectfont@patch}
+\bgroup
+ \def\ltj@@dir@patch#1#2#3{%
+ \global\csletcs{ltj@@orig@#1}{#1}%
+ \protected\expandafter\xdef\csname #1\endcsname{%
+ \csname ltj@@orig@#1\endcsname
+ \unexpanded{\ifnum#3<\z@\let\ltj@@protect\protect\set@typeset@protect}%
+ \unexpanded{\global\let\ltj@afont@name=\font@name}%
+ \expandonce{\csname ltj@selectfont@#2\endcsname}%
+ \unexpanded{\global\let\font@name=\ltj@afont@name}%
+ \unexpanded{\let\protect\ltj@@protect\fi}%
+ }%
+ }
+ \ltj@@dir@patch{yoko}{yoko}{\ltj@curjfnt}
+ \ltj@@dir@patch{tate}{tate}{\ltj@curtfnt}
+ \ltj@@dir@patch{utod}{yoko}{\ltj@curjfnt}
+ \ltj@@dir@patch{dtou}{yoko}{\ltj@curjfnt}
+\egroup
+
\def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}}
\def\set@fontsize#1#2#3{%
\@defaultunits\@tempdimb#2pt\relax\@nnil
@@ -394,16 +422,16 @@
\baselineskip\f@linespread\baselineskip
\normalbaselineskip\baselineskip
\adjustbaseline
- \setbox\ystrutbox\hbox{\yoko
+ \setbox\ystrutbox\hbox{\ltj@@orig@yoko
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
- \setbox\dstrutbox\hbox{\dtou
+ \setbox\dstrutbox\hbox{\ltj@@orig@dtou
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
- \setbox\tstrutbox\hbox{\tate
+ \setbox\tstrutbox\hbox{\ltj@@orig@tate
\vrule\@width\z@
\@height.5\baselineskip \@depth.5\baselineskip}%
- \setbox\zstrutbox\hbox{\utod
+ \setbox\zstrutbox\hbox{\ltj@@orig@utod
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
\let\size@update\relax}}
@@ -415,12 +443,13 @@
local t = lua.get_functions_table()
local getfont, dir_tate = font.getfont, luatexja.dir_table.dir_tate
local fmt, get_attr = luatexja.jfont.font_metric_table, tex.getattribute
+ local getcount=tex.getcount
local setdimen, set_attr = tex.setdimen, tex.setattribute
local dir = luatexja.unary_pars.direction
t[\the\ltj@@adjust@baseline@inner] = function()
local ft = fmt[get_attr('ltj@curtfnt')] or nulltable
- ft = ft and ft.char_type or nulltable
- local fk = ft and ft[0] or nulltable
+ ft = ft.char_type or nulltable
+ local fk = ft[0] or nulltable
local ht, dp, wd = fk.height or 0, fk.depth or 0,
fk.width or ft.zw or 0
local fm
@@ -430,8 +459,8 @@
tex.round(0.5*((fm.height or 0)- (fm.depth or 0) - ht+ dp)))
if dir() ~= dir_tate then
ft = fmt[get_attr('ltj@curjfnt')] or nulltable
- ft = ft and ft.char_type or nulltable
- fk = ft and ft[0] or nulltable
+ ft = ft.char_type or nulltable
+ fk = ft[0] or nulltable
ht, dp, wd = fk.height or 0, fk.depth or 0,
fk.width or ft.zw or 0
end
@@ -601,19 +630,47 @@
\let\extract@afont\extract@font
\def\pickup@jfont{%
+ \ifnum
+ \unless\ifnum\ltjgetparameter{direction}=3 1\else
+ \ifltjselectfont@force@define 1\else 0\fi\fi =1 %
\expandafter \ifx \font@name \relax
\let\extract@font\extract@jfont
\define@newfont
\let\extract@font\extract@afont
\fi
- \let\getjfont\font@name}
+ \let\getjfont\font@name
+ \else
+ \begingroup\escapechar\m@ne
+ \ifcsname ltj@@fontjfm/\expandafter\string\font@name\endcsname\else
+ \let\extract@font\extract@jfont@onlyjfm
+ \define@newfont
+ \let\extract@font\extract@afont
+ \fi
+ \endgroup
+ \csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font@name\endcsname
+ \fi
+}
\def\pickup@tfont{%
+ \ifnum
+ \ifnum\ltjgetparameter{direction}=3 1\else
+ \ifltjselectfont@force@define 1\else 0\fi\fi =1 %
\expandafter \ifx \font@name \relax
\let\extract@font\extract@tfont
\define@newfont
\let\extract@font\extract@afont
\fi
- \let\gettfont\font@name}
+ \let\gettfont\font@name
+ \else
+ \begingroup\escapechar\m@ne
+ \ifcsname ltj@@fontjfm/\expandafter\string\font@name\endcsname\else
+ \let\extract@font\extract@tfont@onlyjfm
+ \define@newfont
+ \let\extract@font\extract@afont
+ \fi
+ \endgroup
+ \csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font@name\endcsname
+ \fi
+}
% 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように
% わざと「ゴミをつける」
@@ -621,23 +678,35 @@
#1\directlua{luatexja.jfont.print_aftl_address()}\space at%
}
\def\extract@jfont{%
- \get@external@font
- \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
+ \get@external@font
+ \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}{%
\edef\external@font{\expandafter\ltj@@patch@external@font\external@font}%
- \fi
- \expandafter\globaljfont\font@name\external@font\relax% ここで時間がかかる
- \font@name%\global\zw=\zw\global\zh=\zh
+ }%
+ \expandafter\globaljfont\font@name\external@font\relax\font@name% ここで時間がかかる
\csname \f@encoding+\f@family\endcsname
\csname\curr@fontshape\endcsname}
\def\extract@tfont{%
- \get@external@font
- \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
+ \get@external@font
+ \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}{%
\edef\external@font{\expandafter\ltj@@patch@external@font\external@font}%
- \fi
- \expandafter\globaltfont\font@name\external@font\relax
- \font@name%\global\zw=\zw\global\zh=\zh
+ }%
+ \expandafter\globaltfont\font@name\external@font\relax\font@name
\csname \f@encoding+\f@family\endcsname
\csname\curr@fontshape\endcsname}
+\def\extract@jfont@onlyjfm{%
+ \get@external@font
+ \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
+ \directlua{%
+ luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'yoko')
+ }%
+ }}
+\def\extract@tfont@onlyjfm{%
+ \get@external@font
+ \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{%
+ \directlua{%
+ luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'tate')
+ }%
+ }}
\let\ltj@@al@do@subst@correction=\do@subst@correction
\def\ltj@@ja@do@subst@correction{%
@@ -737,8 +806,8 @@
\directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
}
-\def\ltj@@does@alt@set#1{%
- \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}}
+\def\ltj@@does@alt@set#1#2{%
+ \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}{#2}}
%%%% patch \@text@composite because of {y,t}albaselineshift