diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/xebabel.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/xebabel.def | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/xebabel.def b/Master/texmf-dist/tex/generic/babel/xebabel.def index bf2da9aca63..f3ab376c6f8 100644 --- a/Master/texmf-dist/tex/generic/babel/xebabel.def +++ b/Master/texmf-dist/tex/generic/babel/xebabel.def @@ -82,19 +82,24 @@ \input #1\relax} \ifx\DisableBabelHook\@undefined\endinput\fi \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont} +\AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts} \DisableBabelHook{babel-fontspec} \bbl@trace{Font handling with fontspec} \@onlypreamble\babelfont \newcommand\babelfont[2][]{% 1=langs/scripts 2=fam \edef\bbl@tempa{#1}% - \def\bbl@tempb{#2}% + \def\bbl@tempb{#2}% Used by \bbl@bblfont \ifx\fontspec\@undefined \usepackage{fontspec}% \fi \EnableBabelHook{babel-fontspec}% Just calls \bbl@switchfont \bbl@bblfont} -\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname - \bbl@ifunset{\bbl@tempb family}{\bbl@providefam{\bbl@tempb}}{}% +\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt + \bbl@ifunset{\bbl@tempb family}% + {\bbl@providefam{\bbl@tempb}}% + {\bbl@exp{% + \\\bbl@sreplace\<\bbl@tempb family >% + {\@nameuse{\bbl@tempb default}}{\<\bbl@tempb default>}}}% % For the default font, just in case: \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \expandafter\bbl@ifblank\expandafter{\bbl@tempa}% @@ -113,7 +118,18 @@ \\\not@math@alphabet\<#1family>\relax \\\fontfamily\<#1default>\\\selectfont}% \\\DeclareTextFontCommand{\<text#1>}{\<#1family>}}} -\def\bbl@switchfont{% +\def\bbl@nostdfont#1{% + \bbl@ifunset{bbl@WFF@\f@family}% + {\bbl@csarg\gdef{WFF@\f@family}{}% Flag, to avoid dupl warns + \bbl@warning{The current font is not a babel standard family:\\% + #1% + \fontname\font\\% + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}} + {}}% +\gdef\bbl@switchfont{% \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}% \bbl@exp{% eg Arabic -> arabic \lowercase{\edef\\\bbl@tempa{\bbl@cs{sname@\languagename}}}}% @@ -129,12 +145,7 @@ \global\let\<bbl@##1dflt@\languagename>% \<bbl@##1dflt@*\bbl@tempa>}}}% {}}% 1=T - language, already defined - \def\bbl@tempa{% - \bbl@warning{The current font is not a standard family:\\% - \fontname\font\\% - Script and Language are not applied. Consider\\% - defining a new family with \string\babelfont.\\% - Reported}}% + \def\bbl@tempa{\bbl@nostdfont{}}% \bbl@foreach\bbl@font@fams{% don't gather with prev for \bbl@ifunset{bbl@##1dflt@\languagename}% {\bbl@cs{famrst@##1}% @@ -146,6 +157,34 @@ \\\bbl@font@set\<bbl@##1dflt@\languagename>% the main part! \<##1default>\<##1family>}}}% \bbl@ifrestoring{}{\bbl@tempa}}% +\ifx\f@family\@undefined\else % if latex + \ifcase\bbl@engine % if pdftex + \let\bbl@ckeckstdfonts\relax + \else + \def\bbl@ckeckstdfonts{% + \begingroup + \global\let\bbl@ckeckstdfonts\relax + \let\bbl@tempa\@empty + \bbl@foreach\bbl@font@fams{% + \bbl@ifunset{bbl@##1dflt@}% + {\@nameuse{##1family}% + \bbl@csarg\gdef{WFF@\f@family}{}% Flag + \bbl@exp{\\\bbl@add\\\bbl@tempa{* \<##1family> / \f@family\\\\% + \space\space\fontname\font\\\\}}% + \bbl@csarg\xdef{##1dflt@}{\f@family}% + \expandafter\xdef\csname ##1default\endcsname{\f@family}}% + {}}% + \ifx\bbl@tempa\@empty\else + \bbl@warning{The following fonts are not babel standard families:\\% + \bbl@tempa + There is nothing intrinsically wrong with it, but\\% + 'babel' will no set Script and Language. Consider\\% + defining a new family with \string\babelfont.\\% + Reported}% + \fi + \endgroup} + \fi +\fi \def\bbl@font@set#1#2#3{% eg \bbl@rmdflt@lang \rmdefault \rmfamily \bbl@xin@{<>}{#1}% \ifin@ |