diff options
Diffstat (limited to 'macros/latex/contrib/fontspec/fontspec-code-user.dtx')
-rw-r--r-- | macros/latex/contrib/fontspec/fontspec-code-user.dtx | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/macros/latex/contrib/fontspec/fontspec-code-user.dtx b/macros/latex/contrib/fontspec/fontspec-code-user.dtx index 7cbafbf8b0..aa739b4dee 100644 --- a/macros/latex/contrib/fontspec/fontspec-code-user.dtx +++ b/macros/latex/contrib/fontspec/fontspec-code-user.dtx @@ -27,6 +27,25 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\rmfamily} +% \begin{macro}{\sffamily} +% \begin{macro}{\ttfamily} +% Add an encoding switch to the three family commands. +% \begin{macrocode} +\tl_replace_all:cnn { rmfamily~ } { \fontfamily } + { \fontencoding \l_@@_rmfamily_encoding_tl \fontfamily } +\tl_replace_all:cnn { sffamily~ } { \fontfamily } + { \fontencoding \l_@@_sffamily_encoding_tl \fontfamily } +\tl_replace_all:cnn { ttfamily~ } { \fontfamily } + { \fontencoding \l_@@_ttfamily_encoding_tl \fontfamily } +\tl_set_eq:NN \l_@@_rmfamily_encoding_tl \g_fontspec_encoding_tl +\tl_set_eq:NN \l_@@_sffamily_encoding_tl \g_fontspec_encoding_tl +\tl_set_eq:NN \l_@@_ttfamily_encoding_tl \g_fontspec_encoding_tl +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\setmainfont} % The following three macros perform equivalent operations setting % the default font for a particular family: `roman', sans serif, or typewriter @@ -39,18 +58,10 @@ { \fontspec_set_family:Nnn \l_@@_rmfamily_family_tl {#1} {#2} \tl_set_eq:NN \rmdefault \l_@@_rmfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \g_@@_nfss_enc_tl } - \exp_not:N \fontfamily { \exp_not:N \rmdefault } - \exp_not:N \selectfont - } - } + \tl_set_eq:NN \l_@@_rmfamily_encoding_tl \g_@@_nfss_enc_tl \str_if_eq:eeT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } - \@@_setmainfont_hook:nn {#1} {#2} + \@@_setmainfont_hook:nn {#1} {#2} % for unicode-math only \normalfont } % \end{macrocode} @@ -63,18 +74,10 @@ { \fontspec_set_family:Nnn \l_@@_sffamily_family_tl {#1} {#2} \tl_set_eq:NN \sfdefault \l_@@_sffamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \g_@@_nfss_enc_tl } - \exp_not:N \fontfamily { \exp_not:N \sfdefault } - \exp_not:N \selectfont - } - } + \tl_set_eq:NN \l_@@_sffamily_encoding_tl \g_@@_nfss_enc_tl \str_if_eq:eeT {\familydefault} {\sfdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } - \@@_setsansfont_hook:nn {#1} {#2} + \@@_setsansfont_hook:nn {#1} {#2} % for unicode-math only \normalfont } % \end{macrocode} @@ -87,18 +90,10 @@ { \fontspec_set_family:Nnn \l_@@_ttfamily_family_tl {#1} {#2} \tl_set_eq:NN \ttdefault \l_@@_ttfamily_family_tl - \use:x - { - \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \g_@@_nfss_enc_tl } - \exp_not:N \fontfamily { \exp_not:N \ttdefault } - \exp_not:N \selectfont - } - } + \tl_set_eq:NN \l_@@_ttfamily_encoding_tl \g_@@_nfss_enc_tl \str_if_eq:eeT {\familydefault} {\ttdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } - \@@_setmonofont_hook:nn {#1} {#2} + \@@_setmonofont_hook:nn {#1} {#2} % for unicode-math only \normalfont } % \end{macrocode} @@ -118,7 +113,7 @@ { %<XE> \fontspec_gset_family:Nnn \g_@@_mathrm_tl {#1} {#2} %<LU> \fontspec_gset_family:Nnn \g_@@_mathrm_tl {Renderer=Basic,#1} {#2} - \@@_setmathrm_hook:nn {#1} {#2} + \@@_setmathrm_hook:nn {#1} {#2} % for unicode-math only } % \end{macrocode} % \end{macro} @@ -129,7 +124,7 @@ { %<XE> \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {#1} {#2} %<LU> \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {Renderer=Basic,#1} {#2} - \@@_setboldmathrm_hook:nn {#1} {#2} + \@@_setboldmathrm_hook:nn {#1} {#2} % for unicode-math only } % \end{macrocode} % \end{macro} @@ -140,7 +135,7 @@ { %<XE> \fontspec_gset_family:Nnn \g_@@_mathsf_tl {#1} {#2} %<LU> \fontspec_gset_family:Nnn \g_@@_mathsf_tl {Renderer=Basic,#1} {#2} - \@@_setmathsf_hook:nn {#1} {#2} + \@@_setmathsf_hook:nn {#1} {#2} % for unicode-math only } % \end{macrocode} % \end{macro} @@ -151,7 +146,7 @@ { %<XE> \fontspec_gset_family:Nnn \g_@@_mathtt_tl {#1} {#2} %<LU> \fontspec_gset_family:Nnn \g_@@_mathtt_tl {Renderer=Basic,#1} {#2} - \@@_setmathtt_hook:nn {#1} {#2} + \@@_setmathtt_hook:nn {#1} {#2} % for unicode-math only } % \end{macrocode} % \end{macro} @@ -528,7 +523,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2019 Will Robertson, LPPL "maintainer" +% Copyright 2004-2020 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright |