texlive[45216] Master/texmf-dist: luatexja (4sep17)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 4 23:45:54 CEST 2017


Revision: 45216
          http://tug.org/svn/texlive?view=revision&revision=45216
Author:   karl
Date:     2017-09-04 23:45:53 +0200 (Mon, 04 Sep 2017)
Log Message:
-----------
luatexja (4sep17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luatexja/README
    trunk/Master/texmf-dist/doc/luatex/luatexja/ltjclasses.pdf
    trunk/Master/texmf-dist/doc/luatex/luatexja/ltjsclasses.pdf
    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/source/luatex/luatexja/ltj-kinsoku_make.tex
    trunk/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx
    trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx
    trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty
    trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/source/luatex/luatexja/tool/function_uax50.lua
    trunk/Master/texmf-dist/tex/luatex/luatexja/max_perf_pct

Modified: trunk/Master/texmf-dist/doc/luatex/luatexja/README
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luatexja/README	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/README	2017-09-04 21:45:53 UTC (rev 45216)
@@ -1,4 +1,4 @@
-The LuaTeX-ja Package 20170730.0
+The LuaTeX-ja Package 20170904.0
 --------------------------------
 Copyright (c) 2011--2017 The LuaTeX-ja project
 License: modified BSD (see COPYING)
@@ -40,9 +40,9 @@
 2. If you must/want to install manually:
 
    a. Download the source archive from CTAN,
-      or tagged as 20170730.0 in the Git repository by
+      or tagged as 20170904.0 in the Git repository by
       <http://git.osdn.jp/view?p=luatex-ja/luatexja.git
-                              ;a=snapshot;h=refs/tags/20170730.0;sf=tgz>
+                              ;a=snapshot;h=refs/tags/20170904.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: Sun Jul 30 13:50:43 2017 +0900
+Last commit date: Mon Sep 4 21:02:03 2017 +0900

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

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

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	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx	2017-09-04 21:45:53 UTC (rev 45216)
@@ -1562,57 +1562,7 @@
 %<ja>として読み込み,小塚書体(Pr6N)を使うことを指定している.
 %<en> which means that Kozuka~Pr6N fonts will be used in this document.
 
-%<*ja>
-上記のプリセット以外の和文フォント設定を使いたい場合,本来は
-\Pkg{luatexja-fontspec}パッケージの提供する
-\cs{setmainjfont}, \cs{setsansjfont}を使って自分で指定するべきである.
-\texttt{custom}オプションを使うことで,\Pkg{luatexja-preset}パッケージの内部に直接アクセスして
-\begin{lstlisting}
-\usepackage[kozuka-pr6n,          % kozuka-pr6n プリセットを基礎にして,
-  custom={
-    mc=SourceHanSerif-Regular,    % 明朝体(全ウェイト)
-    mc-l=SourceHanSerif-Bold,     % 明朝体細字
-    mc-m=KozMinPr6N-Regular,      % 明朝体中字
-  % mc-bx=KozMinPr6N-Bold,        % 明朝体太字
-  % gt=HirakakuProN-W3,           % ゴシック体(全ウェイト)
-  % gt-m=SourceHanSans-Regular,   % ゴシック体中字(deluxe オプション指定時)
-  % gt-bx=HiraKakuProN-W6,ular,   % ゴシック体太字
-  % gt-eb=HiraKakuProN-W6,ular,   % ゴシック体極太
-    mg-m=HG Maru Gothic PRO,      % 丸ゴシック体
-  },
-  deluxe,expert,jis2004,match,nfssonly
-]{luatexja-preset}
-\end{lstlisting}
-のようにすることもできるが,\texttt{custom}オプションの書式は予告なく変更されることがある
-上,\texttt{90jis}や\texttt{JIS2004}オプションとの相性があまり良くないので推奨はしない.
-%</ja>
-%<*en>
-To use a Japanese font setting which does not match with any presets,
-the legitimate method is to use \cs{setmainjfont}~and~\cs{setsansjfont}
-which are provided by the \Pkg{luatexja-fontspec} package.
 
-One can use the \texttt{custom} option, such as
-\begin{lstlisting}
-\usepackage[kozuka-pr6n,          % based on the kozuka-pr6n preset (Kozuka Pr6N),
-  custom={
-    mc=SourceHanSerif-Regular,    % mincho family (all weights)
-    mc-l=SourceHanSerif-Bold,     % mincho light
-    mc-m=KozMinPr6N-Regular,      % mincho medium
-  % mc-bx=KozMinPr6N-Bold,        % mincho bold
-  % gt=HirakakuProN-W3,           % gothic family (all weights)
-  % gt-m=SourceHanSans-Regular,   % gothic medium (with deluxe option)
-  % gt-bx=HiraKakuProN-W6,ular,   % gothic bold
-  % gt-eb=HiraKakuProN-W6,ular,   % gothic extra bold
-    mg-m=HGMaruGothicMPRO,        % rounded gothic
-  },
-  deluxe,expert,jis2004,match,nfssonly
-]{luatexja-preset}
-\end{lstlisting}
-However, we do not recommend this \cs{custom} option;
-the format might change, and this \cs{custom} option is not well-compatible with
-\texttt{90jis}~nor~\cs{jis2004} options.
-%</en>
-
 %<*en>
 \subsection{\cs{CID}, \cs{UTF}, and macros in \Pkg{japanese-otf} package}
 Under \pLaTeX, \Pkg{japanese-otf} package (developed by Shuzaburo Saito) is
@@ -2400,7 +2350,6 @@
 ``ア'', not 20.
 %</en>
 %<*ja>
-\newpage
 \subsection{禁則処理関連パラメータとOpenTypeのfont feature}
 禁則処理や \Param{kanjiskip}, \Param{xkanjiskip} の挿入に関連したパラメータのうち
 \begin{quote}
@@ -2802,7 +2751,9 @@
 The fifth column (\emph{utod} direction) corresponds the ``\texttt{tate (math) direction}'' of \pTeX.
 
 Directions can be changed by \cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod},
-only when the current list is null. Also, the direction of a math formula is changed to
+only when the current list is null.
+These commands cannot be executed in unrestricted horizontal modes, nor math modes.
+The direction of a math formula is changed to
 \emph{utod}, when the direction outside the math formula is \emph{tate} (vertical writing).
 %</en>
 
@@ -2816,6 +2767,8 @@
 
 組方向は,\cs{yoko},~\cs{tate}, \cs{dtou},~\cs{utod} をそれぞれ使用することで,
 現在作成中のリストやボックスが空の時にのみ変更可能である.
+ただし,現在のモードが非制限水平モードや(文中,別行立て問わず)数式モードであるときには
+組方向を変更することは出来ない.
 また,縦組中の数式内のボックスは\pTeX と同じように組方向が \cs{utod} となる.
 %</ja>
 
@@ -3660,14 +3613,27 @@
 This command admits the same syntax used in \cs{font}~and~\cs{jfont}.
 A font defined by~\cs{tfont} differs the following points from that by~\cs{jfont}:
 \begin{itemize}
- \item Both \texttt{vert}~and~\texttt{vrt2} Opentype features are activated,
-  unless they are explicitly activated or deactivated (as the third line in the example below).
+ \item OpenType Feature~\texttt{vrt2}%
+  \footnote{If the font does not define \texttt{vrt2} feature,
+	use \texttt{vert} instead.} is automatically activated,
+  unless \texttt{vert}~and//or~\texttt{vrt2} are explicitly activated
+  or deactivated (as the second line in the example below).
 \begin{lstlisting}
-\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv
-    % vert and vrt2 are automatically activated
+\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv % vrt2 is automatically activated
 \tfont\T=file:KozMinPr6N-Regular.otf:jfm=ujisv;-vert % vert and vrt2 are not activated
+\tfont\U=file:ipaexm.ttf:jfm=ujisv
+    % vert is automatically activated, since this font does not have vrt2
 \end{lstlisting}
- \item ...
+ \item Sometimes \texttt{vert} and/or \texttt{vrt2} are not activated
+ while one specified activation of these feature.
+ This is because the font does not define these features in current combination of
+ script~tag and language~system~identifier.
+
+ In this situation, \LuaTeX-ja performs all replacements which is defined in~\texttt{vert}
+ feature for \emph{some} scripts for \emph{some} languages.
+ \item Furthermore, a glyph is automatically rotated 90~degrees,
+  if it is not replaced by \texttt{vert} feature for \emph{any} script
+  for \emph{any} language, and if it is marked as `r''~or~``Tr'' in UAX~\#50.
  \item One have to specify the name of vertical JFM in  \texttt{jfm=<name>}.
 \LuaTeX-ja ships following vertical JFMs:
 \begin{description}
@@ -3685,14 +3651,32 @@
 \cs{tfont} で定義された縦組用和文フォントは,
 以下の点が \cs{jfont} による横組用和文フォントとは異なる:
 \begin{itemize}
- \item 自動的に \texttt{vert}, \texttt{vrt2} の両OpenType featureが有効化される.
-但し,以下の例の3行目に示すように,明示的に \texttt{vert}, \texttt{vrt2}(のいずれか)の
-有効・無効を指定した場合は別である.
+ \item 明示的に \texttt{vert}, \texttt{vrt2}(のいずれか)の
+  有効・無効を指定した場合を除き,自動的に OpenType feature~\texttt{vrt2} の有効化が
+  指定されたものとみなされる
+ \footnote{もしフォントが\texttt{vrt2}を定義していなかった場合,代わりに
+ \texttt{vert}を用いる.}.
 \begin{lstlisting}
-\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv
-    % vert and vrt2 are automatically activated
+\tfont\S=file:KozMinPr6N-Regular.otf:jfm=ujisv % vrt2 is automatically activated
 \tfont\T=file:KozMinPr6N-Regular.otf:jfm=ujisv;-vert % vert and vrt2 are not activated
+\tfont\U=file:ipaexm.ttf:jfm=ujisv
+    % vert is automatically activated, since this font does not have vrt2
 \end{lstlisting}
+ \item \texttt{vert}, \texttt{vrt2} の少なくとも一つの有効を指定した場合にも関わらず,
+  script tagとlanguage system identifierの値の組み合わせによって
+  実際には有効にならなかった場合,\LuaTeX-jaは
+ \begin{quote}
+   どれかのscript,~languageで定義されている\texttt{vert}による
+   (単一グリフから単一グリフへの)置換を全部適用する
+ \end{quote}
+  という挙動を取る\footnote{%
+  例えば,Windows~7に付属しているSimHeiでは,\texttt{vert}はScriptが\texttt{hani},
+  Languageが\texttt{CHN}という状況でのみ定義されている.しかし,\Pkg{luaotfload}では
+  このscript,~languageの組み合わせを指定することはできないので,
+  \Pkg{luaotfload}そのままでは\texttt{vert}を適用させることはできない.
+ }.
+ \item さらに,「いかなるscript,~languageでも\texttt{vert}により置換されない」グリフ
+  のうち,UAX~\#50で``r''もしくは``Tr''と指定されているものは90度自動回転させる.
  \item \ref{ssec-math}節で述べる,数式中の和文フォントには縦組用和文フォントは指定できない.
  \item \texttt{jfm=<name>}\ の部分には縦組用JFMを指定する.
 以下の縦組用JFMが\LuaTeX-jaには同梱されている.%おり,違いを\autoref{tab-difjfm-tate}に示した.
@@ -7120,8 +7104,8 @@
 This package provides functions in a part of \Pkg{japanese-otf} package (changing fonts)
 and a part of \Pkg{PXchfon} package (presets) by Takayuki Yato.
 
-One can specified other options other than listed below.
-These are simply passed to the \Pkg{luatexja-fontspec}\footnote{if \texttt{nfssonly} option is
+Options which are given in \cs{usepackage} but not described in this~subsection
+are simply passed to the \Pkg{luatexja-fontspec}\footnote{if \texttt{nfssonly} option is
 \emph{not} specified; in this case these options are simply ignored.}.
 For example, the line~5 in below example is equivalent to lines 1--3.
 %</en>
@@ -7131,7 +7115,8 @@
 \Pkg{otf}パッケージの一部(多書体化)と八登崇之氏による\Pkg{PXchfon}パッケージの一部(プリセット指定)
 とを合わせたような格好をしている.
 
-オプションとして,以下のリストにないものも指定することができるが,それらは
+パッケージ読み込み時に渡されたオプションのうち,
+本節にないものを指定した場合,それらはそのまま
 \Pkg{luatexja-fontspec}パッケージに渡される\footnote{\texttt{nfssonly} オプションが
 指定されていた場合は,\Pkg{luatexja-fontspec}パッケージは読み込まれないので単純に無視され
 る.}.例えば,下の1--3行目は5行目のように一行にまとめることができる.
@@ -7144,6 +7129,10 @@
 \usepackage[no-math,match,kozuka-pr6n]{luatexja-preset}
 \end{lstlisting}
 
+%<en>\subsubsection{General Options}
+%<ja>\subsubsection{一般的なオプション}
+\label{sssec:ltjpreset-general}
+
 \begin{cslist}[before*=]
 \item[fontspec%
 %<en>\textrm{~(enabled by default)}
@@ -7338,8 +7327,10 @@
 両オプションが同時に指定された場合の動作については全く考慮していない.
 %</ja>
 
-%<en>\paragraph{Presets for multi weight}
-%<ja>\paragraph{多ウェイト用プリセットの一覧}
+%<en>\subsubsection{Presets which support multi weights}
+%<ja>\subsubsection{多ウェイト用プリセットの一覧}
+\label{sssec:ltjpreset-multi}
+
 %<*en>
 Besides \texttt{morisawa-pro}~and~\texttt{morisawa-pr6n} presets,
 fonts are specified by font name, not by file name.
@@ -7444,7 +7435,7 @@
  \item[morisawa-pro]  Morisawa Pro (Adobe-Japan1-4) fonts.
 %<en>    \\*[-\dimexpr\medskipamount+\baselineskip\relax]
  \item[morisawa-pr6n]  Morisawa Pr6N (Adobe-Japan1-6, JIS04-savvy) fonts.
-\begin{center}\small
+\begin{center}\footnotesize
 \begin{tabular}{ll>{\tt}l>{\tt}l}
 \toprule
 \bf family&\bf series&morisawa-pro&morisawa-pr6n\\
@@ -7622,11 +7613,11 @@
 \end{tabular}
 \end{center}
 
+\end{cslist}
+%<en>\subsubsection{Presets which do not support multi weights}
+%<ja>\subsubsection{単ウェイト用プリセット一覧}
+\label{sssec:ltjpreset-single}
 
-
-\end{cslist}
-%<en>\paragraph{Presets for single weight}
-%<ja>\paragraph{単ウェイト用プリセット一覧}
 %<*en>
 Next, we describe settings for using only single weight.
 %</en>
@@ -7647,16 +7638,17 @@
 &IPA Gothic&IPAex Gothic&MS Gothic\\
 %</en>
 %<*ja>
-\gtfamily 明朝体&Ryumin-Light(非埋込)
+\gtfamily 明朝&Ryumin-Light(非埋込)
 &IPA明朝&IPAex明朝&MS明朝\\
-\gtfamily ゴシック体&GothicBBB-Medium(非埋込)
+\gtfamily ゴシック&GothicBBB-Medium(非埋込)
 &IPAゴシック&IPAexゴシック&MSゴシック\\
 %</ja>
 \bottomrule
 \end{tabular}\par\medskip}
 
-%<en>\paragraph{Using HG fonts}
-%<ja>\paragraph{HGフォントの利用}
+%<en>\subsubsection{Presets which use HG fonts}
+%<ja>\subsubsection{HGフォントを使うプリセット}
+\label{sssec:ltjpreset-hg}
 %<*en>
 We can use HG~fonts bundled with Microsoft~Office for realizing multiple weights.
 In the table below, starred fonts (e.g., IPA~Gothic*) are used
@@ -7687,14 +7679,14 @@
 %</en>
 %<*ja>
 &medium&IPA明朝&IPAex明朝&MS明朝\\
-\smash{\raisebox{1.5ex}{\textgt{明朝体}}}%
+\smash{\raisebox{1.5ex}{\textgt{明朝}}}%
 &bold&HG明朝E&HG明朝E&HG明朝E\\\midrule
 &&IPAゴシック*&IPAexゴシック*&MSゴシック*\\
 &\smash{\raisebox{1.5ex}{medium}}%
 &HGゴシックM&HGゴシックM&HGゴシックM\\\cmidrule{2-5}
-\textgt{ゴシック体}&bold&HGゴシックE&HGゴシックE&HGゴシックE\\\cmidrule{2-5}
+\textgt{ゴシック}&bold&HGゴシックE&HGゴシックE&HGゴシックE\\\cmidrule{2-5}
 &extra bold&HG創英角ゴシックUB&HG創英角ゴシックUB&HG創英角ゴシックUB\\\midrule
-\textgt{丸ゴシック体}&&
+\textgt{丸ゴシック}&&
 HG丸ゴシックM-PRO&HG丸ゴシックM-PRO&HG丸ゴシックM-PRO\\
 %</ja>
 \bottomrule
@@ -7721,6 +7713,138 @@
 として指定を行っているので注意すること.
 %</ja>
 
+%<en>\subsubsection{Define/Use Custom Presets}
+%<ja>\subsubsection{新たなプリセットの定義}
+
+%<*ja>
+バージョン********.0以降では,自分で新たなプリセットを定義することが出来るようになった.
+以下に説明する2命令はプリアンブルでしか実行できない.
+%</ja>
+%<*en>
+From version~********.0, one can define new presets using \cs{ltjnewpreset},
+and use them by \cs{ltjapplypreset}. These two commands can only be used in the preamble.
+%</en>
+\begin{cslist}
+ \item[\cs{ltjnewpreset}\{<name>\}\{<specification>\}]
+%<*ja>
+  新たに<name>という名称のプリセットを定義する.この名称は,
+  すでに定義されているプリセット名や,
+  \ref{sssec:ltjpreset-general}で定義されているオプション,さらに
+  次の9つと重複してはならない.
+  \begin{quote}
+	\ttfamily
+	mc mc-l mc-m mc-bx gt gt-m 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 gt-m=<font>] ゴシック体中字(\cs{gtfamily}\cs{mdseries})
+   \item[\ttfamily gt-bx=<font>] ゴシック体太字(\cs{gtfamily}\cs{bfseries})
+   \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>
+	\end{quote}
+   \item[\ttfamily gt=<font>] ゴシック体の中字・太字・極太全部を設定.
+	以下を指定したことと同じである:
+	\begin{quote}
+	  \ttfamily gt-m=<font>, gt-bx=<font>, gt-eb=<font>
+	\end{quote}
+  \end{description}
+  なお,パッケージ読み込み時に \texttt{deluxe} が有効でない場合は,
+  上記9キーのうち\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:
+  \begin{quote}
+	\ttfamily
+	mc mc-l mc-m mc-bx gt gt-m gt-bx gt-eb mg-m
+  \end{quote}
+
+  <specification> is a comma-separated list which consists of
+  other presets and/or the following keys:
+  \begin{description}
+   \item[\ttfamily mc-l=<font>] mincho light
+   \item[\ttfamily mc-m=<font>] mincho medium
+   \item[\ttfamily mc-bx=<font>] mincho bold
+   \item[\ttfamily gt-m=<font>] gothic medium
+   \item[\ttfamily gt-bx=<font>] gothic bold
+   \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>
+	\end{quote}
+   \item[\ttfamily gt=<font>] Same as
+	\begin{quote}
+	  \ttfamily gt-m=<font>, gt-bx=<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.
+%</en>
+ \item[\cs{ltjnewpreset}*\{<name>\}\{<specification>\}]
+%<*ja>
+  \cs{ltjnewpreset}とほぼ同じであるが,こちらはすでに定義されているプリセット名
+  を<name>に指定した場合にはエラーを出さずに定義を置き換える.
+%</ja>
+%<*en>
+  Almost same as \cs{ltjnewpreset}. However, if <name> matches a preset which already defined,
+  this command simply overwrite it.
+%</en>
+ \item[\cs{ltjapplypreset}\{<name>\}]
+%<ja> <name>で指定されたプリセットを使って和文フォントを設定する.
+%<en> Set Japanese font families using preset~<name>.
+\end{cslist}
+
+%<*ja>
+なお,\cs{ltjnewpreset}の第二引数<specification>に含まれる
+プリセット名は\cs{ltjnewpreset}の時点で定義されている必要はなく,
+\cs{ltjapplypreset}で実際に使うときに定義されていれば良い.
+そのため,次のような記述も可能である:
+\begin{lstlisting}
+  \ltjnewpreset{hoge}{piyo,mc-bx=HiraMinProN-W6}
+  \ltjnewpreset{piyo}{mg-m=HiraMaruProN-W4}
+  \ltjapplypreset{hoge}
+\end{lstlisting}
+
+\paragraph{注意}
+\cs{ltjnewpreset}で定義したプリセットには以下の制限がある.
+\begin{itemize}
+  \item 非埋め込みのフォントを指定することはできない.
+  \item \texttt{ipa-hg}などのいくつかのプリセットでは
+  「\texttt{90jis}, \texttt{jis2004}が指定されているか否かでフォントの指定を変える」処理が
+  行われていたが,\cs{ltjnewpreset}で定義したプリセットではこの処理は働かない.
+  HGフォントやモガ明朝などを使うプリセットを定義する場合には注意すること.
+\end{itemize}
+%</ja>
+%<*en>
+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{piyo}{mg-m=HiraMaruProN-W4}
+  \ltjapplypreset{hoge}
+\end{lstlisting}
+
+\paragraph{Restrictions}
+Presets which are defined by \cs{ltjnewpreset} have following restrictions:
+\begin{itemize}
+  \item One cannot specify non-embedded fonts (such as Ryumin-Light).
+  \item Some presets, such as \texttt{ipa-hg}, have a feature that
+  fonts are changed according to whether \texttt{90jis}~or~\texttt{jis2004} is speified.
+  This feature is not usable in presets which are defined by \cs{ltjnewpreset}.
+\end{itemize}
+%</en>
+
+
 \clearpage
 %<en>\part{Implementations}
 %<ja>\part{実装}

Modified: trunk/Master/texmf-dist/source/luatex/luatexja/ltj-kinsoku_make.tex
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luatexja/ltj-kinsoku_make.tex	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/source/luatex/luatexja/ltj-kinsoku_make.tex	2017-09-04 21:45:53 UTC (rev 45216)
@@ -59,8 +59,8 @@
 \ltjsetparameter{prebreakpenalty={`",10000}}
 \ltjsetparameter{postbreakpenalty={`\#,500}}
 \ltjsetparameter{postbreakpenalty={`\$,500}}
-\ltjsetparameter{postbreakpenalty={`\%,500}}
-\ltjsetparameter{postbreakpenalty={`\&,500}}
+\ltjsetparameter{prebreakpenalty={`\%,500}}
+\ltjsetparameter{prebreakpenalty={`\&,500}}
 \ltjsetparameter{postbreakpenalty={`\`,10000}}
 \ltjsetparameter{prebreakpenalty={`',10000}}
 \ltjsetparameter{prebreakpenalty={`),10000}}
@@ -124,8 +124,8 @@
 \ltjsetparameter{prebreakpenalty={`=,200}}
 \ltjsetparameter{postbreakpenalty={`#,200}}
 \ltjsetparameter{postbreakpenalty={`$,200}}
-\ltjsetparameter{postbreakpenalty={`%,200}}
-\ltjsetparameter{postbreakpenalty={`&,200}}
+\ltjsetparameter{prebreakpenalty={`%,200}}
+\ltjsetparameter{prebreakpenalty={`&,200}}
 \ltjsetparameter{prebreakpenalty={`ぁ,150}}
 \ltjsetparameter{prebreakpenalty={`ぃ,150}}
 \ltjsetparameter{prebreakpenalty={`ぅ,150}}
@@ -180,6 +180,7 @@
 \ltjsetparameter{postbreakpenalty={`¡,10000}}
 \ltjsetparameter{postbreakpenalty={`¿,10000}}
 \ltjsetparameter{prebreakpenalty={`ː,10000}}
+\ltjsetparameter{prebreakpenalty={`·,10000}}
 \ltjsetparameter{prebreakpenalty={`ª,10000}}
 \ltjsetparameter{prebreakpenalty={`º,10000}}
 \ltjsetparameter{prebreakpenalty={`¹,10000}}
@@ -432,8 +433,8 @@
 %
 % inhibitxspcode  JIS X 0212
 %
-%\ltjsetparameter{jaxspmode={`¡,postonly}}
-%\ltjsetparameter{jaxspmode={`¿,postonly}}
+%\ltjsetparameter{jaxspmode={`¡,preonly}}
+%\ltjsetparameter{jaxspmode={`¿,preonly}}
 %\ltjsetparameter{jaxspmode={`º,postonly}}
 %\ltjsetparameter{jaxspmode={`ª,postonly}}
 \ltjsetparameter{jaxspmode={`™,postonly}}

Modified: trunk/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/source/luatex/luatexja/ltjclasses.dtx	2017-09-04 21:45:53 UTC (rev 45216)
@@ -110,6 +110,9 @@
 % \changes{v1.7e}{2017/03/05}{トンボに表示するジョブ情報の書式を変更}
 % \changes{v1.7e}{2017/03/05}{\cs{frontmatter}と\cs{mainmatter}を
 %   奇数ページに送るように変更}
+% \changes{v1.7e-ltj-15}{2017/08/31}{本ドキュメントのタイプセットで,小塚フォントが存在するときには
+%   それを用いるように変更(PDFサイズ削減のため).}
+% \changes{v1.7f}{2017/08/31}{和文書体の基準を全角空白から「漢」に変更}
 % \fi
 %
 % \iffalse
@@ -139,7 +142,7 @@
 %<11pt&bk>\ProvidesFile{ltjtbk11.clo}
 %<12pt&bk>\ProvidesFile{ltjtbk12.clo}
 %</tate>
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
 %<article|report|book> Standard LuaLaTeX-ja class]
 %<10pt|11pt|12pt>  Standard LuaLaTeX-ja file (size option)]
 %<*driver>
@@ -146,7 +149,15 @@
 ]
 \documentclass{ltjltxdoc}
 \GetFileInfo{ltjclasses.dtx}
-\usepackage[ipaex,nfssonly]{luatexja-preset}
+\begingroup
+ \suppressfontnotfounderror=1
+ \global\font\testfont=file:KozMinPr6N-Regular.otf
+\endgroup
+\ifx\testfont\nullfont
+  \usepackage[ipaex,nfssonly]{luatexja-preset}
+\else
+  \usepackage[kozuka-pr6n,nfssonly]{luatexja-preset}
+\fi
 \usepackage[unicode]{hyperref}
 \title{Lua\LaTeX-ja用\texttt{jclasses}互換クラス}
 \author{Lua\TeX-jaプロジェクト}
@@ -694,9 +705,11 @@
 % \begin{macro}{\Cvs}
 % \begin{macro}{\Chs}
 % 基準となる長さの設定をします。これらのパラメータは\file{lltjfont.sty}で定義
-% されています。
+% されています。基準とする文字を「全角空白」(EUCコード\texttt{0xA1A1})から
+% 「漢」(JISコード\texttt{0x3441})へ変更しました。
+% \changes{v1.7f}{2017/08/31}{和文書体の基準を全角空白から「漢」に変更}
 %    \begin{macrocode}
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/source/luatex/luatexja/ltjsclasses.dtx	2017-09-04 21:45:53 UTC (rev 45216)
@@ -57,13 +57,21 @@
 %<*driver>
 \ProvidesFile{ltjsclasses.dtx}
 %</driver>
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 %<*driver>
 \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
 \documentclass{ltjsarticle}
 \usepackage{hypdoc}
 \hypersetup{unicode=true}
-\usepackage[ipaex,nfssonly]{luatexja-preset}
+\begingroup
+ \suppressfontnotfounderror=1
+ \global\font\testfont=file:KozMinPr6N-Regular.otf
+\endgroup
+\ifx\testfont\nullfont
+  \usepackage[ipaex,nfssonly]{luatexja-preset}
+\else
+  \usepackage[kozuka-pr6n,nfssonly]{luatexja-preset}
+\fi  
 \ltjsetparameter{alxspmode={`\*,allow}}
 \ltjsetparameter{alxspmode={`\\,allow}}
 %%%%\usepackage{unicode-math}
@@ -1055,6 +1063,7 @@
 % \texttt{jsclasses}で行われていた |\textmc|, |\textgt| の再定義は不要のように思われます。
 %
 % \texttt{jsclasses.dtx}中で行われていた |\reDeclareMathAlphabet| の再定義は削除。
+% また,Yue ZHANGさん作の\texttt{fixjfm}パッケージ対応のコードもLua\TeX-jaでは削除しています.
 %
 %    \begin{macrocode}
 \AtBeginDocument{%

Added: trunk/Master/texmf-dist/source/luatex/luatexja/tool/function_uax50.lua
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luatexja/tool/function_uax50.lua	                        (rev 0)
+++ trunk/Master/texmf-dist/source/luatex/luatexja/tool/function_uax50.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -0,0 +1,50 @@
+kpse.set_program_name('luatex')
+dofile(kpse.find_file('lualibs.lua'))
+
+local function toX(a) return string.format('0x%X',a) end
+
+local uax_revision = '10.0.0'
+print('  -- UAX#50 for Unicode  ' ..  uax_revision)
+local fh = io.open('VerticalOrientation-' .. uax_revision .. '.txt')
+local t = {}
+
+for c in fh:lines() do
+    if c:match('(%x+)%.%.(%x+)%s+;%sT-[rR]') then
+	local b, e = c:match('(%x+)%.%.(%x+)%s+;')
+	b, e = tonumber(b,16), tonumber(e,16)
+	for i=b,e do t[i]=true end
+    elseif c:match('(%x+)%s+;%sT-[rR]') then
+	local b = c:match('(%x+)%s+;')
+	t[tonumber(b,16)]=true
+    end
+end
+
+fh:close()
+local t2={}
+local b, v = 0, t[0]
+for i=0,0x10ffff do
+    if t[i]~=v then
+	table.insert(t2,b); b, v=i, t[i]
+    end
+end
+table.insert(t2,b)
+
+print('  -- t[0] = ' .. tostring(t[0]))
+print(table.serialize(t2,'  local t'))
+
+--[[
+for i,v in ipairs(t2) do
+    print(i, toX(v[1]) .. ' ≦x< ' .. toX(v[2]),  v[3])
+end
+]]
+
+print([[  local function rotate_in_uax50(i)
+    local lo, hi = 1, #t
+    while lo < hi do
+      local mi = math.ceil((lo+hi)/2)
+      if t[mi]<=i then lo=mi else hi=mi-1 end 
+    end
+    return lo%2==1
+  end
+]])
+


Property changes on: trunk/Master/texmf-dist/source/luatex/luatexja/tool/function_uax50.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -1,38 +1,79 @@
 % luatexja-preset.sty
-\ProvidesPackage{luatexja-preset}[2017/07/30 Japanese font presets]
+\ProvidesPackage{luatexja-preset}[2017/09/04 Japanese font presets]
 
 \RequirePackage{expl3,l3keys2e}
 \RequirePackage{luatexja}
 \ExplSyntaxOn
 
-\fp_new:N \l_ltjpreset_scale_fp
+\fp_new:N \g_ltjpreset_scale_fp
 \group_begin:
 \fontsize{10}{10}\selectfont
-\fp_gset:Nn \l_ltjpreset_scale_fp {\zw / 10}
+\fp_gset:Nn \g_ltjpreset_scale_fp {\zw / 10}
 \group_end:
 
+%% messages
+\msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
+  The~ luatexja-fontspec~ package~ is~ loaded~ already.~
+  Hence~ we~ ignore~ `nfssonly'~option.
+}
+\msg_new:nnn { luatexja-preset }{ no-font }{
+  Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it.
+}
+\msg_new:nnn { luatexja-preset }{ scale }{
+  Japanese~fonts~will~be~scaled~by~#1.
+}
+
+\msg_new:nnn { luatexja-preset }{ exist-preset-nooverwrite }{
+  The~ preset~ `#1'~ is~ already~ defined.~
+  To~ redefine~ this~ preset,~ use~ \str_use:N \c_backslash_str ltjnewpreset*~ instead.
+}
+\msg_new:nnn { luatexja-preset }{ exist-preset-overwrite }{
+  The~ preset~ `#1'~ is~ redefined.
+}
+
+\msg_new:nnn { luatexja-preset }{ illegal-preset-name }{
+  The~ preset~ `#1'~ cannot~ be~ defined,~
+  since~ the~ luatexja-preset~ package~ an~ option~ with~ the~ same~ name.
+}
+
+\seq_new:N \g_ltjpreset_presets_seq
+
 \keys_define:nn { luatexja-preset }{
-  unknown .code:n = \PassOptionsToPackage { \l_keys_key_tl } { luatexja-fontspec },
-  scale .fp_gset:N = \l_ltjpreset_scale_fp,
+  unknown .code:n =
+    \keys_set_known:noN { ltjpreset-presets } { \tl_use:N \l_keys_tl } \l_tmpa_tl
+    \tl_if_empty:NT \l_tmpa_tl {
+      \PassOptionsToPackage { \l_tmpa_tl } { luatexja-fontspec }
+    },
+  scale .fp_gset:N = \g_ltjpreset_scale_fp,
   match .code: n =
     \renewcommand\jttdefault{\gtdefault}\@ltj at match@familytrue
     \PassOptionsToPackage { match } { luatexja-fontspec },
-  match .value_forbidden:n = true
+  match .value_forbidden:n = true,
+  __custom  .bool_set:N = \g_ltjpreset_custom_bool,  __custom  .groups:n = { preset },
+  __office  .bool_set:N = \g_ltjpreset_office_bool,  __office  .groups:n = { preset },
+  __noembed .bool_set:N = \g_ltjpreset_noembed_bool, __noembed .groups:n = { preset },
 }
 \cs_new:Nn \ltjpreset_declare_option:nn {
   \keys_define:nn { luatexja-preset }{
-    #1 .code:n = #2,
+    #1 .code:n = { #2 },
     #1 .value_forbidden:n = true
   }
 }
+\cs_new:Nn \ltjpreset_declare_preset:nn {
+  \keys_define:nn { luatexja-preset }{
+    #1 .meta:n = { #2 },
+    #1 .value_forbidden:n = true, #1 .groups:n = { preset },
+  }
+  \seq_put_right:Nn \g_ltjpreset_presets_seq { #1 }
+}
+\cs_generate_variant:Nn \ltjpreset_declare_preset:nn {nx}
 \cs_new:Nn \ltjpreset_declare_bool_option:nn {
-  \bool_new:c { l_ltjpreset_#1_bool }
-  \bool_set_false:c { l_ltjpreset_#1_bool }
+  \bool_new:c { g_ltjpreset_#1_bool }
+  \bool_set_false:c { g_ltjpreset_#1_bool }
   \keys_define:nn { luatexja-preset }{
-    #1 .bool_set:c =  { l_ltjpreset_#1_bool },
-    #2 .bool_set_inverse:c =  { l_ltjpreset_#1_bool },
-    #1 .default:n =  true,
-    #2 .default:n =  true,
+    #1 .bool_set:c =  { g_ltjpreset_#1_bool },
+    #2 .bool_set_inverse:c =  { g_ltjpreset_#1_bool },
+    #1 .default:n =  true, #2 .default:n =  true,
   }
 }
 
@@ -56,52 +97,53 @@
 \ltjpreset_declare_option:nn{jis2004}{\tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=JIS2004 }} % jis2004
 
 % font preset
-\bool_new:N \l_ltjpreset_office_bool  % MS Office の HG 系フォントを使っているか
-\bool_new:N \l_ltjpreset_noembed_bool % 非埋込か
-
-\prop_new:N \l_ltjpreset_font_prop
-\keys_define:nn { ltjpreset_set_font_list } {
+\prop_new:N \g_ltjpreset_font_prop
+\keys_define:nn { luatexja-preset } {
   mc .code:n =
-     \prop_put:Nnn \l_ltjpreset_font_prop { mc-l } {#1}
-     \prop_put:Nnn \l_ltjpreset_font_prop { mc-m } {#1}
-     \prop_put:Nnn \l_ltjpreset_font_prop { mc-bx } {#1},
+     \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},
+  mc .groups:n = { preset }, mc .value_required:n = true,
   gt .code:n =
-     \prop_put:Nnn \l_ltjpreset_font_prop { gt-u } {#1}
-     \prop_put:Nnn \l_ltjpreset_font_prop { gt-m } {#1}
-     \prop_put:Nnn \l_ltjpreset_font_prop { gt-bx } {#1}
-     \prop_put:Nnn \l_ltjpreset_font_prop { gt-eb } {#1},
-  unknown .code:n =
-   \prop_put:Non \l_ltjpreset_font_prop { \l_keys_key_tl } {#1}
+     \prop_put:Nnn \g_ltjpreset_font_prop { gt-u } {#1}
+     \prop_put:Nnn \g_ltjpreset_font_prop { gt-m } {#1}
+     \prop_put:Nnn \g_ltjpreset_font_prop { gt-bx } {#1}
+     \prop_put:Nnn \g_ltjpreset_font_prop { gt-eb } {#1},
+  gt .groups:n = { preset }, gt .value_required:n = true,
 }
-
-
-
-\cs_new:Npn \ltjpreset_set_uni:nn #1#2 {
-  \keys_set:nn { ltjpreset_set_font_list } {
-    mc = #1, gt = #2, mc-bx = #2, mg-m = #2,
+\cs_set:Nn \g_ltjpreset_tmp_cs:n {
+  \keys_define:nn { luatexja-preset } {
+    #1 .code:n = \prop_put:Non \g_ltjpreset_font_prop { #1 } { ##1 },
+    #1 .groups:n = { preset }, #1 .value_required:n = true,
   }
 }
-\cs_new:Npn \ltjpreset_set_multi:n #1 {
-  \keys_set:nn { ltjpreset_set_font_list } { #1 }
-  \bool_set_false:N \l_ltjpreset_office_bool
-  \bool_set_false:N \l_ltjpreset_noembed_bool
+\g_ltjpreset_tmp_cs:n { mc-l }
+\g_ltjpreset_tmp_cs:n { mc-m }
+\g_ltjpreset_tmp_cs:n { mc-bx }
+\g_ltjpreset_tmp_cs:n { gt-u }
+\g_ltjpreset_tmp_cs:n { gt-m }
+\g_ltjpreset_tmp_cs:n { gt-bx }
+\g_ltjpreset_tmp_cs:n { gt-eb}
+\g_ltjpreset_tmp_cs:n { mg-m }
+\cs_undefine:N \g_ltjpreset_tmp_cs:n
+
+\cs_new:Nn \ltjpreset_set_uni:nn {
+  mc = #1, gt = #2, mc-bx = #2, mg-m = #2,
+  __custom = false, __office = false, __noembed = false,
 }
 \cs_new:Npn \ltjpreset_set_office:nn #1 #2{
-  \ltjpreset_set_multi:n {
-    mc-m = #1,         mc-bx = HGMinchoE ,
-    gt-m = HGGothicM , gt-bx = HGGothicE ,
-    gt-u = #2 ,        gt-eb = HGSoeiKakugothicUB ,
-    mg-m = HGMaruGothicMPRO
-  }
-  \bool_set_true:N \l_ltjpreset_office_bool
+  mc   = #1,         mc-bx = HGMinchoE ,
+  gt-m = HGGothicM , gt-bx = HGGothicE ,
+  gt-u = #2 ,        gt-eb = HGSoeiKakugothicUB ,
+  mg-m = HGMaruGothicMPRO,
+  __custom = false, __office = true, __noembed = false,
 }
 
-
 %%%%%%%% プリセット達
 
 % カスタム指定
  \keys_define:nn { luatexja-preset }{
-    custom .code:n = \ltjpreset_set_multi:n { #1 },
+    custom .meta:n = { #1, __custom = true, }, 
     custom .value_required:n = true,
     jfm_yoko .tl_set:N = \ltjpreset_use_jfm_yoko_tl,
     jfm_tate .tl_set:N = \ltjpreset_use_jfm_tate_tl,
@@ -109,130 +151,116 @@
 
 % 小塚 (Adobe)
 %% Pro
-\ltjpreset_declare_option:nn{kozuka-pro}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{kozuka-pro}{
     mc-m =  KozMinPro-Regular, mc-bx = KozMinPro-Bold,
     gt-m =  KozGoPro-Regular,  gt-bx = 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_option:nn{kozuka-pr6}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{kozuka-pr6}{
     mc-m =  KozMinProVI-Regular, mc-bx = KozMinProVI-Bold,
     gt-m =  KozGoProVI-Regular,  gt-bx = 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_option:nn{kozuka-pr6n}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{kozuka-pr6n}{
     mc-m =  KozMinPr6N-Regular, mc-bx = KozMinPr6N-Bold,
     gt-m =  KozGoPr6N-Regular,  gt-bx = KozGoPr6N-Bold,
     gt-u =  KozGoPr6N-Medium,   gt-eb = KozGoPr6N-Heavy,
     mg-m =  KozGoPr6N-Heavy,    mc-l =  KozMinPr6N-Light,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
 
 % ヒラギノ (OSX)
-\ltjpreset_declare_option:nn{hiragino-pro}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{hiragino-pro}{
     mc-m = HiraMinPro-W3,  mc-bx = HiraMinPro-W6,
     gt-m = HiraKakuPro-W3, gt-bx = 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_option:nn{hiragino-pron}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{hiragino-pron}{
     mc-m = HiraMinProN-W3,  mc-bx = HiraMinProN-W6,
     gt-m = HiraKakuProN-W3, gt-bx = HiraKakuProN-W6,
     gt-u = HiraKakuProN-W6, gt-eb = HiraKakuStdN-W8,
     mg-m = HiraMaruProN-W4, mc-l =  HiraMinProN-W2,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
 
 % モリサワ
-\ltjpreset_declare_option:nn{morisawa-pro}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{morisawa-pro}{
     mc =   A-OTF-RyuminPro-Light.otf,      mc-bx = A-OTF-FutoMinA101Pro-Bold.otf,
     gt-m = A-OTF-GothicBBBPro-Medium.otf , gt-bx = 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_option:nn{morisawa-pr6n}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{morisawa-pr6n}{
     mc =   A-OTF-RyuminPr6N-Light.otf,      mc-bx = A-OTF-FutoMinA101Pr6N-Bold.otf,
     gt-m = A-OTF-GothicBBBPr6N-Medium.otf , gt-bx = 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,
 }
 
 % 游明朝/游ゴシック (Win8.1)
-\ltjpreset_declare_option:nn{yu-win}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{yu-win}{
     mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
     gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
     gt-u = YuGothic-Regular, gt-eb = YuGothic-Bold,
-    mg-m = YuGothic-Bold,    mc-l =  YuMincho-Light
-  }
+    mg-m = YuGothic-Bold,    mc-l =  YuMincho-Light,
+    __custom = false, __office = false, __noembed = false,
 }
 % Win10
-\ltjpreset_declare_option:nn{yu-win10}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{yu-win10}{
     mc-m = YuMincho-Regular, mc-bx = YuMincho-Demibold,
     gt-m = YuGothic-Regular, gt-bx = YuGothic-Bold,
     gt-u = YuGothic-Medium,  gt-eb = YuGothic-Bold,
-    mg-m = YuGothic-Bold,    mc-l =  YuMincho-Light
-  }
+    mg-m = YuGothic-Bold,    mc-l =  YuMincho-Light,
+    __custom = false, __office = false, __noembed = false,
 }
 
 % Yu fonts in OSX
 % according to http://support.apple.com/kb/HT5944
-\ltjpreset_declare_option:nn{yu-osx}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{yu-osx}{
     mc =  YuMincho~Medium, mc-bx = YuMincho~Demibold,
     gt-m =  YuGothic~Medium, gt-u =  YuGothic~Medium,
     gt-bx = YuGothic~Bold,   gt-eb = YuGothic~Bold,
-    mg-m =  YuGothic~Bold
-  }
+    mg-m =  YuGothic~Bold,
+    __custom = false, __office = false, __noembed = false,
 }
 
 % moga-mobo
-\ltjpreset_declare_option:nn{moga-mobo}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{moga-mobo}{
     mc =   Moga90Mincho, mc-bx = Moga90Mincho~Bold,
     gt-m = Moga90Gothic, gt-bx = Moga90Gothic~Bold,
     gt-u = Moga90Gothic, gt-eb = Moga90Gothic~Bold,
-    mg-m = Mobo90Gothic
-  }
+    mg-m = Mobo90Gothic,
+    __custom = false, __office = false, __noembed = false,
 }
-\ltjpreset_declare_option:nn{moga-mobo-ex}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{moga-mobo-ex}{
     mc =   MogaEx90Mincho, mc-bx = MogaEx90Mincho~Bold,
     gt-m = MogaEx90Gothic, gt-bx = MogaEx90Gothic~Bold,
     gt-u = MogaEx90Gothic, gt-eb = MogaEx90Gothic~Bold,
-    mg-m = MoboEx90Gothic
-  }
+    mg-m = MoboEx90Gothic,
+    __custom = false, __office = false, __noembed = false,
 }
 
 % Ume fones
-\ltjpreset_declare_option:nn{ume}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{ume}{
     mc = Ume~Mincho,
     gt-m = Ume~Gothic,    gt-bx = Ume~Gothic~O5,
     gt-u = Ume~Gothic~O5, gt-eb = Ume~Gothic~O5,
-    mg-m = Ume~Gothic~O4
-  }
+    mg-m = Ume~Gothic~O4,
+    __custom = false, __office = false, __noembed = false,
 }
 
 % Source Han {Serif,Sans}
-\ltjpreset_declare_option:nn{sourcehan}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{sourcehan}{
     mc-m =  Source~Han~Serif~Regular,
     mc-bx = Source~Han~Serif~Bold,
     gt-m =  Source~Han~Sans~Regular,
@@ -241,10 +269,9 @@
     gt-eb = Source~Han~Sans~Heavy,
     mg-m =  Source~Han~Sans~Heavy,
     mc-l =  Source~Han~Serif~Light,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
-\ltjpreset_declare_option:nn{sourcehan-jp}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{sourcehan-jp}{
     mc-m =  Source~Han~Serif~JP~Regular,
     mc-bx = Source~Han~Serif~JP~Bold,
     gt-m =  Source~Han~Sans~JP~Regular,
@@ -253,10 +280,9 @@
     gt-eb = Source~Han~Sans~JP~Heavy,
     mg-m =  Source~Han~Sans~JP~Heavy,
     mc-l =  Source~Han~Serif~JP~Light,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
-\ltjpreset_declare_option:nn{noto-otc}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{noto-otc}{
     mc-m =  Noto~Serif~CJK~Regular,
     mc-bx = Noto~Serif~CJK~Bold,
     gt-m =  Noto~Sans~CJK~Regular,
@@ -265,10 +291,9 @@
     gt-eb = Noto~Sans~CJK~Black,
     mg-m =  Noto~Sans~CJK~Black,
     mc-l =  Noto~Serif~CJK~Light,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
-\ltjpreset_declare_option:nn{noto-otf}{
-  \ltjpreset_set_multi:n {
+\ltjpreset_declare_preset:nx{noto-otf}{
     mc-m =  Noto~Serif~CJK~JP~Regular,
     mc-bx = Noto~Serif~CJK~JP~Bold,
     gt-m =  Noto~Sans~CJK~JP~Regular,
@@ -277,161 +302,127 @@
     gt-eb = Noto~Sans~CJK~JP~Black,
     mg-m =  Noto~Sans~CJK~JP~Black,
     mc-l =  Noto~Serif~CJK~JP~Light,
-  }
+    __custom = false, __office = false, __noembed = false,
 }
 
 
 % ipa, ipaex, ms
-\ltjpreset_declare_option:nn{ipa}{
+\ltjpreset_declare_preset:nx{ipa}{
   \ltjpreset_set_uni:nn { IPAMincho } { IPAGothic }
 }
-\ltjpreset_declare_option:nn{ipaex}{
+\ltjpreset_declare_preset:nx{ipaex}{
   \ltjpreset_set_uni:nn { IPAExMincho } { IPAExGothic }
 }
-\ltjpreset_declare_option:nn{ms}{
+\ltjpreset_declare_preset:nx{ms}{
   \ltjpreset_set_uni:nn { MS-Mincho } { MS-Gothic }
 }
 
 % {ipa,ipaex,ms}-dx % Office 付属フォントを利用
-\ltjpreset_declare_option:nn{ipaex-hg}{
+\ltjpreset_declare_preset:nx{ipaex-hg}{
   \ltjpreset_set_office:nn { IPAExMincho } { IPAExGothic }
 }
-\ltjpreset_declare_option:nn{ipa-hg}{
+\ltjpreset_declare_preset:nx{ipa-hg}{
   \ltjpreset_set_office:nn { IPAMincho } { IPAGothic }
 }
-\ltjpreset_declare_option:nn{ms-hg}{
+\ltjpreset_declare_preset:nx{ms-hg}{
   \ltjpreset_set_office:nn { MS-Mincho } { MS-Gothic }
 }
 
 
 % 非埋込
-\ltjpreset_declare_option:nn{noembed}{
-  \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium }
-  \bool_set_true:N \l_ltjpreset_noembed_bool
+\ltjpreset_declare_preset:nx{noembed}{
+  \ltjpreset_set_uni:nn { Ryumin-Light } { GothicBBB-Medium },
+  __custom = false, __office = false, __noembed = true,
 }
 
-\keys_set:nn { luatexja-preset }{ ipaex }
+\keys_set:nn {luatexja-preset} { ipaex }
 \ProcessKeysOptions { luatexja-preset }
-
-%%%%%%%% main routine
-
-\msg_new:nnn { luatexja-preset }{ ltj-fontspec }{
-  The~ luatexja-fontspec~ package~ is~ loaded~ already.~
-  Hence~ we~ ignore~ `nfssonly'~option.
-}
 \@ifpackageloaded{luatexja-fontspec}{
-  \bool_if:NT \l_ltjpreset_nfssonly_bool
+  \bool_if:NT \g_ltjpreset_nfssonly_bool
     { \msg_warning:nn { luatexja-preset }{ ltj-fontspec } }
-  \bool_set_false:N \l_ltjpreset_nfssonly_bool
+  \bool_set_false:N \g_ltjpreset_nfssonly_bool
 }{}
 
-\bool_new:N \l_ltjpreset_shape_nlck_bool
-%% KozMinPr6N, HiraMinProN-W3 の場合はjp04 feature がないので,nlck にする
-\tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
-\tl_if_eq:NNTF \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
-  \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \l_ltjpreset_font_prop { mc-m } }
-  \tl_if_in:NnT  \l_tmpb_tl { KozMinPr6N-Regular }
-   { \bool_set_true:N \l_ltjpreset_shape_nlck_bool }
-  \tl_if_in:NnT  \l_tmpb_tl { HiraMinProN-W3 }
-   { \bool_set_true:N \l_ltjpreset_shape_nlck_bool }
-  \tl_if_in:NnT  \l_tmpb_tl { Moga90Mincho }
-   {
-     \prop_clear:N \l_tmpa_prop
-     \prop_map_inline:Nn \l_ltjpreset_font_prop {
-       \tl_set:Nn \l_tmpb_tl { #2 }
-       \tl_remove_all:Nn \l_tmpb_tl {90}
-       \prop_put:Nnx \l_tmpa_prop { #1 } { \tl_use:N \l_tmpb_tl }
-     }
-     \prop_set_eq:NN \l_ltjpreset_font_prop \l_tmpa_prop
-     \tl_clear:N \l_ltjpreset_kanji_shape_tl
-   }
-  \tl_if_in:NnT  \l_tmpb_tl { MogaEx90Mincho }
-   {
-     \prop_clear:N \l_tmpa_prop
-     \prop_map_inline:Nn \l_ltjpreset_font_prop {
-       \tl_set:Nn \l_tmpb_tl { #2 }
-       \tl_remove_all:Nn \l_tmpb_tl {90}
-       \prop_put:Nnx \l_tmpa_prop { #1 } { \tl_use:N \l_tmpb_tl }
-     }
-     \prop_set_eq:NN \l_ltjpreset_font_prop \l_tmpa_prop
-     \tl_clear:N \l_ltjpreset_kanji_shape_tl
-   }
-}{
-  \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
-  \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
-    \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \l_ltjpreset_font_prop { mc-m } }
-    \tl_if_in:NnT  \l_tmpb_tl { Moga90Mincho }
-      { \tl_clear:N \l_ltjpreset_kanji_shape_tl }
-  }
-}
+%%%%%%%% main routine
 
-%%%%  リストからの展開
-% mc/m
-\cs_set:Nx \ltjpreset_font_mc_l:  { \prop_item:Nn \l_ltjpreset_font_prop { mc-l } }
-\cs_set:Nx \ltjpreset_font_mc_m:  { \prop_item:Nn \l_ltjpreset_font_prop { mc-m } }
-\cs_set:Nx \ltjpreset_font_mc_bx: { \prop_item:Nn \l_ltjpreset_font_prop { mc-bx } }
-\cs_set:Nx \ltjpreset_font_gt_m:  { \prop_item:Nn \l_ltjpreset_font_prop { gt-m } }
-\cs_set:Nx \ltjpreset_font_gt_u:  { \prop_item:Nn \l_ltjpreset_font_prop { gt-u } }
-\cs_set:Nx \ltjpreset_font_gt_bx: { \prop_item:Nn \l_ltjpreset_font_prop { gt-bx } }
-\cs_set:Nx \ltjpreset_font_gt_eb: { \prop_item:Nn \l_ltjpreset_font_prop { gt-eb } }
-\cs_set:Nx \ltjpreset_font_mg_m:  { \prop_item:Nn \l_ltjpreset_font_prop { mg-m } }
-
-%\prop_show:N \l_ltjpreset_font_prop 
-
-%% HG 系フォント + JIS2004/90JIS のときはフォント名を置換
-\bool_if:NT \l_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_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:
-    % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
+\cs_new:Nn \ltjpreset_extract_fonts: {
+  %% MogaMincho の場合は 90 をつける/はずす
+  \bool_if:NF \g_ltjpreset_custom_bool {
+    \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
+    \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
+      \tl_set:Nx \l_tmpb_tl { \prop_item:Nn \g_ltjpreset_font_prop { mc-m } }
+      \tl_if_in:NnT  \l_tmpb_tl { Moga90Mincho } {
+        \prop_clear:N \l_tmpa_prop
+        \prop_map_inline:Nn \g_ltjpreset_font_prop {
+           \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
+          \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
+         } 
+         \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
+       }
+       \tl_if_in:NnT  \l_tmpb_tl { MogaEx90Mincho } {
+         \prop_clear:N \l_tmpa_prop
+         \prop_map_inline:Nn \g_ltjpreset_font_prop {
+           \tl_set:Nn \l_tmpb_tl { ##2 } \tl_remove_all:Nn \l_tmpb_tl {90}
+           \prop_put:Nnx \l_tmpa_prop { ##1 } { \tl_use:N \l_tmpb_tl }
+         }
+         \prop_set_eq:NN \g_ltjpreset_font_prop \l_tmpa_prop
+       }
+    }
   }
-  \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_gt_eb: { hgrsgu.ttc }
-    \cs_set:Nx \ltjpreset_font_mg_m:  { hgrsmp.ttf }
+  %%%%  リストからの展開
+  \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_gt_m:  { \prop_item:Nn \g_ltjpreset_font_prop { gt-m } }
+  \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_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_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:
+      % HG ゴシックM のときはそうはいかないので 1 ウェイト時のゴシック体を使う
+    }
+    \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_gt_eb: { hgrsgu.ttc }
+      \cs_set:Nx \ltjpreset_font_mg_m:  { hgrsmp.ttf }
+    }
   }
-}
-
-% mc/l
-\tl_set:Nx \l_tmpa_tl { \ltjpreset_font_mc_l: }
-\tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}}
-\cs_set:Nx \ltjpreset_font_mc_l: {
-   \tl_if_blank:nTF \l_tmpa_tl { \ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl }
-}
-
-%% 90JIS/JIS2004 字形指定のオプション
-\bool_if:NTF \l_ltjpreset_nfssonly_bool {
-  \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
-  \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
-    \tl_set:Nn \l_ltjpreset_kanji_shape_tl { +jp90 }
+  % mc/l
+  \tl_set:Nx \l_tmpa_tl { \ltjpreset_font_mc_l: }
+  \tl_if_empty:NT \l_tmpa_tl {\tl_set:Nn \l_tmpa_tl {~}}
+  \cs_set:Nx \ltjpreset_font_mc_l: {
+    \tl_if_blank:nTF \l_tmpa_tl { \ltjpreset_font_mc_m: } {\tl_use:N \l_tmpa_tl }
   }
-  \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
-  \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
-    \bool_if:NTF \l_ltjpreset_shape_nlck_bool
-      { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { +nlck } }
-      { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { +jp04 } }
+  %% 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:
+    }
+  }{
+    \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_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:
   }
-} {
-  \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
-  \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
-    \bool_if:NT \l_ltjpreset_shape_nlck_bool
-      { \tl_set:Nn \l_ltjpreset_kanji_shape_tl { , CJKShape=NLC } }
-  }
 }
 
-
 %%%%%%%% 存在判定
 \cs_new:Nn \ltjpreset_substitute:nnnn {
   \group_begin:
     \suppressfontnotfounderror=1
-    \font \l_ltjpreset_font_test: = "\cs:w ltjpreset_font_#1_#2: \cs_end:"\relax
-    \ifx \l_ltjpreset_font_test: \nullfont
+    \font \g_ltjpreset_font_test: = "\cs:w ltjpreset_font_#1_#2: \cs_end:"\relax
+    \ifx \g_ltjpreset_font_test: \nullfont
       \msg_warning:nnxxxx { luatexja-preset }{ no-font }
         { \cs:w ltjpreset_font_#1_#2: \cs_end: }{ #1/#2 }
         { \cs:w ltjpreset_font_#3_#4: \cs_end: }{ #3/#4 }
@@ -440,180 +431,170 @@
   \group_end:
 }
 
-\msg_new:nnn { luatexja-preset }{ no-font }{
-  Font~ #1~ (#2)~ is~ not~found.~ Hence~ I~ substitute~ #3~ (#4)~ for~ it.
+%%%%%%%% 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  }
+  }
+  \def\ltdefault{l}
+  \DeclareRobustCommand\ltseries { \not at math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
+  \def\ebdefault{eb}
+  \DeclareRobustCommand\ebseries { \not at math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
+  \DeclareRobustCommand\gtebfamily { \gtfamily\fontseries{\ebdefault}\selectfont }
+} {
+  \cs_set_eq:NN \ltjpreset_check_deluxe_existence: \prg_do_nothing:
 }
-\bool_if:NT \l_ltjpreset_deluxe_bool {
-  \ltjpreset_substitute:nnnn { gt } { eb } { gt } { bx }
-  \ltjpreset_substitute:nnnn { mg } { m  } { gt } { bx }
-  \ltjpreset_substitute:nnnn { mc } { l  } { mc } { m  }
-}
 
+\bool_if:NTF \g_ltjpreset_nfssonly_bool {
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%% nfss only
-\bool_if:NTF \l_ltjpreset_nfssonly_bool {
-\msg_new:nnn { luatexja-preset }{ scale }{
-  Japanese~fonts~will~be~scaled~by~\fp_use:N \l_ltjpreset_scale_fp.
-}
-\msg_warning:nn { luatexja-preset }{ scale }
+  \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltjpreset_scale_fp }
 
-\cs_new:Nn \ltj_preset_define_family:nnn {
-  \DeclareFontShape{JY3}{#1}{#2}{n}{ <-> s*[\fp_use:N \l_ltjpreset_scale_fp]
-    {\bool_if:NT \l_ltjpreset_noembed_bool {psft:} "#3"
-    : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl
-    ; script=hani \bool_if:NT \l_ltjpreset_expert_bool { ;+hkna }}
-  } {}
-  \DeclareFontShape{JT3}{#1}{#2}{n}{ <-> s*[\fp_use:N \l_ltjpreset_scale_fp]
-    {\bool_if:NT \l_ltjpreset_noembed_bool {psft:} "#3"
-    : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl;
-    ; script=hani \bool_if:NT \l_ltjpreset_expert_bool { ;+vkna }}
-  } {}
-  \bool_if:NT \l_ltjpreset_expert_bool {
-    \DeclareFontShape{JY3}{#1}{#2}{rb}{ <-> s*[\fp_use:N \l_ltjpreset_scale_fp]
-      {\bool_if:NT \l_ltjpreset_noembed_bool {psft:} "#3"
-      : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl ;+ruby
-      ; script=kana}
-    } {}
-    \DeclareFontShape{JT3}{#1}{#2}{rb}{ <-> s*[\fp_use:N \l_ltjpreset_scale_fp]
-      {\bool_if:NT \l_ltjpreset_noembed_bool {psft:} "#3"
-      : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl ;+ruby
-      ; script=kana}
-    } {}
+  \cs_new:Nn \ltj_preset_declare_font_shape:nnnnnn {
+    \cs_if_exist:cT { #1/#2/#3/#4/10 } { \cs_undefine:c { #1/#2/#3/#4/10 } }
+    \DeclareFontShape{#1}{#2}{#3}{#4}{ <-> s*[\fp_use:N \g_ltjpreset_scale_fp]
+      { \bool_if:NT \g_ltjpreset_noembed_bool {psft:} #5
+	;-kern \tl_use:N \l_ltjpreset_kanji_shape_tl; #6 } } {}
   }
-}
+  \cs_new:Nn \ltj_preset_define_family:nnn {
+    \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { n }
+      { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl }
+      { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+hkna } }
+    \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { n }
+      { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl }
+      { script=hani \bool_if:NT \g_ltjpreset_expert_bool { ;+vkna } }
+    \bool_if:NT \g_ltjpreset_expert_bool {
+      \ltj_preset_declare_font_shape:nnnnnn { JY3 } { #1 } { #2 } { rb }
+        { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_yoko_tl } { script=kana; +ruby }
+      \ltj_preset_declare_font_shape:nnnnnn { JT3 } { #1 } { #2 } { rb }
+        { "#3" : jfm=\tl_use:N \ltjpreset_use_jfm_tate_tl } { script=kana; +ruby }
+    }
+  }
 
-\DeclareKanjiFamily{JY3}{ltjpm}{}\DeclareKanjiFamily{JT3}{ltjpm}{}
-\DeclareKanjiFamily{JY3}{ltjpg}{}\DeclareKanjiFamily{JT3}{ltjpg}{}
+  \DeclareKanjiFamily{JY3}{ltjpm}{}\DeclareKanjiFamily{JT3}{ltjpm}{}
+  \DeclareKanjiFamily{JY3}{ltjpg}{}\DeclareKanjiFamily{JT3}{ltjpg}{}
+  \def\mcdefault{ltjpm}\def\gtdefault{ltjpg}
+  \SetSymbolFont{mincho}{normal}{JY3}{ltjpm}{m}{n}
+  \SetSymbolFont{mincho}{bold}{JY3}{ltjpm}{bx}{n}
+  \DeclareMathAlphabet{\mathgt}{JY3}{ltjpg}{m}{n}
+  \bool_if:NT \g_ltjpreset_expert_bool {
+    \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont }
+  }
 
-\bool_if:NTF \l_ltjpreset_deluxe_bool {
-  \bool_if:NT \l_ltjpreset_bold_bool {
-    \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx:
+  \bool_if:NT \g_ltjpreset_deluxe_bool {
+    \DeclareKanjiFamily{JY3}{ltjpmg}{}\DeclareKanjiFamily{JT3}{ltjpmg}{}
+    \DeclareRobustCommand\mgfamily {
+      \not at math@alphabet\mgfamily\relax\kanjifamily{ltjpmg}\selectfont
+    }
+    \DeclareTextFontCommand{\textmg}{\mgfamily}
   }
-}{
-  \bool_if:NTF \l_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_u:
+  %
+  \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
+    \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS1990 }
+    \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
+      \tl_set:Nn \l_ltjpreset_kanji_shape_tl { ;+jp90 }
+    }
+    \tl_set:Nn \l_tmpa_tl {, CJKShape=JIS2004 }
+    \tl_if_eq:NNT \l_ltjpreset_kanji_shape_tl \l_tmpa_tl {
+      \tl_set:Nx \l_ltjpreset_kanji_shape_tl { ;+jp04 }
+    }
+    \ltj_preset_define_family:nnn {ltjpm} {m}  {\ltjpreset_font_mc_m:}
+    \ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:}
+    \ltj_preset_define_family:nnn {ltjpg} {m}  {\ltjpreset_font_gt_m:}
+    \ltj_preset_define_family:nnn {ltjpg} {bx} {\ltjpreset_font_gt_bx:}
+    \normalfont
+    \bool_if:NT \g_ltjpreset_deluxe_bool {
+      \ltj_preset_define_family:nnn {ltjpm}  {l} {\ltjpreset_font_mc_l:}
+      \ltj_preset_define_family:nnn {ltjpg}  {eb} {\ltjpreset_font_gt_eb:}
+      \ltj_preset_define_family:nnn {ltjpmg} {m}  {\ltjpreset_font_mg_m:}
+    }
+    \group_end:
   }
-  \cs_set_eq:NN \ltjpreset_font_gt_bx: \ltjpreset_font_gt_m:
-  \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_m:
-}
-
-\ltj_preset_define_family:nnn {ltjpm} {m}  {\ltjpreset_font_mc_m:}
-\ltj_preset_define_family:nnn {ltjpm} {bx} {\ltjpreset_font_mc_bx:}
-\ltj_preset_define_family:nnn {ltjpg} {m}  {\ltjpreset_font_gt_m:}
-\ltj_preset_define_family:nnn {ltjpg} {bx} {\ltjpreset_font_gt_bx:}
-
-\def\mcdefault{ltjpm}\def\gtdefault{ltjpg}
-\normalfont
-
-\SetSymbolFont{mincho}{normal}{JY3}{ltjpm}{m}{n}
-\SetSymbolFont{mincho}{bold}{JY3}{ltjpm}{bx}{n}
-\DeclareMathAlphabet{\mathgt}{JY3}{ltjpg}{m}{n}
-
-\bool_if:NT \l_ltjpreset_expert_bool {
-  \DeclareRobustCommand\rubyfamily { \kanjishape{rb}\selectfont }
-}
-
-\bool_if:NTF \l_ltjpreset_deluxe_bool {
-  \DeclareKanjiFamily{JY3}{ltjpmg}{}\DeclareKanjiFamily{JT3}{ltjpmg}{}
-  \def\ltdefault{l}
-  \DeclareRobustCommand\ltseries { \not at math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
-  \ltj_preset_define_family:nnn {ltjpm}  {l} {\ltjpreset_font_mc_l:}
-  \def\ebdefault{eb}
-  \DeclareRobustCommand\ebseries { \not at math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
-  \DeclareRobustCommand\gtebfamily { \kanjifamily{ltjpg}\fontseries{\ebdefault}\selectfont }
-  \DeclareTextFontCommand{\textgteb}{\gtebfamily}
-  \ltj_preset_define_family:nnn {ltjpg}  {eb} {\ltjpreset_font_gt_eb:}
-  \DeclareRobustCommand\mgfamily { \not at math@alphabet\mgfamily\relax\kanjifamily{ltjpmg}\selectfont }
-  \DeclareTextFontCommand{\textmg}{\mgfamily}
-  \ltj_preset_define_family:nnn {ltjpmg} {m}  {\ltjpreset_font_mg_m:}
-}
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%% fontspec
 } {
-\PassOptionsToPackage { scale = \fp_use:N \l_ltjpreset_scale_fp } { luatexja-fontspec }
-\RequirePackage{luatexja-fontspec}
-% scale
-\msg_new:nnn { luatexja-preset }{ scale }{
-  Japanese~fonts~will~be~scaled~by~\fp_use:N \g_ltj_fontspec_scale_fp.
-}
-\msg_warning:nn { luatexja-preset }{ scale }
+  \PassOptionsToPackage { scale = \fp_use:N \g_ltjpreset_scale_fp } { luatexja-fontspec }
+  \RequirePackage{luatexja-fontspec}
+  % scale
+  \msg_warning:nnx { luatexja-preset }{ scale }{ \fp_use:N \g_ltj_fontspec_scale_fp }
+  \tl_new:N \l_ltjpreset_add_features_tl
 
-% expert 用設定
-\tl_new:N \l_ltjpreset_add_features_tl
-
-\tl_set:Nx \l_ltjpreset_add_features_tl {
-  \tl_use:N \l_ltjpreset_kanji_shape_tl,
-  YokoFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_yoko_tl },
-  TateFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_tate_tl },
-  Script=CJK,
+  \bool_if:NT \g_ltjpreset_expert_bool {
+    \cs_set:Npn \rubyfamily { \addjfontfeatures {
+      Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna}
+    } }
+  }
+  \addjfontfeature{ Kerning=Off }
+  % 実際の fontspec の呼びだし
+  \cs_new:Nn \ltjpreset_do_fontset: { \group_begin:
+      \tl_gset:Nx \l_ltjpreset_add_features_tl {
+        \tl_use:N \l_ltjpreset_kanji_shape_tl,
+        YokoFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_yoko_tl },
+        TateFeatures = { JFM = \tl_use:N \ltjpreset_use_jfm_tate_tl },
+        Script=CJK, \bool_if:NT \g_ltjpreset_noembed_bool { , NoEmbed }
+      }
+    \group_end:
+    \bool_if:NT \g_ltjpreset_expert_bool {
+      \tl_put_left:Nn \l_ltjpreset_add_features_tl {
+        , YokoFeatures = {Style = HorizontalKana}, TateFeatures = {Style = VerticalKana}
+      }
+    }
+    \setmainjfont [
+      \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={l}{n}{\ltjpreset_font_mc_l:}, }
+      BoldFont = \ltjpreset_font_mc_bx: \tl_use:N \l_ltjpreset_add_features_tl
+    ] { \ltjpreset_font_mc_m: }
+    \setsansjfont [
+      \bool_if:NT \g_ltjpreset_deluxe_bool { FontFace={eb}{n}{\ltjpreset_font_gt_eb:}, }
+      BoldFont = \ltjpreset_font_gt_bx: \tl_use:N \l_ltjpreset_add_features_tl
+    ] { \ltjpreset_font_gt_m: }
+    \bool_if:NT \g_ltjpreset_deluxe_bool {
+      %% mg
+      \newjfontfamily \mgfamily [
+        BoldFont = \ltjpreset_font_mg_m: \tl_use:N \l_ltjpreset_add_features_tl
+      ] { \ltjpreset_font_mg_m: }
+      \DeclareTextFontCommand{\textmg}{\mgfamily}
+    }
+  }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 }
 
-\bool_if:NT \l_ltjpreset_expert_bool {
-  \cs_set:Npn \rubyfamily { \addjfontfeatures {
-    Style=Ruby , YokoFeatures={RawFeature=-hkna} , TateFeatures={RawFeature=-vkna}
-  } }
-  \tl_put_left:Nn \l_ltjpreset_add_features_tl {
-    YokoFeatures = {Style = HorizontalKana},
-    TateFeatures = {Style = VerticalKana},
+\def\ltjnewpreset{
+    \@ifstar{\ltjpreset_new_preset:nnn{ true }}{\ltjpreset_new_preset:nnn{ false }}}
+\cs_set:Nn \ltjpreset_new_preset:nnn {
+  \keys_if_exist:nnTF { luatexja-preset } { #2 } {
+    \seq_if_in:NnTF \g_ltjpreset_presets_seq { #2 } {
+      \bool_if:cTF { c_ #1 _bool } {
+        \msg_warning:nnn { luatexja-preset }{ exist-preset-overwrite } { #2 }
+      } {
+        \msg_error:nnn { luatexja-preset }{ exist-preset-nooverwrite } { #2 }
+      }
+    } {
+      \msg_error:nnn { luatexja-preset }{ illegal-preset-name } { #2 }
+    }
+  } {
+    \keys_define:nn { luatexja-preset } {
+      #2 .meta:n = { #3, __custom = true, __noembed = false, __office = false, },
+      #2 .value_forbidden:n = true, #2 .groups:n = { preset },
+    }
+    \seq_put_right:Nn \g_ltjpreset_presets_seq { #2 }
   }
 }
 
-% (丸)ゴシック体の設定: bold option もここで
-\bool_if:NTF \l_ltjpreset_deluxe_bool {
-%% mg
- \newjfontfamily \mgfamily [
-      BoldFont = \ltjpreset_font_mg_m:,
-      \bool_if:NT \l_ltjpreset_noembed_bool { NoEmbed,  }
-      \tl_use:N \l_ltjpreset_add_features_tl
-    ] { \ltjpreset_font_mg_m: }
-    \DeclareTextFontCommand{\textmg}{\mgfamily}
-%% gt/eb
-  \def\ebdefault{eb}
-  \DeclareRobustCommand\ebseries { \not at math@alphabet\ebseries\relax\fontseries\ebdefault\selectfont }
-  \DeclareRobustCommand\gtebfamily { \kanjifamily{\gtdefault}\fontseries{\ebdefault}\selectfont }
-  \DeclareTextFontCommand{\textgteb}{\gtebfamily}
-%% mc/l
-  \def\ltdefault{l}
-  \DeclareRobustCommand\ltseries { \not at math@alphabet\ltseries\relax\fontseries\ltdefault\selectfont }
-  \bool_if:NT \l_ltjpreset_bold_bool {
-    \cs_set_eq:NN \ltjpreset_font_mc_bx: \ltjpreset_font_gt_bx:
-  }
-}{
-  \bool_if:NTF \l_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_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:Npn \ltjapplypreset #1 {
+  \keys_set_groups:nnn { luatexja-preset } { preset } { #1 }
+  \ltjpreset_extract_fonts:
+  \ltjpreset_check_deluxe_existence:
+  \ltjpreset_do_fontset:
+  \normalfont
 }
 
+\ltjapplypreset {}
 
-% 実際の fontspec の呼びだし
+\@onlypreamble\ltjnewpreset
+\@onlypreamble\ltjapplypreset
 
-\addjfontfeature{ Kerning=Off }
+\ExplSyntaxOff
 
-\setmainjfont [
-  \bool_if:NT \l_ltjpreset_deluxe_bool {
-    FontFace={l}{n}{\ltjpreset_font_mc_l:},
-  }
-  BoldFont = \ltjpreset_font_mc_bx:
-  \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
-  \tl_use:N \l_ltjpreset_add_features_tl
-] { \ltjpreset_font_mc_m: }
-\setsansjfont [
-  \bool_if:NT \l_ltjpreset_deluxe_bool {
-    FontFace={eb}{n}{\ltjpreset_font_gt_eb:},
-  }
-  BoldFont = \ltjpreset_font_gt_bx:
-  \bool_if:NT \l_ltjpreset_noembed_bool { , NoEmbed },
-  \tl_use:N \l_ltjpreset_add_features_tl
-] { \ltjpreset_font_gt_m: }
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-}
-\ExplSyntaxOff
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -67,13 +67,13 @@
          [2] = { 0, 0, 0, kanjiskip_shrink=1 },
 	 [3] = { 0.25, 0.0, 0.25, priority=1, ratio=1 },
          [4] = { 0, 0, 0, kanjiskip_shrink=1 },
-	 [5] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [105] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [6] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [7] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [107] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [207] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
-	 [8] = { 0.5 , 0.0, 0.5, rario=0, kanjiskip_stretch=1 },
+	 [5] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [105] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [6] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [7] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [107] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [207] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
+	 [8] = { 0.5 , 0.0, 0.5, ratio=0, kanjiskip_stretch=1 },
       }
    },
 
@@ -137,7 +137,7 @@
 
    [5] = { -- -- 二分(二重)ダッシュ
       chars = { '゠', '–' },
-      align = 'center', left = 0.0, down = 0.0,
+      align = 'middle', left = 0.0, down = 0.0,
       width = 0.50, height = 0.50, depth = 0.50, italic=0.0,
       glue = {
 	 [1] = { 0.5 , 0.0, 0.5, ratio=1, kanjiskip_stretch=1 },

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/lltjext.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjext}[2017/07/26 v1.2g-ltj-7 Macros for vertical writing]
+\ProvidesPackage{lltjext}[2017/08/27 v1.2g-ltj-8 Macros for vertical writing]
 \RequirePackage{luatexja}
 \newcount\ltj at ext@dir
 {\catcode`\*=11
@@ -19,11 +19,11 @@
  \ltj at ext@dir=\ltjgetparameter{direction}\relax\X at tabarray}
 \def\tabular{\let\@halignto\@empty\X at tabular}
 \@namedef{tabular*}{\@ifnextchar<%>
-   {\@stabular}{\@stabular<z>}}
+   {\@stabular}{\@stabular<Z>}}
 \def\X at tabarray{\@ifnextchar<%>
-   {\p at tabarray}{\p at tabarray<z>}}
+   {\p at tabarray}{\p at tabarray<Z>}}
 \def\X at tabular{\@ifnextchar<%>
-   {\p at tabular}{\p at tabular<z>}}
+   {\p at tabular}{\p at tabular<Z>}}
 \def\@stabular<#1>#2{%
    \setlength\dimen@{#2}%
    \edef\@halignto{to\the\dimen@}\p at tabular<#1>}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -200,14 +200,21 @@
       elseif v=='adj' then
          v,name = get_adjust_dir_count(), nil
       end
+      local current_nest = tex_nest[lv]
       if tex.currentgrouptype==6 then
 	 ltjb.package_error(
                  'luatexja',
                  "You can't use `\\" .. name .. "' in an align",
-		 "To change direction in an align, \n"
-		    .. "you shold use \\hbox or \\vbox.")
+		 "To change the direction in an align, \n"
+		 .. "you shold use \\hbox or \\vbox.")
+      elseif current_nest.mode == ltjs.hmode or abs(current_nest.mode) == ltjs.mmode then
+	 ltjb.package_error(
+                 'luatexja',
+		 "Improper `\\" .. name .. "'",
+		 'You cannot change the direction in unrestricted horizontal mode \n'
+		 .. 'nor math modes.')
       else
- 	 local h = (lv==0) and tex.lists.page_head or tex_nest[lv].head.next
+	 local h = (lv==0) and tex.lists.page_head or current_nest.head.next
 	 local flag,w = test_list(h,lv)
 	 if flag==0 then
 	    if lv==0 and not page_direction then
@@ -225,12 +232,12 @@
 	 elseif lv==0 then
 	    page_direction = v
 	 else -- flag == 2: need to create dir whatsit.
-	    local h = tex_nest[lv].head
+	    local h = current_nest.head
 	    local hn = node.next(h)
 	    hn = (hn and hn.id==id_local) and hn or h
 	    local w = to_node(dir_pool[v]())
 	    insert_after_node(h,hn,w)
-	    tex_nest[lv].tail = node_tail_node(w)
+	    current_nest.tail = node_tail_node(w)
 	 end
          ensure_tex_attr(attr_icflag, 0)
       end

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -127,19 +127,24 @@
 
 
 -- penalty 値の計算
-local function add_penalty(p,e)
-   local pp = getfield(p, 'penalty')
-   if pp>=10000 then
-      if e<=-10000 then setfield(p, 'penalty', 0) end
-   elseif pp<=-10000 then
-      if e>=10000 then  setfield(p, 'penalty', 0) end
-   else
-      pp = pp + e
-      if pp>=10000 then      setfield(p, 'penalty', 10000)
-      elseif pp<=-10000 then setfield(p, 'penalty', -10000)
-      else                   setfield(p, 'penalty', pp) end
+local add_penalty
+do
+local setpenalty = node.direct.setpenalty or function(n, a) setfield(n,'penalty',a) end
+local getpenalty = node.direct.getpenalty or function(n) return getfield(n,'penalty') end
+function add_penalty(p,e)
+   local pp = getpenalty(p)
+   if (pp>-10000) and (pp<10000) then
+      if e>=10000 then       setpenalty(p, 10000)
+      elseif e<=-10000 then  setpenalty(p, -10000)
+      else
+         pp = pp + e
+         if pp>=10000 then      setpenalty(p, 10000)
+         elseif pp<=-10000 then setpenalty(p, -10000)
+	 else                   setpenalty(p, pp) end
+      end
    end
 end
+end
 
 -- 「異なる JFM」の間の調整方法
 diffmet_rule = math.two_paverage

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2017/05/05',
+  date = '2017/09/04',
   description = 'Loader for Japanese fonts',
 })
 module('luatexja.jfont', package.seeall)
@@ -42,7 +42,7 @@
 
 local jfm_file_name, jfm_var, jfm_ksp
 local defjfm_res
-local jfm_dir, is_def_jfont, is_vert_enabled
+local jfm_dir, is_def_jfont, is_vert_enabled, auto_enable_vrt2
 
 local function norm_val(a)
    if (not a) or (a==0.) then
@@ -300,6 +300,7 @@
 
 -- EXT
    local identifiers = fonts.hashes.identifiers
+   local provides_feature = luaotfload.aux.provides_feature
    function jfontdefY()
       local j = load_jfont_metric(jfm_dir)
       local fn = font.id(cstemp)
@@ -328,6 +329,14 @@
                         chars_cbcache = {},
 			vert_activated = is_vert_enabled,
       }
+      if auto_enable_vrt2 then
+         local t = identifiers[fn]
+         local lang, scr = t.properties.language, t.properties.script
+         local vrt2_exist = provides_feature(
+           fn, t.properties.script, t.properties.language, 'vrt2'
+         )
+         t.shared.features[vrt2_exist and 'vrt2' or 'vert'] = true
+      end
 
       fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn)
       font_metric_table[fn]=fmtable
@@ -334,6 +343,7 @@
       tex.sprint(cat_lp, global_flag, '\\protected\\expandafter\\def\\csname ',
 		    (cstemp==' ') and '\\space' or cstemp, '\\endcsname{\\ltj at cur'..
 		    (jfm_dir == 'yoko' and 'j' or 't') .. 'fnt', fn, '\\relax}')
+      jfm_file_name = nil
    end
 end
 
@@ -355,11 +365,19 @@
 end
 
 do
+   local gmatch = string.gmatch
    -- extract jfm_file_name and jfm_var
    -- normalize position of 'jfm=' and 'jfmvar=' keys
    local function extract_metric(name)
-      local is_braced = name:match('^{(.*)}$')
-       name= is_braced or name
+      do
+         local nametemp
+	 nametemp = name:match('^{(.*)}$')
+	 if nametemp then name = nametemp
+         else
+  	    nametemp = name:match('^"(.*)"$')
+	    name = nametemp or name
+         end
+      end
       jfm_file_name = ''; jfm_var = ''; jfm_ksp = true
       local tmp, index = name:sub(1, 5), 1
       if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then
@@ -368,7 +386,7 @@
       local p = name:find(":", index); index = p and (p+1) or index
       while index do
 	 local l = name:len()+1
-	 local q = name:find(";", index+1) or l
+	 local q = name:find(";", index) or l
 	 if name:sub(index, index+3)=='jfm=' and q>index+4 then
 	    jfm_file_name = name:sub(index+4, q-1)
 	    if l~=q then
@@ -398,18 +416,17 @@
 	    name = name .. 'jfmvar=' .. jfm_var
 	 end
       end
-      for x in string.gmatch (name, "[:;]([+%%-]?)ltjks") do
+      for x in gmatch (name, "[:;]([+%%-]?)ltjks") do
 	 jfm_ksp = not (x=='-')
       end
       if jfm_dir == 'tate' then
 	 is_vert_enabled = (not name:match('[:;]%-vert')) and (not  name:match('[:;]%-vrt2'))
-         if not name:match('vert') and not name:match('vrt2') then
-            name = name .. ';+vert;+vrt2'
-         end
+	 auto_enable_vrt2 
+	   = (not name:match('[:;][+%-]?vert')) and (not name:match('[:;][+%-]?vrt2'))
       else
-	 is_vert_enabled = nil
+	 is_vert_enabled, auto_enable_vrt2 = nil, nil
       end
-      return is_braced and ('{' .. name .. '}') or name
+      return name
    end
 
    -- define_font callback
@@ -705,18 +722,6 @@
 end
 
 ------------------------------------------------------------------------
--- VERT VARIANT TABLE
-------------------------------------------------------------------------
-local vert_form_table = {
-   [0x2013]=0xFE32, [0x2014]=0xFE31, [0x2025]=0xFE30,
-   [0xFF08]=0xFE35, [0xFF09]=0xFE36, [0xFF5B]=0xFE37, [0xFF5D]=0xFE38,
-   [0x3014]=0xFE39, [0x3015]=0xFE3A, [0x3010]=0xFE3B, [0x3011]=0xFE3C,
-   [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40,
-   [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44,
-   [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, [0xFF3F]=0xFE33,
-}
-
-------------------------------------------------------------------------
 -- 追加のフォント情報
 ------------------------------------------------------------------------
 font_extra_info = {}
@@ -723,7 +728,58 @@
 local font_extra_info = font_extra_info -- key: fontnumber
 local font_extra_basename = {} -- key: basename
 
--- IVS and vertical metrics
+local list_rotate_glyphs
+do
+   -- output of function_uax50.lua
+   -- UAX#50 for Unicode  10.0.0
+   -- t[0] = true
+   local t={ 0, 167, 168, 169, 170, 174, 175, 177, 178, 188, 191, 215, 216, 247, 248, 746, 748, 888, 890, 896, 900, 907, 908, 909, 910, 930, 931, 1328, 1329, 1367, 1369, 1376, 1377, 1416, 1417, 1419, 1421, 1424, 1425, 1480, 1488, 1515, 1520, 1525, 1536, 1565, 1566, 1806, 1807, 1867, 1869, 1970, 1984, 2043, 2048, 2094, 2096, 2111, 2112, 2140, 2142, 2143, 2144, 2155, 2208, 2229, 2230, 2238, 2260, 2436, 2437, 2445, 2447, 2449, 2451, 2473, 2474, 2481, 2482, 2483, 2486, 2490, 2492, 2501, 2503, 2505, 2507, 2511, 2519, 2520, 2524, 2526, 2527, 2532, 2534, 2558, 2561, 2564, 2565, 2571, 2575, 2577, 2579, 2601, 2602, 2609, 2610, 2612, 2613, 2615, 2616, 2618, 2620, 2621, 2622, 2627, 2631, 2633, 2635, 2638, 2641, 2642, 2649, 2653, 2654, 2655, 2662, 2678, 2689, 2692, 2693, 2702, 2703, 2706, 2707, 2729, 2730, 2737, 2738, 2740, 2741, 2746, 2748, 2758, 2759, 2762, 2763, 2766, 2768, 2769, 2784, 2788, 2790, 2802, 2809, 2816, 2817, 2820, 2821, 2829, 2831, 2833, 2835, 2857, 2858, 2865, 2866, 2868, 2869, 2874, 2876, 2885, 2887, 2889, 2891, 2894, 2902, 2904, 2908, 2910, 2911, 2916, 2918, 2936, 2946, 2948, 2949, 2955, 2958, 2961, 2962, 2966, 2969, 2971, 2972, 2973, 2974, 2976, 2979, 2981, 2984, 2987, 2990, 3002, 3006, 3011, 3014, 3017, 3018, 3022, 3024, 3025, 3031, 3032, 3046, 3067, 3072, 3076, 3077, 3085, 3086, 3089, 3090, 3113, 3114, 3130, 3133, 3141, 3142, 3145, 3146, 3150, 3157, 3159, 3160, 3163, 3168, 3172, 3174, 3184, 3192, 3204, 3205, 3213, 3214, 3217, 3218, 3241, 3242, 3252, 3253, 3258, 3260, 3269, 3270, 3273, 3274, 3278, 3285, 3287, 3294, 3295, 3296, 3300, 3302, 3312, 3313, 3315, 3328, 3332, 3333, 3341, 3342, 3345, 3346, 3397, 3398, 3401, 3402, 3408, 3412, 3428, 3430, 3456, 3458, 3460, 3461, 3479, 3482, 3506, 3507, 3516, 3517, 3518, 3520, 3527, 3530, 3531, 3535, 3541, 3542, 3543, 3544, 3552, 3558, 3568, 3570, 3573, 3585, 3643, 3647, 3676, 3713, 3715, 3716, 3717, 3719, 3721, 3722, 3723, 3725, 3726, 3732, 3736, 3737, 3744, 3745, 3748, 3749, 3750, 3751, 3752, 3754, 3756, 3757, 3770, 3771, 3774, 3776, 3781, 3782, 3783, 37!
 84, 3790, 3792, 3802, 3804, 3808, 3840, 3912, 3913, 3949, 3953, 3992, 3993, 4029, 4030, 4045, 4046, 4059, 4096, 4294, 4295, 4296, 4301, 4302, 4304, 4352, 4608, 4681, 4682, 4686, 4688, 4695, 4696, 4697, 4698, 4702, 4704, 4745, 4746, 4750, 4752, 4785, 4786, 4790, 4792, 4799, 4800, 4801, 4802, 4806, 4808, 4823, 4824, 4881, 4882, 4886, 4888, 4955, 4957, 4989, 4992, 5018, 5024, 5110, 5112, 5118, 5120, 5121, 5760, 5789, 5792, 5881, 5888, 5901, 5902, 5909, 5920, 5943, 5952, 5972, 5984, 5997, 5998, 6001, 6002, 6004, 6016, 6110, 6112, 6122, 6128, 6138, 6144, 6159, 6160, 6170, 6176, 6264, 6272, 6315, 6400, 6431, 6432, 6444, 6448, 6460, 6464, 6465, 6468, 6510, 6512, 6517, 6528, 6572, 6576, 6602, 6608, 6619, 6622, 6684, 6686, 6751, 6752, 6781, 6783, 6794, 6800, 6810, 6816, 6830, 6832, 6847, 6912, 6988, 6992, 7037, 7040, 7156, 7164, 7224, 7227, 7242, 7245, 7305, 7360, 7368, 7376, 7418, 7424, 7674, 7675, 7958, 7960, 7966, 7968, 8006, 8008, 8014, 8016, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8062, 8064, 8117, 8118, 8133, 8134, 8148, 8150, 8156, 8157, 8176, 8178, 8181, 8182, 8191, 8192, 8214, 8215, 8224, 8226, 8240, 8242, 8251, 8253, 8258, 8259, 8263, 8266, 8273, 8274, 8293, 8294, 8306, 8308, 8335, 8336, 8349, 8352, 8384, 8400, 8413, 8417, 8418, 8421, 8433, 8450, 8451, 8458, 8463, 8464, 8467, 8469, 8470, 8472, 8478, 8484, 8485, 8486, 8487, 8488, 8489, 8490, 8494, 8495, 8501, 8512, 8517, 8523, 8524, 8526, 8527, 8586, 8588, 8592, 8734, 8735, 8756, 8758, 8960, 8968, 8972, 8992, 8996, 9001, 9003, 9004, 9085, 9115, 9150, 9166, 9167, 9168, 9169, 9180, 9186, 9251, 9252, 9472, 9632, 9754, 9760, 10088, 10102, 10132, 11026, 11056, 11088, 11098, 11124, 11126, 11158, 11160, 11192, 11218, 11219, 11244, 11248, 11264, 11311, 11312, 11359, 11360, 11508, 11513, 11558, 11559, 11560, 11565, 11566, 11568, 11624, 11631, 11633, 11647, 11671, 11680, 11687, 11688, 11695, 11696, 11703, 11704, 11711, 11712, 11719, 11720, 11727, 11728, 11735, 11736, 11743, 11744, 11850, 12296, 12306, 12308, 12320, 12336, 12337, 12448, 12449, 12540, 12541, 42192, !
 42540, 42560, 42744, 42752, 42927, 42928, 42936, 42999, 43052, 43056, 43066, 43072, 43128, 43136, 43206, 43214, 43226, 43232, 43262, 43264, 43348, 43359, 43360, 43392, 43470, 43471, 43482, 43486, 43519, 43520, 43575, 43584, 43598, 43600, 43610, 43612, 43715, 43739, 43767, 43777, 43783, 43785, 43791, 43793, 43799, 43808, 43815, 43816, 43823, 43824, 43878, 43888, 44014, 44016, 44026, 55296, 57344, 64256, 64263, 64275, 64280, 64285, 64311, 64312, 64317, 64318, 64319, 64320, 64322, 64323, 64325, 64326, 64450, 64467, 64832, 64848, 64912, 64914, 64968, 65008, 65022, 65024, 65040, 65056, 65072, 65097, 65104, 65112, 65119, 65123, 65127, 65136, 65141, 65142, 65277, 65279, 65280, 65288, 65290, 65293, 65294, 65306, 65311, 65339, 65340, 65341, 65342, 65343, 65344, 65371, 65471, 65474, 65480, 65482, 65488, 65490, 65496, 65498, 65501, 65507, 65508, 65512, 65519, 65529, 65532, 65536, 65548, 65549, 65575, 65576, 65595, 65596, 65598, 65599, 65614, 65616, 65630, 65664, 65787, 65792, 65795, 65799, 65844, 65847, 65935, 65936, 65948, 65952, 65953, 66000, 66046, 66176, 66205, 66208, 66257, 66272, 66300, 66304, 66340, 66349, 66379, 66384, 66427, 66432, 66462, 66463, 66500, 66504, 66518, 66560, 66718, 66720, 66730, 66736, 66772, 66776, 66812, 66816, 66856, 66864, 66916, 66927, 66928, 67072, 67383, 67392, 67414, 67424, 67432, 67584, 67590, 67592, 67593, 67594, 67638, 67639, 67641, 67644, 67645, 67647, 67670, 67671, 67743, 67751, 67760, 67808, 67827, 67828, 67830, 67835, 67868, 67871, 67898, 67903, 67904, 68000, 68024, 68028, 68048, 68050, 68100, 68101, 68103, 68108, 68116, 68117, 68120, 68121, 68148, 68152, 68155, 68159, 68168, 68176, 68185, 68192, 68256, 68288, 68327, 68331, 68343, 68352, 68406, 68409, 68438, 68440, 68467, 68472, 68498, 68505, 68509, 68521, 68528, 68608, 68681, 68736, 68787, 68800, 68851, 68858, 68864, 69216, 69247, 69632, 69710, 69714, 69744, 69759, 69826, 69840, 69865, 69872, 69882, 69888, 69941, 69942, 69956, 69968, 70007, 70016, 70094, 70096, 70112, 70113, 70133, 70144, 70162, 70163, 70207, 70272, 70279, 70280, 702!
 81, 70282, 70286, 70287, 70302, 70303, 70314, 70320, 70379, 70384, 70394, 70400, 70404, 70405, 70413, 70415, 70417, 70419, 70441, 70442, 70449, 70450, 70452, 70453, 70458, 70460, 70469, 70471, 70473, 70475, 70478, 70480, 70481, 70487, 70488, 70493, 70500, 70502, 70509, 70512, 70517, 70656, 70746, 70747, 70748, 70749, 70750, 70784, 70856, 70864, 70874, 71168, 71237, 71248, 71258, 71264, 71277, 71296, 71352, 71360, 71370, 71424, 71450, 71453, 71468, 71472, 71488, 71840, 71923, 71935, 71936, 72384, 72441, 72704, 72713, 72714, 72759, 72760, 72774, 72784, 72813, 72816, 72848, 72850, 72872, 72873, 72887, 72960, 72967, 72968, 72970, 72971, 73015, 73018, 73019, 73020, 73022, 73023, 73032, 73040, 73050, 73728, 74650, 74752, 74863, 74864, 74869, 74880, 75076, 92160, 92729, 92736, 92767, 92768, 92778, 92782, 92784, 92880, 92910, 92912, 92918, 92928, 92998, 93008, 93018, 93019, 93026, 93027, 93048, 93053, 93072, 93952, 94021, 94032, 94079, 94095, 94112, 113664, 113771, 113776, 113789, 113792, 113801, 113808, 113818, 113820, 113828, 119296, 119366, 119808, 119893, 119894, 119965, 119966, 119968, 119970, 119971, 119973, 119975, 119977, 119981, 119982, 119994, 119995, 119996, 119997, 120004, 120005, 120070, 120071, 120075, 120077, 120085, 120086, 120093, 120094, 120122, 120123, 120127, 120128, 120133, 120134, 120135, 120138, 120145, 120146, 120486, 120488, 120780, 120782, 120832, 122880, 122887, 122888, 122905, 122907, 122914, 122915, 122917, 122918, 122923, 124928, 125125, 125127, 125143, 125184, 125259, 125264, 125274, 125278, 125280, 126464, 126468, 126469, 126496, 126497, 126499, 126500, 126501, 126503, 126504, 126505, 126515, 126516, 126520, 126521, 126522, 126523, 126524, 126530, 126531, 126535, 126536, 126537, 126538, 126539, 126540, 126541, 126544, 126545, 126547, 126548, 126549, 126551, 126552, 126553, 126554, 126555, 126556, 126557, 126558, 126559, 126560, 126561, 126563, 126564, 126565, 126567, 126571, 126572, 126579, 126580, 126584, 126585, 126589, 126590, 126591, 126592, 126602, 126603, 126620, 126625, 126628, 126!
 629, 126634, 126635, 126652, 126704, 126706, 129024, 129036, 129040, 129096, 129104, 129114, 129120, 129160, 129168, 129198, 917505, 917506, 917536, 917632, 917760, 918000 }
+   local function rotate_in_uax50(i)
+     local lo, hi = 1, #t
+     while lo < hi do
+       local mi = math.ceil((lo+hi)/2)
+       if t[mi]<=i then lo=mi else hi=mi-1 end 
+     end
+     return lo%2==1
+   end
+   list_rotate_glyphs = function (dest, id)
+      if id.specification and id.resources then
+         local rot = {}
+         for i,_ in pairs(id.characters) do
+	    if rotate_in_uax50(i) then rot[i] = true end
+         end
+         if id.resources.sequences then
+	 for _,i in pairs(id.resources.sequences) do
+	    if i.order[1]== 'vert' and i.type == 'gsub_single' and i.steps then
+	       for _,j in pairs(i.steps) do
+	          if type(j)=='table' then 
+		     if type(j.coverage)=='table' then
+			for i,_ in pairs(j.coverage) do rot[i]=nil end
+		     end
+		  end
+	       end
+	    end
+	 end; end
+	 -- コードポイントが共有されているグリフについて
+         if id.resources.duplicates then
+	 for i,v in pairs(id.resources.duplicates) do
+	    local f = rot[i]
+            for j,_ in pairs(v) do f = f and rot[j] end
+            rot[i]=f
+            for j,_ in pairs(v) do rot[j] = f end
+         end; end
+	 
+	 for i,_ in pairs(rot) do
+	    dest = dest or {}
+	    dest[i] = dest[i] or {}
+	    dest[i].rotation = true
+         end
+      end
+      return dest
+   end
+end
+
+-- vertical metrics
 local prepare_fl_data
 local supply_vkern_table
 do
@@ -765,17 +821,6 @@
 		  end
 	       end
 	    end
-	    -- vertical form
-	    local gi = unitable[gv.name]
-	    if gi then
-	       if unitable[gv.name .. '.vert'] then
-	          dest = dest or {}; dest[gi] = dest[gi] or {};
-	          dest[gi].vform = unitable[gv.name .. '.vert']
-	       elseif id.characters[gi] and vert_form_table[gi] then
-	          dest = dest or {}; dest[gi] = dest[gi] or {};
-	          dest[gi].vform = vert_form_table[gi]
-	       end
-	    end
 	    -- vertical metric
 	    local vw, tsb, vk = glyph_vmetric(gv)
 	    local gi = unitable[gv.name]
@@ -815,11 +860,19 @@
    prepare_fl_data = function (dest, id)
       local t = fontloader.info(id.filename)
       local fl
-      if t.filename then
+      if t.fontname then
         fl = fontloader.open(id.filename)
       else
-        fl = fontloader.open(id.filename, id.fullname)
+        fl = fontloader.open(id.filename, id.fontname) -- マニュアルにはこっちで書いてあるが?
+	if not fl then
+          local index
+	  for i,v in ipairs(t) do
+            if v.fontname == id.fontname then index=i; break end
+          end  
+	  fl = fontloader.open(id.filename, index)
+        end
       end
+      if not fl then fontloader.close(fl); return dest end
       local ind_to_uni, unicodes = {}, {}
       for i,v in pairs(id.characters) do
 	  ind_to_uni[v.index] = i
@@ -871,7 +924,7 @@
 
 --
 do
-   local cache_ver = 12
+   local cache_ver = 15
    local checksum = file.checksum
 
    local function prepare_extra_data_base(id)
@@ -891,6 +944,7 @@
 	 else
 	    local dat = nil
 	    dat = prepare_fl_data(dat, id)
+	    dat = list_rotate_glyphs(dat, id)
 	    font_extra_basename[bname] = dat or {}
 	    ltjb.save_cache( v,
 			     {
@@ -911,8 +965,10 @@
        'luaotfload.patch_font',
        function (tfmdata)
 	  -- these function is executed one time per one fontfile
-          local bname = prepare_extra_data_base(tfmdata)
-          if bname then supply_vkern_table(tfmdata, bname) end
+          if jfm_file_name then
+            local bname = prepare_extra_data_base(tfmdata)
+            if bname then supply_vkern_table(tfmdata, bname) end
+          end
 	  return tfmdata
        end,
        'ltj.prepare_extra_data', 1)
@@ -988,11 +1044,65 @@
 	 end
       end
       return fmtable
-   end, 1, 'ltj.v_advance'
+   end, 'ltj.v_advance', 1
 )
 end
 
 ------------------------------------------------------------------------
+-- make table of vertical glyphs which does not covered by vert feature
+-- nor UTR#50
+------------------------------------------------------------------------
+do
+------------------------------------------------------------------------
+-- VERT VARIANT TABLE
+------------------------------------------------------------------------
+  local provides_feature = luaotfload.aux.provides_feature
+  local vert_form_table = {
+     [0x3001]=0xFE11, [0x3002]=0xFE12, [0x3016]=0xFE17, [0x3017]=0xFE18,
+     [0x2026]=0xFE19,
+     [0x2025]=0xFE30, [0x2014]=0xFE31, [0x2013]=0xFE32, [0xFF3F]=0xFE33,
+     [0xFF08]=0xFE35, [0xFF09]=0xFE36, [0xFF5B]=0xFE37, [0xFF5D]=0xFE38,
+     [0x3014]=0xFE39, [0x3015]=0xFE3A, [0x3010]=0xFE3B, [0x3011]=0xFE3C,
+     [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40,
+     [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44,
+     [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, 
+  }
+  local function add_vform(coverage, vform, ft, add_vert)
+     if type(coverage)~='table' then return end
+     for i,v in pairs(vert_form_table) do
+	 if not coverage[i] and ft.characters[v] then
+	     vform[i] = v
+	 end
+     end
+     if add_vert then -- vert feature が有効にならない場合
+	for i,v in pairs(coverage) do vform[i] = vform[i] or v end
+     end
+  end
+
+luatexbase.add_to_callback(
+   "luatexja.define_jfont",
+   function (fmtable, fnum)
+      local vform = {}; fmtable.vform = vform
+      local t = font_getfont(fnum)
+      if t.specification and t.resources then
+	 local add_vert  
+	   = not (provides_feature(fnum, t.properties.script, t.properties.language, 'vert'))
+	     and not (provides_feature(fnum, t.properties.script, t.properties.language, 'vrt2'))
+         -- 現在の language, script で vert もvrt2 も有効にできない場合,強制的に vert 適用
+	 for _,i in pairs(t.resources.sequences) do
+	    if i.order[1]== 'vert' and i.type == 'gsub_single' and i.steps then
+	       for _,j in pairs(i.steps) do
+	          if type(j)=='table' then add_vform(j.coverage,vform, t, add_vert) end
+	       end
+	    end
+	  end
+      end
+      return fmtable
+   end, 'ltj.get_vert_form', 1
+)
+end
+
+------------------------------------------------------------------------
 -- supply tounicode entries
 ------------------------------------------------------------------------
 do

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -29,6 +29,8 @@
  [1033]=20061,
  [2097185]=10000,
  [2097186]=10000,
+ [2097189]=500,
+ [2097190]=500,
  [2097191]=10000,
  [2097193]=10000,
  [2097194]=500,
@@ -45,6 +47,7 @@
  [2097330]=10000,
  [2097331]=10000,
  [2097332]=10000,
+ [2097335]=10000,
  [2097337]=10000,
  [2097338]=10000,
  [2097339]=10000,
@@ -125,6 +128,8 @@
  [2109950]=150,
  [2109951]=150,
  [2162433]=10000,
+ [2162437]=200,
+ [2162438]=200,
  [2162441]=10000,
  [2162443]=200,
  [2162444]=10000,

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -169,9 +169,9 @@
    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
-      getfield(n, 'user_id') == DIR then
+        getfield(n, 'user_id') == DIR then
 	 local old_n = n; n = node_remove(n, n)
-	 node_free(old_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)),

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -43,7 +43,7 @@
 local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
 local ltjs_orig_char_table = ltjs.orig_char_table
 local ltjf_replace_altfont = ltjf.replace_altfont
-local ltjf_font_extra_info = ltjf.font_extra_info
+--local ltjf_font_extra_info = ltjf.font_extra_info
 local attr_orig_char = luatexbase.attributes['ltj at origchar']
 local STCK  = luatexja.userid_table.STCK
 local DIR   = luatexja.userid_table.DIR
@@ -148,8 +148,8 @@
 	    setfont(p, nf)
 	    if ltjf_font_metric_table[nf].vert_activated then
 	       local pc = getchar(p)
-	       pc = (ltjf_font_extra_info[nf] and ltjf_font_extra_info[nf][pc] and ltjf_font_extra_info[nf][pc].vform)
-	       if pc and font_getfont(nf).characters[pc] then setchar(p,  pc) end
+	       pc = ltjf_font_metric_table[nf].vform[pc]
+               if pc then setchar(p,  pc) end
 	    end
 	 end
       end

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -5,7 +5,7 @@
 
 local cidfont_data = {}
 local cache_chars = {}
-local cache_ver = 5
+local cache_ver = 6
 local identifiers = fonts.hashes.identifiers
 
 local cid_reg, cid_order, cid_supp, cid_name
@@ -118,6 +118,7 @@
 	 },
 	 embedding = "no", cache = "yes", factor = 0, hfactor = 0, vfactor = 0,
 	 tounicode = 1,
+	 properties = { language = "dflt", script = "dflt" },
       }
       cidfont_data[cid_name] = k
 
@@ -200,7 +201,7 @@
    cidf_vert_processor = {
       function (head, fnum)
          local fontdata = identifiers[fnum]
-         if fontdata.is_ltj_vert then
+         if luatexja.jfont.font_metric_table[fnum].vert_activated then
             local vt = fontdata.shared.ltj_vert_table
             for n in traverse_id(id_glyph, head) do
                if n.font==fnum then
@@ -316,9 +317,6 @@
       e = e * 1000
       var, fontdata.extend  = var .. 'x' .. tostring(e), e
    end
-   if string.match(specification.detail, '(%+?vert)') then
-      cachedata.is_ltj_vert = true
-   end
    fontdata.name = specification.name .. size .. var; cachedata.name = fontdata.name
    fontdata.fullname = specification.name .. var; cachedata.fullname = fontdata.fullname
    fontdata.psname = specification.name; cachedata.psname = fontdata.psname
@@ -328,7 +326,8 @@
 end
 
 local function font_callback(name, size, id, fallback)
-   local p = name:find(":") or name:len()+1
+   if name:sub(1,1)=="{" and name:sub(-1)=="}" then name = name:sub(2,-2) end
+   local p = name:find(":") or 0
    if name:sub(1, p-1) == 'psft' then
       local s = "Adobe-Japan1-6"
       local basename = name:sub(p+1)

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -57,7 +57,6 @@
 local attr_tkblshift = luatexbase.attributes['ltj at tkblshift']
 local attr_icflag = luatexbase.attributes['ltj at icflag']
 
-local ltjf_font_metric_table = ltjf.font_metric_table
 local ltjf_font_extra_info = ltjf.font_extra_info
 
 local PACKED       = luatexja.icflag_table.PACKED
@@ -144,6 +143,33 @@
 luatexja.setwidth.capsule_glyph_yoko = capsule_glyph_yoko
 
 -- 和文文字の位置補正(縦)
+-- UTR#50 で R もしくは Tr と指定されているが,縦組用グリフがないもの
+local function capsule_glyph_tate_rot(p, met, char_data, head, dir, asc)
+   fshift.down = char_data.down; fshift.left = char_data.left
+   fshift = call_callback("luatexja.set_width", fshift, met, char_data)
+   local kbl = has_attr(p, attr_tkblshift) or 0
+   -- f*: whd specified in JFM
+   local pwidth, pheight,pdepth = getwhd(p)
+   local fwidth = char_data.width or pwidth
+   local fheight= char_data.height or pheight
+   local fdepth = char_data.depth or pdepth
+   local q
+   head, q = node_remove(head, p)
+   local xo, yo = getoffsets(p)
+   setoffsets(p, xo + char_data.align*(fwidth-pwidth) - fshift.left,
+              yo - fshift.down - asc);
+   setnext(p, nil)
+   local box = node_new(id_hlist)
+   setwhd(box, fwidth, fheight, fdepth)
+   setfield(box, 'head', p)
+   setfield(box, 'shift', kbl)
+   setdir(box, dir)
+   set_attr(box, attr_icflag, PACKED)
+   head = q and node_insert_before(head, q, box)
+      or node_insert_after(head, node_tail(head), box)
+   return q, head, box
+end
+
 local function capsule_glyph_tate(p, met, char_data, head, dir)
    if not char_data then return node_next(p), head end
    local ascent, descent = met.ascent, met.descent
@@ -151,10 +177,13 @@
    do
       local pf = getfont(p)
       local pc = getchar(p)
-      setchar(p, pc)
-      pwidth = ltjf_font_extra_info[pf] and  ltjf_font_extra_info[pf][pc]
-	 and ltjf_font_extra_info[pf][pc].vwidth
-	 and ltjf_font_extra_info[pf][pc].vwidth * met.size or (ascent+descent)
+      local cei = ltjf_font_extra_info[pf] and  ltjf_font_extra_info[pf][pc]
+      if cei and met.vert_activated then
+	 if cei.rotation then
+	    return capsule_glyph_tate_rot(p, met, char_data, head, dir, 0.5*(ascent-descent))
+	 end
+      end
+      pwidth = (cei and cei.vwidth) and cei.vwidth * met.size or (ascent+descent)
       pwidth = pwidth + (met.v_advance[pc] or 0)
       ascent = met.v_origin[pc] and ascent - met.v_origin[pc] or ascent
    end

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjarticle.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjarticle}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk10.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjbk10.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xpt{15}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk11.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjbk11.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xipt{15.5}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbk12.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjbk12.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xiipt{16.5}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjbook.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjbook}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjreport.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjreport}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsarticle.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsarticle}
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 \def\jsc at clsname{ltjsarticle}
 \RequirePackage{luatexja}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsbook.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsbook}
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 \def\jsc at clsname{ltjsbook}
 \RequirePackage{luatexja}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize10.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjsize10.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xpt{15}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize11.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjsize11.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xipt{15.5}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsize12.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjsize12.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xiipt{16.5}%
@@ -33,7 +33,7 @@
    \belowdisplayskip \abovedisplayskip
    \let\@listi\@listI}
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjskiyou.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjskiyou}
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 \def\jsc at clsname{ltjskiyou}
 \RequirePackage{luatexja}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjspf.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjspf}
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 \def\jsc at clsname{ltjspf}
 \RequirePackage{luatexja}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjsreport.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -38,7 +38,7 @@
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjsreport}
-  [2017/03/06 ltjsclasses ]
+  [2017/09/04 ltjsclasses ]
 \def\jsc at clsname{ltjsreport}
 \RequirePackage{luatexja}
 \newif\if at restonecol

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtarticle.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjtarticle}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk10.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtbk10.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xpt{17}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk11.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtbk11.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xipt{17}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbk12.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtbk12.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xiipt{18}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtbook.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjtbook}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtreport.cls	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesClass{ltjtreport}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
 \newcounter{@paper}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize10.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtsize10.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xpt{17}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize11.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtsize11.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xipt{17}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/ltjtsize12.clo	2017-09-04 21:45:53 UTC (rev 45216)
@@ -23,7 +23,7 @@
 %% File: ltjclasses.dtx
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{ltjtsize12.clo}
-  [2017/03/06 v1.7e-ltj-14
+  [2017/08/31 v1.7f-ltj-15
   Standard LuaLaTeX-ja file (size option)]
 \renewcommand{\normalsize}{%
     \@setfontsize\normalsize\@xiipt{18}%
@@ -35,7 +35,7 @@
 \def\kanjiencodingdefault{JT3}%
 \kanjiencoding{\kanjiencodingdefault}%
 \normalsize
-\setbox0\hbox{\char"3000}% 全角スペース
+\setbox0\hbox{漢}
 \setlength\Cht{\ht0}
 \setlength\Cdp{\dp0}
 \setlength\Cwd{\wd0}

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -79,6 +79,7 @@
   \RequirePackage{pdftexcmds} [2011/11/29] % v0.20
   \RequirePackage{xkeyval}    [2012/10/14] % v2.6b
   \RequirePackage{atbegshi}
+  \RequirePackage{etoolbox}
   \AtBeginShipoutInit
   \IfFileExists{everyhook.sty}{\RequirePackage{everyhook}\ltj at everyhook@availtrue}{}
 \else                           %<*!LaTeX>

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua	2017-09-04 21:45:53 UTC (rev 45216)
@@ -535,13 +535,13 @@
    elseif pt=='noad' then
       s = base ; print_fn(s)
       if p.nucleus then
-         prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn);
+         prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn, limit);
       end
       if p.sup then
-         prefix = k .. '^'; debug_show_node_X(p.sup, print_fn);
+         prefix = k .. '^'; debug_show_node_X(p.sup, print_fn, limit);
       end
       if p.sub then
-         prefix = k .. '_'; debug_show_node_X(p.sub, print_fn);
+         prefix = k .. '_'; debug_show_node_X(p.sub, print_fn, limit);
       end
       prefix = k;
    elseif pt=='math_char' then

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/luatexja.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -37,7 +37,7 @@
   \ProvidesPackage{luatexja}[2017/05/05 Japanese Typesetting with Lua(La)TeX]
 \fi                             %</LaTeX>
 %%%% VERSION
-\def\LuaTeXjaversion{20170730.0}
+\def\LuaTeXjaversion{20170904.0}
 
 \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
 

Added: trunk/Master/texmf-dist/tex/luatex/luatexja/max_perf_pct
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/max_perf_pct	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/max_perf_pct	2017-09-04 21:45:53 UTC (rev 45216)
@@ -0,0 +1 @@
+100

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,8 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjcore}[2017/06/18 Patch to LaTeX2e Kernel for LuaTeX-ja]
+\ProvidesPackage{lltjcore}[2017/08/27 Patch to LaTeX2e Kernel for LuaTeX-ja]
+\RequirePackage{etoolbox}
 
 \def\cleardoublepage{\clearpage\if at twoside
   \ifodd\c at page
@@ -182,11 +183,11 @@
     \@latex at warning{Reference `#3' on page \thepage \space
               undefined}%
   \else
-    \expandafter#2#1\relax{}% change \null to \relax
+    \expandafter#2#1\spacefactor\@m{}% change \null to \spacefactor\@m{}
   \fi}
 \endgroup
 \if at compatibility\else
-\def\verb{\relax\ifmmode\hbox\else\leavevmode\fi
+\def\verb{\relax\ifmmode\hbox\else\leavevmode\vadjust{}\fi
   \bgroup
     \verb at eol@error \let\do\@makeother \dospecials
     \verbatim at font\@noligs
@@ -196,18 +197,15 @@
 \gdef\@stopfield{\null\color at endgroup\egroup}
 \newcount\hour
 \newcount\minute
-\RequirePackage{etoolbox}
-\ifltj at everyhook@avail
-  \pretocmd{\footnote}{\inhibitglue}{}{}
-  \pretocmd{\footnotemark}{\inhibitglue}{}{}
-  \patchcmd{\@footnotemark}{\@makefnmark}{%
-    \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark%
-    \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi%
-  }{}{}
-  \patchcmd{\@tabular}{\leavevmode}{\leavevmode\null}{}{}
-  \apptocmd{\endtabular}{\null}{}{}
-  \expandafter \let \csname endtabular*\endcsname = \endtabular
-\fi
+\pretocmd{\footnote}{\inhibitglue}{}{}
+\pretocmd{\footnotemark}{\inhibitglue}{}{}
+\patchcmd{\@footnotemark}{\@makefnmark}{%
+  \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark%
+  \else\hbox to\z@{\hskip-.25\zw\raise.9\zh\@makefnmark\hss}\fi%
+}{}{}
+\patchcmd{\@tabular}{\leavevmode}{\leavevmode\null}{}{}
+\apptocmd{\endtabular}{\null}{}{}
+\expandafter \let \csname endtabular*\endcsname = \endtabular
 \let\@parboxto\@empty
 \long\def\@iiiparbox#1#2[#3]#4#5{%
   \leavevmode
@@ -290,21 +288,8 @@
   \ignorespaces
 \fi}
 
-\def\@no at lnbk #1[#2]{%
-  \ifvmode
-    \@nolnerr
-  \else
-    \@tempskipa\lastskip
-    \unskip
-    \penalty #1\@getpen{#2}%
-    \hskip\z@\relax %% added (2017/05/03)
-    \ifdim\@tempskipa>\z@
-      \hskip\@tempskipa
-      \ignorespaces
-    \fi
-  \fi}
 
-%%%%%% \@tabclassz
+%%%%%% tabular (platex/#43) \@tabclassz
 \def\ltj at sharp{\ltjfakeboxbdd\ignorespaces\@sharp\unskip\ltjfakeboxbdd}
 \def\@tabclassz{%
   \ifcase\@lastchclass
@@ -335,5 +320,10 @@
    \everypar\expandafter{\the\everypar\ltjfakeboxbdd}\ignorespaces\@sharp\unskip
 }{}{}
 
-
+%%%%%% tabbing (platex/#53)
+\patchcmd\@startline{\strut}{\strut\inhibitglue}{}{}
+\def\ltj at unhbox@curfield{\ltjfakeboxbdd\unhbox\@curfield\ltjfakeboxbdd}
+%\patchcmd\@contfield{\unhbox\@curfield}{\ltj at unhbox@curfield}{}{}
+\patchcmd\@addfield{\unhbox\@curfield}{\ltj at unhbox@curfield}{}{}
+\pretocmd\@stopfield{\inhibitglue}{}{}
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -96,7 +96,7 @@
 \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, -8}}
 
 \directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end}
-\def\<{\inhibitglue}
+\protected\def\<{\ifvmode\leavevmode\fi\inhibitglue}
 
 % END OF FILE
 \endinput

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-array.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-array}[2017/06/18 Patch to preview for LuaTeX-ja]
+\ProvidesPackage{lltjp-array}[2017/06/18 Patch to array for LuaTeX-ja]
 
 \RequirePackage{etoolbox,array,luatexja}
 

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec-immediate.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-%%% \ProvidesPackage{lltjp-fontspec-immediate}[2017/01/28 Patch to fontspec for LuaTeX-ja]
+%%% \ProvidesPackage{lltjp-fontspec-immediate}[2017/08/07 Patch to fontspec for LuaTeX-ja]
 
 \RequirePackage{fontspec,luatexja}
 \ExplSyntaxOn
@@ -63,5 +63,6 @@
  }
 }
 \ExplSyntaxOff
+\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
 \endinput
 

Modified: trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty	2017-09-04 21:45:19 UTC (rev 45215)
+++ trunk/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty	2017-09-04 21:45:53 UTC (rev 45216)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-fontspec}[2017/05/05 Patch to fontspec for LuaTeX-ja]
+\ProvidesPackage{lltjp-fontspec}[2017/08/07 Patch to fontspec for LuaTeX-ja]
 
 \RequirePackage{fontspec,luatexja}
 \ExplSyntaxOn
@@ -38,4 +38,5 @@
 \cs_set:Npn \eminnershape { \mcfamily \upshape }
 
 \ExplSyntaxOff
+\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
 \endinput



More information about the tex-live-commits mailing list