From c493011f1ad4ff5cd2973ed6a6a3d4c9fec6470f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 Mar 2015 22:59:51 +0000 Subject: fontspec (14mar15) git-svn-id: svn://tug.org/texlive/trunk@36512 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/fontspec/fontspec-luatex.sty | 177 +++++++++++++-------- .../tex/latex/fontspec/fontspec-patches.sty | 41 +++-- .../tex/latex/fontspec/fontspec-xetex.sty | 177 +++++++++++++-------- Master/texmf-dist/tex/latex/fontspec/fontspec.sty | 2 +- 4 files changed, 243 insertions(+), 154 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index e0c14fd0357..d36538320c8 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -14,7 +14,7 @@ %% %% \ProvidesPackage{fontspec-luatex} - [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX] + [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -35,28 +35,50 @@ \cs_set:Npn \XeTeXpicfile {} \RequirePackage{xunicode} \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp: -\DeclareDocumentCommand \fontspec { O{} m O{} } +\cs_new:Nn \__fontspec_pass_args:nnn + { + \IfNoValueTF {#2} + { \__fontspec_post_arg:w {#1} {#3} } + { #1 {#2} {#3} } + } +\NewDocumentCommand \__fontspec_post_arg:w { m m O{} } + { #1 {#3} {#2} } +\NewDocumentCommand \fontspec { o m } + { \__fontspec_pass_args:nnn \__fontspec_fontspec:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_fontspec:nn { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1,#3}{#2} + \fontspec_set_family:Nnn \f@family {#1}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m O{} } +\DeclareDocumentCommand \setmainfont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmainfont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmainfont:nn { - \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \rmdefault {#1}{#2} \normalfont \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m O{} } + +\DeclareDocumentCommand \setsansfont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setsansfont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setsansfont:nn { - \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \sfdefault {#1}{#2} \normalfont \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m O{} } + +\DeclareDocumentCommand \setmonofont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmonofont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmonofont:nn { - \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \ttdefault {#1}{#2} \normalfont \ignorespaces } @@ -65,21 +87,36 @@ \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl \tl_new:N \g__fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m O{} } +\DeclareDocumentCommand \setmathrm { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathrm:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m O{} } + +\DeclareDocumentCommand \setboldmathrm { o m } + { \__fontspec_pass_args:nnn \__fontspec_setboldmathrm:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setboldmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setmathsf { O{} m O{} } + +\DeclareDocumentCommand \setmathsf { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathsf:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathsf:nn { - \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} } -\DeclareDocumentCommand \setmathtt { O{} m O{} } + +\DeclareDocumentCommand \setmathtt { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathtt:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathtt:nn { - \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm @@ -88,9 +125,12 @@ \tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} \tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} \tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m O{} } +\DeclareDocumentCommand \newfontfamily { m o m } + { \__fontspec_pass_args:nnn { \__fontspec_newfontfamily:Nnn #1 } {#2} {#3} } + +\cs_new:Nn \__fontspec_newfontfamily:Nnn { - \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 @@ -100,9 +140,12 @@ } } } -\DeclareDocumentCommand \newfontface { m O{} m O{} } +\DeclareDocumentCommand \newfontface { m o m } + { \__fontspec_pass_args:nnn { \__fontspec_newfontface:Nnn #1 } {#2} {#3} } + +\cs_new:Nn \__fontspec_newfontface:Nnn { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} } \clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop @@ -140,15 +183,13 @@ } } } - \cs_new:Nn \__fontspec_sanitise_fontname:Nn { - \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } + \tl_set:Nx #1 {#2} \tl_remove_all:Nn #1 {~} \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } - \bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { @@ -201,32 +242,34 @@ \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { - \keys_if_exist:nnTF {fontspec} {#1} - { - \keys_define:nn {fontspec} - { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } } - } - { - \keys_if_exist:nnTF {fontspec-preparse} {#1} - { - \keys_define:nn {fontspec-preparse} - { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } } - } + \clist_map_inline:nn + { fontspec, fontspec-preparse, fontspec-preparse-external, + fontspec-preparse-nested, fontspec-renderer } + { + \keys_if_exist:nnT {##1} {#1} { - \keys_if_exist:nnTF {fontspec-preparse-external} {#1} - { - \keys_define:nn {fontspec-preparse-external} + \clist_map_break:n { - #2 .code:n = - { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } } + \__fontspec_alias_font_feature:nnn {##1} {#1} {#2} + \use_none_delimit_by_q_nil:w } - } - { - \__fontspec_warning:nx {rename-feature-not-exist} {#1} - } } - } + } + + % this executes if no match was found: + \__fontspec_warning:nx {rename-feature-not-exist} {#1} + + % jump to here if a match: + \use_none:n + \q_nil } + +\cs_set:Nn \__fontspec_alias_font_feature:nnn + { + \keys_define:nn {#1} + { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } } + } + \DeclareDocumentCommand \aliasfontfeatureoption {mmm} { \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } } \DeclareDocumentCommand \newfontscript {mm} @@ -506,12 +549,11 @@ \font_suppress_not_found_error: \__fontspec_init: - \tl_set:Nx \l_fontspec_fontname_tl {#2} - \tl_remove_all:Nn \l_fontspec_fontname_tl {~} - \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl - \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \tl_set:Nx \l_fontspec_fontname_tl {#2} + \tl_set:Nx \l_fontspec_fontname_up_tl {#2} + \tl_set:Nx \l__fontspec_basename_tl {#2} - \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} \__fontspec_extract_all_features:n {#1} \__fontspec_preparse_features: @@ -532,26 +574,25 @@ } \group_end: } -\cs_new:Nn \__fontspec_load_external_fontoptions:N +\cs_new:Nn \__fontspec_load_external_fontoptions:Nn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \prop_if_in:NVF \g__fontspec_fontopts_prop {\l__fontspec_tmp_tl} + \__fontspec_sanitise_fontname:Nn #1 {#2} + \tl_set:Nx \l__fontspec_ext_filename_tl {#1.fontspec} + \tl_remove_all:Nn \l__fontspec_ext_filename_tl {~} + \prop_if_in:NVF \g__fontspec_fontopts_prop #1 { - \exp_args:No \file_if_exist:nT {\l__fontspec_tmp_tl.fontspec} - { \file_input:n {\l__fontspec_tmp_tl.fontspec} } + \exp_args:No \file_if_exist:nT { \l__fontspec_ext_filename_tl } + { \file_input:n { \l__fontspec_ext_filename_tl } } } } \cs_new:Nn \__fontspec_extract_all_features:n { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \bool_if:NTF \l__fontspec_disable_defaults_bool { - \clist_set:Nx \l__fontspec_all_features_clist - {#1} + \clist_set:Nx \l__fontspec_all_features_clist {#1} } { - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist @@ -570,7 +611,7 @@ } \cs_new:Nn \__fontspec_preparse_features: { - \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + \__fontspec_if_detect_external:VT \l__fontspec_basename_tl { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } \keys_set_known:nxN {fontspec-preparse-external} @@ -602,6 +643,7 @@ } \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } +\cs_generate_variant:Nn \__fontspec_if_detect_external:nT {V} \cs_set:Nn \__fontspec_fullname:n { \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } @@ -757,10 +799,8 @@ \cs_new:Nn \__fontspec_load_fontname:n { - \tl_set:Nx \l_fontspec_fontname_tl {#1} - \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } @@ -1153,9 +1193,10 @@ \tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { - Renderer .choice_code:n = + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} { - \int_compare:nTF {\l_keys_choice_int <= 3} { + \int_compare:nTF {\l_keys_choice_int <= 4} { \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} } { @@ -1163,8 +1204,6 @@ { g_fontspec_mode_tag_ \l_keys_choice_tl } } } - , - Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} \tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index a690db0eb37..259777fa392 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -14,27 +14,38 @@ %% %% \ProvidesPackage{fontspec-patches} - [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX] + [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn -\cs_set_protected:Npn \@fnsymbol #1 +\cs_if_exist:NF \TextOrMath { - \int_case:nnF {#1} + % copy official definition: + \protected\expandafter\def\csname TextOrMath\space\endcsname{% + \ifmmode \expandafter\@secondoftwo + \else \expandafter\@firstoftwo \fi} + \edef\TextOrMath#1#2{% + \expandafter\noexpand\csname TextOrMath\space\endcsname + {#1}{#2}} + % translation of official definition: + \cs_set:Npn \@fnsymbol #1 { - {0} {} - {1} { \mode_if_math:TF *\textasteriskcentered } - {2} { \mode_if_math:TF \dagger\textdagger } - {3} { \mode_if_math:TF \ddagger\textdaggerdbl } - {4} { \mode_if_math:TF \mathsection\textsection } - {5} { \mode_if_math:TF \mathparagraph\textparagraph } - {6} { \mode_if_math:TF \|\textbardbl } - {7} { \mode_if_math:TF {**}{\textasteriskcentered\textasteriskcentered} } - {8} { \mode_if_math:TF {\dagger\dagger}{\textdagger\textdagger} } - {9} { \mode_if_math:TF {\ddagger\ddagger}{\textdaggerdbl\textdaggerdbl} } + \int_case:nnF {#1} + { + {0} {} + {1} { \TextOrMath \textasteriskcentered* } + {2} { \TextOrMath \textdagger\dagger } + {3} { \TextOrMath \textdaggerdbl\ddagger } + {4} { \TextOrMath \textsection\mathsection } + {5} { \TextOrMath \textparagraph\mathparagraph } + {6} { \TextOrMath \textbardbl\| } + {7} { \TextOrMath {\textasteriskcentered\textasteriskcentered}{**} } + {8} { \TextOrMath {\textdagger\textdagger}{\dagger\dagger} } + {9} { \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger} } + } + { \@ctrerr } + } } - { \@ctrerr } - } \DeclareRobustCommand \em { \@nomath\em diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 9598731ef62..74500f06cf3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -14,7 +14,7 @@ %% %% \ProvidesPackage{fontspec-xetex} - [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX] + [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -32,28 +32,50 @@ \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl } \RequirePackage{xunicode} -\DeclareDocumentCommand \fontspec { O{} m O{} } +\cs_new:Nn \__fontspec_pass_args:nnn + { + \IfNoValueTF {#2} + { \__fontspec_post_arg:w {#1} {#3} } + { #1 {#2} {#3} } + } +\NewDocumentCommand \__fontspec_post_arg:w { m m O{} } + { #1 {#3} {#2} } +\NewDocumentCommand \fontspec { o m } + { \__fontspec_pass_args:nnn \__fontspec_fontspec:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_fontspec:nn { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1,#3}{#2} + \fontspec_set_family:Nnn \f@family {#1}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m O{} } +\DeclareDocumentCommand \setmainfont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmainfont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmainfont:nn { - \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \rmdefault {#1}{#2} \normalfont \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m O{} } + +\DeclareDocumentCommand \setsansfont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setsansfont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setsansfont:nn { - \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \sfdefault {#1}{#2} \normalfont \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m O{} } + +\DeclareDocumentCommand \setmonofont { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmonofont:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmonofont:nn { - \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} + \fontspec_set_family:Nnn \ttdefault {#1}{#2} \normalfont \ignorespaces } @@ -62,21 +84,36 @@ \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl \tl_new:N \g__fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m O{} } +\DeclareDocumentCommand \setmathrm { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathrm:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m O{} } + +\DeclareDocumentCommand \setboldmathrm { o m } + { \__fontspec_pass_args:nnn \__fontspec_setboldmathrm:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setboldmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2} } -\DeclareDocumentCommand \setmathsf { O{} m O{} } + +\DeclareDocumentCommand \setmathsf { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathsf:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathsf:nn { - \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} } -\DeclareDocumentCommand \setmathtt { O{} m O{} } + +\DeclareDocumentCommand \setmathtt { o m } + { \__fontspec_pass_args:nnn \__fontspec_setmathtt:nn {#1} {#2} } + +\cs_new:Nn \__fontspec_setmathtt:nn { - \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm @@ -85,9 +122,12 @@ \tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} \tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} \tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m O{} } +\DeclareDocumentCommand \newfontfamily { m o m } + { \__fontspec_pass_args:nnn { \__fontspec_newfontfamily:Nnn #1 } {#2} {#3} } + +\cs_new:Nn \__fontspec_newfontfamily:Nnn { - \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 @@ -97,9 +137,12 @@ } } } -\DeclareDocumentCommand \newfontface { m O{} m O{} } +\DeclareDocumentCommand \newfontface { m o m } + { \__fontspec_pass_args:nnn { \__fontspec_newfontface:Nnn #1 } {#2} {#3} } + +\cs_new:Nn \__fontspec_newfontface:Nnn { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} } \clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop @@ -137,15 +180,12 @@ } } } - \cs_new:Nn \__fontspec_sanitise_fontname:Nn { - \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } - \tl_remove_all:Nn #1 {~} + \tl_set:Nx #1 {#2} \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } - \bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { @@ -198,32 +238,34 @@ \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { - \keys_if_exist:nnTF {fontspec} {#1} - { - \keys_define:nn {fontspec} - { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } } - } - { - \keys_if_exist:nnTF {fontspec-preparse} {#1} - { - \keys_define:nn {fontspec-preparse} - { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } } - } + \clist_map_inline:nn + { fontspec, fontspec-preparse, fontspec-preparse-external, + fontspec-preparse-nested, fontspec-renderer } + { + \keys_if_exist:nnT {##1} {#1} { - \keys_if_exist:nnTF {fontspec-preparse-external} {#1} - { - \keys_define:nn {fontspec-preparse-external} + \clist_map_break:n { - #2 .code:n = - { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } } + \__fontspec_alias_font_feature:nnn {##1} {#1} {#2} + \use_none_delimit_by_q_nil:w } - } - { - \__fontspec_warning:nx {rename-feature-not-exist} {#1} - } } - } + } + + % this executes if no match was found: + \__fontspec_warning:nx {rename-feature-not-exist} {#1} + + % jump to here if a match: + \use_none:n + \q_nil } + +\cs_set:Nn \__fontspec_alias_font_feature:nnn + { + \keys_define:nn {#1} + { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } } + } + \DeclareDocumentCommand \aliasfontfeatureoption {mmm} { \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } } \DeclareDocumentCommand \newfontscript {mm} @@ -503,11 +545,11 @@ \font_suppress_not_found_error: \__fontspec_init: - \tl_set:Nx \l_fontspec_fontname_tl {#2} - \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl - \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \tl_set:Nx \l_fontspec_fontname_tl {#2} + \tl_set:Nx \l_fontspec_fontname_up_tl {#2} + \tl_set:Nx \l__fontspec_basename_tl {#2} - \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} \__fontspec_extract_all_features:n {#1} \__fontspec_preparse_features: @@ -528,26 +570,25 @@ } \group_end: } -\cs_new:Nn \__fontspec_load_external_fontoptions:N +\cs_new:Nn \__fontspec_load_external_fontoptions:Nn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \prop_if_in:NVF \g__fontspec_fontopts_prop {\l__fontspec_tmp_tl} + \__fontspec_sanitise_fontname:Nn #1 {#2} + \tl_set:Nx \l__fontspec_ext_filename_tl {#1.fontspec} + \tl_remove_all:Nn \l__fontspec_ext_filename_tl {~} + \prop_if_in:NVF \g__fontspec_fontopts_prop #1 { - \exp_args:No \file_if_exist:nT {\l__fontspec_tmp_tl.fontspec} - { \file_input:n {\l__fontspec_tmp_tl.fontspec} } + \exp_args:No \file_if_exist:nT { \l__fontspec_ext_filename_tl } + { \file_input:n { \l__fontspec_ext_filename_tl } } } } \cs_new:Nn \__fontspec_extract_all_features:n { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \bool_if:NTF \l__fontspec_disable_defaults_bool { - \clist_set:Nx \l__fontspec_all_features_clist - {#1} + \clist_set:Nx \l__fontspec_all_features_clist {#1} } { - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist @@ -566,7 +607,7 @@ } \cs_new:Nn \__fontspec_preparse_features: { - \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + \__fontspec_if_detect_external:VT \l__fontspec_basename_tl { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } \keys_set_known:nxN {fontspec-preparse-external} @@ -598,6 +639,7 @@ } \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } +\cs_generate_variant:Nn \__fontspec_if_detect_external:nT {V} \cs_set:Nn \__fontspec_fullname:n { \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } @@ -776,10 +818,8 @@ \cs_new:Nn \__fontspec_load_fontname:n { - \tl_set:Nx \l_fontspec_fontname_tl {#1} - \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } @@ -1219,9 +1259,10 @@ \tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { - Renderer .choice_code:n = + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} { - \int_compare:nTF {\l_keys_choice_int <= 3} { + \int_compare:nTF {\l_keys_choice_int <= 4} { \tl_set:Nv \l_fontspec_renderer_tl { g_fontspec_renderer_tag_ \l_keys_choice_tl } } @@ -1229,8 +1270,6 @@ \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} } } - , - Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} \tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index 1eefd221419..920e4ef5f70 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -14,7 +14,7 @@ %% %% \ProvidesPackage{fontspec} - [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX] + [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX] \RequirePackage{expl3}[2011/09/05] -- cgit v1.2.3