texlive[49635] Master/texmf-dist: luatexja (7jan19)

commits+karl at tug.org commits+karl at tug.org
Mon Jan 7 23:13:27 CET 2019


Revision: 49635
          http://tug.org/svn/texlive?view=revision&revision=49635
Author:   karl
Date:     2019-01-07 23:13:27 +0100 (Mon, 07 Jan 2019)
Log Message:
-----------
luatexja (7jan19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luatexja/README
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
    trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/README
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luatexja/README	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/README	2019-01-07 22:13:27 UTC (rev 49635)
@@ -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 @@
 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 @@
 
 * 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

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx	2019-01-07 22:13:27 UTC (rev 49635)
@@ -1120,7 +1120,7 @@
 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 @@
 },
 \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 @@
 ただし,現在のモードが非制限水平モードや(文中,別行立て問わず)数式モードであるときには
 組方向を変更することは出来ない.
 また,縦組中の数式内のボックスは\pTeX と同じように組方向が \cs{utod} となる.
+
+なお,\LaTeX の下で\LuaTeX-jaを使用する場合,組方向変更命令には
+「新たな組方向下での和文フォントを必要なら読み込み(・選択する)」という
+処理が付け加えられている(\ref{ssec:ltx-jfm}節参照).
 %</ja>
 
 %<*en>
@@ -5973,6 +5977,77 @@
 %<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 at 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 at 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 @@
 と同義.
 \end{cslist}
 
-また,優先順位付きの行長調整のために,次の3パラメータが\cs{ltjsetparameter}内で
+また,次のパラメータが\cs{ltjsetparameter}内で
 追加される.いずれもグローバルに効力を発揮する.
 \begin{cslist}[style=standard]
 \item[\DParam{stretch\_priority}\,=\{<list>\}]
@@ -7121,22 +7196,30 @@
 \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 @@
 
 \attr{ltj at 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 at curtfnt}
 %<*en>
-The font index of current Japanese font for vertical direction.
+Similar to \cs{ltj at curjfnt}, but with current Japanese font for vertical direction.
 %</en>
 %<*ja>
-現在の縦組用和文フォントのフォント番号.
+縦組用和文フォントに関する\cs{ltj at curjfnt}と同様の値.
 %</ja>
 
 \attr{ltj at charclass}
@@ -10994,11 +11082,11 @@
 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 @@
       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}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty	2019-01-07 22:13:27 UTC (rev 49635)
@@ -134,6 +134,8 @@
 }
 \define at key[ltj]{japaram}{linestep_factor}{%
   \directlua{local d = #1; luatexja.adjust.step_factor=math.abs(d)}\relax}
+\define at key[ltj]{japaram}{profile_hgap_factor}{%
+  \directlua{luatexja.adjust.profile_hgap_factor = math.abs(#1)}\relax}
 
 
 %%------------------ all done

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua	2019-01-07 22:13:27 UTC (rev 49635)
@@ -445,56 +445,83 @@
    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
+  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
+  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 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
-      end
-    end
-    local t2 = {}
-    for i,v in pairs(t) do insert(t2, { i, v[1], v[2] } ) end
-    table.sort(t2, function(a,b) return a[1]<b[1] end)
-    do
       local dmax, d, hmax, h, lmin = 0, 0, 0, 0, 1/0
-      for i,v in ipairs(t2) do
-        d, h = (v[2] or d), (v[3] or h)
+      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 @@
       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)

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2019-01-07 22:13:27 UTC (rev 49635)
@@ -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 @@
          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 @@
       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 @@
 -- 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 @@
    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 at cur' .. (dir=='yoko' and 'j' or 't') .. 'fnt' .. tostring(j) .. '\\relax')
+   end
+   luatexja.jfont.load_jfmonly = load_jfmonly
 end
 
 ------------------------------------------------------------------------
@@ -640,7 +657,7 @@
    -- 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()

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua	2019-01-07 22:13:27 UTC (rev 49635)
@@ -103,7 +103,9 @@
 	    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

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua	2019-01-07 22:13:27 UTC (rev 49635)
@@ -208,7 +208,7 @@
       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

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2019-01-07 22:13:27 UTC (rev 49635)
@@ -35,13 +35,13 @@
   \expandafter\let\csname ifltj at 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 at disablejfamtrue}
   \DeclareOption*{}
   \ProcessOptions\relax
 \fi                             %</LaTeX>
 %%%% VERSION
-\def\LuaTeXjaversion{20181103.0}
+\def\LuaTeXjaversion{20190107.0}
 
 \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
 

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty	2019-01-07 22:12:53 UTC (rev 49634)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty	2019-01-07 22:13:27 UTC (rev 49635)
@@ -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 at chardef@text at cmd#1{%
   \let\@ifdefinable\@@ifdefinable%
@@ -75,13 +75,13 @@
   \fi\fi
 }
 
-\def\ystrut{\relax\hbox{\yoko
+\def\ystrut{\relax\hbox{\ltj@@orig at yoko
    \ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi}}
-\def\tstrut{\relax\hbox{\tate
+\def\tstrut{\relax\hbox{\ltj@@orig at tate
    \ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
-\def\dstrut{\relax\hbox{\dtou
+\def\dstrut{\relax\hbox{\ltj@@orig at dtou
    \ifmmode\copy\dstrutbox\else\unhcopy\dstrutbox\fi}}
-\def\zstrut{\relax\hbox{\utod
+\def\zstrut{\relax\hbox{\ltj@@orig at utod
    \ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
 
 {%
@@ -243,6 +243,8 @@
    \gdef\f at baselineskip{#5pt}}
 \@onlypreamble\DeclareKanjiSubstitution
 \@onlypreamble\DeclareErrorKanjiFont
+
+\newif\ifltjselectfont at force@define
 \def\DeclareFixedFont#1#2#3#4#5#6{%
    \begingroup
       \math at fontsfalse
@@ -249,12 +251,16 @@
       \every at math@size{}%
       \fontsize{#6}\z@
       \directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{#2}')}\ifin@%
+	    \ltjselectfont at force@definetrue
         \usekanji{#2}{#3}{#4}{#5}%
         \global\let#1\getjfont
+	    \ltjselectfont at force@definefalse
       \else
         \directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{#2}')}\ifin@%
+  	      \ltjselectfont at force@definetrue
           \usekanji{#2}{#3}{#4}{#5}%
           \global\let#1\gettfont
+	      \ltjselectfont at 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 at selectfont\endcsname\csname selectfont\space\endcsname
 \@EverySelectfont at Init
+%\let\ltj@@font at info\@font at info
+%\let\ltj@@font at warning\@font at warning
 \def\@EverySelectfont at Init{%
   \expandafter\let\csname selectfont\space \endcsname \ltj@@orig at selectfont
   \ltj@@EverySelectfont at Init
@@ -321,22 +329,26 @@
 \def\ltj at selectfont@tate{%
   \let\k at encoding\ct at encoding
   \xdef\font at name{\csname\curr at kfontshape/\f at size\endcsname}%
-  \pickup at tfont\font at name
-  \ltj@@does at alt@set{\curr at kfontshape}%
-    % alt fonts の定義
-    \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr at kfontshape}')}%
-    % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
-    \directlua{luatexja.jfont.pickup_alt_font_a('\f at size')}%
+  \pickup at tfont
+  \ifnum\ltjgetparameter{direction}=3 \font at name
+    \ltj@@does at alt@set{\curr at kfontshape}{%
+      % alt fonts の定義
+      \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr at kfontshape}')}%
+      % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+      \directlua{luatexja.jfont.pickup_alt_font_a('\f at size')}%
+    }%
   \fi}
 \def\ltj at selectfont@yoko{%
   \let\k at encoding\cy at encoding
   \xdef\font at name{\csname\curr at kfontshape/\f at size\endcsname}%
-  \pickup at jfont\font at name
-  \ltj@@does at alt@set{\curr at kfontshape}%
-    % alt fonts の定義
-    \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr at kfontshape}')}%
-    % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
-    \directlua{luatexja.jfont.pickup_alt_font_a('\f at size')}%
+  \pickup at jfont
+  \unless\ifnum\ltjgetparameter{direction}=3 \font at name
+	 \ltj@@does at alt@set{\curr at kfontshape}{%
+      % alt fonts の定義
+      \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr at kfontshape}')}%
+      % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+      \directlua{luatexja.jfont.pickup_alt_font_a('\f at size')}%
+    }%
   \fi}
 \def\ltj at selectfont@patch{%
   \directlua{luatexja.base.start_time_measure('selectfont')}%
@@ -354,8 +366,6 @@
     \fi
   \fi
   \global\let\ltj at afont@name=\font at name
-  %\ifnum3=\ltjgetparameter{direction}\relax \ltj at selectfont@tate
-  %\else \ltj at selectfont@yoko\fi
   \ltj at selectfont@tate\ltj at selectfont@yoko
 %
   \edef\tmp at item{{\k at encoding}}\expandafter\def\expandafter\k at encoding\tmp at item
@@ -381,6 +391,24 @@
 }
 \EverySelectfont{\ltj at selectfont@patch}
 
+\bgroup
+  \def\ltj@@dir at 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 at typeset@protect}%
+      \unexpanded{\global\let\ltj at afont@name=\font at name}%
+	  \expandonce{\csname ltj at selectfont@#2\endcsname}%
+      \unexpanded{\global\let\font at name=\ltj at afont@name}%
+      \unexpanded{\let\protect\ltj@@protect\fi}%
+	}%
+  }
+  \ltj@@dir at patch{yoko}{yoko}{\ltj at curjfnt}
+  \ltj@@dir at patch{tate}{tate}{\ltj at curtfnt}
+  \ltj@@dir at patch{utod}{yoko}{\ltj at curjfnt}
+  \ltj@@dir at patch{dtou}{yoko}{\ltj at curjfnt}
+\egroup
+
 \def\KanjiEncodingPair#1#2{\@namedef{t at enc@#1}{#2}\@namedef{y at enc@#2}{#1}}
 \def\set at fontsize#1#2#3{%
     \@defaultunits\@tempdimb#2pt\relax\@nnil
@@ -394,16 +422,16 @@
       \baselineskip\f at linespread\baselineskip
       \normalbaselineskip\baselineskip
       \adjustbaseline
-      \setbox\ystrutbox\hbox{\yoko
+      \setbox\ystrutbox\hbox{\ltj@@orig at yoko
           \vrule\@width\z@
                 \@height.7\baselineskip \@depth.3\baselineskip}%
-      \setbox\dstrutbox\hbox{\dtou
+      \setbox\dstrutbox\hbox{\ltj@@orig at dtou
           \vrule\@width\z@
                 \@height.7\baselineskip \@depth.3\baselineskip}%
-      \setbox\tstrutbox\hbox{\tate
+      \setbox\tstrutbox\hbox{\ltj@@orig at tate
           \vrule\@width\z@
                 \@height.5\baselineskip \@depth.5\baselineskip}%
-      \setbox\zstrutbox\hbox{\utod
+      \setbox\zstrutbox\hbox{\ltj@@orig at utod
           \vrule\@width\z@
                 \@height.7\baselineskip \@depth.3\baselineskip}%
      \let\size at 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 at baseline@inner] = function()
     local ft = fmt[get_attr('ltj at 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 at 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 at afont\extract at font
 \def\pickup at jfont{%
+  \ifnum
+	\unless\ifnum\ltjgetparameter{direction}=3 1\else
+	    \ifltjselectfont at force@define 1\else 0\fi\fi =1 %
     \expandafter \ifx \font at name \relax
        \let\extract at font\extract at jfont
        \define at newfont
        \let\extract at font\extract at afont
     \fi
-    \let\getjfont\font at name}
+    \let\getjfont\font at name
+  \else
+	\begingroup\escapechar\m at ne
+	\ifcsname ltj@@fontjfm/\expandafter\string\font at name\endcsname\else
+       \let\extract at font\extract at jfont@onlyjfm
+       \define at newfont
+       \let\extract at font\extract at afont
+	\fi
+	\endgroup
+	\csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font at name\endcsname
+  \fi
+}
 \def\pickup at tfont{%
+  \ifnum
+	\ifnum\ltjgetparameter{direction}=3 1\else
+	    \ifltjselectfont at force@define 1\else 0\fi\fi =1 %
     \expandafter \ifx \font at name \relax
        \let\extract at font\extract at tfont
        \define at newfont
        \let\extract at font\extract at afont
     \fi
-    \let\gettfont\font at name}
+    \let\gettfont\font at name
+  \else
+	\begingroup\escapechar\m at ne
+	\ifcsname ltj@@fontjfm/\expandafter\string\font at name\endcsname\else
+       \let\extract at font\extract at tfont@onlyjfm
+       \define at newfont
+       \let\extract at font\extract at afont
+	\fi
+	\endgroup
+	\csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font at name\endcsname
+  \fi
+}
 
 % 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように
 % わざと「ゴミをつける」
@@ -621,23 +678,35 @@
   #1\directlua{luatexja.jfont.print_aftl_address()}\space at%
 }
 \def\extract at jfont{%
-   \get at external@font
-    \ltj@@does at alt@set{\f at encoding/\f at family/\f at series/\f at shape}%
+	\get at external@font
+    \ltj@@does at alt@set{\f at encoding/\f at family/\f at series/\f at shape}{%
       \edef\external at font{\expandafter\ltj@@patch at external@font\external at font}%
-    \fi
-    \expandafter\globaljfont\font at name\external at font\relax% ここで時間がかかる
-    \font at name%\global\zw=\zw\global\zh=\zh
+    }%
+    \expandafter\globaljfont\font at name\external at font\relax\font at name% ここで時間がかかる
     \csname \f at encoding+\f at family\endcsname
     \csname\curr at fontshape\endcsname}
 \def\extract at tfont{%
-   \get at external@font
-    \ltj@@does at alt@set{\f at encoding/\f at family/\f at series/\f at shape}%
+	\get at external@font
+    \ltj@@does at alt@set{\f at encoding/\f at family/\f at series/\f at shape}{%
       \edef\external at font{\expandafter\ltj@@patch at external@font\external at font}%
-    \fi
-    \expandafter\globaltfont\font at name\external at font\relax
-    \font at name%\global\zw=\zw\global\zh=\zh
+    }%
+    \expandafter\globaltfont\font at name\external at font\relax\font at name
     \csname \f at encoding+\f at family\endcsname
     \csname\curr at fontshape\endcsname}
+\def\extract at jfont@onlyjfm{%
+	\get at external@font
+	\csxdef{ltj@@fontjfm/\expandafter\string\font at name}{%
+	  \directlua{%
+		luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external at font}', 'yoko')
+	  }%
+	}}
+\def\extract at tfont@onlyjfm{%
+	\get at external@font
+	\csxdef{ltj@@fontjfm/\expandafter\string\font at name}{%
+	  \directlua{%
+		luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external at font}', 'tate')
+	  }%
+	}}
 
 \let\ltj@@al at do@subst at correction=\do at subst@correction
 \def\ltj@@ja at do@subst at correction{%
@@ -737,8 +806,8 @@
   \directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj at tempcntc,'\luatexluaescapestring{#2}')}%
 }
 
-\def\ltj@@does at alt@set#1{%
-  \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}}
+\def\ltj@@does at alt@set#1#2{%
+  \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}{#2}}
 
 %%%% patch \@text at composite because of {y,t}albaselineshift
 



More information about the tex-live-commits mailing list