diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty | 876 |
1 files changed, 446 insertions, 430 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 5211738902a..d9e499698f6 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -37,10 +37,11 @@ %% (your choice): <http://www.latex-project.org/lppl/>. %% ------------------------------------------------ %%^^A%% fontspec.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% Metadata for the package, including files and versioning \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2017/11/09}{2.6g}{Font selection for XeLaTeX and LuaLaTeX} + {2018/07/29}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> %%^^A%% fontspec-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -70,6 +71,8 @@ \bool_new:N \l__fontspec_defining_encoding_bool \bool_new:N \l__fontspec_script_exist_bool \bool_new:N \g__fontspec_em_normalise_slant_bool +\bool_new:N \l__fontspec_proceed_bool +\bool_new:N \l__fontspec_check_feat_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -97,13 +100,15 @@ \clist_new:N \l__fontspec_sizing_leftover_clist \clist_new:N \l__fontspec_fontfeat_clist \clist_new:N \l__fontspec_fontfeat_curr_clist -\tl_new:N \l__fontspec_fontfeat_up_clist -\tl_new:N \l__fontspec_fontfeat_bf_clist -\tl_new:N \l__fontspec_fontfeat_it_clist -\tl_new:N \l__fontspec_fontfeat_bfit_clist -\tl_new:N \l__fontspec_fontfeat_sl_clist -\tl_new:N \l__fontspec_fontfeat_bfsl_clist -\tl_new:N \l__fontspec_fontfeat_sc_clist +\clist_new:N \l__fontspec_arg_clist +\clist_new:N \l__fontspec_this_feat_clist +\clist_new:N \l__fontspec_fontfeat_up_clist +\clist_new:N \l__fontspec_fontfeat_bf_clist +\clist_new:N \l__fontspec_fontfeat_it_clist +\clist_new:N \l__fontspec_fontfeat_bfit_clist +\clist_new:N \l__fontspec_fontfeat_sl_clist +\clist_new:N \l__fontspec_fontfeat_bfsl_clist +\clist_new:N \l__fontspec_fontfeat_sc_clist \prop_new:N \g__fontspec_fontopts_prop \prop_new:N \l__fontspec_nfss_prop \prop_new:N \l__fontspec_nfssfont_prop @@ -111,41 +116,50 @@ \prop_new:N \g__fontspec_all_opentype_feature_names_prop \prop_new:N \g__fontspec_em_prop \prop_new:N \g__fontspec_strong_prop +\prop_new:N \g__fontspec_fontid_family_prop +\prop_new:N \g__fontspec_family_int_prop \tl_new:N \l_fontspec_family_tl \tl_new:N \g_fontspec_encoding_tl \tl_new:N \l_fontspec_renderer_tl \tl_new:N \l_fontspec_fontname_tl -\tl_new:N \l_fontspec_defined_shapes_tl \tl_clear_new:N \UTFencname \tl_clear_new:N \cyrillicencoding \tl_clear_new:N \latinencoding +\tl_new:N \l_fontspec_mode_tl +\tl_new:N \g__fontspec_curr_series_tl +\tl_new:N \g__fontspec_defined_shapes_tl +\tl_new:N \g__fontspec_nfss_enc_tl +\tl_new:N \g__fontspec_nfss_family_tl \tl_new:N \g__fontspec_single_feat_tl -\tl_new:N \l__fontspec_tmp_tl -\tl_new:N \l__fontspec_size_tl -\tl_new:N \l__fontspec_sizedfont_tl -\tl_new:N \l__fontspec_nfss_tl -\tl_new:N \l__fontspec_nfss_sc_tl -\tl_new:N \l__fontspec_this_font_tl -\tl_new:N \l__fontspec_scale_tl -\tl_new:N \l__fontspec_opacity_tl -\tl_new:N \l__fontspec_hexcol_tl -\tl_new:N \l__fontspec_fontid_tl -\tl_new:N \l__fontspec_extension_tl -\tl_new:N \l__fontspec_ext_filename_tl -\tl_new:N \l__fontspec_font_path_tl \tl_new:N \l__fontspec_basename_tl \tl_new:N \l__fontspec_curr_fontname_tl -\tl_new:N \l__fontspec_saved_fontname_tl +\tl_new:N \l__fontspec_curr_bfname_tl +\tl_new:N \l__fontspec_ext_filename_tl +\tl_new:N \l__fontspec_extension_tl +\tl_new:N \l__fontspec_font_path_tl +\tl_new:N \l__fontspec_fontid_tl +\tl_new:N \l__fontspec_fontname_tl +\tl_new:N \l__fontspec_hexcol_tl +\tl_new:N \l__fontspec_nfss_sc_tl +\tl_new:N \l__fontspec_nfss_tl +\tl_new:N \l__fontspec_nfss_fam_tl +\tl_new:N \l__fontspec_opacity_tl \tl_new:N \l__fontspec_optical_size_tl -\tl_new:N \l__fontspec_ttc_index_tl -\tl_new:N \l__fontspec_nfss_enc_tl -\tl_new:N \g__fontspec_curr_series_tl \tl_new:N \l__fontspec_options_tl -\tl_new:N \l__fontspec_fontname_tl +\tl_new:N \l__fontspec_saved_fontname_tl +\tl_new:N \l__fontspec_scale_tl +\tl_new:N \l__fontspec_size_tl +\tl_new:N \l__fontspec_sizedfont_tl +\tl_new:N \l__fontspec_this_font_tl +\tl_new:N \l__fontspec_tmp_tl +\tl_new:N \l__fontspec_ttc_index_tl \tl_new:N \g__fontspec_mathrm_tl \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl \tl_new:N \g__fontspec_mathtt_tl +\tl_gset:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_gset:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_gset:Nn \g__fontspec_mathtt_tl {\ttdefault} \tl_new:N \l__fontspec_family_label_tl \tl_new:N \l__fontspec_fake_slant_tl \tl_new:N \l__fontspec_fake_embolden_tl @@ -161,20 +175,17 @@ \tl_new:N \l__fontspec_lang_name_tl \tl_new:N \l_fontspec_lang_tl \tl_new:N \l__fontspec_mapping_tl -\tl_new:N \g__fontspec_hexcol_tl -\tl_new:N \g__fontspec_opacity_tl -\tl_set:Nn \g__fontspec_hexcol_tl {000000} -\tl_set:Nn \g__fontspec_opacity_tl {FF~} \tl_new:N \l__fontspec_punctspace_adjust_tl \tl_new:N \l__fontspec_wordspace_adjust_tl \tl_new:N \l__fontspec_postadjust_tl -\tl_new:N \g__fontspec_postadjust_tl -\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } -\tl_new:N \l__fontspec_rawfeatures_sclist +\tl_const:Nn \c__fontspec_hexcol_tl {000000} +\tl_const:Nn \c__fontspec_opacity_tl {FF~} +\tl_const:Nn \c__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } +\tl_new:N \g__fontspec_rawfeatures_sclist \tl_new:N \l__fontspec_pre_feat_sclist -\tl_new:N \g__fontspec_rmfamily_family -\tl_new:N \g__fontspec_sffamily_family -\tl_new:N \g__fontspec_ttfamily_family +\tl_new:N \l__fontspec_rmfamily_family_tl +\tl_new:N \l__fontspec_sffamily_family_tl +\tl_new:N \l__fontspec_ttfamily_family_tl %%^^A%% fontspec-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } @@ -362,11 +373,11 @@ } \__fontspec_msg_new:nnn {fontspec} {defining-font} { - Font family '\l_fontspec_family_tl' created for font '#2' + Font family '\g__fontspec_nfss_family_tl' created for font '#2' with options [\l__fontspec_all_features_clist].\\ \\ This font family consists of the following NFSS series/shapes:\\ - \l_fontspec_defined_shapes_tl + \g__fontspec_defined_shapes_tl } \__fontspec_msg_new:nnn {fontspec} {no-font-shape} { @@ -406,23 +417,25 @@ %%^^A%% fontspec-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareOption{cm-default} - { \__fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\bool_set_true:N \g__fontspec_math_bool} -\DeclareOption{no-math}{\bool_set_false:N \g__fontspec_math_bool} -\DeclareOption{config}{\bool_set_true:N \g__fontspec_cfg_bool} -\DeclareOption{no-config}{\bool_set_false:N \g__fontspec_cfg_bool} -\DeclareOption{euenc}{\bool_set_true:N \g__fontspec_euenc_bool} -\DeclareOption{tuenc}{\bool_set_false:N \g__fontspec_euenc_bool} -\DeclareOption{quiet} - { - \msg_redirect_module:nnn { fontspec } { warning } { info } - \msg_redirect_module:nnn { fontspec } { info } { none } - } + { + \__fontspec_warning:n {cm-default-obsolete} + } +\DeclareOption {math} { \bool_gset_true:N \g__fontspec_math_bool } +\DeclareOption {no-math} { \bool_gset_false:N \g__fontspec_math_bool } +\DeclareOption {config} { \bool_gset_true:N \g__fontspec_cfg_bool } +\DeclareOption {no-config}{ \bool_gset_false:N \g__fontspec_cfg_bool } +\DeclareOption {euenc} { \bool_gset_true:N \g__fontspec_euenc_bool } +\DeclareOption {tuenc} { \bool_gset_false:N \g__fontspec_euenc_bool } +\DeclareOption {quiet} + { + \msg_redirect_module:nnn { fontspec } { warning } { info } + \msg_redirect_module:nnn { fontspec } { info } { none } + } \DeclareOption{silent} - { - \msg_redirect_module:nnn { fontspec } { warning } { none } - \msg_redirect_module:nnn { fontspec } { info } { none } - } + { + \msg_redirect_module:nnn { fontspec } { warning } { none } + \msg_redirect_module:nnn { fontspec } { info } { none } + } \ExecuteOptions{config,math,tuenc} \ProcessOptions* \bool_if:NF \g__fontspec_euenc_bool @@ -438,14 +451,14 @@ } { \__fontspec_warning:n {tu-missing} - \bool_set_true:N \g__fontspec_euenc_bool + \bool_gset_true:N \g__fontspec_euenc_bool } } \bool_if:NTF \g__fontspec_euenc_bool { - \tl_set:Nn \g_fontspec_encoding_tl {EU1} + \tl_gset:Nn \g_fontspec_encoding_tl {EU1} } - { \tl_set:Nn \g_fontspec_encoding_tl { TU } } + { \tl_gset:Nn \g_fontspec_encoding_tl { TU } } \tl_set:Nn \rmdefault {lmr} \tl_set:Nn \sfdefault {lmss} \tl_set:Nn \ttdefault {lmtt} @@ -539,18 +552,22 @@ \NewDocumentCommand \fontspec { O{} m O{} } { \__fontspec_main_fontspec:nn {#1,#3} {#2} + \ignorespaces } \NewDocumentCommand \setmainfont { O{} m O{} } { \__fontspec_main_setmainfont:nn {#1,#3} {#2} + \ignorespaces } \NewDocumentCommand \setsansfont { O{} m O{} } { \__fontspec_main_setsansfont:nn {#1,#3} {#2} + \ignorespaces } \NewDocumentCommand \setmonofont { O{} m O{} } { \__fontspec_main_setmonofont:nn {#1,#3} {#2} + \ignorespaces } \NewDocumentCommand \setmathrm { O{} m O{} } { @@ -574,7 +591,15 @@ } \NewDocumentCommand \newfontfamily { m O{} m O{} } { - \__fontspec_main_newfontfamily:nnn {#1} {#2,#4} {#3} + \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \NewDocumentCommand + } +\NewDocumentCommand \renewfontfamily { m O{} m O{} } + { + \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \RenewDocumentCommand + } +\NewDocumentCommand \setfontfamily { m O{} m O{} } + { + \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \DeclareDocumentCommand } \NewDocumentCommand \newfontface { m O{} m O{} } { @@ -582,7 +607,10 @@ } \NewDocumentCommand \defaultfontfeatures { t+ o m } { - \__fontspec_main_defaultfontfeatures:nnn {#1} {#2} {#3} + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } \NewDocumentCommand \addfontfeatures {m} { @@ -624,9 +652,9 @@ { \fontspec_new_lang:nn {#1} {#2} } -\NewDocumentCommand \DeclareFontsExtensions {m} +\NewDocumentCommand \DeclareFontExtensions {m} { - \__fontspec_main_DeclareFontsExtensions:n {#1} + \__fontspec_main_DeclareFontExtensions:n {#1} } \NewDocumentCommand \IfFontFeatureActiveTF {mmm} { @@ -636,81 +664,83 @@ %%^^A%% fontspec-user.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_main_fontspec:nn - { - \fontspec_set_family:Nnn \f@family {#1} {#2} - \fontencoding { \l__fontspec_nfss_enc_tl } - \selectfont - \ignorespaces - } + { + \fontspec_set_family:Nnn \f@family {#1} {#2} + \fontencoding { \g__fontspec_nfss_enc_tl } + \selectfont + } \cs_new:Nn \__fontspec_main_setmainfont:nn - { - \fontspec_set_family:Nnn \g__fontspec_rmfamily_family {#1} {#2} - \tl_set_eq:NN \rmdefault \g__fontspec_rmfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \rmfamily } - { - \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_rmfamily_family } - \exp_not:N \selectfont - } + { + \fontspec_set_family:Nnn \l__fontspec_rmfamily_family_tl {#1} {#2} + \tl_set_eq:NN \rmdefault \l__fontspec_rmfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \rmfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_rmfamily_family_tl } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\rmdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmainfont_hook:nn {#1} {#2} + \normalfont } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} - { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } - \__fontspec_setmainfont_hook:nn {#1} {#2} - \normalfont - \ignorespaces - } \cs_new:Nn \__fontspec_main_setsansfont:nn - { - \fontspec_set_family:Nnn \g__fontspec_sffamily_family {#1} {#2} - \tl_set_eq:NN \sfdefault \g__fontspec_sffamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \sffamily } - { - \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_sffamily_family } - \exp_not:N \selectfont - } + { + \fontspec_set_family:Nnn \l__fontspec_sffamily_family_tl {#1} {#2} + \tl_set_eq:NN \sfdefault \l__fontspec_sffamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \sffamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_sffamily_family_tl } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\sfdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setsansfont_hook:nn {#1} {#2} + \normalfont } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} - { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } - \__fontspec_setsansfont_hook:nn {#1} {#2} - \normalfont - \ignorespaces - } \cs_new:Nn \__fontspec_main_setmonofont:nn - { - \fontspec_set_family:Nnn \g__fontspec_ttfamily_family {#1} {#2} - \tl_set_eq:NN \ttdefault \g__fontspec_ttfamily_family - \use:x { \exp_not:n { \DeclareRobustCommand \ttfamily } - { - \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } - \exp_not:N \fontfamily { \g__fontspec_ttfamily_family } - \exp_not:N \selectfont - } + { + \fontspec_set_family:Nnn \l__fontspec_ttfamily_family_tl {#1} {#2} + \tl_set_eq:NN \ttdefault \l__fontspec_ttfamily_family_tl + \use:x + { + \exp_not:n { \DeclareRobustCommand \ttfamily } + { + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \fontfamily { \l__fontspec_ttfamily_family_tl } + \exp_not:N \selectfont + } + } + \str_if_eq_x:nnT {\familydefault} {\ttdefault} + { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } + \__fontspec_setmonofont_hook:nn {#1} {#2} + \normalfont } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} - { \tl_set_eq:NN \encodingdefault \l__fontspec_nfss_enc_tl } - \__fontspec_setmonofont_hook:nn {#1} {#2} - \normalfont - \ignorespaces - } \cs_new:Nn \__fontspec_main_setmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2} \__fontspec_setmathrm_hook:nn {#1} {#2} } \cs_new:Nn \__fontspec_main_setboldmathrm:nn { - \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2} \__fontspec_setboldmathrm_hook:nn {#1} {#2} } \cs_new:Nn \__fontspec_main_setmathsf:nn { - \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2} \__fontspec_setmathsf_hook:nn {#1} {#2} } \cs_new:Nn \__fontspec_main_setmathtt:nn { - \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2} \__fontspec_setmathtt_hook:nn {#1} {#2} } \cs_set_eq:NN \__fontspec_setmainfont_hook:nn \use_none:nn @@ -724,170 +754,159 @@ \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} -\cs_new:Nn \__fontspec_main_newfontfamily:nnn - { - \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3} - \use:x - { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 - { - \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } - \exp_not:N \fontencoding { \l__fontspec_nfss_enc_tl } - \exp_not:N \selectfont - } - } - } +\tl_gset:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_gset:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_gset:Nn \g__fontspec_mathtt_tl {\ttdefault} +\cs_new:Nn \__fontspec_main_newfontfamily:nnnN + { + \fontspec_set_family:cnn { l__fontspec_ \cs_to_str:N #1 _family_tl } {#2} {#3} + \use:x + { + \exp_not:N #4 \exp_not:N #1 {} + { + \exp_not:N \fontfamily { \use:c { l__fontspec_ \cs_to_str:N #1 _family_tl } } + \exp_not:N \fontencoding { \g__fontspec_nfss_enc_tl } + \exp_not:N \selectfont + } + } + } \cs_new:Nn \__fontspec_main_newfontface:nnn - { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} - } -\cs_new:Nn \__fontspec_main_defaultfontfeatures:nnn { - \IfNoValueTF {#2} - { \__fontspec_set_default_features:nn {#1} {#3} } - { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } - \ignorespaces + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} } \cs_new:Nn \__fontspec_set_default_features:nn { - \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \IfBooleanTF {#1} \clist_gput_right:Nn \clist_gset:Nn \g__fontspec_default_fontopts_clist {#2} } \cs_new:Nn \__fontspec_set_font_default_features:nnn - { - \clist_map_inline:nn {#2} - { - \tl_if_single:nTF {##1} - { \tl_set:No \l__fontspec_tmp_tl { \cs:w g__fontspec_ \cs_to_str:N ##1 _family\cs_end: } } - { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } + { + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l__fontspec_tmp_tl { \cs:w l__fontspec_ \cs_to_str:N ##1 _family_tl\cs_end: } } + { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } - \IfBooleanTF {#1} - { - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl - { \tl_clear:N \l__fontspec_tmpb_tl } - \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} - \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl - } - { - \tl_if_empty:nTF {#3} - { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_put:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } - } - } - } + \IfBooleanTF {#1} + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + { \tl_clear:N \l__fontspec_tmpb_tl } + \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} + \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_gput:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } + } + } + } \cs_new:Nn \__fontspec_main_addfontfeatures:n - { - \fontspec_if_fontspec_font:TF - { - \group_begin: - \keys_set_known:nnN {fontspec-addfeatures} {#1} \l__fontspec_tmp_tl - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {options} \l__fontspec_options_tl - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {fontname} \l__fontspec_fontname_tl - \bool_set_true:N \l__fontspec_disable_defaults_bool - \use:x - { - \__fontspec_select_font_family:nn - { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} - } - \group_end: - \fontfamily\l_fontspec_family_tl\selectfont - } - { - \__fontspec_warning:nx {addfontfeatures-ignored} {#1} - } - \ignorespaces - } + { + \fontspec_if_fontspec_font:TF + { + \group_begin: + \keys_set_known:nnN {fontspec-addfeatures} {#1} \l__fontspec_tmp_tl + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {options} \l__fontspec_options_tl + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {fontname} \l__fontspec_fontname_tl + \bool_set_true:N \l__fontspec_disable_defaults_bool + \use:x + { + \__fontspec_select_font_family:nn + { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} + } + \group_end: + \fontfamily \g__fontspec_nfss_family_tl \selectfont + } + { + \__fontspec_warning:nx {addfontfeatures-ignored} {#1} + } + \ignorespaces + } \cs_new:Nn \__fontspec_main_newfontfeature:nn - { - \keys_define:nn { fontspec } - { - #1 .code:n = - { - \__fontspec_update_featstr:n {#2} - } - } - } + { + \keys_define:nn { fontspec } + { + #1 .code:n = { \__fontspec_update_featstr:n {#2} } + } + } \cs_new:Nn \__fontspec_main_newAATfeature:nnnn - { - \keys_if_exist:nnF { fontspec } {#1} - { \__fontspec_define_aat_feature_group:n {#1} } + { + \keys_if_exist:nnF { fontspec } {#1} + { \__fontspec_define_aat_feature_group:n {#1} } - \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \__fontspec_define_aat_feature:nnnn {#1}{#2}{#3}{#4} - } + \__fontspec_define_aat_feature:nnnn {#1}{#2}{#3}{#4} + } \cs_new:Nn \__fontspec_main_newopentypefeature:nnn - { - \keys_if_exist:nnF { fontspec / options } {#1} - { \__fontspec_define_opentype_feature_group:n {#1} } + { + \keys_if_exist:nnF { fontspec / options } {#1} + { \__fontspec_define_opentype_feature_group:n {#1} } - \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn - {#1} {#2} { \__fontspec_strip_plus_minus:n {#3} } {#3} {} - } + \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn + {#1} {#2} { \__fontspec_strip_plus_minus:n {#3} } {#3} {} + } \cs_new:Nn \__fontspec_strip_plus_minus:n { \__fontspec_strip_plus_minus_aux:Nq #1 \q_nil } \cs_new:Npn \__fontspec_strip_plus_minus_aux:Nq #1#2 \q_nil { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} } \cs_new:Nn \__fontspec_main_aliasfontfeature:nn - { - \bool_set_false:N \l__fontspec_alias_bool + { + \bool_set_false:N \l__fontspec_alias_bool - \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist - { - \keys_if_exist:nnT {##1} {#1} + \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - \bool_set_true:N \l__fontspec_alias_bool - \keys_define:nn {##1} - { #2 .code:n = { \keys_set:nn {##1} { #1 = {####1} } } } + \keys_if_exist:nnT {##1} {#1} + { + \bool_set_true:N \l__fontspec_alias_bool + \keys_define:nn {##1} + { #2 .code:n = { \keys_set:nn {##1} { #1 = {####1} } } } + } } - } - \bool_if:NF \l__fontspec_alias_bool - { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } - } + \bool_if:NF \l__fontspec_alias_bool + { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } + } \cs_new:Nn \__fontspec_main_aliasfontfeatureoption:nnn - { - \bool_set_false:N \l__fontspec_alias_bool + { + \bool_set_false:N \l__fontspec_alias_bool - \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist - { - \keys_if_exist:nnT { ##1 / #1 } {#2} + \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - \bool_set_true:N \l__fontspec_alias_bool - \keys_define:nn { ##1 / #1 } - { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } - } + \keys_if_exist:nnT { ##1 / #1 } {#2} + { + \bool_set_true:N \l__fontspec_alias_bool + \keys_define:nn { ##1 / #1 } + { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } + } - \keys_if_exist:nnT { ##1 / #1 } {#2Reset} - { - \keys_define:nn { ##1 / #1 } - { #3Reset .code:n = { \keys_set:nn {##1} { #1 = {#2Reset} } } } - } + \keys_if_exist:nnT { ##1 / #1 } {#2Reset} + { + \keys_define:nn { ##1 / #1 } + { #3Reset .code:n = { \keys_set:nn {##1} { #1 = {#2Reset} } } } + } - \keys_if_exist:nnT { ##1 / #1 } {#2Off} - { - \keys_define:nn { ##1 / #1 } - { #3Off .code:n = { \keys_set:nn {##1} { #1 = {#2Off} } } } - } - } + \keys_if_exist:nnT { ##1 / #1 } {#2Off} + { + \keys_define:nn { ##1 / #1 } + { #3Off .code:n = { \keys_set:nn {##1} { #1 = {#2Off} } } } + } + } - \bool_if:NF \l__fontspec_alias_bool - { \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} } - } -\cs_new:Nn \__fontspec_main_DeclareFontsExtensions:n - { - \clist_set:Nn \l__fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l__fontspec_extensions_clist {~} - } -\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} + \bool_if:NF \l__fontspec_alias_bool + { \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} } + } +\cs_new:Nn \__fontspec_main_DeclareFontExtensions:n + { + \clist_set:Nn \l__fontspec_extensions_clist { #1 } + } +\__fontspec_main_DeclareFontExtensions:n {.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \cs_new:Nn \__fontspec_main_IfFontFeatureActiveTF:nnn { \__fontspec_if_font_feature:nTF {#1} {#2} {#3} @@ -902,7 +921,7 @@ \bool_set_true:N \l__fontspec_never_check_bool \bool_set_false:N \l__fontspec_firsttime_bool \clist_clear:N \l__fontspec_fontfeat_clist - \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {#1} + \__fontspec_get_features:n {#1} \group_end: @@ -916,64 +935,64 @@ %%^^A%% fontspec-api.dtx -- part of FONTSPEC <wspr.io/fontspec> \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} - { - \cs_if_exist:cTF {g__fontspec_fontinfo_ \f@family _prop} \prg_return_true: \prg_return_false: - } + { + \cs_if_exist:cTF {g__fontspec_fontinfo_ \f@family _prop} \prg_return_true: \prg_return_false: + } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_atsui_bool - { - \__fontspec_make_AAT_feature_string:NnnTF \font {#1} {#2} - \prg_return_true: \prg_return_false: - } - { - \prg_return_false: - } - } - { - \prg_return_false: - } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_atsui_bool + { + \__fontspec_make_AAT_feature_string:NnnTF \font {#1} {#2} + \prg_return_true: \prg_return_false: + } + { + \prg_return_false: + } + } + { + \prg_return_false: + } + } \prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: - } - { - \prg_return_false: - } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: + } + { + \prg_return_false: + } + } \prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl - \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl - \int_set:Nn \l__fontspec_language_int {\l__fontspec_tmp_tl} + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl + \int_set:Nn \l__fontspec_language_int {\l__fontspec_tmp_tl} - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl - \__fontspec_check_ot_feat:NnTF \font {#1} {\prg_return_true:} {\prg_return_false:} - } - { - \prg_return_false: - } - } - { - \prg_return_false: - } - } + \__fontspec_check_ot_feat:NnTF \font {#1} {\prg_return_true:} {\prg_return_false:} + } + { + \prg_return_false: + } + } + { + \prg_return_false: + } + } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} { \fontspec_if_fontspec_font:TF @@ -1065,19 +1084,19 @@ { \prg_return_false: } } \cs_new:Nn \fontspec_set_family:Nnn - { - \tl_set:Nn \l__fontspec_family_label_tl { #1 } - \__fontspec_select_font_family:nn {#2}{#3} - \tl_set_eq:NN #1 \l_fontspec_family_tl - } + { + \tl_set:Nn \l__fontspec_family_label_tl {#1} + \__fontspec_select_font_family:nn {#2} {#3} + \tl_set_eq:NN #1 \l_fontspec_family_tl + } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} -\cs_new:Nn \fontspec_set_fontface:NNnn - { - \tl_set:Nn \l__fontspec_family_label_tl { #1 } - \__fontspec_select_font_family:nn {#3}{#4} - \font #1 = \fontname \l_fontspec_font \scan_stop: - \tl_set_eq:NN #2 \l_fontspec_family_tl - } + \cs_new:Nn \fontspec_set_fontface:NNnn + { + \tl_set:Nn \l__fontspec_family_label_tl {#1} + \__fontspec_select_font_family:nn {#3}{#4} + \global \font #1 = \fontname \l_fontspec_font \scan_stop: + \tl_set_eq:NN #2 \l_fontspec_family_tl + } \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} { \group_begin: @@ -1143,7 +1162,7 @@ \__fontspec_preparse_features: \__fontspec_load_font: \__fontspec_set_scriptlang: - \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} + \__fontspec_get_features:n {} \bool_set_false:N \l__fontspec_firsttime_bool \__fontspec_save_family_needed:nTF {#2} @@ -1153,6 +1172,8 @@ { } \group_end: + + \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl } \cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn %% deprecated, for compatibility only \cs_new:Nn \__fontspec_sanitise_fontname:Nn @@ -1302,10 +1323,10 @@ } } } -\cs_new:Nn \__fontspec_get_features:Nn +\cs_new:Nn \__fontspec_get_features:n { \__fontspec_init_fontface: - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} \l__fontspec_keys_leftover_clist \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist \bool_if:NTF \l__fontspec_ot_bool @@ -1323,66 +1344,68 @@ { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } - { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } + { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - - \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } -\prg_new_conditional:Nnn \__fontspec_save_family_needed:n {TF} - { +\prg_new_conditional:Nnn \__fontspec_save_family_needed:n { TF } + { - \tl_if_exist:cF {g__fontspec_UID_\l__fontspec_fontid_tl} + \tl_if_empty:NTF \l__fontspec_nfss_fam_tl { - \tl_new:c {g__fontspec_UID_\l__fontspec_fontid_tl} + \prop_get:NVNTF \g__fontspec_fontid_family_prop \l__fontspec_fontid_tl \l__fontspec_tmp_tl + { + \tl_gset_eq:NN \g__fontspec_nfss_family_tl \l__fontspec_tmp_tl + \prg_return_false: + } + { + \tl_set:Nx \l__fontspec_tmp_tl {#1} + \tl_remove_all:Nn \l__fontspec_tmp_tl { ~ } + \__fontspec_save_fontid_family:VV \l__fontspec_fontid_tl \l__fontspec_tmp_tl + \prg_return_true: + } } - - \tl_if_exist:NT \l__fontspec_nfss_fam_tl { - \tl_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_tl + \tl_gset_eq:NN \g__fontspec_nfss_family_tl \l__fontspec_nfss_fam_tl + \cs_undefine:c { g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop } + \prg_return_true: } - - \tl_if_empty:cT {g__fontspec_UID_\l__fontspec_fontid_tl} - { - % The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped: - \tl_set:Nx \l__fontspec_tmp_tl {#1} - \tl_remove_all:Nn \l__fontspec_tmp_tl {~} - - \cs_if_exist:cTF {g__fontspec_family_ \l__fontspec_tmp_tl _int} - { \int_gincr:c {g__fontspec_family_ \l__fontspec_tmp_tl _int} } - { \int_new:c {g__fontspec_family_ \l__fontspec_tmp_tl _int} } - - \tl_gset:cx {g__fontspec_UID_\l__fontspec_fontid_tl} - { - \l__fontspec_tmp_tl ( \int_use:c {g__fontspec_family_ \l__fontspec_tmp_tl _int} ) - } - } - \tl_gset:Nv \l_fontspec_family_tl {g__fontspec_UID_\l__fontspec_fontid_tl} - \cs_if_exist:cTF {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} - \prg_return_false: \prg_return_true: - } + } +\cs_new:Nn \__fontspec_save_fontid_family:nn + { + \prop_get:NnNTF \g__fontspec_family_int_prop {#2} \l__fontspec_tmp_tl + { + \tl_set:Nx \l__fontspec_tmp_tl + { \int_eval:n { \l__fontspec_tmp_tl + 1 } } + } + { \tl_set:Nn \l__fontspec_tmp_tl { 0 } } + \prop_gput:NnV \g__fontspec_family_int_prop {#2} \l__fontspec_tmp_tl + \tl_gset:Nx \g__fontspec_nfss_family_tl { #2 ( \l__fontspec_tmp_tl ) } + \prop_gput:NnV \g__fontspec_fontid_family_prop {#1} \g__fontspec_nfss_family_tl + } +\cs_generate_variant:Nn \__fontspec_save_fontid_family:nn { VV } \cs_new:Nn \__fontspec_save_family:nn { \__fontspec_save_fontinfo:n {#2} \__fontspec_find_autofonts: - \DeclareFontFamily{\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{} + \DeclareFontFamily{\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{} \__fontspec_set_faces: \__fontspec_info:nxx {defining-font} {#1} {#2} } \cs_new:Nn \__fontspec_save_fontinfo:n { - \prop_new:c {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} - \prop_gput:cnx {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {fontname} { #1 } - \prop_gput:cnx {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } - \prop_gput:cnx {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {fontdef} + \prop_new:c {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontname} { #1 } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontdef} { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} - { \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } } - \prop_gput:cnV {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {script-num} \l__fontspec_script_int - \prop_gput:cnV {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {lang-num} \l__fontspec_language_int - \prop_gput:cnV {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num} \l__fontspec_language_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl } \cs_new:Nn \__fontspec_find_autofonts: { @@ -1558,25 +1581,25 @@ \cs_new:Nn \__fontspec_setup_nfss:Nnnn { - \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist { #2 , #3 , #4 } + \__fontspec_get_features:n { #2 , #3 , #4 } \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } - { \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } } } \cs_new:Nn \__fontspec_declare_shapes_normal:nn { - \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl} {\l_fontspec_family_tl} + \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl} {\g__fontspec_nfss_family_tl} {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} } \cs_new:Nn \__fontspec_declare_shapes_smcaps:nn { \tl_if_empty:NF \l__fontspec_nfss_sc_tl { - \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl} {\l_fontspec_family_tl} {#1} + \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl} {\g__fontspec_nfss_family_tl} {#1} { \__fontspec_combo_sc_shape:n {#2} } {\l__fontspec_nfss_sc_tl} {\l__fontspec_postadjust_tl} } } @@ -1604,13 +1627,13 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \__fontspec_DeclareFontShape:xxxxxx {\l__fontspec_nfss_enc_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} + \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{#1}{\sldefault} + {<->ssub*\g__fontspec_nfss_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } \cs_new:Nn \__fontspec_declare_shape_loginfo:nn { - \tl_gput_right:Nx \l_fontspec_defined_shapes_tl + \tl_gput_right:Nx \g__fontspec_defined_shapes_tl { \exp_not:n { \\ } -~ \exp_not:N \str_case:nn {#1/#2} @@ -1671,14 +1694,14 @@ \bool_if:NF \l__fontspec_firsttime_bool { \tl_gset:Nx \g__fontspec_single_feat_tl { #1 } - \tl_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1;} + \tl_gput_right:Nx \g__fontspec_rawfeatures_sclist {#1;} } } \cs_new:Nn \__fontspec_remove_clashing_featstr:n { \clist_map_inline:nn {#1} { - \tl_gremove_all:Nn \l__fontspec_rawfeatures_sclist {##1;} + \tl_gremove_all:Nn \g__fontspec_rawfeatures_sclist {##1;} } } \cs_set:Npn \__fontspec_init: @@ -1690,18 +1713,18 @@ \tl_clear:N \l__fontspec_optical_size_tl \tl_clear:N \l__fontspec_ttc_index_tl \tl_clear:N \l_fontspec_renderer_tl - \tl_clear:N \l_fontspec_defined_shapes_tl - \tl_clear:N \g__fontspec_curr_series_tl - \tl_gset_eq:NN \l__fontspec_nfss_enc_tl \g_fontspec_encoding_tl + \tl_gclear:N \g__fontspec_defined_shapes_tl + \tl_gclear:N \g__fontspec_curr_series_tl + \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl } \cs_new:Nn \__fontspec_init_fontface: { - \tl_clear:N \l__fontspec_rawfeatures_sclist + \tl_gclear:N \g__fontspec_rawfeatures_sclist \tl_clear:N \l__fontspec_scale_tl - \tl_set_eq:NN \l__fontspec_opacity_tl \g__fontspec_opacity_tl - \tl_set_eq:NN \l__fontspec_hexcol_tl \g__fontspec_hexcol_tl - \tl_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_set_eq:NN \l__fontspec_opacity_tl \c__fontspec_opacity_tl + \tl_set_eq:NN \l__fontspec_hexcol_tl \c__fontspec_hexcol_tl + \tl_set_eq:NN \l__fontspec_postadjust_tl \c__fontspec_postadjust_tl \tl_clear:N \l__fontspec_wordspace_adjust_tl \tl_clear:N \l__fontspec_punctspace_adjust_tl } @@ -2057,7 +2080,7 @@ %%^^A%% fontspec-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> -\clist_set:Nn \g__fontspec_all_keyval_modules_clist +\clist_gset:Nn \g__fontspec_all_keyval_modules_clist { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-cfg, fontspec-preparse-external, fontspec-preparse-nested, @@ -2065,7 +2088,7 @@ } \cs_new:Nn \__fontspec_keys_define_code:nnn { - \keys_define:nn {#1} { #2 .code:n = {#3} } + \keys_define:nn {#1} { #2 .code:n = {#3} } } \cs_new:Nn \__fontspec_aff_error:n { @@ -2164,7 +2187,7 @@ \seq_if_empty:NT \g__fontspec_bf_series_seq { \tl_gset:Nx \g__fontspec_curr_series_tl {\bfdefault} - \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} + \seq_gput_right:Nx \g__fontspec_bf_series_seq {\bfdefault} } \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} { \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } @@ -2274,32 +2297,29 @@ } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} { - \tl_gset:Nx \l__fontspec_nfss_enc_tl { #1 } + \tl_gset:Nx \g__fontspec_nfss_enc_tl { #1 } } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} { \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } - \cs_undefine:c {g__fontspec_UID_\l__fontspec_fontid_tl} - \tl_if_exist:NT \l_fontspec_family_tl - { \cs_undefine:c {g__fontspec_fontinfo_ \l_fontspec_family_tl _prop} } } \__fontspec_keys_define_code:nnn {fontspec} {FontFace} - { - \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } - \tl_set_eq:NN \l__fontspec_this_feat_tl \l__fontspec_arg_tl - \tl_clear:N \l__fontspec_this_font_tl - \int_compare:nT { \clist_count:N \l__fontspec_arg_tl = 1 } - { - \tl_if_in:NnF \l__fontspec_arg_tl {=} - { - \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_tl - \tl_clear:N \l__fontspec_this_feat_tl - } - } + { + \tl_clear:N \l__fontspec_this_font_tl + \clist_set:No \l__fontspec_arg_clist { \use_iii:nnn #1 } + \clist_set_eq:NN \l__fontspec_this_feat_clist \l__fontspec_arg_clist + \int_compare:nT { \clist_count:N \l__fontspec_arg_clist = 1 } + { + \tl_if_in:NnF \l__fontspec_arg_clist {=} + { + \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_clist + \tl_clear:N \l__fontspec_this_feat_clist + } + } - \__fontspec_add_nfssfont:nnnn - {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} - } + \__fontspec_add_nfssfont:nnnn + {\use_i:nnn #1} {\use_ii:nnn #1} {\l__fontspec_this_font_tl} {\l__fontspec_this_feat_clist} + } \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnF {#1} @@ -2447,7 +2467,7 @@ \cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 { \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} - \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl { \bool_if:NF \l__fontspec_firsttime_bool { \__fontspec_warning:nx {opa-twice-col} {#7#8} } @@ -2459,7 +2479,7 @@ { \int_set:Nn \l__fontspec_tmp_int {255} \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl { \bool_if:NF \l__fontspec_firsttime_bool { \__fontspec_warning:nx {opa-twice} {#1} } @@ -3707,24 +3727,20 @@ %%^^A%% fontspec-math.dtx -- part of FONTSPEC <wspr.io/fontspec> \@ifpackageloaded{euler} - { - \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool - } - { - \bool_set_false:N \g__fontspec_pkg_euler_loaded_bool - } + { \bool_gset_true:N \g__fontspec_pkg_euler_loaded_bool } + { \bool_gset_false:N \g__fontspec_pkg_euler_loaded_bool } \cs_new:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { \bool_if:NTF \g__fontspec_pkg_euler_loaded_bool - { \bool_set_true:N \g__fontspec_math_euler_bool } + { \bool_gset_true:N \g__fontspec_math_euler_bool } { \__fontspec_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{ \bool_gset_true:N \g__fontspec_math_lucida_bool }{} + \@ifpackageloaded{lucidabr}{ \bool_gset_true:N \g__fontspec_math_lucida_bool }{} + \@ifpackageloaded{lucimatx}{ \bool_gset_true:N \g__fontspec_math_lucida_bool }{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -3806,34 +3822,34 @@ { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_gset_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arevmath}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{arevmath} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{eulervm} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathdesign} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{concmath} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{cmbright} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathesf} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic} {\bool_gset_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{iwona} { \ifx\define@iwona@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kmath} {\bool_gset_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{kurier} { \ifx\define@kurier@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{fouriernc}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{fourier}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{lmodern}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{mathpazo}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{mathptmx}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{MinionPro}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g__fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{fouriernc} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{fourier} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{lmodern} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathpazo} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathptmx} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{MinionPro} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{unicode-math} {\bool_gset_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{breqn} {\bool_gset_false:N \g__fontspec_math_bool}{} \bool_if:NT \g__fontspec_math_bool { \__fontspec_info:n {setup-math} @@ -3910,15 +3926,15 @@ } \cs_new_protected:Npn \emfontdeclare #1 { - \prop_clear:N \g__fontspec_em_prop - \int_zero:N \l__fontspec_emdef_int - \bool_set_true:N \g__fontspec_em_normalise_slant_bool + \prop_gclear:N \g__fontspec_em_prop + \int_zero:N \l__fontspec_emdef_int + \bool_gset_true:N \g__fontspec_em_normalise_slant_bool \tl_if_in:nnT {#1} {\slshape} { \tl_if_in:nnT {#1} {\itshape} { - \bool_set_false:N \g__fontspec_em_normalise_slant_bool + \bool_gset_false:N \g__fontspec_em_normalise_slant_bool } } @@ -3964,7 +3980,7 @@ \cs_set:Npn \eminnershape { \upshape } \cs_new_protected:Npn \strongfontdeclare #1 { - \prop_clear:N \g__fontspec_strong_prop + \prop_gclear:N \g__fontspec_strong_prop \int_zero:N \l__fontspec_strongdef_int \group_begin: |