diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty | 2230 |
1 files changed, 1125 insertions, 1105 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 14cba40dacd..17a012c3d66 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -6,26 +6,26 @@ %% %% fontspec.dtx (with options: `fontspec,LU') %% fontspec-code-load.dtx (with options: `fontspec,LU') -%% fontspec-vars.dtx (with options: `fontspec,LU') -%% fontspec-msg.dtx (with options: `fontspec,LU') -%% fontspec-opening.dtx (with options: `fontspec,LU') -%% fontspec-fontload.dtx (with options: `fontspec,LU') -%% fontspec-interfaces.dtx (with options: `fontspec,LU') -%% fontspec-user.dtx (with options: `fontspec,LU') -%% fontspec-api.dtx (with options: `fontspec,LU') -%% fontspec-internal.dtx (with options: `fontspec,LU') -%% fontspec-opentype.dtx (with options: `fontspec,LU') -%% fontspec-graphite.dtx (with options: `fontspec,LU') -%% fontspec-keyval.dtx (with options: `fontspec,LU') -%% fontspec-feat-opentype.dtx (with options: `fontspec,LU') -%% fontspec-scripts.dtx (with options: `fontspec,LU') -%% fontspec-lang.dtx (with options: `fontspec,LU') -%% fontspec-feat-aat.dtx (with options: `fontspec,LU') -%% fontspec-enc.dtx (with options: `fontspec,LU') -%% fontspec-math.dtx (with options: `fontspec,LU') -%% fontspec-closing.dtx (with options: `fontspec,LU') -%% fontspec-xfss.dtx (with options: `fontspec,LU') -%% fontspec-patches.dtx (with options: `fontspec,LU') +%% fontspec-code-vars.dtx (with options: `fontspec,LU') +%% fontspec-code-msg.dtx (with options: `fontspec,LU') +%% fontspec-code-opening.dtx (with options: `fontspec,LU') +%% fontspec-code-fontload.dtx (with options: `fontspec,LU') +%% fontspec-code-interfaces.dtx (with options: `fontspec,LU') +%% fontspec-code-user.dtx (with options: `fontspec,LU') +%% fontspec-code-api.dtx (with options: `fontspec,LU') +%% fontspec-code-internal.dtx (with options: `fontspec,LU') +%% fontspec-code-opentype.dtx (with options: `fontspec,LU') +%% fontspec-code-graphite.dtx (with options: `fontspec,LU') +%% fontspec-code-keyval.dtx (with options: `fontspec,LU') +%% fontspec-code-feat-opentype.dtx (with options: `fontspec,LU') +%% fontspec-code-scripts.dtx (with options: `fontspec,LU') +%% fontspec-code-lang.dtx (with options: `fontspec,LU') +%% fontspec-code-feat-aat.dtx (with options: `fontspec,LU') +%% fontspec-code-enc.dtx (with options: `fontspec,LU') +%% fontspec-code-math.dtx (with options: `fontspec,LU') +%% fontspec-code-closing.dtx (with options: `fontspec,LU') +%% fontspec-code-xfss.dtx (with options: `fontspec,LU') +%% fontspec-code-patches.dtx (with options: `fontspec,LU') %% ------------------------------------------------ %% The FONTSPEC package <wspr.io/fontspec> %% ------------------------------------------------ @@ -41,10 +41,10 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-luatex}% - {2018/07/30}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/10}{2.6j}{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> +%%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_new:N \l__fontspec_firsttime_bool \bool_new:N \l__fontspec_nobf_bool \bool_new:N \l__fontspec_noit_bool @@ -67,12 +67,12 @@ \bool_new:N \l__fontspec_disable_defaults_bool \bool_new:N \l__fontspec_alias_bool \bool_new:N \l__fontspec_external_bool -\bool_new:N \l__fontspec_never_check_bool \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 +\bool_new:N \l__fontspec_never_check_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -158,6 +158,10 @@ \tl_new:N \l__fontspec_emshape_query_tl \tl_new:N \l__fontspec_em_switch_tl \tl_new:N \l__fontspec_em_tmp_tl +\tl_new:N \l__fontspec_strong_tmp_tl +\tl_new:N \l__fontspec_strong_switch_tl +\tl_new:N \l__fontspec_hyphenchar_tl +\tl_new:N \l__fontspec_smcp_shape_tl \tl_new:N \g__fontspec_mathrm_tl \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl @@ -192,7 +196,7 @@ \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> +%%^^A%% fontspec-code-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } \cs_new:Npn \__fontspec_error:nn { \msg_error:nnn {fontspec} } \cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } @@ -300,6 +304,10 @@ { Option '#2' of font feature '#1' overwritten. } +\__fontspec_msg_new:nnn {fontspec} {ot-tag-too-long} + { + 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-latn} { Font '\l_fontspec_fontname_tl' does not contain script '#1'.\\ @@ -420,7 +428,7 @@ } \char_set_catcode_ignore:n {32} -%%^^A%% fontspec-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareOption{cm-default} { \__fontspec_warning:n {cm-default-obsolete} @@ -473,10 +481,10 @@ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument - { - \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl - \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl - } + { + \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl + \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl + } \bool_if:NT \g__fontspec_euenc_bool { \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile @@ -511,7 +519,7 @@ \cs_generate_variant:Nn \tl_if_eq:nnT {ox} \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} -%%^^A%% fontspec-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { @@ -523,7 +531,7 @@ } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { - \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one + \int_set:Nn \suppressfontnotfounderror {1} } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_null:N {p,TF,T,F} { @@ -544,7 +552,7 @@ } \prg_new_conditional:Nnn \__fontspec_primitive_font_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 #2 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -555,7 +563,7 @@ \tex_hyphenchar:D #1 = #2 \scan_stop: } -%%^^A%% fontspec-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> \NewDocumentCommand \fontspec { O{} m O{} } { @@ -669,7 +677,7 @@ \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } -%%^^A%% fontspec-user.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_main_fontspec:nn { @@ -690,7 +698,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} + \str_if_eq:eeT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmainfont_hook:nn {#1} {#2} \normalfont @@ -708,7 +716,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} + \str_if_eq:eeT {\familydefault} {\sfdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setsansfont_hook:nn {#1} {#2} \normalfont @@ -726,7 +734,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} + \str_if_eq:eeT {\familydefault} {\ttdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmonofont_hook:nn {#1} {#2} \normalfont @@ -940,7 +948,7 @@ } } -%%^^A%% fontspec-api.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { @@ -1002,99 +1010,96 @@ } } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_language_int {#2} - \__fontspec_check_ot_feat:NnTF \font {#3} \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_ot_bool + { + \__fontspec_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_check_script:NnTF \font {#1} \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_ot_bool + { + \__fontspec_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language: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} - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_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} {script-tag} \l_fontspec_script_tl - \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \tl_set:Nn \l_fontspec_script_tl {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_check_lang:NnTF \font {#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_ot_bool + { + \__fontspec_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_script: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-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\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_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_language: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} {lang-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\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_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \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_clear_new:N #1 \tl_set_eq:NN #1 \l_fontspec_family_tl } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} @@ -1143,81 +1148,81 @@ { \prg_return_false: } } -%%^^A%% fontspec-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new_protected:Nn \__fontspec_select_font_family:nn - { - \group_begin: - \__fontspec_font_suppress_not_found_error: - \__fontspec_init: + { + \group_begin: + \__fontspec_font_suppress_not_found_error: + \__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_basename_tl {#2} + \__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_basename_tl {#2} - \__fontspec_if_detect_external:nT {#2} - { \keys_set:nn {fontspec-preparse-external} {Path} } + \__fontspec_if_detect_external:nT {#2} + { \keys_set:nn {fontspec-preparse-external} {Path} } - \keys_set_known:nn {fontspec-preparse-cfg} {#1} + \keys_set_known:nn {fontspec-preparse-cfg} {#1} - \__fontspec_init_ttc:n {#2} - \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_init_ttc:n {#2} + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_extract_all_features:n {#1} - \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + \__fontspec_extract_all_features:n {#1} + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } - \__fontspec_preparse_features: - \__fontspec_load_font: - \__fontspec_set_scriptlang: - \__fontspec_get_features:n {} - \bool_set_false:N \l__fontspec_firsttime_bool + \__fontspec_preparse_features: + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:n {} + \bool_set_false:N \l__fontspec_firsttime_bool - \__fontspec_save_family_needed:nTF {#2} - { - \__fontspec_save_family:nn {#1} {#2} - } - { - } - \group_end: + \__fontspec_save_family_needed:nTF {#2} + { + \__fontspec_save_family:nn {#1} {#2} + } + { + } + \group_end: - \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl - } + \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 - { - \tl_set:Nx #1 {#2} + { + \tl_set:Nx #1 {#2} \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \tl_if_in:NnT #1 {##1} - { - \tl_remove_once:Nn #1 {##1} - \tl_set:Nn \l__fontspec_extension_tl {##1} - \clist_map_break: - } - } - } + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \tl_set:Nn \l__fontspec_extension_tl {##1} + \clist_map_break: + } + } + } \prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} - { - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \bool_set_false:N \l__fontspec_tmpa_bool - \exp_args:Nx % <- this should be handled earlier - \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } - } - \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: - } + { + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \bool_set_false:N \l__fontspec_tmpa_bool + \exp_args:Nx % <- this should be handled earlier + \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } + } + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: + } \cs_new:Nn \__fontspec_init_ttc:n - { - \str_if_eq_x:nnT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} - } - } + { + \str_if_eq:eeT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} + } + } \cs_new:Nn \__fontspec_load_external_fontoptions:Nn { \bool_if:NT \l__fontspec_fontcfg_bool @@ -1233,67 +1238,67 @@ } } \cs_new:Nn \__fontspec_extract_all_features:n - { - \bool_if:NTF \l__fontspec_disable_defaults_bool - { - \clist_set:Nx \l__fontspec_all_features_clist {#1} - } - { - \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { + \bool_if:NTF \l__fontspec_disable_defaults_bool + { + \clist_set:Nx \l__fontspec_all_features_clist {#1} + } + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist - { \clist_clear:N \l__fontspec_family_fontopts_clist } - \tl_clear:N \l__fontspec_family_label_tl + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist + { \clist_clear:N \l__fontspec_family_fontopts_clist } + \tl_clear:N \l__fontspec_family_label_tl - \clist_set:Nx \l__fontspec_all_features_clist - { - \g__fontspec_default_fontopts_clist, - \l__fontspec_family_fontopts_clist, - \l__fontspec_fontopts_clist, - #1 - } - } - } + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } + } + } \cs_new:Nn \__fontspec_preparse_features: - { + { - \__fontspec_keys_set_known:nxN {fontspec-preparse-external} - { \l__fontspec_all_features_clist } - \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} + { \l__fontspec_all_features_clist } + \l__fontspec_keys_leftover_clist - \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} - \l__fontspec_keys_leftover_clist - \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} - \l__fontspec_fontfeat_clist - } + \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } \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_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 + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn - { + { " \__fontspec_fontname_wrap:n { #1 #2 } #3 #4 #5 - \str_if_eq_x:nnF {#6}{} {:#6} " - } + \str_if_eq:eeF {#6}{} {:#6} " + } \cs_new:Nn \__fontspec_construct_font_call:nn - { - \__fontspec_construct_font_call:nnnnnn - {#1} - \l__fontspec_extension_tl - \l__fontspec_ttc_index_tl - \l_fontspec_renderer_tl - \l__fontspec_optical_size_tl - {#2} - } + { + \__fontspec_construct_font_call:nnnnnn + {#1} + \l__fontspec_extension_tl + \l__fontspec_ttc_index_tl + \l_fontspec_renderer_tl + \l__fontspec_optical_size_tl + {#2} + } \cs_new:Nn \__fontspec_font_is_name: { \cs_set_eq:NN \__fontspec_fontname_wrap:n \use:n @@ -1303,50 +1308,51 @@ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] } } \cs_new:Nn \__fontspec_set_scriptlang: - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \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 {no-scripts} - } - } - { - \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} - } - } - } + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \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 {no-scripts} + \bool_set_true:N \l__fontspec_never_check_bool + } + } + { + \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} + } + } + } \cs_new:Nn \__fontspec_get_features:n - { - \__fontspec_init_fontface: - \__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 - \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist - - \tl_if_empty:NF \l__fontspec_mapping_tl - { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } - - \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } - { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } - { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } + { + \__fontspec_init_fontface: + \__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 + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } + + \str_if_eq:eeF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } + { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } + } \prg_new_conditional:Nnn \__fontspec_save_family_needed:n { TF } { @@ -1393,141 +1399,139 @@ \__fontspec_info:nxx {defining-font} {#1} {#2} } \cs_new:Nn \__fontspec_save_fontinfo:n - { - \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 \g__fontspec_rawfeatures_sclist } - } - \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 - } + { + \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 \g__fontspec_rawfeatures_sclist } + } + \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: - { - \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} - } + { + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} + } - \bool_if:NF \l__fontspec_nobf_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} - } + \bool_if:NF \l__fontspec_nobf_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + } - \bool_if:NF \l__fontspec_noit_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} - } + \bool_if:NF \l__fontspec_noit_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} + } - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} - } + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} + } \cs_new:Nn \__fontspec_set_faces: - { - \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist - \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist - \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist - - \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } - } + { + \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } + } \cs_new:Nn \__fontspec_set_faces_aux:nnnnn - { - \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} - \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} + \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} + } \cs_new:Nn \fontspec_complete_fontname:Nn - { - \tl_set:Nx #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} + { + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} \tl_remove_all:Nn #1 {~} - } + } \cs_new:Nn \__fontspec_add_nfssfont:nnnn - { - \tl_set:Nx \l__fontspec_this_font_tl {#3} + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} - \tl_if_empty:xTF {#4} - { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } - { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } - \tl_if_empty:NF \l__fontspec_this_font_tl - { - \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} - { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } - } - } + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } + } \cs_new:Nn \__fontspec_set_font_type:N - { - \bool_set_true:N \l__fontspec_ot_bool - } + { + \bool_set_true:N \l__fontspec_ot_bool + } \cs_new:Nn \__fontspec_set_autofont:Nnn - { - \bool_if:NF \l__fontspec_external_bool - { - \tl_if_empty:xF {#2} - { - \tl_if_empty:NT #1 - { - \__fontspec_if_autofont:nnTF {#2} {#3} - { \tl_set:Nx #1 {#2#3} } - { \__fontspec_info:nx {no-font-shape} {#2#3} } - } - } - } - } - + { + \bool_if:NF \l__fontspec_external_bool + { + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } + } + } + } + } \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_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } - } + { + \__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: } + } \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_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} - \group_end: - } - + { + \group_begin: + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist + \__fontspec_load_fontname:n {#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 - { + { \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { \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} } - } + } \keys_define:nn {fontspec/fontname} { Font .tl_set:N = \l_fontspec_fontname_tl , Font .groups:n = {getfontname} , } \cs_new:Nn \__fontspec_declare_shape:nnnn - { - \tl_clear:N \l__fontspec_nfss_tl - \tl_clear:N \l__fontspec_nfss_sc_tl - \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl + { + \tl_clear:N \l__fontspec_nfss_tl + \tl_clear:N \l__fontspec_nfss_sc_tl + \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl - \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } + \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } - \__fontspec_declare_shapes_normal:nn {#1} {#2} - \__fontspec_declare_shapes_smcaps:nn {#1} {#2} - \__fontspec_declare_shape_slanted:nn {#1} {#2} - \__fontspec_declare_shape_loginfo:nn {#1} {#2} - } + \__fontspec_declare_shapes_normal:nn {#1} {#2} + \__fontspec_declare_shapes_smcaps:nn {#1} {#2} + \__fontspec_declare_shape_slanted:nn {#1} {#2} + \__fontspec_declare_shape_loginfo:nn {#1} {#2} + } \cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} \cs_new:Nn \__fontspec_setup_single_size:nn { @@ -1546,38 +1550,38 @@ \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist \bool_if:NF \l__fontspec_nosc_bool - { - \tl_if_empty:NTF \l__fontspec_fontname_sc_tl - { - \__fontspec_make_smallcaps:TF - { - \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} - } - { - \bool_set_true:N \l__fontspec_nosc_bool - } - } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size - } + { + \tl_if_empty:NTF \l__fontspec_fontname_sc_tl + { + \__fontspec_make_smallcaps:TF + { + \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} + } + { + \bool_set_true:N \l__fontspec_nosc_bool + } + } + { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + } \bool_if:NF \l__fontspec_nosc_bool - { - \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl - {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} - } + { + \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl + {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} + } } \cs_new:Nn \__fontspec_setup_nfss:Nnnn - { + { - \__fontspec_get_features:n { #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 \g__fontspec_rawfeatures_sclist } - } - } + \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 \g__fontspec_rawfeatures_sclist } + } + } \cs_new:Nn \__fontspec_declare_shapes_normal:nn { \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl} {\g__fontspec_nfss_family_tl} @@ -1591,7 +1595,6 @@ { \__fontspec_combo_sc_shape:n {#2} } {\l__fontspec_nfss_sc_tl} {\l__fontspec_postadjust_tl} } } - \cs_new:Nn \__fontspec_combo_sc_shape:n { \tl_if_exist:cTF { \__fontspec_shape_merge:nn {#1} {\scdefault} } @@ -1599,73 +1602,74 @@ { \scdefault } } \cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn - { - \group_begin: - \normalsize - \cs_undefine:c {#1/#2/#3/#4/\f@size} - \group_end: - \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} - } + { +\group_begin: +\normalsize +\cs_undefine:c {#1/#2/#3/#4/\f@size} +\group_end: +\DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } \cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn - { - \bool_if:nT - { - \str_if_eq_x_p:nn {#2} {\itdefault} && - !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) - } - { - \__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} - } - } + { + \bool_if:nT + { + \str_if_eq_p:ee {#2} {\itdefault} && + !(\str_if_eq_p:ee {\itdefault} {\sldefault}) + } + { + \__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 \g__fontspec_defined_shapes_tl - { - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn {#1/#2} - { - {\mddefault/\updefault} {'normal'~} - {\bfdefault/\updefault} {'bold'~} - {\mddefault/\itdefault} {'italic'~} - {\mddefault/\sldefault} {'slanted'~} - {\bfdefault/\itdefault} {'bold~ italic'~} - {\bfdefault/\sldefault} {'bold~ slanted'~} - } (#1/#2)~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_tl - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } - { - {\mddefault/\scdefault} {'small~ caps'~} - {\bfdefault/\scdefault} {'bold~ small~ caps'~} - {\mddefault/\itscdefault} {'italic~ small~ caps'~} - {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} - {\mddefault/\slscdefault} {'slanted~ small~ caps'~} - {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} - }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_sc_tl - \tl_if_empty:fF {\l__fontspec_postadjust_tl} - { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl - } - } - } + { + \tl_gput_right:Nx \g__fontspec_defined_shapes_tl + { + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn {#1/#2} + { + {\mddefault/\updefault} {'normal'~} + {\bfdefault/\updefault} {'bold'~} + {\mddefault/\itdefault} {'italic'~} + {\mddefault/\sldefault} {'slanted'~} + {\bfdefault/\itdefault} {'bold~ italic'~} + {\bfdefault/\sldefault} {'bold~ slanted'~} + } (#1/#2)~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_tl + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } + { + {\mddefault/\scdefault} {'small~ caps'~} + {\bfdefault/\scdefault} {'bold~ small~ caps'~} + {\mddefault/\itscdefault} {'italic~ small~ caps'~} + {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} + {\mddefault/\slscdefault} {'slanted~ small~ caps'~} + {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} + }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_sc_tl + \tl_if_empty:fF {\l__fontspec_postadjust_tl} + { + \exp_not:N \\ and~ font~ adjustment~ code: + \exp_not:N \\ \l__fontspec_postadjust_tl + } + } + } \tl_set:Nn \l__fontspec_pre_feat_sclist - { - mode = \l_fontspec_mode_tl ; - \tl_if_empty:NF \l_fontspec_script_tl - { - script = \l_fontspec_script_tl ; - language = \l_fontspec_lang_tl ; - } - } + { + mode = \l_fontspec_mode_tl ; + \tl_if_empty:NF \l_fontspec_script_tl + { + script = \l_fontspec_script_tl ; + language = \l_fontspec_lang_tl ; + } + } \cs_new:Nn \__fontspec_make_smallcaps:TF - { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} - } + { + \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + } \cs_new:Nn \__fontspec_update_featstr:n { \bool_if:NF \l__fontspec_firsttime_bool @@ -1682,23 +1686,23 @@ } } \cs_set:Npn \__fontspec_init: - { - \bool_set_false:N \l__fontspec_ot_bool - \bool_set_true:N \l__fontspec_firsttime_bool - \__fontspec_font_is_name: - \tl_clear:N \l__fontspec_font_path_tl - \tl_clear:N \l__fontspec_optical_size_tl - \tl_clear:N \l__fontspec_ttc_index_tl - \tl_clear:N \l_fontspec_renderer_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 - \tl_set:Nn \l_fontspec_mode_tl {node} - \int_set:Nn \luatex_prehyphenchar:D { `\- } % fixme - \int_zero:N \luatex_posthyphenchar:D % fixme - \int_zero:N \luatex_preexhyphenchar:D % fixme - \int_zero:N \luatex_postexhyphenchar:D % fixme - } + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \__fontspec_font_is_name: + \tl_clear:N \l__fontspec_font_path_tl + \tl_clear:N \l__fontspec_optical_size_tl + \tl_clear:N \l__fontspec_ttc_index_tl + \tl_clear:N \l_fontspec_renderer_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 + \tl_set:Nn \l_fontspec_mode_tl {node} + \int_set:Nn \prehyphenchar { `\- } % fixme + \int_zero:N \posthyphenchar % fixme + \int_zero:N \preexhyphenchar % fixme + \int_zero:N \postexhyphenchar % fixme + } \cs_new:Nn \__fontspec_init_fontface: { \tl_gclear:N \g__fontspec_rawfeatures_sclist @@ -1709,29 +1713,24 @@ \tl_clear:N \l__fontspec_wordspace_adjust_tl \tl_clear:N \l__fontspec_punctspace_adjust_tl } -\cs_new:Nn \__fontspec_iv_str_to_num:Nn +\cs_new_protected:Nn \__fontspec_ot_validate_tag:n { - \__fontspec_strip_leading_sign:Nw #1#2 \q_nil + \__fontspec_ot_validate_tag:w #1 \q_nil } -\cs_set:Npn \__fontspec_strip_leading_sign:Nw #1#2#3 \q_nil +\cs_generate_variant:Nn \__fontspec_ot_validate_tag:n {x} +\cs_set:Npn \__fontspec_ot_validate_tag:w #1 #2 \q_nil { - \bool_if:nTF { \str_if_eq_p:nn {#2} {+} || \str_if_eq_p:nn {#2} {-} } - { \__fontspec_iv_str_to_num:w #1 \q_nil #3 \c_empty_tl \c_empty_tl \q_nil } - { \__fontspec_iv_str_to_num:w #1 \q_nil #2#3 \c_empty_tl \c_empty_tl \q_nil } + \bool_if:nTF { \str_if_eq_p:nn {#1} {+} || \str_if_eq_p:nn {#1} {-} } + { \__fontspec_ot_validate_tag_aux:w #2 \c_empty_tl \c_empty_tl \q_nil } + { \__fontspec_ot_validate_tag_aux:w #1#2 \c_empty_tl \c_empty_tl \q_nil } + } +\cs_set:Npn \__fontspec_ot_validate_tag_aux:w #1#2#3#4#5 \q_nil + { + \int_compare:nT { \tl_count:n {#5} > 2 } + { \__fontspec_error:nx {ot-tag-too-long} {#1#2#3#4#5} } } -\cs_set:Npn \__fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil - { - \int_set:Nn #1 - { - `#2 * "1000000 - + `#3 * "10000 - + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 - + \ifx \c_empty_tl #5 32 \else `#5 \fi - } - } -\cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {No} -%%^^A%% fontspec-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_define_opentype_feature_group:n { @@ -1771,16 +1770,16 @@ \cs_new:Nn \__fontspec_feat_off:n {#1Off} \cs_new:Nn \__fontspec_feat_reset:n {#1Reset} \cs_new:Nn \__fontspec_define_opentype_onoffreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} + } \cs_new:Nn \__fontspec_define_opentype_onreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} + } \cs_new:Nn \__fontspec_make_OT_feature:nnn { @@ -1813,46 +1812,58 @@ { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua{fontspec.check_ot_script("\l__fontspec_tmp_tl", "#2")} - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \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} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua{fontspec.check_ot_script("\l__fontspec_tmp_tl", "#2")} + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } } - } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { + \__fontspec_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_lang:Nnn {TF} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_lang( "\l__fontspec_tmp_tl", "#2", "\l_fontspec_script_tl" ) + \__fontspec_ot_validate_tag:x {#2} + \__fontspec_ot_validate_tag:x {#3} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_lang( "\l__fontspec_tmp_tl", "#2", "#3" ) + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { + \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl} + {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_feat( - "\l__fontspec_tmp_tl", "#2", - "\l_fontspec_lang_tl", "\l_fontspec_script_tl" - ) + \__fontspec_ot_validate_tag:x {#2} + \__fontspec_ot_validate_tag:x {#3} + \__fontspec_ot_validate_tag:x {#4} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_feat("\l__fontspec_tmp_tl", "#2", "#3", "#4") + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - \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} @@ -1977,10 +1988,10 @@ \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {zero}{Slashed~Zero} -%%^^A%% fontspec-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> \clist_gset:Nn \g__fontspec_all_keyval_modules_clist { @@ -2006,60 +2017,61 @@ \bool_set_false:N \l__fontspec_fontcfg_bool } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Path} - { - \bool_set_true:N \l__fontspec_nobf_bool - \bool_set_true:N \l__fontspec_noit_bool - \bool_set_true:N \l__fontspec_external_bool - \tl_set:Nn \l__fontspec_font_path_tl {#1} - \__fontspec_font_is_file: - } + { + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \tl_set:Nn \l__fontspec_font_path_tl {#1} + \__fontspec_font_is_file: + } \aliasfontfeature{Path}{ExternalLocation} \__fontspec_keys_define_code:nnn {fontspec} {Path} {} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} - { - \tl_set:Nn \l__fontspec_extension_tl {#1} - \bool_if:NF \l__fontspec_external_bool - { - \keys_set:nn {fontspec-preparse-external} {Path} - } - } + { + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool + { + \keys_set:nn {fontspec-preparse-external} {Path} + } + } \tl_clear:N \l__fontspec_extension_tl \__fontspec_keys_define_code:nnn {fontspec} {Extension} {} \keys_define:nn {fontspec-renderer} - { - Renderer .choices:nn = - {AAT,ICU,OpenType,Graphite,Full,Basic} - { - \int_compare:nTF {\l_keys_choice_int <= 4} { - \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} - } - { - \tl_set:Nx \l_fontspec_mode_tl - { - \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } - } - \tl_gset:Nx \g__fontspec_single_feat_tl { mode=\l_fontspec_mode_tl } - } - } - } + { + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} + { + \int_compare:nTF {\l_keys_choice_int <= 4} + { + \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} + } + { + \tl_set:Nx \l_fontspec_mode_tl + { + \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } + } + \tl_gset:Nx \g__fontspec_single_feat_tl { mode=\l_fontspec_mode_tl } + } + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} - { - \tl_set:Nn \l__fontspec_script_name_tl {#1} - } + { + \tl_set:Nn \l__fontspec_script_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} - { - \tl_set:Nn \l__fontspec_lang_name_tl {#1} - } + { + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {FontIndex} - { - \str_if_eq_x:nnF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { \__fontspec_warning:n {font-index-needs-ttc} } + { + \str_if_eq:eeF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { \__fontspec_warning:n {font-index-needs-ttc} } \tl_set:Nn \l__fontspec_ttc_index_tl {(#1)} - } + } \__fontspec_keys_define_code:nnn {fontspec} {FontIndex} - { + { \tl_set:Nn \l__fontspec_ttc_index_tl {(#1)} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l__fontspec_fontname_up_tl {#1} @@ -2125,76 +2137,76 @@ } } \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + { + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} - { - \bool_if:NF \l__fontspec_firsttime_bool - { - \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} - } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \tl_if_empty:NT \l__fontspec_this_font_tl - { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \tl_if_empty:NT \l__fontspec_this_font_tl + { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} - { - \tl_set:Nn \l__fontspec_this_font_tl {#1} - } + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec} {Font} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Size} - { - \tl_set:Nn \l__fontspec_size_tl {#1} - } + { + \tl_set:Nn \l__fontspec_size_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Font} - { - \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} - { - \tl_gset:Nx \g__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 } - } + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec} {FontFace} { \tl_clear:N \l__fontspec_this_font_tl @@ -2213,271 +2225,273 @@ {\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} - { - {MatchLowercase} { \__fontspec_calc_scale:n {5} } - {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] } - } + { + \str_case:nnF {#1} + { + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {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] } + } \cs_new:Nn \__fontspec_calc_scale:n - { - \group_begin: + { + \group_begin: - \fontencoding { \encodingdefault } - \fontfamily { \rmdefault } - \selectfont + \fontencoding { \encodingdefault } + \fontfamily { \rmdefault } + \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_tmpa_dim {#1} \font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font - \tl_gset:Nx \l__fontspec_scale_tl - { - \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } - } + \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} } + } - \__fontspec_info:n {set-scale} - \group_end: - } + \__fontspec_info:n {set-scale} + \exp_args:NNNx + \group_end: + \tl_set:Nx \l__fontspec_scale_tl { \l__fontspec_scale_tl } + } \cs_new:Nn \__fontspec_set_font_dimen:NnN - { - \dim_set:Nn #1 { \fontdimen #2 #3 } - \dim_compare:nNnT #1 = {0pt} - { - \settoheight #1 - { - \str_if_eq:nnTF {#3} {\font} \rmfamily #3 - \int_case:nnF #2 - { - {5} {x} % x-height - {8} {X} % cap-height - } {?} % "else" clause; never reached. - } - } - } + { + \dim_set:Nn #1 { \fontdimen #2 #3 } + \dim_compare:nNnT #1 = {0pt} + { + \settoheight #1 + { + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 + \int_case:nnF #2 + { + {5} {x} % x-height + {8} {X} % cap-height + } {?} % "else" clause; never reached. + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} - { - \bool_if:NF \l__fontspec_firsttime_bool - { \_fontspec_parse_wordspace:w #1,,,\q_stop } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \_fontspec_parse_wordspace:w #1,,,\q_stop } + } \__fontspec_aff_error:n {WordSpace} \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop - { - \tl_if_empty:nTF {#4} - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #1 \fontdimen 3 \font - \fontdimen 4 \font = #1 \fontdimen 4 \font - } - } - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #2 \fontdimen 3 \font - \fontdimen 4 \font = #3 \fontdimen 4 \font - } - } - } + { + \tl_if_empty:nTF {#4} + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #1 \fontdimen 3 \font + \fontdimen 4 \font = #1 \fontdimen 4 \font + } + } + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #2 \fontdimen 3 \font + \fontdimen 4 \font = #3 \fontdimen 4 \font + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} - { - \str_case_x:nnF {#1} - { - {WordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 0 \fontdimen 2 \font } - } - {TwiceWordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 1 \fontdimen 2 \font } - } - } - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } - } - } + { + \str_case_e:nnF {#1} + { + {WordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } + } \__fontspec_aff_error:n {PunctuationSpace} \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} - { - \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} - } + { + \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {LetterSpace} - { - \__fontspec_update_featstr:n {letterspace=#1} - } + { + \__fontspec_update_featstr:n {letterspace=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} - { - \str_if_eq:nnTF {#1} {None} - { - \tl_put_right:Nn \l__fontspec_postadjust_tl - { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } - } - { - \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} + { + \str_if_eq:nnTF {#1} {None} + { + \tl_put_right:Nn \l__fontspec_postadjust_tl + { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } + } + { + \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} - \tl_if_single:nTF {#1} - { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } - { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } + \tl_if_single:nTF {#1} + { \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} - { - \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_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\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_aff_error:n {HyphenChar} \__fontspec_keys_define_code:nnn {fontspec} {Color} - { - \cs_if_exist:cTF { \token_to_str:N \color@ #1 } - { - \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl - } - { - \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } - { - \int_compare:nTF { \tl_count:n {#1} == 8 } - { \fontspec_parse_colour:viii #1 } - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {bad-colour} {#1} } - } - } - } - } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } + } + } + } + } \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 \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice-col} {#7#8} } - } - \tl_set:Nn \l__fontspec_opacity_tl {#7#8} - } + { + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \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} } + } + \tl_set:Nn \l__fontspec_opacity_tl {#7#8} + } \aliasfontfeature{Color}{Colour} \__fontspec_keys_define_code:nnn {fontspec} {Opacity} - { - \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 \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice} {#1} } - } - \tl_set:Nx \l__fontspec_opacity_tl - { - \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hex:n { \l__fontspec_tmp_int } - } - } + { + \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 \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } + } + \tl_set:Nx \l__fontspec_opacity_tl + { + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hex:n { \l__fontspec_tmp_int } + } + } \__fontspec_keys_define_code:nnn {fontspec-opentype} {Mapping} - { - \str_if_eq:nnTF {#1} {tex-text} - { - \__fontspec_warning:n {no-mapping-ligtex} - \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} - \keys_set:nn {fontspec-opentype} { Ligatures=TeX } - } - { \__fontspec_warning:n {no-mapping} } - } + { + \str_if_eq:nnTF {#1} {tex-text} + { + \__fontspec_warning:n {no-mapping-ligtex} + \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} + \keys_set:nn {fontspec-opentype} { Ligatures=TeX } + } + { \__fontspec_warning:n {no-mapping} } + } \__fontspec_keys_define_code:nnn {fontspec} {Weight} - { - \__fontspec_update_featstr:n{weight=#1} - } + { + \__fontspec_update_featstr:n{weight=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {Width} - { - \__fontspec_update_featstr:n{width=#1} - } + { + \__fontspec_update_featstr:n{width=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} - { - \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} - } + { + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} + } \keys_define:nn {fontspec} - { - FakeSlant .code:n = - { - \__fontspec_update_featstr:n{slant=#1} - }, - FakeSlant .default:n = {0.2} -} + { + FakeSlant .code:n = + { + \__fontspec_update_featstr:n {slant=#1} + }, + FakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - FakeStretch .code:n = - { - \__fontspec_update_featstr:n{extend=#1} - }, - FakeStretch .default:n = {1.2} -} + { + FakeStretch .code:n = + { + \__fontspec_update_featstr:n {extend=#1} + }, + FakeStretch .default:n = {1.2} + } \keys_define:nn {fontspec} - { - FakeBold .code:n = { \__fontspec_warning:n {fakebold-only-xetex} } - } + { + FakeBold .code:n = { \__fontspec_warning:n {fakebold-only-xetex} } + } \keys_define:nn {fontspec} - { - AutoFakeSlant .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_slant_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_noit_bool - - \tl_if_empty:NF \l__fontspec_fake_embolden_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeBold=\l__fontspec_fake_embolden_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeSlant .default:n = {0.2} -} + { + AutoFakeSlant .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_slant_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_noit_bool + + \tl_if_empty:NF \l__fontspec_fake_embolden_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeBold=\l__fontspec_fake_embolden_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - AutoFakeBold .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_nobf_bool - - \tl_if_empty:NF \l__fontspec_fake_slant_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeSlant=\l__fontspec_fake_slant_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeBold .default:n = {1.5} -} + { + AutoFakeBold .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_nobf_bool + + \tl_if_empty:NF \l__fontspec_fake_slant_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeSlant=\l__fontspec_fake_slant_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeBold .default:n = {1.5} + } \__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } \__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } -%%^^A%% fontspec-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \__fontspec_feat_prop_add:nn {salt} { Alternate\,=\,$N$ } \__fontspec_feat_prop_add:nn {nalt} { Annotation\,=\,$N$ } @@ -2669,152 +2683,156 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {ProportionalMetrics} {vpal} {vpal} {+valt,+vhal} \__fontspec_define_opentype_feature_group:n {Alternate} \keys_define:nn {fontspec-opentype} - { - Alternate .default:n = {0} , - Alternate / Random .code:n = - { \__fontspec_make_OT_feature:nnn {salt}{ +salt = random }{} } , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } - } - } + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } + } + } +\keys_define:nn {fontspec-opentype} + { + Alternate / Random .code:n = + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = random }{} } , + } \aliasfontfeature{Alternate}{StylisticAlternates} \__fontspec_define_opentype_feature_group:n {Variant} \keys_define:nn {fontspec-opentype} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Variant .default:n = {0} , + Variant / unknown .code:n = { - \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + \clist_map_inline:nn {#1} + { + \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + } } - } - } + } \aliasfontfeature{Variant}{StylisticSet} \__fontspec_define_opentype_feature_group:n {CharacterVariant} \use:x - { - \cs_new:Npn \exp_not:N \fontspec_parse_cv:w - ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil - { - \__fontspec_make_OT_feature:xxx - { cv \exp_not:N \two@digits {##1} } { +cv \exp_not:N \two@digits {##1} = ##2 } {} - } - \keys_define:nn {fontspec-opentype} - { - CharacterVariant / unknown .code:n = - { - \clist_map_inline:nn {##1} - { - \exp_not:N \fontspec_parse_cv:w - ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil - } - } - } - } + { + \cs_new:Npn \exp_not:N \fontspec_parse_cv:w + ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil + { + \__fontspec_make_OT_feature:xxx + { cv \exp_not:N \two@digits {##1} } + { +cv \exp_not:N \two@digits {##1} = ##2 } {} + } + \keys_define:nn {fontspec-opentype} + { + CharacterVariant / unknown .code:n = + { + \clist_map_inline:nn {##1} + { + \exp_not:N \fontspec_parse_cv:w + ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil + } + } + } + } \__fontspec_define_opentype_feature_group:n {Annotation} \keys_define:nn {fontspec-opentype} - { - Annotation .default:n = {0} , - Annotation / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} - } - } + { + Annotation .default:n = {0} , + Annotation / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} + } + } \__fontspec_define_opentype_feature_group:n {Ornament} \keys_define:nn {fontspec-opentype} - { - Ornament .default:n = {0} , - Ornament / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} - } - } + { + Ornament .default:n = {0} , + Ornament / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} + } + } \keys_define:nn { fontspec-opentype } { Script .choice: } \cs_new:Nn \fontspec_new_script:nn - { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = - \bool_set_false:N \l__fontspec_script_exist_bool - \clist_map_inline:nn {#2} - { - \__fontspec_check_script:NnTF \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_script_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } - { } - } - \bool_if:NF \l__fontspec_script_exist_bool - { - \str_if_eq:nnTF {#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_define:nn { fontspec-opentype } { Script / #1 .code:n = + \bool_set_false:N \l__fontspec_script_exist_bool + \clist_map_inline:nn {#2} + { + \__fontspec_check_script:NnTF \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_script_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: + } + { } + } + \bool_if:NF \l__fontspec_script_exist_bool + { + \str_if_eq:nnTF {#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_define:nn { fontspec-opentype } { Language .choice: } \cs_new:Nn \fontspec_new_lang:nn - { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} - { - \tl_set:Nn \l_fontspec_lang_tl {#2} - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } - } - { - \__fontspec_warning:nx {language-not-exist} {#1} - \keys_set:nn { fontspec-opentype } { Language = Default } - } + { + \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + { + \tl_set:Nn \l_fontspec_lang_tl {#2} + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } + } + { + \__fontspec_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec-opentype } { Language = Default } + } + } } - } \__fontspec_keys_define_code:nnn {fontspec-opentype}{ Language / Default } - { - \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \int_zero:N \l__fontspec_language_int - \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } - } + { + \tl_set:Nn \l_fontspec_lang_tl {DFLT} + \int_zero:N \l__fontspec_language_int + \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } + } \keys_define:nn {fontspec-opentype} - { - Language / Turkish .code:n = - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TRK} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } - } - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TUR} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } - } - { - \__fontspec_warning:nx {language-not-exist} {Turkish} - \keys_set:nn {fontspec-opentype} {Language=Default} - } - } - } - } + { + Language / Turkish .code:n = + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TRK} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } + } + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TUR} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } + } + { + \__fontspec_warning:nx {language-not-exist} {Turkish} + \keys_set:nn {fontspec-opentype} {Language=Default} + } + } + } + } \cs_new:Nn \__fontspec_ot_compat:nn { \aliasfontfeatureoption {#1} {#2Off} {No#2} @@ -2837,7 +2855,7 @@ \__fontspec_ot_compat:nn {Diacritics} {AboveBase} \__fontspec_ot_compat:nn {Diacritics} {BelowBase} -%%^^A%% fontspec-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontscript{Adlam}{adlm} \newfontscript{Ahom}{ahom} @@ -2984,7 +3002,7 @@ \newfontscript{N'ko}{nko~} \newfontscript{Oriya}{ory2,orya} -%%^^A%% fontspec-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontlanguage{Abaza}{ABA} \newfontlanguage{Abkhazian}{ABK} @@ -3369,10 +3387,10 @@ \newfontlanguage{Zande}{ZND} \newfontlanguage{Zulu}{ZUL} -%%^^A%% fontspec-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand\UnicodeFontFile[2]{"[#1]:#2"} \providecommand\UnicodeFontName[2]{"#1:#2"} @@ -3462,7 +3480,7 @@ { \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} } } -%%^^A%% fontspec-math.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-math.dtx -- part of FONTSPEC <wspr.io/fontspec> \@ifpackageloaded{euler} { \bool_gset_true:N \g__fontspec_pkg_euler_loaded_bool } { \bool_gset_false:N \g__fontspec_pkg_euler_loaded_bool } @@ -3533,6 +3551,7 @@ \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} + \renewcommand{\hbar}{{\mathchar"AF\mkern-9mu h}}% TODO: test with other fonts } } \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault @@ -3595,23 +3614,23 @@ } \AtBeginDocument{\fontspec_maybe_setup_maths:} -%%^^A%% fontspec-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_if:NT \g__fontspec_cfg_bool - { - \InputIfFileExists{fontspec.cfg} - {} - {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} - } + { + \InputIfFileExists{fontspec.cfg} + {} + { \typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.} } + } -%%^^A%% fontspec-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand*\itscdefault{\itdefault\scdefault} \providecommand*\slscdefault{\sldefault\scdefault} \DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape{\itscdefault}\selectfont - } + { + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont + } \DeclareTextFontCommand{\textsi}{\sishape} \cs_new:Nn \__fontspec_shape_merge:nn { c__fontspec_shape_#1_#2_tl } \tl_const:cn { \__fontspec_shape_merge:nn \itdefault \scdefault } {\itscdefault} @@ -3642,25 +3661,25 @@ \prg_return_true: \prg_return_false: } \DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_merge_shape:n\itdefault - } + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } \DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_merge_shape:n\sldefault - } + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } \DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_merge_shape:n\scdefault - } + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } \DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_merge_shape:n\updefault - } + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } \cs_new_protected:Npn \emfontdeclare #1 { \prop_gclear:N \g__fontspec_em_prop @@ -3763,33 +3782,33 @@ \strongfontdeclare{ \bfseries } \emfontdeclare{ \emshape, \eminnershape } -%%^^A%% fontspec-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareRobustCommand{\-} - { - \discretionary - { - \char\ifnum\hyphenchar\font<\z@ - \xlx@defaulthyphenchar - \else - \hyphenchar\font - \fi - }{}{} - } + { + \discretionary + { + \char\ifnum\hyphenchar\font<\z@ + \xlx@defaulthyphenchar + \else + \hyphenchar\font + \fi + }{}{} + } \def\xlx@defaulthyphenchar{`\-} \cs_new:Nn \fontspec_visible_space: - { - \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \char"2423\scan_stop: } - { \fontspec_visible_space_fallback: } - } + { + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \char"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } \cs_new:Nn \fontspec_visible_space_fallback: - { { - \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} - \textvisiblespace + { + \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} + \textvisiblespace + } } - } \group_begin: \char_set_catcode_active:n{"20}% \cs_gset:Npn\fontspec_print_visible_spaces:{% @@ -3798,71 +3817,72 @@ }% \group_end: \def\verb - { - \relax\ifmmode\hbox\else\leavevmode\null\fi - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\__fontspecsverb\@verb - } + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\__fontspecsverb\@verb + } \def\__fontspecsverb{\fontspec_print_visible_spaces:\@sverb} \AtBeginDocument - { - \fontspec_patch_verbatim: - \fontspec_patch_moreverb: - \fontspec_patch_fancyvrb: - \fontspec_patch_listings: - } + { + \fontspec_patch_verbatim: + \fontspec_patch_moreverb: + \fontspec_patch_fancyvrb: + \fontspec_patch_listings: + } \cs_set:Npn \fontspec_patch_verbatim: - { - \@ifpackageloaded{verbatim} - { - \cs_set:cpn {verbatim*} - { - \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - } - { - \cs_set:cpn {verbatim*} - { - \@verbatim \fontspec_print_visible_spaces: \@sxverbatim - } - } + { + \@ifpackageloaded{verbatim} + { + \cs_set:cpn {verbatim*} + { + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + } + { + \cs_set:cpn {verbatim*} + { + \@verbatim \fontspec_print_visible_spaces: \@sxverbatim + } + } } \cs_set:Npn \fontspec_patch_moreverb: - { - \@ifpackageloaded{moreverb}{ - \cs_set:cpn {listingcont*} - { - \cs_set:Npn \verbatim@processline - { - \thelisting@line \global\advance\listing@line\c_one - \the\verbatim@line\par - } - \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - }{} - } + { + \@ifpackageloaded{moreverb} + { + \cs_set:cpn {listingcont*} + { + \cs_set:Npn \verbatim@processline + { + \thelisting@line \global\advance\listing@line1\relax + \the\verbatim@line\par + } + \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + }{} + } \cs_set:Npn \fontspec_patch_fancyvrb: - { - \@ifpackageloaded{fancyvrb} - { - \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{fancyvrb} + { + \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: + }{} + } \cs_set:Npn \fontspec_patch_listings: - { - \@ifpackageloaded{listings} - { - \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{listings} + { + \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: + }{} + } \RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } + { + { \addfontfeature{Numbers=OldStyle} #1 } + } \NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } + { + { \addfontfeature{Numbers=Lining} #1 } + } |