diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
4 files changed, 363 insertions, 282 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 6c799b521b1..e456b46917b 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -41,7 +41,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-luatex}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> %%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -73,7 +73,6 @@ \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool \bool_new:N \l__fontspec_never_check_bool -\bool_new:N \l__fontspec_scripts_missing_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -184,8 +183,10 @@ \tl_new:N \l__fontspec_fontname_bfsl_tl \tl_new:N \l__fontspec_fontname_sc_tl \tl_new:N \l__fontspec_script_name_tl +\tl_set:Nn \l__fontspec_script_name_tl {CustomDefault} \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl +\tl_set:Nn \l__fontspec_lang_name_tl {Default} \tl_new:N \l_fontspec_lang_tl \tl_new:N \l__fontspec_mapping_tl \tl_new:N \l__fontspec_punctspace_adjust_tl @@ -246,7 +247,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl' does not contain glyph #1. + '#1' does not contain glyph #2. } \__fontspec_msg_new:nnnn {fontspec} {euler-too-late} { @@ -312,15 +313,6 @@ { OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - `Script=Latin` used instead. - } \__fontspec_msg_new:nnn {fontspec} {aat-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl' feature not supported @@ -344,7 +336,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. + '#1' doesn't appear to have an Optical Size axis. } \__fontspec_msg_new:nnn {fontspec} {language-not-exist} { @@ -407,13 +399,9 @@ { Adjusting the maths setup (use [no-math] to avoid this). } -\__fontspec_msg_new:nnn {fontspec} {no-scripts} - { - Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. - } -\__fontspec_msg_new:nnn {fontspec} {dflt-script} +\__fontspec_msg_new:nnn {fontspec} {no-script} { - Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + Font "#1" does not contain requested Script "#2". } \__fontspec_msg_new:nnn {fontspec} {opa-twice} { @@ -520,6 +508,7 @@ \cs_generate_variant:Nn \prop_get:NnNT {NxN} \cs_generate_variant:Nn \prop_get:NnNTF {NxN} \cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty_p:n {e} \cs_generate_variant:Nn \tl_if_empty:nTF {x} \cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_generate_variant:Nn \tl_if_empty:nF {f} @@ -530,11 +519,11 @@ \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { - \font #1 = #2 ~at~ #3 \scan_stop: + \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 { - \global \font #1 = #2 ~at~ #3 \scan_stop: + \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { @@ -548,11 +537,25 @@ \prg_return_false: \fi } +\prg_set_conditional:Nnn \__fontspec_primitive_font_set:Nnn {TF,T,F} + { + \__fontspec_primitive_font_set:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\prg_set_conditional:Nnn \__fontspec_primitive_font_gset:Nnn {TF,T,F} + { + \__fontspec_primitive_font_gset:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\cs_set:Npn \__fontspec_primitive_font_set:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_set:Nnn } +\cs_set:Npn \__fontspec_primitive_font_set:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_set:NnnF } +\cs_set:Npn \__fontspec_primitive_font_gset:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_gset:Nnn } +\cs_set:Npn \__fontspec_primitive_font_gset:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_gset:NnnF } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_exist:n {TF,T,F} { \group_begin: \__fontspec_font_suppress_not_found_error: - \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} {10pt} + \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} { \f@size pt - 1sp } \__fontspec_primitive_font_if_null:NTF \l__fontspec_primitive_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } @@ -569,6 +572,11 @@ { \tex_hyphenchar:D #1 = #2 \scan_stop: } +\cs_new_eq:NN \__fontspec_primitive_font_get_name:N \fontname +\cs_new:Npn \__fontspec_primitive_font_current_name: + { + \__fontspec_primitive_font_get_name:N \tex_font:D + } %%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -683,6 +691,17 @@ { \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } +\AtBeginDocument + { + \RenewDocumentCommand \oldstylenums {m} + { + \__fontspec_main_oldstylenums:n {#1} + } + } +\NewDocumentCommand \liningnums {m} + { + \__fontspec_main_liningnums:n {#1} + } %%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -954,6 +973,20 @@ { \prg_return_true: } { \prg_return_false: } } } +\cs_new_protected:Nn \__fontspec_main_oldstylenums:n + { + \group_begin: + \addfontfeature{Numbers=OldStyle} + #1 + \group_end: + } +\cs_new_protected:Nn \__fontspec_main_liningnums:n + { + \group_begin: + \addfontfeature{Numbers=Lining} + #1 + \group_end: + } %%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -1104,18 +1137,23 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} - \tl_clear_new:N #1 + \tl_if_exist:NF #1 { \tl_new:N #1 } \tl_set_eq:NN #1 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} - \cs_new:Nn \fontspec_set_fontface:NNnn +\tl_new:N \l__fontspec_fontface_cs_tl +\tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} +\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:Nn \l__fontspec_fontface_cs_tl {#1} + \tl_set:Nn \l__fontspec_family_label_tl {#2} + \__fontspec_select_font_family:nn {#3} {#4} \tl_set_eq:NN #2 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} { @@ -1131,7 +1169,7 @@ \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} { \exp_args:Nxx \tl_if_in:nnTF - { \fontname\font } { \tl_to_str:n {#1} } + { \__fontspec_primitive_font_current_name: } { \tl_to_str:n {#1} } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F} @@ -1164,7 +1202,7 @@ \__fontspec_init: \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} \__fontspec_if_detect_external:nT {#2} @@ -1282,20 +1320,19 @@ } \cs_new:Nn \__fontspec_load_font: { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \__fontspec_check_script:NnTF \l_fontspec_font {DFLT} - { - \bool_set_false:N \l__fontspec_scripts_missing_bool - } - { - \bool_set_true:N \l__fontspec_scripts_missing_bool - } + + \__fontspec_primitive_font_set:NnnF \l__fontspec_test_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt - 2sp } + { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + + \__fontspec_set_font_type:N \l__fontspec_test_font + \__fontspec_primitive_font_gset:Onn \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt } + + \l__fontspec_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn { @@ -1325,37 +1362,10 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \bool_if:NTF \l__fontspec_scripts_missing_bool - { - \__fontspec_info:n {no-scripts} - } + \tl_if_empty:NF \l__fontspec_script_name_tl { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {dflt-script} - \keys_set:nx {fontspec-opentype} {Script=Default} - \keys_set:nx {fontspec-opentype} {Language=Default} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } } } @@ -1512,28 +1522,30 @@ } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } + \group_begin: + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt + 1sp } + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } { \f@size pt + 1sp } + \str_if_eq:eeTF { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpa_font } { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpb_font } + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { \group_begin: \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {#1} \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} \group_end: } -\cs_new:Nn \__fontspec_load_fontname:n +\cs_new:Nn \__fontspec_load_fontname:Nn { - \__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 + \__fontspec_load_external_fontoptions:Nn #1 {#2} + \prop_get:NVNF \g__fontspec_fontopts_prop #1 \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist - \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } + \__fontspec_primitive_font_set:OnnF \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt } + { \__fontspec_error:nx {font-not-found} {#2} } } \keys_define:nn {fontspec/fontname} { @@ -1564,7 +1576,7 @@ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } % "normal" - \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {\l__fontspec_sizing_leftover_clist} {} % small caps @@ -1582,7 +1594,7 @@ \bool_set_true:N \l__fontspec_nosc_bool } } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_fontname_sc_tl} }% local for each size } \bool_if:NF \l__fontspec_nosc_bool @@ -1596,6 +1608,11 @@ \__fontspec_get_features:n { #2 , #3 , #4 } + \tl_if_empty:NF \l__fontspec_scale_tl + { + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } + \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl @@ -1689,7 +1706,7 @@ } \cs_new:Nn \__fontspec_make_smallcaps:TF { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + \exp_args:No \__fontspec_check_ot_feat:NnTF \l__fontspec_fontface_cs_tl {smcp} {#1} {#2} } \cs_new:Nn \__fontspec_update_featstr:n { @@ -1755,7 +1772,7 @@ \cs_new:Nn \__fontspec_define_opentype_feature_group:n { - \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} } } \cs_new:Nn \__fontspec_feat_prop_add:nn { @@ -1775,7 +1792,8 @@ \keys_define:nn {fontspec-opentype} { #1/#2 .code:n = - { \__fontspec_remove_clashing_featstr:n {#5} } + { \__fontspec_remove_clashing_featstr:n {#5} } , + #1/#2 .groups:n = {opentype} } } { @@ -1784,7 +1802,8 @@ #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} - } + } , + #1/#2 .groups:n = {opentype} } } } @@ -1810,7 +1829,7 @@ \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool } \bool_if:NT \l__fontspec_check_feat_bool { - \__fontspec_check_ot_feat:NnF \l_fontspec_font {#1} + \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1} { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} \bool_set_false:N \l__fontspec_proceed_bool @@ -1834,6 +1853,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#2} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \cs_if_eq:NNTF #1 \font { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } @@ -1847,6 +1869,7 @@ \prg_return_false: } } + } } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { @@ -1857,6 +1880,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \__fontspec_ot_validate_tag:x {#3} \cs_if_eq:NNTF #1 \font @@ -1868,6 +1894,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { @@ -1876,9 +1903,12 @@ } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} { - \bool_if:nTF {\l__fontspec_never_check_bool || \l__fontspec_scripts_missing_bool} + \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \__fontspec_ot_validate_tag:x {#3} \__fontspec_ot_validate_tag:x {#4} @@ -1891,6 +1921,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -2259,7 +2290,12 @@ {MatchUppercase} { \__fontspec_calc_scale:n {8} } } { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } +\__fontspec_keys_define_code:nnn {fontspec} {ScaleAgain} + { + \tl_if_empty:NT \l__fontspec_scale_tl { \tl_set:Nn \l__fontspec_scale_tl {1} } + \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { #1 * \l__fontspec_scale_tl } } + \__fontspec_info:n {set-scale} } \cs_new:Nn \__fontspec_calc_scale:n { @@ -2270,12 +2306,12 @@ \selectfont \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l__fontspec_fontface_cs_tl \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } + \dim_to_fp:n {\l__fontspec_tmpb_dim} } } \__fontspec_info:n {set-scale} @@ -2368,12 +2404,12 @@ { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + \exp_args:No \__fontspec_primitive_font_glyph_if_exist:NnTF \l__fontspec_fontface_cs_tl {\l__fontspec_hyphenchar_tl} { \tl_put_right:Nn \l__fontspec_postadjust_tl { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } } - { \__fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{\l_fontspec_fontname_tl}{#1} } } } @@ -2712,6 +2748,7 @@ \keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , + Alternate .groups:n = {opentype}, Alternate / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2728,6 +2765,7 @@ \keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , + Variant .groups:n = {opentype} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2763,6 +2801,7 @@ \keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , + Annotation .groups:n = {opentype}, Annotation / unknown .code:n = { \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} @@ -2772,62 +2811,68 @@ \keys_define:nn {fontspec-opentype} { Ornament .default:n = {0} , + Ornament .groups:n = {opentype}, Ornament / unknown .code:n = { \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} } } -\keys_define:nn { fontspec-opentype } { Script .choice: } +\keys_define:nn {fontspec-opentype} + { + Script .choice: , + Script .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Script / #1 .code:n = { - \bool_if:NF \l__fontspec_scripts_missing_bool + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1} { - \__fontspec_check_script:NnT \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_scriptlang_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } + \tl_set:Nn \l__fontspec_script_name_tl {#1} + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_scriptlang_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: } - \bool_if:NF \l__fontspec_scriptlang_exist_bool + } + \bool_if:NF \l__fontspec_scriptlang_exist_bool + { + \bool_if:nF { \str_if_eq_p:ee {#1} {CustomDefault} } + { + \tl_clear:N \l__fontspec_script_name_tl + \__fontspec_warning:nx {no-script} {\l_fontspec_fontname_tl} {#1} + } + + \bool_if:nF { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } - } - } + \str_if_eq_p:ee {#1} {Default} || + \str_if_eq_p:ee {#1} {Latin} || + \str_if_eq_p:ee {#1} {CustomDefault} + } + { + \keys_set:nn {fontspec-opentype} { Script = CustomDefault } } } } } } -\keys_define:nn {fontspec-opentype} { Language .choice: } +\keys_define:nn {fontspec-opentype} + { + Language .choice: , + Language .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_lang:nn { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Language / #1 .code:n = { \bool_set_false:N \l__fontspec_scriptlang_exist_bool \clist_map_inline:nn {#2} { - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2} { \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} @@ -2903,6 +2948,7 @@ \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} +\newfontscript{CustomDefault}{latn,DFLT} \newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Duployan}{dupl} @@ -3895,12 +3941,4 @@ \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: }{} } -\RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } -\NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 1e7ad583f4b..cf7f95bf6cf 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -41,7 +41,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> %%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -73,7 +73,6 @@ \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool \bool_new:N \l__fontspec_never_check_bool -\bool_new:N \l__fontspec_scripts_missing_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -184,8 +183,10 @@ \tl_new:N \l__fontspec_fontname_bfsl_tl \tl_new:N \l__fontspec_fontname_sc_tl \tl_new:N \l__fontspec_script_name_tl +\tl_set:Nn \l__fontspec_script_name_tl {CustomDefault} \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl +\tl_set:Nn \l__fontspec_lang_name_tl {Default} \tl_new:N \l_fontspec_lang_tl \tl_new:N \l__fontspec_mapping_tl \tl_new:N \l__fontspec_punctspace_adjust_tl @@ -246,7 +247,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl' does not contain glyph #1. + '#1' does not contain glyph #2. } \__fontspec_msg_new:nnnn {fontspec} {euler-too-late} { @@ -312,15 +313,6 @@ { OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - `Script=Latin` used instead. - } \__fontspec_msg_new:nnn {fontspec} {aat-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl' feature not supported @@ -344,7 +336,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. + '#1' doesn't appear to have an Optical Size axis. } \__fontspec_msg_new:nnn {fontspec} {language-not-exist} { @@ -407,13 +399,9 @@ { Adjusting the maths setup (use [no-math] to avoid this). } -\__fontspec_msg_new:nnn {fontspec} {no-scripts} +\__fontspec_msg_new:nnn {fontspec} {no-script} { - Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. - } -\__fontspec_msg_new:nnn {fontspec} {dflt-script} - { - Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + Font "#1" does not contain requested Script "#2". } \__fontspec_msg_new:nnn {fontspec} {opa-twice} { @@ -517,6 +505,7 @@ \cs_generate_variant:Nn \prop_get:NnNT {NxN} \cs_generate_variant:Nn \prop_get:NnNTF {NxN} \cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty_p:n {e} \cs_generate_variant:Nn \tl_if_empty:nTF {x} \cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_generate_variant:Nn \tl_if_empty:nF {f} @@ -527,11 +516,11 @@ \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { - \font #1 = #2 ~at~ #3 \scan_stop: + \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 { - \global \font #1 = #2 ~at~ #3 \scan_stop: + \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { @@ -545,11 +534,25 @@ \prg_return_false: \fi } +\prg_set_conditional:Nnn \__fontspec_primitive_font_set:Nnn {TF,T,F} + { + \__fontspec_primitive_font_set:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\prg_set_conditional:Nnn \__fontspec_primitive_font_gset:Nnn {TF,T,F} + { + \__fontspec_primitive_font_gset:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\cs_set:Npn \__fontspec_primitive_font_set:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_set:Nnn } +\cs_set:Npn \__fontspec_primitive_font_set:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_set:NnnF } +\cs_set:Npn \__fontspec_primitive_font_gset:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_gset:Nnn } +\cs_set:Npn \__fontspec_primitive_font_gset:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_gset:NnnF } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_exist:n {TF,T,F} { \group_begin: \__fontspec_font_suppress_not_found_error: - \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} {10pt} + \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} { \f@size pt - 1sp } \__fontspec_primitive_font_if_null:NTF \l__fontspec_primitive_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } @@ -566,6 +569,11 @@ { \tex_hyphenchar:D #1 = #2 \scan_stop: } +\cs_new_eq:NN \__fontspec_primitive_font_get_name:N \fontname +\cs_new:Npn \__fontspec_primitive_font_current_name: + { + \__fontspec_primitive_font_get_name:N \tex_font:D + } %%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -680,6 +688,17 @@ { \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } +\AtBeginDocument + { + \RenewDocumentCommand \oldstylenums {m} + { + \__fontspec_main_oldstylenums:n {#1} + } + } +\NewDocumentCommand \liningnums {m} + { + \__fontspec_main_liningnums:n {#1} + } %%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -951,6 +970,20 @@ { \prg_return_true: } { \prg_return_false: } } } +\cs_new_protected:Nn \__fontspec_main_oldstylenums:n + { + \group_begin: + \addfontfeature{Numbers=OldStyle} + #1 + \group_end: + } +\cs_new_protected:Nn \__fontspec_main_liningnums:n + { + \group_begin: + \addfontfeature{Numbers=Lining} + #1 + \group_end: + } %%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -1101,18 +1134,23 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} - \tl_clear_new:N #1 + \tl_if_exist:NF #1 { \tl_new:N #1 } \tl_set_eq:NN #1 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} - \cs_new:Nn \fontspec_set_fontface:NNnn +\tl_new:N \l__fontspec_fontface_cs_tl +\tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} +\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:Nn \l__fontspec_fontface_cs_tl {#1} + \tl_set:Nn \l__fontspec_family_label_tl {#2} + \__fontspec_select_font_family:nn {#3} {#4} \tl_set_eq:NN #2 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} { @@ -1128,7 +1166,7 @@ \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} { \exp_args:Nxx \tl_if_in:nnTF - { \fontname\font } { \tl_to_str:n {#1} } + { \__fontspec_primitive_font_current_name: } { \tl_to_str:n {#1} } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F} @@ -1161,7 +1199,7 @@ \__fontspec_init: \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} \__fontspec_if_detect_external:nT {#2} @@ -1278,20 +1316,19 @@ } \cs_new:Nn \__fontspec_load_font: { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \__fontspec_check_script:NnTF \l_fontspec_font {DFLT} - { - \bool_set_false:N \l__fontspec_scripts_missing_bool - } - { - \bool_set_true:N \l__fontspec_scripts_missing_bool - } + + \__fontspec_primitive_font_set:NnnF \l__fontspec_test_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt - 2sp } + { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + + \__fontspec_set_font_type:N \l__fontspec_test_font + \__fontspec_primitive_font_gset:Onn \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt } + + \l__fontspec_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn { @@ -1321,37 +1358,10 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \bool_if:NTF \l__fontspec_scripts_missing_bool + \tl_if_empty:NF \l__fontspec_script_name_tl { - \__fontspec_info:n {no-scripts} - } - { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {dflt-script} - \keys_set:nx {fontspec-opentype} {Script=Default} - \keys_set:nx {fontspec-opentype} {Language=Default} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } } } @@ -1533,28 +1543,30 @@ } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } + \group_begin: + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt + 1sp } + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } { \f@size pt + 1sp } + \str_if_eq:eeTF { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpa_font } { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpb_font } + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { \group_begin: \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {#1} \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} \group_end: } -\cs_new:Nn \__fontspec_load_fontname:n +\cs_new:Nn \__fontspec_load_fontname:Nn { - \__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 + \__fontspec_load_external_fontoptions:Nn #1 {#2} + \prop_get:NVNF \g__fontspec_fontopts_prop #1 \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist - \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } + \__fontspec_primitive_font_set:OnnF \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt } + { \__fontspec_error:nx {font-not-found} {#2} } } \keys_define:nn {fontspec/fontname} { @@ -1585,7 +1597,7 @@ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } % "normal" - \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {\l__fontspec_sizing_leftover_clist} {} % small caps @@ -1603,7 +1615,7 @@ \bool_set_true:N \l__fontspec_nosc_bool } } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_fontname_sc_tl} }% local for each size } \bool_if:NF \l__fontspec_nosc_bool @@ -1617,6 +1629,11 @@ \__fontspec_get_features:n { #2 , #3 , #4 } + \tl_if_empty:NF \l__fontspec_scale_tl + { + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } + \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl @@ -1712,7 +1729,7 @@ } \cs_new:Nn \__fontspec_make_ot_smallcaps:TF { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + \exp_args:No \__fontspec_check_ot_feat:NnTF \l__fontspec_fontface_cs_tl {smcp} {#1} {#2} } \cs_new:Nn \__fontspec_make_smallcaps:TF { @@ -1720,7 +1737,10 @@ { \__fontspec_make_ot_smallcaps:TF {#1} {#2} } { \bool_if:NT \l__fontspec_atsui_bool - { \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } + { + \exp_args:No \__fontspec_make_AAT_feature_string:NnnTF + \l__fontspec_fontface_cs_tl {3} {3} {#1} {#2} + } } } \cs_new:Nn \__fontspec_update_featstr:n @@ -1797,7 +1817,7 @@ \cs_new:Nn \__fontspec_define_opentype_feature_group:n { - \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} } } \cs_new:Nn \__fontspec_feat_prop_add:nn { @@ -1817,7 +1837,8 @@ \keys_define:nn {fontspec-opentype} { #1/#2 .code:n = - { \__fontspec_remove_clashing_featstr:n {#5} } + { \__fontspec_remove_clashing_featstr:n {#5} } , + #1/#2 .groups:n = {opentype} } } { @@ -1826,7 +1847,8 @@ #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} - } + } , + #1/#2 .groups:n = {opentype} } } } @@ -1852,7 +1874,7 @@ \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool } \bool_if:NT \l__fontspec_check_feat_bool { - \__fontspec_check_ot_feat:NnF \l_fontspec_font {#1} + \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1} { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} \bool_set_false:N \l__fontspec_proceed_bool @@ -1876,6 +1898,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#2} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } \int_zero:N \l_tmpa_int @@ -1891,6 +1916,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { @@ -1901,6 +1927,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \__fontspec_iv_str_to_num:Nx \l__fontspec_script_int {#3} \int_set:Nn \l__fontspec_tmpb_int @@ -1923,6 +1952,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { @@ -1931,9 +1961,12 @@ } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} { - \bool_if:nTF {\l__fontspec_never_check_bool || \l__fontspec_scripts_missing_bool} + \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \__fontspec_iv_str_to_num:Nx \l__fontspec_language_int {#3} \__fontspec_lang_dflt_correct:N \l__fontspec_language_int @@ -1958,6 +1991,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -2102,7 +2136,7 @@ \tl_if_empty:nTF {#1} { \__fontspec_warning:n {aat-feature-not-exist} } { - \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + \exp_args:No \__fontspec_make_AAT_feature_string:NnnTF \l__fontspec_fontface_cs_tl {#1} {#2} { \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } @@ -2388,7 +2422,12 @@ {MatchUppercase} { \__fontspec_calc_scale:n {8} } } { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } +\__fontspec_keys_define_code:nnn {fontspec} {ScaleAgain} + { + \tl_if_empty:NT \l__fontspec_scale_tl { \tl_set:Nn \l__fontspec_scale_tl {1} } + \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { #1 * \l__fontspec_scale_tl } } + \__fontspec_info:n {set-scale} } \cs_new:Nn \__fontspec_calc_scale:n { @@ -2399,12 +2438,12 @@ \selectfont \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l__fontspec_fontface_cs_tl \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } + \dim_to_fp:n {\l__fontspec_tmpb_dim} } } \__fontspec_info:n {set-scale} @@ -2497,12 +2536,12 @@ { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + \exp_args:No \__fontspec_primitive_font_glyph_if_exist:NnTF \l__fontspec_fontface_cs_tl {\l__fontspec_hyphenchar_tl} { \tl_put_right:Nn \l__fontspec_postadjust_tl { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } } - { \__fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{\l_fontspec_fontname_tl}{#1} } } } @@ -2583,7 +2622,7 @@ \bool_if:nT { !\l__fontspec_ot_bool && !\l__fontspec_mm_bool } { \bool_if:NT \l__fontspec_firsttime_bool - { \__fontspec_warning:n {no-opticals} } + { \__fontspec_warning:n {no-opticals} {\l_fontspec_fontname_tl} } } } \keys_define:nn {fontspec} @@ -2685,7 +2724,9 @@ \keys_define:nn {fontspec-opentype} { Ligatures / TeX .code:n = { \tl_set:Nn \l__fontspec_mapping_tl {tex-text} }, + Ligatures / TeX .groups:n = {opentype}, Ligatures / TeXReset .code:n = { \tl_clear:N \l__fontspec_mapping_tl }, + Ligatures / TeXReset .groups:n = {opentype}, } \__fontspec_define_opentype_feature_group:n {Letters} \__fontspec_define_opentype_feature:nnnnn {Letters} {ResetAll} {} {} @@ -2860,6 +2901,7 @@ \keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , + Alternate .groups:n = {opentype}, Alternate / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2871,6 +2913,7 @@ \keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , + Variant .groups:n = {opentype} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2906,6 +2949,7 @@ \keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , + Annotation .groups:n = {opentype}, Annotation / unknown .code:n = { \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} @@ -2915,62 +2959,68 @@ \keys_define:nn {fontspec-opentype} { Ornament .default:n = {0} , + Ornament .groups:n = {opentype}, Ornament / unknown .code:n = { \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} } } -\keys_define:nn { fontspec-opentype } { Script .choice: } +\keys_define:nn {fontspec-opentype} + { + Script .choice: , + Script .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Script / #1 .code:n = { - \bool_if:NF \l__fontspec_scripts_missing_bool + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1} { - \__fontspec_check_script:NnT \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_scriptlang_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } + \tl_set:Nn \l__fontspec_script_name_tl {#1} + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_scriptlang_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: } - \bool_if:NF \l__fontspec_scriptlang_exist_bool + } + \bool_if:NF \l__fontspec_scriptlang_exist_bool + { + \bool_if:nF { \str_if_eq_p:ee {#1} {CustomDefault} } { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } - } - } + \tl_clear:N \l__fontspec_script_name_tl + \__fontspec_warning:nx {no-script} {\l_fontspec_fontname_tl} {#1} + } + + \bool_if:nF + { + \str_if_eq_p:ee {#1} {Default} || + \str_if_eq_p:ee {#1} {Latin} || + \str_if_eq_p:ee {#1} {CustomDefault} + } + { + \keys_set:nn {fontspec-opentype} { Script = CustomDefault } } } } } } -\keys_define:nn {fontspec-opentype} { Language .choice: } +\keys_define:nn {fontspec-opentype} + { + Language .choice: , + Language .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_lang:nn { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Language / #1 .code:n = { \bool_set_false:N \l__fontspec_scriptlang_exist_bool \clist_map_inline:nn {#2} { - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2} { \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} @@ -3046,6 +3096,7 @@ \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} +\newfontscript{CustomDefault}{latn,DFLT} \newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Duployan}{dupl} @@ -4175,12 +4226,4 @@ \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: }{} } -\RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } -\NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index a3b2cebcf69..e67eed16e82 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -23,8 +23,8 @@ fontspec = fontspec or {} local fontspec = fontspec fontspec.module = { name = "fontspec", - version = "2.6l", - date = "2019/01/18", + version = "2.7", + date = "2019/01/24", description = "Font selection for XeLaTeX and LuaLaTeX", author = "Khaled Hosny, Philipp Gesang, Will Robertson", copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index a5a4ba37d20..7178fb7f2d3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -21,7 +21,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> \sys_if_engine_luatex:T |