summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty185
1 files changed, 166 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 0f572b52fc7..f2d78fb653a 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
@@ -3,8 +3,9 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjfont}[2019/09/25 Patch to NFSS2 for LuaTeX-ja]
+\ProvidesPackage{lltjfont}[2020/01/26 Patch to NFSS2 for LuaTeX-ja]
+%% patching \DeclareTextComposite
\def\ltj@chardef@text@cmd#1{%
\let\@ifdefinable\@@ifdefinable%
\edef\ltj@chardef@text@cmd@name{\expandafter\@gobble\string#1}%
@@ -23,13 +24,11 @@
\@dec@text@cmd\ltj@chardef@text@cmd#1{#2}#3\relax
}
-\ifdefined\UnicodeEncodingName
- \let\ltj@temp@DeclareTextComposite=\DeclareTextComposite
- \def\DeclareTextComposite#1#2#3#4{}%
- \input{tuenc.def}
- \let\DeclareTextComposite=\ltj@temp@DeclareTextComposite
- \expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
-\fi
+\let\ltj@temp@DeclareTextComposite=\DeclareTextComposite
+\def\DeclareTextComposite#1#2#3#4{}%
+\input{tuenc.def}
+\let\DeclareTextComposite=\ltj@temp@DeclareTextComposite
+\expandafter\patchcmd\csname TU\string\textasteriskcentered\endcsname{\char}{\ltjalchar}{}{}
\let\k@encoding\@empty
@@ -568,12 +567,93 @@
\edef\k@family{#1}\edef\f@family{#1}%
\fi\fi
}
+
+\ifdefined\@rmfamilyhook
+%%%% LaTeX 2020-02-02
+\DeclareRobustCommand\romanseriesforce[1]{\edef\f@series{#1}}
+\DeclareRobustCommand\kanjiseriesforce[1]{\edef\k@series{#1}}
+\DeclareRobustCommand\fontseriesforce[1]{\kanjiseries{#1}\romanseries{#1}}
+\DeclareRobustCommand\romanshapeforce[1]{\edef\f@shape{#1}}
+\DeclareRobustCommand\kanjishapeforce[1]{\edef\k@shape{#1}}
+\DeclareRobustCommand\fontshapeforce[1]{\kanjishape{#1}\romanshape{#1}}
+
+\def\merge@font@kanji@series#1{%
+ \expandafter\expandafter\expandafter
+ \merge@font@kanji@series@
+ \csname series@\k@series @#1\endcsname
+ {#1}%
+ \@nil
+}
+\def\set@target@kanji@series#1{%
+ \edef\k@series{#1}%
+ \edef\k@series{\expandafter\series@drop@one@m\k@series mm\series@drop@one@m}%
+}
+\def\merge@font@kanji@series@#1#2#3\@nil{%
+ \def\@reserveda{#3}%
+ \ifx\@reserveda\@empty
+ \set@target@kanji@series{#2}%
+ \else
+ \begingroup\let\f@encoding\k@encoding\let\f@family\k@family
+ \maybe@load@fontshape\endgroup
+ \edef\@reserveda{\k@encoding /\k@family /#1/\k@shape}%
+ \ifcsname \@reserveda \endcsname
+ \set@target@kanji@series{#1}%
+ \else
+ \ifcsname \k@encoding /\k@family /#2/\k@shape \endcsname
+ \set@target@kanji@series{#2}%
+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
+ \else
+ \set@target@kanji@series{#3}%
+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
+ \fi
+ \fi
+ \fi
+}
+\def\merge@font@kanji@shape#1{%
+ \expandafter\expandafter\expandafter
+ \merge@font@kanji@shape@
+ \csname shape@\k@shape @#1\endcsname
+ {#1}%
+ \@nil
+}
+\def\merge@font@kanji@shape@#1#2#3\@nil{%
+ \def\@reserveda{#3}%
+ \ifx\@reserveda\@empty
+ \edef\k@shape{#2}%
+ \else
+ \maybe@load@fontshape
+ \edef\@reserveda{\k@encoding /\k@family /\k@series/#1}%
+ \ifcsname \@reserveda\endcsname
+ \edef\k@shape{#1}%
+ \else
+ \ifcsname \k@encoding /\k@family /\k@series/#2\endcsname
+ \edef\k@shape{#2}%
+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
+ \else
+ \edef\k@shape{#3}%
+ {\let\curr@fontshape\curr@kfontshape\@font@shape@subst@warning}%
+ \fi
+ \fi
+ \fi
+}
+\DeclareRobustCommand\romanseries[1]{\merge@font@series{#1}}
+\DeclareRobustCommand\kanjiseries[1]{\merge@font@kanji@series{#1}}
+\DeclareRobustCommand\fontseries[1]{%
+ \merge@font@series{#1}\merge@font@kanji@series{#1}}
+\DeclareRobustCommand\romanshape[1]{\merge@font@shape{#1}}
+\DeclareRobustCommand\kanjishape[1]{\merge@font@kanji@shape{#1}}
+\DeclareRobustCommand\fontshape[1]{%
+ \merge@font@shape{#1}\merge@font@kanji@shape{#1}}
+\else
+%%%% LaTeX 2019-10-01
\DeclareRobustCommand\romanseries[1]{\edef\f@series{#1}}
\DeclareRobustCommand\kanjiseries[1]{\edef\k@series{#1}}
\DeclareRobustCommand\fontseries[1]{\kanjiseries{#1}\romanseries{#1}}
\DeclareRobustCommand\romanshape[1]{\edef\f@shape{#1}}
\DeclareRobustCommand\kanjishape[1]{\edef\k@shape{#1}}
\DeclareRobustCommand\fontshape[1]{\kanjishape{#1}\romanshape{#1}}
+\fi
+%%%%
\DeclareRobustCommand\usekanji[4]{%
\kanjiencoding{#1}\kanjifamily{#2}\kanjiseries{#3}\kanjishape{#4}%
\selectfont\ignorespaces}
@@ -586,22 +666,89 @@
\else\useroman{#1}{#2}{#3}{#4}%
\fi}
\DeclareRobustCommand\normalfont{%
- \kanjiencoding{\kanjiencodingdefault}%
- \kanjifamily{\kanjifamilydefault}%
- \kanjiseries{\kanjiseriesdefault}%
- \kanjishape{\kanjishapedefault}%
- \romanencoding{\encodingdefault}%
- \romanfamily{\familydefault}%
- \romanseries{\seriesdefault}%
- \romanshape{\shapedefault}%
- \selectfont\ignorespaces}
+ \useroman\encodingdefault\familydefault\seriesdefault\shapedefault
+ \usekanji\kanjiencodingdefault\kanjifamilydefault\kanjiseriesdefault\kanjishapedefault
+ \ignorespaces}
\let\reset@font\normalfont
+
+\ifdefined\@rmfamilyhook
+%%%% LaTeX 2020-02-02
+\let\prepare@family@series@update@kanji=\prepare@family@series@update
+\patchcmd\prepare@family@series@update{\fontfamily}{\romanfamily}{}{}
+\patchcmd\prepare@family@series@update@kanji{\fontfamily}{\kanjifamily}{}{}
+\patchcmd\prepare@family@series@update@kanji{\f@series}{\k@series}{}{}
+\patchcmd\prepare@family@series@update@kanji{\maybe@load@fontshape}
+ {\begingroup\let\f@encoding\k@encoding\let\f@family\k@family
+ \maybe@load@fontshape\endgroup}{}{}
+\patchcmd\prepare@family@series@update@kanji{\@meta@family@list}{\@meta@family@kanji@list}{}{}
+\def\@meta@family@kanji@list{\@elt{mc}\@elt{gt}\@elt{jtt}}
+\DeclareRobustCommand\bfseries{%
+ \not@math@alphabet\bfseries\mathbf
+ \expand@font@defaults
+ \romanseries{%
+ \ifx\f@family\rmdef@ult \bfseries@rm
+ \else\ifx\f@family\sfdef@ult \bfseries@sf
+ \else\ifx\f@family\ttdef@ult \bfseries@tt
+ \else \bfdefault
+ \fi\fi\fi
+ }%
+ \kanjiseries{%
+ \ifx\k@family\mcdef@ult \bfseries@mc
+ \else\ifx\k@family\gtdef@ult \bfseries@gt
+ \else\ifx\k@family\jttdef@ult\bfseries@jtt
+ \else \bfdefault
+ \fi\fi\fi
+ }%
+ \selectfont
+}
+\DeclareRobustCommand\mdseries{%
+ \not@math@alphabet\mdseries\relax
+ \expand@font@defaults
+ \romanseries{%
+ \ifx\f@family\rmdef@ult \mdseries@rm
+ \else\ifx\f@family\sfdef@ult \mdseries@sf
+ \else\ifx\f@family\ttdef@ult \mdseries@tt
+ \else \mddefault
+ \fi\fi\fi
+ }%
+ \kanjiseries{%
+ \ifx\k@family\mcdef@ult \mdseries@mc
+ \else\ifx\k@family\gtdef@ult \mdseries@gt
+ \else\ifx\k@family\jttdef@ult\mdseries@jtt
+ \else \mddefault
+ \fi\fi\fi
+ }%
+ \selectfont
+}
+\appto\expand@font@defaults{%
+ \edef\mcdef@ult{\mcdefault}%
+ \edef\gtdef@ult{\gtdefault}%
+ \edef\jttdef@ult{\jttdefault}%
+ \edef\kanjidef@ult{\kanjifamilydefault}%
+}
+\appto\init@series@setup{%
+ \ifx\kanjidef@ult\mcdef@ult \mcfamily
+ \else\ifx\kanjidef@ult\gtdef@ult \gtfamily
+ \else\ifx\kanjidef@ult\jttdef@ult \jttfamily
+ \fi\fi\fi
+}
+\fi
+\ifdefined\prepare@family@series@update@kanji\else
+%%%% LaTeX 2019-10-01
+\def\prepare@family@series@update@kanji#1{\kanjifamily}
+\fi
+
\DeclareRobustCommand\mcfamily{%
\unless\ifltj@disablejfam\not@math@alphabet\mcfamily\mathmc\fi
- \kanjifamily\mcdefault\selectfont}
+ \prepare@family@series@update@kanji{mc}\mcdefault
+ \selectfont}
\DeclareRobustCommand\gtfamily{%
\unless\ifltj@disablejfam\not@math@alphabet\gtfamily\mathgt\fi
- \kanjifamily\gtdefault\selectfont}
+ \prepare@family@series@update@kanji{gt}\gtdefault
+ \selectfont}
+
+
+
\let\romanprocess@table\process@table
\def\kanjiprocess@table{%
\kanjiencoding{\kanjiencodingdefault}%