summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty72
1 files changed, 72 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
index 4a037d640cd..056ae0cc6f9 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
@@ -149,4 +149,76 @@
\cs_set_eq:NN \addjfontfeature \addjfontfeatures
+\ExplSyntaxOff
+%%%%%%%% Now we completely ignore kanjifont definition file.
+
+\DeclareRobustCommand\fontfamily[1]{%
+ \@notkfamfalse\@notffamfalse\edef\tmp@item{{#1}}%
+ \ifcsname \k@encoding+#1\endcsname % if \k@encoding+#1 is already defined
+ \edef\k@family{#1}%
+ \else
+ \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\k@encoding+%
+ \@notkfamtrue
+ \fi
+ \ifcsname \f@encoding+#1\endcsname
+ \edef\f@family{#1}%
+ \else % search font definition file...
+ \ifcsname ffam@list@\f@encoding\endcsname\else
+ \expandafter\gdef\csname ffam@list@\f@encoding\endcsname{}%
+ \expandafter\gdef\csname notffam@list@\f@encoding\endcsname{}%
+ \fi
+ \edef\@templist{\@nameuse{ffam@list@\f@encoding}}%
+ \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
+ \ifin@\edef\f@family{#1}\else
+ \edef\@templist{\@nameuse{notffam@list@\f@encoding}}%
+ \expandafter\expandafter\expandafter\inlist@\expandafter\tmp@item\expandafter{\@templist}%
+ \ifin@\@notffamtrue\else
+ \def\@temp##1+{\lowercase{\def\@@temp{##1#1.fd}}}\expandafter\@temp\f@encoding+%
+ \message{(I search font definition file. \@@temp)}%
+ \IfFileExists{\@@temp}{\@tempswztrue}{\@tempswzfalse}%
+ \if@tempswz
+ \expandafter\xdef\csname ffam@list@\f@encoding\endcsname
+ {\@nameuse{ffam@list@\f@encoding}\fam@elt<#1>}\edef\f@family{#1}%
+ \else
+ \expandafter\xdef\csname notffam@list@\f@encoding\endcsname
+ {\@nameuse{notffam@list@\f@encoding}\fam@elt<#1>}\@notffamtrue%
+ \fi
+ \fi
+ \fi
+ \fi
+ \if@notkfam\if@notffam
+ {\ifcsname D@\k@encoding\endcsname\@nameuse{D@\k@encoding}\fi
+ \xdef\@@temp{\default@family}}\edef\k@family{\@@temp}%
+ {\ifcsname D@\f@encoding\endcsname\@nameuse{D@\f@encoding}\fi
+ \xdef\@@temp{\default@family}}\edef\f@family{\@@temp}%
+ \fi\fi
+}
+
+% We must redefine \try@load@fontshape to ignore kanjifont definitions at all.
+\def\try@load@fontshape{%
+ \expandafter
+ \ifx\csname \f@encoding+\f@family\endcsname\relax
+ \edef\tmp@item{{\directlua{%
+ tex.print(luatexbase.catcodetables["latex-package"], '\f@encoding')}%
+ }}% \f@encoding の展開結果の catcode は 12 であるため,これで補正.
+ \expandafter\expandafter\expandafter
+ \inlist@\expandafter\tmp@item\expandafter{\kenc@list}%
+\ifin@ % Japanese font: we don't search fd.
+ \@font@warning{We don't search kanjifont definition
+ \MessageBreak for \f@encoding/\f@family}%
+\else % Alphabetic font
+ \@font@info{Try loading font information for
+ \f@encoding+\f@family}%
+ \global\expandafter\let
+ \csname\f@encoding+\f@family\endcsname\@empty
+ \nfss@catcodes
+ \let\nfss@catcodes\relax
+ \edef\reserved@a{%
+ \lowercase{%
+ \noexpand\InputIfFileExists{\f@encoding\f@family.fd}}}%
+ \reserved@a\relax
+ {\@input@{\f@encoding\f@family.fd}}%
+\fi
+ \fi}
+
\endinput