• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: コミット

ソースコードの管理場所


コミットメタ情報

リビジョンf1398298c252f6fed2b642c80ff726112d6c7785 (tree)
日時2020-01-23 15:09:00
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
コミッターHironori Kitagawa

ログメッセージ

Merge branch 'kitagawa_nfss' into kitagawa_test

変更サマリ

差分

--- a/README
+++ b/README
@@ -1,6 +1,6 @@
11 The LuaTeX-ja Package $VER$
22 --------------------------------
3-Copyright (c) 2011--2019 The LuaTeX-ja project
3+Copyright (c) 2011--2020 The LuaTeX-ja project
44 License: modified BSD (see COPYING)
55
66 LuaTeX-ja is a macro package for typesetting Japanese documents with LuaTeX.
--- a/doc/luatexja.dtx
+++ b/doc/luatexja.dtx
@@ -653,10 +653,27 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}.
653653 \Pkg{everysel} (if you want to use \LuaTeX-ja with \LaTeXe)
654654 \item \Pkg{ltxcmds}, \Pkg{pdftexcmds}, \Pkg{filehook}, \Pkg{atbegshi}
655655 \item \href{https://github.com/wspr/fontspec/}{\Pkg{fontspec}} v2.7c (or later)
656-%<en>\item \emph{IPAex fonts} (\url{http://ipafont.ipa.go.jp/})
657-%<ja>\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})}
656+%<en>\item IPAex fonts (\url{http://ipafont.ipa.go.jp/})
657+%<ja>\item IPAexフォント(\url{http://ipafont.ipa.go.jp/})
658658 \end{itemize}
659-
659+%<*en>
660+Note that color specification in font~definitions, such as
661+\begin{lstlisting}
662+\font\test=file:lmromandunh10-regular.otf:color=FF0000BB % \font primitive
663+\addfontfeatures{Color=00FF00} % fontspec
664+\end{lstlisting}
665+are not compatible with \LuaTeX-ja in plain \LuaTeX\ and \LaTeX~2019-10-01~(or prior).
666+So we recommend to use \LaTeX~2020-02-02.
667+%</en>
668+%<*ja>
669+なお,フォント定義の際の色指定,例えば
670+\begin{lstlisting}
671+\font\test=file:lmromandunh10-regular.otf:color=FF0000BB % \font primitive
672+\addfontfeatures{Color=00FF00} % fontspec
673+\end{lstlisting}
674+は,plain \LuaTeX や\LaTeX~2019-10-01以前において\LuaTeX-jaとは\emph{共存しない}.
675+そのため,\LaTeX~2020-02-02以降を用いることを勧める.
676+%</ja>
660677
661678 %<*en>
662679 Now \LuaTeX-ja is available from
@@ -1424,7 +1441,7 @@ this chapter. For the method, please see Subsection~\ref{ssec:math}.
14241441 と考えており,したがってこの節では数式モード中の和文フォントを変更する方法については
14251442 記述しない.この方法については\ref{ssec:math}節を参照のこと.
14261443
1427-{\gtfamily\bfseries
1444+{\bfseries
14281445 既に記述した通り,\texttt{disablejfam}オプションを指定して\LuaTeX-jaを読み込んだ場合は,
14291446 \verb+$素$+ のように直接和文文字を数式モード中に記述することはできなくなる.
14301447 \cs{mbox},あるいは\Pkg{amsmath}パッケージの提供する\cs{text}命令などを使うことになる.
@@ -4997,6 +5014,17 @@ a \emph{horizontal} Japanese font.
49975014 \end{tabular}
49985015 \end{table}
49995016
5017+%<*en>
5018+Note that any OpenType features are not applied to Japanese characters in math mode.
5019+Other features, such as \texttt{color}~and~\texttt{embolden} may be applied to these
5020+characters, but one should not expect this.
5021+%</en>
5022+%<*ja>
5023+なお,数式中に直に記述した和文文字に対してはOpenType機能は適用されない.
5024+\texttt{color}や\texttt{embolden}など他の「機能」は適用される可能性があるが,
5025+ユーザは期待すべきではない.
5026+%</ja>
5027+
50005028 %<en>\subsection{Callbacks}
50015029 %<ja>\subsection{コールバック}
50025030
--- a/src/ltj-jfmglue.lua
+++ b/src/ltj-jfmglue.lua
@@ -803,7 +803,9 @@ do
803803 blend_diffmet(
804804 getfield(gb, 'stretch'), getfield(ga, 'stretch'), db, da),
805805 -blend_diffmet(
806- -getfield(gb, 'shrink'), -getfield(ga, 'shrink'), db, da))
806+ -getfield(gb, 'shrink'), -getfield(ga, 'shrink'), db, da),
807+ getfield(gb, 'stretch_order'), getfield(gb, 'shrink_order'))
808+ -- {stretch, shrink}_order: [x]kanjiskip のとき
807809 node_free(ga)
808810 return gb
809811 elseif k == bk_ak then
@@ -863,7 +865,8 @@ do
863865 bn and (bn*getfield(kanji_skip, 'width')) or 0,
864866 bp and (bp*getfield(kanji_skip, 'stretch')) or 0,
865867 bh and (bh*getfield(kanji_skip, 'shrink')) or 0,
866- 0, 0)
868+ bp and getfield(kanji_skip, 'stretch_order') or 0,
869+ bh and getfield(kanji_skip, 'shrink_order') or 0)
867870 set_attr(g, attr_icflag, KANJI_SKIP_JFM)
868871 return g
869872 end
@@ -908,11 +911,11 @@ do
908911 Np.class)
909912 local g = calc_ja_ja_aux(gb, ga, db, da)
910913 local k
911- if (pmc==qmc) and (qm.var==pm.var) then
912- gb = get_kanjiskip_low(false, qm, bn, bp, bh)
913- ga = get_kanjiskip_low(false, pm, an, ap, ah)
914- k = calc_ja_ja_aux(gb, ga, db, da)
915- end
914+ --if (pmc==qmc) and (qm.var==pm.var) then
915+ gb = get_kanjiskip_low(false, qm, bn, bp, bh)
916+ ga = get_kanjiskip_low(false, pm, an, ap, ah)
917+ k = calc_ja_ja_aux(gb, ga, db, da)
918+ --end
916919 return g, k
917920 end
918921 end
@@ -946,7 +949,8 @@ do
946949 bn and (bn*getfield(xkanji_skip, 'width')) or 0,
947950 bp and (bp*getfield(xkanji_skip, 'stretch')) or 0,
948951 bh and (bh*getfield(xkanji_skip, 'shrink')) or 0,
949- 0, 0)
952+ bp and getfield(xkanji_skip, 'stretch_order') or 0,
953+ bh and getfield(xkanji_skip, 'shrink_order') or 0)
950954 set_attr(g, attr_icflag, XKANJI_SKIP_JFM)
951955 return g
952956 end
--- a/src/ltj-math.lua
+++ b/src/ltj-math.lua
@@ -166,7 +166,6 @@ function (p, sty)
166166 end
167167
168168 do
169- local mlist_to_hlist = node.mlist_to_hlist
170169 local function mlist_callback_ltja(n)
171170 local n = to_direct(n); list_dir = ltjd_get_dir_count()
172171 if getid(n)==id_whatsit and getsubtype(n)==sid_user and
@@ -176,11 +175,12 @@ do
176175 end
177176 return to_node(conv_jchar_to_hbox(n, 0))
178177 end
179- -- LaTeX 2020-02-02 seems to have pre_mlist_to_hlist callback
180- if luatexbase.callbacktypes['pre_mlist_to_hlist'] then
181- luatexbase.add_to_callback('pre_mlist_to_hlist',
182- mlist_callback_ltja(n), 'ltj.mlist_to_hlist_pre', 1)
178+ -- LaTeX 2020-02-02 seems to have pre_mlist_to_hlist_filter callback
179+ if luatexbase.callbacktypes['pre_mlist_to_hlist_filter'] then
180+ luatexbase.add_to_callback('pre_mlist_to_hlist_filter',
181+ mlist_callback_ltja, 'ltj.mlist_to_hlist_pre', 1)
183182 else
183+ local mlist_to_hlist = node.mlist_to_hlist
184184 luatexbase.add_to_callback('mlist_to_hlist',
185185 function (n, display_type, penalties)
186186 return mlist_to_hlist(mlist_callback_ltja(n),display_type, penalties)
--- a/src/luatexja-core.sty
+++ b/src/luatexja-core.sty
@@ -232,8 +232,10 @@
232232 t[\the\ltj@zw@inner] = function() setdimen('ltj@zw', ltjf.get_zw()) end
233233 t[\the\ltj@zh@inner] = function() setdimen('ltj@zh', ltjf.get_zh()) end
234234 }
235-\protected\def\zw{\luafunction\ltj@zw@inner\ltj@zw}
236-\protected\def\zh{\luafunction\ltj@zh@inner\ltj@zh}
235+\protected\def\ltj@zw{\luafunction\ltj@zw@inner\ltj@zw}
236+\protected\def\ltj@zh{\luafunction\ltj@zh@inner\ltj@zh}
237+\let\zw=\ltj@zw
238+\let\zh=\ltj@zh
237239
238240 %%%%%%%% \inhibitglue
239241 \newluafunction\ltj@reset@globaldefs@inner
--- a/src/luatexja.lua
+++ b/src/luatexja.lua
@@ -402,7 +402,7 @@ end
402402
403403 local prefix, inner_depth
404404 local utfchar = utf.char
405-local function debug_show_node_X(p,print_fn, limit)
405+local function debug_show_node_X(p,print_fn, limit, inner_depth)
406406 local k = prefix
407407 local s
408408 local pt=node_type(p.id)
@@ -451,7 +451,7 @@ local function debug_show_node_X(p,print_fn, limit)
451451 prefix, inner_depth = prefix.. '.', inner_depth + 1
452452 if inner_depth < limit then
453453 for q in node.traverse(p.head) do
454- debug_show_node_X(q, print_fn, limit)
454+ debug_show_node_X(q, print_fn, limit, inner_depth)
455455 end
456456 end
457457 prefix=k
@@ -466,15 +466,15 @@ local function debug_show_node_X(p,print_fn, limit)
466466 if inner_depth < limit then
467467 prefix, inner_depth = k.. 'p.', inner_depth + 1
468468 for q in node.traverse(p.pre) do
469- debug_show_node_X(q, print_fn, limit)
469+ debug_show_node_X(q, print_fn, limit, inner_depth)
470470 end
471471 prefix = k.. 'P.'
472472 for q in node.traverse(p.post) do
473- debug_show_node_X(q, print_fn, limit)
473+ debug_show_node_X(q, print_fn, limit, inner_depth)
474474 end
475475 prefix = k.. 'R.'
476476 for q in node.traverse(p.replace) do
477- debug_show_node_X(q, print_fn, limit)
477+ debug_show_node_X(q, print_fn, limit, inner_depth)
478478 end
479479 end
480480 prefix=k
@@ -532,7 +532,7 @@ local function debug_show_node_X(p,print_fn, limit)
532532 prefix, inner_depth =prefix.. '.', inner_depth + 1
533533 if inner_depth < limit then
534534 for q in node.traverse(p.value) do
535- debug_show_node_X(q, print_fn, limit)
535+ debug_show_node_X(q, print_fn, limit, inner_depth)
536536 end
537537 end
538538 prefix, inner_depth = k, bid
@@ -553,13 +553,13 @@ local function debug_show_node_X(p,print_fn, limit)
553553 elseif pt=='noad' then
554554 s = base ; print_fn(s)
555555 if p.nucleus then
556- prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn, limit);
556+ prefix = k .. 'N'; debug_show_node_X(p.nucleus, print_fn, limit, inner_depth);
557557 end
558558 if p.sup then
559- prefix = k .. '^'; debug_show_node_X(p.sup, print_fn, limit);
559+ prefix = k .. '^'; debug_show_node_X(p.sup, print_fn, limit, inner_depth);
560560 end
561561 if p.sub then
562- prefix = k .. '_'; debug_show_node_X(p.sub, print_fn, limit);
562+ prefix = k .. '_'; debug_show_node_X(p.sub, print_fn, limit, inner_depth);
563563 end
564564 prefix = k;
565565 elseif pt=='math_char' then
@@ -570,7 +570,7 @@ local function debug_show_node_X(p,print_fn, limit)
570570 if p.head then
571571 prefix = k .. '.';
572572 for q in node.traverse(p.head) do
573- debug_show_node_X(q, print_fn)
573+ debug_show_node_X(q, print_fn, limit, inner_depth)
574574 end
575575 end
576576 else
@@ -583,7 +583,7 @@ function luatexja.ext_show_node_list(head,depth,print_fn, lim)
583583 inner_depth = 0
584584 if head then
585585 while head do
586- debug_show_node_X(head, print_fn, lim or 1/0); head = node_next(head)
586+ debug_show_node_X(head, print_fn, lim or 1/0, inner_depth); head = node_next(head)
587587 end
588588 else
589589 print_fn(prefix .. ' (null list)')
@@ -593,7 +593,7 @@ function luatexja.ext_show_node(head,depth,print_fn, lim)
593593 prefix = depth
594594 inner_depth = 0
595595 if head then
596- debug_show_node_X(head, print_fn, lim or 1/0)
596+ debug_show_node_X(head, print_fn, lim or 1/0, inner_depth)
597597 else
598598 print_fn(prefix .. ' (null list)')
599599 end
--- a/src/patches/lltjdefs.sty
+++ b/src/patches/lltjdefs.sty
@@ -32,7 +32,13 @@
3232 \newcommand\kanjiencodingdefault{JY3}
3333 \newcommand\kanjifamilydefault{\mcdefault}
3434 \newcommand\kanjiseriesdefault{\mddefault}
35-\newcommand\kanjishapedefault{\updefault}
35+\ifdefined\shapedefault
36+ %% LaTeX 2020-02-02
37+ \newcommand\kanjishapedefault{\shapedefault}
38+\else
39+ %% LaTeX 2019-10-01
40+ \newcommand\kanjishapedefault{\updefault}
41+\fi
3642
3743 \DeclareKanjiFamily{JY3}{mc}{}
3844 \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdmcfont:jfm=\ltj@stdyokojfm}{}
@@ -40,8 +46,8 @@
4046 \DeclareFontShape{JY3}{gt}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdgtfont:jfm=\ltj@stdyokojfm}{}
4147 \DeclareFontShape{JY3}{mc}{bx}{n}{<-> ssub*gt/m/n}{}
4248 \DeclareFontShape{JY3}{gt}{bx}{n}{<-> ssub*gt/m/n}{}
43-\DeclareFontShape{JY3}{mc}{b}{n}{<-> ssub*mc/bx/n}{}
44-\DeclareFontShape{JY3}{gt}{b}{n}{<-> ssub*gt/bx/n}{}
49+\DeclareFontShape{JY3}{mc}{b}{n}{<-> ssub*gt/m/n}{}
50+\DeclareFontShape{JY3}{gt}{b}{n}{<-> ssub*gt/m/n}{}
4551
4652 \DeclareKanjiFamily{JT3}{mc}{}
4753 \DeclareFontShape{JT3}{mc}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdmcfont:jfm=\ltj@stdtatejfm}{}
@@ -49,8 +55,8 @@
4955 \DeclareFontShape{JT3}{gt}{m}{n}{<-> s*[\ifdefined\Cjascale\Cjascale\else 0.962216\fi] \ltj@stdgtfont:jfm=\ltj@stdtatejfm}{}
5056 \DeclareFontShape{JT3}{mc}{bx}{n}{<-> ssub*gt/m/n}{}
5157 \DeclareFontShape{JT3}{gt}{bx}{n}{<-> ssub*gt/m/n}{}
52-\DeclareFontShape{JT3}{mc}{b}{n}{<-> ssub*mc/bx/n}{}
53-\DeclareFontShape{JT3}{gt}{b}{n}{<-> ssub*gt/bx/n}{}
58+\DeclareFontShape{JT3}{mc}{b}{n}{<-> ssub*gt/m/n}{}
59+\DeclareFontShape{JT3}{gt}{b}{n}{<-> ssub*gt/m/n}{}
5460 \KanjiEncodingPair{JY3}{JT3}
5561
5662 \DeclareRelationFont{JY3}{gt}{m}{}{TU}{lmr}{bx}{}
@@ -77,25 +83,50 @@
7783 \DeclareMathAlphabet{\mathgt}{JY3}{gt}{m}{n}
7884 \fi
7985
86+\ifdefined\fontseriesforce
87+\edef\bfseries@mc{\bfdefault}
88+\edef\bfseries@gt{\bfdefault}
89+\def\bfseries@jtt{\bfseries@gt}
90+\edef\mdseries@mc{\mddefault}
91+\edef\mdseries@gt{\mddefault}
92+\def\mdseries@jtt{\mdseries@gt}
93+\fi
94+
8095 \newif\if@ltj@match@family
8196 \@ltj@match@familyfalse
8297 \def\verbatim@font{\normalfont\ttfamily\kanjifamily\jttdefault\selectfont}
83-\DeclareRobustCommand\rmfamily
84- {\not@math@alphabet\rmfamily\mathrm
85- \romanfamily\rmdefault
86- \if@ltj@match@family\kanjifamily\mcdefault\fi\selectfont}
87-\DeclareRobustCommand\sffamily
88- {\not@math@alphabet\sffamily\mathsf
89- \romanfamily\sfdefault
90- \if@ltj@match@family\kanjifamily\gtdefault\fi\selectfont}
91-\DeclareRobustCommand\ttfamily
92- {\not@math@alphabet\ttfamily\mathtt
93- \romanfamily\ttdefault
94- \if@ltj@match@family\kanjifamily\jttdefault\fi\selectfont}
98+
99+\def\@ltj@hook@family#1#2{ % #1: csname #2: contents
100+ \ifcsname @#1hook\endcsname % LaTeX 2020-02-02
101+ \csappto{@#1hook}{#2}%
102+ \else % LaTeX 2019-10-01
103+ \ifcsname #1 \endcsname
104+ \expandafter\patchcmd\csname #1 \endcsname{\selectfont}{#2\selectfont}{}{}%
105+ \else
106+ \PackageWarningNoLine{luatexja}{%
107+ Patching to \expandafter\string\csname #1\endcsname\space failed
108+ }%
109+ \fi
110+ \fi
111+}
112+\@ltj@hook@family{rmfamily}{%
113+ \if@ltj@match@family
114+ \prepare@family@series@update@kanji{mc}\mcdefault
115+ \fi
116+}
117+\@ltj@hook@family{sffamily}{%
118+ \if@ltj@match@family
119+ \prepare@family@series@update@kanji{gt}\gtdefault
120+ \fi
121+}
122+\@ltj@hook@family{ttfamily}{%
123+ \if@ltj@match@family
124+ \prepare@family@series@update@kanji{jtt}\jttdefault
125+ \fi
126+}
127+
95128 %%% \eminnershape
96-\DeclareRobustCommand\em
97- {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
98- \eminnershape \else \gtfamily \itshape \fi}
129+\expandafter\patchcmd\csname em \endcsname{\itshape}{\gtfamily\itshape}{}{}
99130 \def\eminnershape{\mcfamily \upshape}
100131
101132 \ltjdefcharrange{1}{"80-"36F, "1E00-"1EFF}
--- a/src/patches/lltjfont.sty
+++ b/src/patches/lltjfont.sty
@@ -3,7 +3,7 @@
33 %
44
55 \NeedsTeXFormat{LaTeX2e}
6-\ProvidesPackage{lltjfont}[2019/09/25 Patch to NFSS2 for LuaTeX-ja]
6+\ProvidesPackage{lltjfont}[2020/01/12 Patch to NFSS2 for LuaTeX-ja]
77
88 \def\ltj@chardef@text@cmd#1{%
99 \let\@ifdefinable\@@ifdefinable%
@@ -568,12 +568,93 @@
568568 \edef\k@family{#1}\edef\f@family{#1}%
569569 \fi\fi
570570 }
571+
572+\ifdefined\fontseriesforce
573+%%%% LaTeX 2020-02-02
574+\DeclareRobustCommand\romanseriesforce[1]{\edef\f@series{#1}}
575+\DeclareRobustCommand\kanjiseriesforce[1]{\edef\k@series{#1}}
576+\DeclareRobustCommand\fontseriesforce[1]{\kanjiseries{#1}\romanseries{#1}}
577+\DeclareRobustCommand\romanshapeforce[1]{\edef\f@shape{#1}}
578+\DeclareRobustCommand\kanjishapeforce[1]{\edef\k@shape{#1}}
579+\DeclareRobustCommand\fontshapeforce[1]{\kanjishape{#1}\romanshape{#1}}
580+
581+\def\merge@font@kanji@series#1{%
582+ \expandafter\expandafter\expandafter
583+ \merge@font@kanji@series@
584+ \csname series@\k@series @#1\endcsname
585+ {#1}%
586+ \@nil
587+}
588+\def\set@target@kanji@series#1{%
589+ \edef\k@series{#1}%
590+ \edef\k@series{\expandafter\series@drop@one@m\k@series mm\series@drop@one@m}%
591+}
592+\def\merge@font@kanji@series@#1#2#3\@nil{%
593+ \def\@reserveda{#3}%
594+ \ifx\@reserveda\@empty
595+ \set@target@kanji@series{#2}%
596+ \else
597+ \begingroup\let\f@encoding\k@encoding\let\f@family\k@family
598+ \maybe@load@fontshape\endgroup
599+ \edef\@reserveda{\k@encoding /\k@family /#1/\k@shape}%
600+ \ifcsname \@reserveda \endcsname
601+ \set@target@kanji@series{#1}%
602+ \else
603+ \ifcsname \k@encoding /\k@family /#2/\k@shape \endcsname
604+ \set@target@kanji@series{#2}%
605+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
606+ \else
607+ \set@target@kanji@series{#3}%
608+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
609+ \fi
610+ \fi
611+ \fi
612+}
613+\def\merge@font@kanji@shape#1{%
614+ \expandafter\expandafter\expandafter
615+ \merge@font@kanji@shape@
616+ \csname shape@\k@shape @#1\endcsname
617+ {#1}%
618+ \@nil
619+}
620+\def\merge@font@kanji@shape@#1#2#3\@nil{%
621+ \def\@reserveda{#3}%
622+ \ifx\@reserveda\@empty
623+ \edef\k@shape{#2}%
624+ \else
625+ \maybe@load@fontshape
626+ \edef\@reserveda{\k@encoding /\k@family /\k@series/#1}%
627+ \ifcsname \@reserveda\endcsname
628+ \edef\k@shape{#1}%
629+ \else
630+ \ifcsname \k@encoding /\k@family /\k@series/#2\endcsname
631+ \edef\k@shape{#2}%
632+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
633+ \else
634+ \edef\k@shape{#3}%
635+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
636+ \fi
637+ \fi
638+ \fi
639+}
640+\DeclareRobustCommand\romanseries[1]{\merge@font@series{#1}}
641+\DeclareRobustCommand\kanjiseries[1]{\merge@font@kanji@series{#1}}
642+\DeclareRobustCommand\fontseries[1]{%
643+ \merge@font@series{#1}\merge@font@kanji@series{#1}}
644+\DeclareRobustCommand\romanshape[1]{\merge@font@shape{#1}}
645+\DeclareRobustCommand\kanjishape[1]{\merge@font@kanji@shape{#1}}
646+\DeclareRobustCommand\fontshape[1]{%
647+ \merge@font@shape{#1}\merge@font@kanji@shape{#1}}
648+\else
649+%%%% LaTeX 2019-10-01
571650 \DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}}
572651 \DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}}
573652 \DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}
574653 \DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}}
575654 \DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}}
576655 \DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}}
656+\fi
657+%%%%
577658 \DeclareRobustCommand\usekanji[4]{%
578659 \kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}%
579660 \selectfont\ignorespaces}
@@ -586,22 +667,90 @@
586667 \else\useroman{#1}{#2}{#3}{#4}%
587668 \fi}
588669 \DeclareRobustCommand\normalfont{%
589- \kanjiencoding{\kanjiencodingdefault}%
590- \kanjifamily{\kanjifamilydefault}%
591- \kanjiseries{\kanjiseriesdefault}%
592- \kanjishape{\kanjishapedefault}%
593- \romanencoding{\encodingdefault}%
594- \romanfamily{\familydefault}%
595- \romanseries{\seriesdefault}%
596- \romanshape{\shapedefault}%
597- \selectfont\ignorespaces}
670+ \useroman\encodingdefault\familydefault\seriesdefault\shapedefault
671+ \usekanji\kanjiencodingdefault\kanjifamilydefault\kanjiseriesdefault\kanjishapedefault
672+ \ignorespaces}
598673 \let\reset@font\normalfont
674+
675+\ifdefined\fontseriesforce
676+%%%% LaTeX 2020-02-02
677+\let\prepare@family@series@update@kanji=\prepare@family@series@update
678+\patchcmd\prepare@family@series@update{\fontfamily}{\romanfamily}{}{}
679+\patchcmd\prepare@family@series@update@kanji{\fontfamily}{\kanjifamily}{}{}
680+\patchcmd\prepare@family@series@update@kanji{\f@series}{\k@series}{}{}
681+\patchcmd\prepare@family@series@update@kanji{\maybe@load@fontshape}
682+ {\begingroup\let\f@encoding\k@encoding\let\f@family\k@family
683+ \maybe@load@fontshape\endgroup}{}{}
684+\patchcmd\prepare@family@series@update@kanji{\@meta@family@list}{\@meta@family@kanji@list}{}{}
685+\def\@meta@family@kanji@list{\@elt{mc}\@elt{gt}\@elt{jtt}}
686+%%\appto\@meta@family@list{\@elt{mc}\@elt{gt}\@elt{jtt}}
687+\DeclareRobustCommand\bfseries{%
688+ \not@math@alphabet\bfseries\mathbf
689+ \expand@font@defaults
690+ \romanseries{%
691+ \ifx\f@family\rmdef@ult \bfseries@rm
692+ \else\ifx\f@family\sfdef@ult \bfseries@sf
693+ \else\ifx\f@family\ttdef@ult \bfseries@tt
694+ \else \bfdefault
695+ \fi\fi\fi
696+ }%
697+ \kanjiseries{%
698+ \ifx\k@family\mcdef@ult \bfseries@mc
699+ \else\ifx\k@family\gtdef@ult \bfseries@gt
700+ \else\ifx\k@family\jttdef@ult\bfseries@jtt
701+ \else \bfdefault
702+ \fi\fi\fi
703+ }%
704+ \selectfont
705+}
706+\DeclareRobustCommand\mdseries{%
707+ \not@math@alphabet\mdseries\relax
708+ \expand@font@defaults
709+ \romanseries{%
710+ \ifx\f@family\rmdef@ult \mdseries@rm
711+ \else\ifx\f@family\sfdef@ult \mdseries@sf
712+ \else\ifx\f@family\ttdef@ult \mdseries@tt
713+ \else \mddefault
714+ \fi\fi\fi
715+ }%
716+ \kanjiseries{%
717+ \ifx\k@family\mcdef@ult \mdseries@mc
718+ \else\ifx\k@family\gtdef@ult \mdseries@gt
719+ \else\ifx\k@family\jttdef@ult\mdseries@jtt
720+ \else \mddefault
721+ \fi\fi\fi
722+ }%
723+ \selectfont
724+}
725+\appto\expand@font@defaults{%
726+ \edef\mcdef@ult{\mcdefault}%
727+ \edef\gtdef@ult{\gtdefault}%
728+ \edef\jttdef@ult{\jttdefault}%
729+ \edef\kanjidef@ult{\kanjifamilydefault}%
730+}
731+\appto\init@series@setup{%
732+ \ifx\kanjidef@ult\mcdef@ult \mcfamily
733+ \else\ifx\kanjidef@ult\gtdef@ult \gtfamily
734+ \else\ifx\kanjidef@ult\jttdef@ult \jttfamily
735+ \fi\fi\fi
736+}
737+\fi
738+\ifdefined\prepare@family@series@update@kanji\else
739+%%%% LaTeX 2019-10-01
740+\def\prepare@family@series@update@kanji#1{\kanjifamily}
741+\fi
742+
599743 \DeclareRobustCommand\mcfamily{%
600744 \unless\ifltj@disablejfam\not@math@alphabet\mcfamily\mathmc\fi
601- \kanjifamily\mcdefault\selectfont}
745+ \prepare@family@series@update@kanji{mc}\mcdefault
746+ \selectfont}
602747 \DeclareRobustCommand\gtfamily{%
603748 \unless\ifltj@disablejfam\not@math@alphabet\gtfamily\mathgt\fi
604- \kanjifamily\gtdefault\selectfont}
749+ \prepare@family@series@update@kanji{gt}\gtdefault
750+ \selectfont}
751+
752+
753+
605754 \let\romanprocess@table\process@table
606755 \def\kanjiprocess@table{%
607756 \kanjiencoding{\kanjiencodingdefault}%
--- a/src/patches/lltjp-fontspec.sty
+++ b/src/patches/lltjp-fontspec.sty
@@ -1,5 +1,5 @@
11 %
2-% lltjp-fontspec.sty 2019-10-21
2+% lltjp-fontspec.sty 2020-01-13
33 %
44
55 \NeedsTeXFormat{LaTeX2e}
@@ -7,13 +7,31 @@
77 \RequirePackage{fontspec}
88 \ExplSyntaxOn
99
10-% <= v2.6g uses \l__fontspec_nfss_enc_tl instead of \g__fontspec_nfss_enc_tl
11-\ifdefined \g__fontspec_nfss_enc_tl \else
12- \def \g__fontspec_nfss_enc_tl { \l__fontspec_nfss_enc_tl }
13-\fi
14-
1510 %%%%%%%% fontspec v2.5c overwrites \rmfamily etc. in \setmainfont
16-\@ifpackagelater{fontspec}{2019/10/19}{ %% 2.7d or later
11+\@ifpackagelater{fontspec}{2020/01/09}{ %% 2.7e or later
12+ \tl_replace_all:cnn { rmfamily~ } { \fontfamily }{ \romanfamily }
13+ \tl_replace_all:cnn { sffamily~ } { \fontfamily }{ \romanfamily }
14+ \tl_replace_all:cnn { ttfamily~ } { \fontfamily }{ \romanfamily }
15+ \typeout{LATEX~ 2019-10-01!}
16+ \cs_if_exist:NF \@rmfamilyhook {
17+ \tl_replace_all:cnn { rmfamily~ } { \selectfont } {
18+ \if@ltj@match@family
19+ \prepare@family@series@update@kanji{mc}\mcdefault
20+ \fi\selectfont
21+ }
22+ \tl_replace_all:cnn { sffamily~ } { \selectfont } {
23+ \if@ltj@match@family
24+ \prepare@family@series@update@kanji{gt}\gtdefault
25+ \fi\selectfont
26+ }
27+ \tl_replace_all:cnn { ttfamily~ } { \selectfont } {
28+ \if@ltj@match@family
29+ \prepare@family@series@update@kanji{jtt}\jttdefault
30+ \fi\selectfont
31+ }
32+ }
33+%% end of 2.7e (or later)
34+}{\@ifpackagelater{fontspec}{2019/10/19}{ %% 2.7d
1735 \cs_set:Nn \__fontspec_main_setmainfont:nn
1836 {
1937 \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2}
@@ -71,7 +89,8 @@
7189 \__fontspec_setmonofont_hook:nn {#1} {#2}
7290 \normalfont
7391 }
74-}{\@ifpackagelater{fontspec}{2018/07/29}{ %% 2.6h <= and <= 2.7c
92+%% end of 2.7d
93+}{%% 2.7c
7594 \cs_set:Nn \__fontspec_main_setmainfont:nn
7695 {
7796 \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2}
@@ -129,58 +148,7 @@
129148 \__fontspec_setmonofont_hook:nn {#1} {#2}
130149 \normalfont
131150 }
132-}{ %% <= 2.6g
133-\DeclareDocumentCommand \setmainfont { O{} m O{} }
134- {
135- \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1,#3} {#2}
136- \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family
137- \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily }
138- {
139- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
140- \exp_not:N \fontfamily { \g__fontspec_rmfamily_family }
141- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\mcdefault\exp_not:N\fi%%%
142- \exp_not:N \selectfont
143- }
144- }
145- \str_if_eq:eeT {\familydefault} {\rmdefault}
146- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
147- \normalfont
148- \ignorespaces
149- }
150-\DeclareDocumentCommand \setsansfont { O{} m O{} }
151- {
152- \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1,#3} {#2}
153- \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family
154- \use:x { \exp_not:n { \DeclareRobustCommand \sffamily }
155- {
156- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
157- \exp_not:N \fontfamily { \g__fontspec_sffamily_family }
158- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\gtdefault\exp_not:N\fi%%%
159- \exp_not:N \selectfont
160- }
161- }
162- \str_if_eq:eeT {\familydefault} {\sfdefault}
163- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
164- \normalfont
165- \ignorespaces
166- }
167-\DeclareDocumentCommand \setmonofont { O{} m O{} }
168- {
169- \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1,#3} {#2}
170- \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family
171- \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily }
172- {
173- \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl }
174- \exp_not:N \fontfamily { \g__fontspec_ttfamily_family }
175- \exp_not:N\if@ltj@match@family\exp_not:N\kanjifamily\exp_not:N\jttdefault\exp_not:N\fi%%%
176- \exp_not:N \selectfont
177- }
178- }
179- \str_if_eq:eeT {\familydefault} {\ttdefault}
180- { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl }
181- \normalfont
182- \ignorespaces
183- }
151+%% end of 2.7d
184152 }}
185153
186154 \cs_set:Nn \fontspec_visible_space:
@@ -190,19 +158,6 @@
190158 { \fontspec_visible_space_fallback: }
191159 }
192160
193-\AtBeginDocument{
194- \cs_if_exist:NF \verbvisiblespace {
195- % >= LaTeX2e <2018-12-01> does not need the following patch
196- \def\verb
197- {
198- \relax\ifmmode\hbox\else\leavevmode\fi % same as lltjcore
199- \bgroup
200- \verb@eol@error \let\do\@makeother \dospecials
201- \verbatim@font\@noligs
202- \@ifstar\__fontspecsverb\@verb
203- }
204- }
205-}
206161 \cs_set:Npn \emshape { \gtfamily \itshape }
207162 \cs_set:Npn \eminnershape { \mcfamily \upshape }
208163
Binary files a/test/test09-fontspec.pdf and b/test/test09-fontspec.pdf differ
--- a/test/test09-fontspec.tex
+++ b/test/test09-fontspec.tex
@@ -1,18 +1,9 @@
11 %#! lualatex
22 \documentclass{article}
3-
4-\makeatletter
5-\let\ltj@orig@DeclareFontShape@=\DeclareFontShape@
6-\def\DeclareFontShape@#1#2#3#4#5#6{%
7-\immediate\typeout{DFS |#1|#2|#3|#4|#5|#6|}%
8-\ltj@orig@DeclareFontShape@{#1}{#2}{#3}{#4}{#5}{#6}%
9-}
10-\makeatother
11-
3+\usepackage[margin=15mm]{geometry}
124
135 \usepackage{luatexja}
146 \usepackage{luatexja-fontspec}
15-\usepackage{booktabs,array,lltjext}
167
178 \defaultfontfeatures{Numbers=OldStyle}
189 \setmainfont{TeXGyreTermes}
@@ -22,10 +13,7 @@
2213 \setmainjfont[BoldFont=IPAexGothic]{IPAexMincho} % default: JFM=ujis
2314 \setsansjfont{IPAexGothic}
2415
25-\setjfontfamily\ipajisninety[CJKShape=JIS1990]{IPAexMincho}
26-
27-\normalsize
28-\usepackage[margin=25mm,a4paper]{geometry}
16+\newjfontfamily\ipajisninety[CJKShape=JIS1990]{IPAexMincho}
2917
3018 \begin{document}
3119
@@ -35,12 +23,11 @@
3523
3624 \noindent 通常:「あいうえお」、(かきくけこ)。{\bf 太字}と{\gt ゴシック}。
3725
38-%{\addjfontfeatures{JFM=mono}
39-%\noindent 等幅:「あいうえお」、(かきくけこ)。{\bf 太字}と{\gt ゴシック}。
40-%}
41-
26+{\addjfontfeatures{JFM=mono}
27+\noindent 等幅:「あいうえお」、(かきくけこ)。{\bf 太字}と{\gt ゴシック}。
28+}
4229
43-\def\R{%
30+\subsection{JIS2004}
4431 逢芦飴溢茨鰯淫迂厩噂餌襖迦牙廻恢晦蟹葛鞄釜翰翫徽
4532 祇汲灸笈卿饗僅喰櫛屑粂祁隙倦捲牽鍵諺巷梗膏鵠甑叉
4633 榊薩鯖錆鮫餐杓灼酋楯薯藷哨鞘杖蝕訊逗摺撰煎煽穿箭
@@ -48,29 +35,27 @@
4835 瀞遁謎灘楢禰牌這秤駁箸叛挽誹樋稗逼謬豹廟瀕斧蔽瞥
4936 蔑篇娩鞭庖蓬鱒迄儲餅籾爺鑓愈猷漣煉簾榔屢冤叟咬嘲
5037 囀徘扁棘橙狡甕甦疼祟竈筵篝腱艘芒虔蜃蠅訝靄靱騙鴉
51-}
52-
53-\subsection{JIS2004}
54-\R
55-
56-\medskip\hrule\medskip
57-\vbox{\hsize=7\zw\tate\parindent1\zw\R}
58-
59-
6038
6139 \subsection{JIS1990}
6240 {\ipajisninety
63-\R
41+逢芦飴溢茨鰯淫迂厩噂餌襖迦牙廻恢晦蟹葛鞄釜翰翫徽
42+祇汲灸笈卿饗僅喰櫛屑粂祁隙倦捲牽鍵諺巷梗膏鵠甑叉
43+榊薩鯖錆鮫餐杓灼酋楯薯藷哨鞘杖蝕訊逗摺撰煎煽穿箭
44+詮噌遡揃遜腿蛸辿樽歎註瀦捗槌鎚辻挺鄭擢溺兎堵屠賭
45+瀞遁謎灘楢禰牌這秤駁箸叛挽誹樋稗逼謬豹廟瀕斧蔽瞥
46+蔑篇娩鞭庖蓬鱒迄儲餅籾爺鑓愈猷漣煉簾榔屢冤叟咬嘲
47+囀徘扁棘橙狡甕甦疼祟竈筵篝腱艘芒虔蜃蠅訝靄靱騙鴉
48+}
6449
65-\medskip\hrule\medskip
66-\vbox{\hsize=7\zw\tate\parindent1\zw\R}}
50+\vspace{1\zw}
6751
6852 \subsection{Kerning}
69-{\jfontspec{KozMinPr6N-Regular}
53+{\jfontspec[NoEmbed]{Ryumin-Light}
54+
7055 アノ ← Kerning=Off
7156
7257 \noindent{\addjfontfeatures{Kerning=On} アノ ← Kerning=On}
73-\par}
58+}
7459
7560 \subsection{unicode}
7661
@@ -78,7 +63,7 @@
7863 常に和文:「\ltjjachar"201C」「\ltjjachar"010F」%"
7964 常に欧文:「\ltjalchar"201C」「\ltjalchar"010F」%"
8065
81-{\let\char=\ltjalchar\textquotedblleft}あ\textquotedblleft あ%
66+{\tracingall\let\char=\ltjalchar\textquotedblleft}あ\textquotedblleft あ%
8267 {\let\char=\ltjjachar\textquotedblleft}あ“あ
8368
8469 \begin{itemize}
@@ -94,45 +79,11 @@
9479 \end{itemize}
9580 \end{itemize}
9681
97-\newpage
98-\section{fontspecによる非埋め込みフォント}
99-\setjfontfamily\test[BoldFont=GothicBBB-Medium, NoEmbed]{Ryumin-Light}
100-
101-%{\test
102-%\begin{tabular}<y>{ll>{\itshape}l>{\slshape}l}
103-%\toprule
104-%&Upright&Italic&Slanted\\
105-%\midrule
106-%Regular&あいうえお&あいうえお&あいうえお\
107-%Bold &\textbf{あいうえお}&\textbf{あいうえお}&\textbf{あいうえお}\\
108-%\bottomrule
109-%\end{tabular}}
110-
111-\section{JFMの違い}
112-\setjfontfamily\test[ TateFont=KozGoPr6N-Light ]{KozMinPr6N-Bold}
113-
114-\def\yttest{\leavevmode%
115-\parbox<y>{20\zw}{%
116-「ちょっと」,“チェック”しちゃった!あいう
117-}%
118-\parbox<t>{20\zw}{%
119-「ちょっと」,“チェック”しちゃった!あいう}%
120-}
121-
122-\test
123-\addjfontfeatures{CJKShape=JIS1990,Color=FF0000}
124-\yttest
125-\noindent
126-
127-%\vskip-\dimexpr20\zw+\lineskip\relax
128-\noindent
129-\addjfontfeatures{Color=0000FF, YokoFeatures={ Color=0080FF, JFM=min}, TateFeatures={JFM=tmin}}
130-\yttest
131-
132-
133-\section{match}
134-
135-\normalfont
136-\sffamily aiuあいう\rmfamily aiuあいう \ttfamily aiuあいう
82+\addfontfeatures{Color=BD6D8F}
83+\addjfontfeatures{Color=28AFCB,CJKShape=JIS1990}
84+あいうえお芦漢字ABC
85+\[
86+あいうえお芦\int_0^∞ e^{-x^2}\,dx\mathrm{ABC}\textrm{ABC}\textsf{ABC}
87+\]
13788
138-\end{document}
\ No newline at end of file
89+\end{document}
--- /dev/null
+++ b/test/test31-nfss20200202.tex
@@ -0,0 +1,35 @@
1+\documentclass{ltjarticle}
2+\makeatletter
3+\def\mdseries@mc{el}
4+\def\bfseries@mc{sb}
5+\def\mdseries@gt{l}
6+\def\bfseries@gt{k}
7+\DeclareFontShape{JY3}{gt}{k}{n}{<-> KozGoPr6N-Heavy.otf:jfm=ujis}{}
8+\DeclareFontShape{JT3}{gt}{k}{n}{<-> KozGoPr6N-Heavy.otf:jfm=ujisv}{}
9+\DeclareFontShape{JY3}{gt}{l}{n}{<-> KozGoPr6N-ExtraLight.otf:jfm=ujis}{}
10+\DeclareFontShape{JT3}{gt}{l}{n}{<-> KozGoPr6N-ExtraLight.otf:jfm=ujisv}{}
11+\DeclareFontShape{JY3}{mc}{el}{n}{<-> KozMinPr6N-ExtraLight.otf:jfm=ujis}{}
12+\DeclareFontShape{JT3}{mc}{el}{n}{<-> KozMinPr6N-ExtraLight.otf:jfm=ujisv}{}
13+\DeclareFontShape{JY3}{mc}{sb}{n}{<-> KozMinPr6N-Bold.otf:jfm=ujis}{}
14+\DeclareFontShape{JT3}{mc}{sb}{n}{<-> KozMinPr6N-Bold.otf:jfm=ujisv}{}
15+\def\TEST{%
16+ \par
17+ A: \f@encoding/\f@family/\f@series/\f@shape.
18+ K: \k@encoding/\k@family/\k@series/\k@shape.
19+ あいうABC
20+}
21+\begin{document}
22+\TEST NORMAL
23+\emph{\TEST} EMPH
24+\textsf{\TEST} SF
25+\textbf{\TEST} BF
26+\textgt{\TEST} GT
27+\textbf{\textgt{\TEST}} BF+GT
28+\textbf{\textgt{\textmd{\TEST}}} BF+GT+MD
29+
30+\textsc{\textit{\TEST}} SC+IT
31+
32+{\fontseries{b}\selectfont \TEST} B
33+{\fontseries{bx}\selectfont \TEST} BX
34+
35+\end{document}
\ No newline at end of file
旧リポジトリブラウザで表示