diff options
Diffstat (limited to 'Master/texmf-dist/tex')
6 files changed, 1849 insertions, 1627 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 4758f213f0c..62ec78a76a5 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-luatex} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -26,7 +26,7 @@ \tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl -\tl_put_right:Nn \document +\AtBeginDocument { \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl @@ -35,114 +35,140 @@ \cs_set:Npn \XeTeXpicfile {} \RequirePackage{xunicode} \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp: -\DeclareDocumentCommand \fontspec { O{} m } +\DeclareDocumentCommand \fontspec { O{} m O{} } { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1,#3}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m } +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m } +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m } +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} \normalfont + \ignorespaces } \cs_set_eq:NN \setromanfont \setmainfont -\tl_new:N \g_fontspec_mathrm_tl -\tl_new:N \g_fontspec_bfmathrm_tl -\tl_new:N \g_fontspec_mathsf_tl -\tl_new:N \g_fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m } +\tl_new:N \g__fontspec_mathrm_tl +\tl_new:N \g__fontspec_bfmathrm_tl +\tl_new:N \g__fontspec_mathsf_tl +\tl_new:N \g__fontspec_mathtt_tl +\DeclareDocumentCommand \setmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m } +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathsf { O{} m } +\DeclareDocumentCommand \setmathsf { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathtt { O{} m } +\DeclareDocumentCommand \setmathtt { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\tl_set:Nn \g_fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g_fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g_fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m } +\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_select:nn{#2}{#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont } } } -\DeclareDocumentCommand \newfontface { m O{} m } +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } -\tl_new:N \g_fontspec_default_fontopts_tl +\clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop -\DeclareDocumentCommand \defaultfontfeatures { o m } +\DeclareDocumentCommand \defaultfontfeatures { t+ o m } { - \IfNoValueTF {#1} - { \__fontspec_set_default_features:n {#2} } - { \__fontspec_set_font_default_features:nn {#1} {#2} } + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } -\cs_new:Nn \__fontspec_set_default_features:n +\cs_new:Nn \__fontspec_set_default_features:nn { - \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g__fontspec_default_fontopts_clist {#2} } -\cs_new:Nn \__fontspec_set_font_default_features:nn +\cs_new:Nn \__fontspec_set_font_default_features:nnn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_gput:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l__fontspec_tmp_tl { \cs:w g__fontspec_ \cs_to_str:N ##1 _family\cs_end: } } + { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } + + \IfBooleanTF {#1} + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + { \tl_clear:N \l__fontspec_tmpb_tl } + \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} + \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_put:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } + } + } } + \cs_new:Nn \__fontspec_sanitise_fontname:Nn { \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } + +\bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF + { \group_begin: - \tl_clear:N \g_fontspec_default_fontopts_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {options} \l__fontspec_options_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontname} \l__fontspec_fontname_tl + \bool_set_true:N \l__fontspec_disable_defaults_bool \use:x { - \exp_not:N\fontspec_select:nn - {\csname zf@family@options\f@family\endcsname,#1} - {\csname zf@family@fontname\f@family\endcsname} + \exp_not:N \fontspec_select:nn + { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} } \group_end: \fontfamily\l_fontspec_family_tl\selectfont - \else - \fontspec_warning:n {addfontfeatures-ignored} - \fi + } + { + \__fontspec_warning:n {addfontfeatures-ignored} + } \ignorespaces } \cs_set_eq:NN \addfontfeature \addfontfeatures @@ -152,28 +178,27 @@ { #1 .code:n = { - \fontspec_update_fontid:n {+zf-#1} - \fontspec_update_featstr:n {#2} + \__fontspec_update_featstr:n {#2} } } } \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \fontspec_define_font_feature:n {#1} } + { \__fontspec_define_font_feature:n {#1} } \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \fontspec_define_feature_option:nnnnn{#1}{#2}{#3}{#4}{} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{#3}{#4}{} } -\DeclareDocumentCommand \newICUfeature {mmm} +\DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \fontspec_define_font_feature:n{#1} } + { \__fontspec_define_font_feature:n {#1} } \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \fontspec_define_feature_option:nnnnn{#1}{#2}{}{}{#3} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{}{}{#3} } -\cs_set_eq:NN \newopentypefeature \newICUfeature +\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \keys_if_exist:nnTF {fontspec} {#1} @@ -197,7 +222,7 @@ } } { - \fontspec_warning:nx {rename-feature-not-exist} {#1} + \__fontspec_warning:nx {rename-feature-not-exist} {#1} } } } @@ -215,18 +240,17 @@ \keys_define:nn { fontspec } { Script / #1 .code:n = \fontspec_check_script:nTF {#2} { - \fontspec_update_fontid:n {+script=#1} \tl_set:Nn \l_fontspec_script_tl {#2} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} } { \fontspec_check_script:nTF {latn} { - \fontspec_warning:nx {script-not-exist-latn} {#1} + \__fontspec_warning:nx {script-not-exist-latn} {#1} \keys_set:nn {fontspec} {Script=Latin} } { - \fontspec_warning:nx {script-not-exist} {#1} + \__fontspec_warning:nx {script-not-exist} {#1} } } } @@ -242,32 +266,32 @@ \keys_define:nn { fontspec } { Language / #1 .code:n = \fontspec_check_lang:nTF {#2} { - \fontspec_update_fontid:n {+lang=#1} \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} } { - \fontspec_warning:nx {language-not-exist} {#1} + \__fontspec_warning:nx {language-not-exist} {#1} \keys_set:nn { fontspec } { Language = Default } } } } \DeclareDocumentCommand \DeclareFontsExtensions {m} { - \tl_set:Nn \l_fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l_fontspec_extensions_clist {~} + \clist_set:Nn \l__fontspec_extensions_clist { #1 } + \tl_remove_all:Nn \l__fontspec_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \cs_if_exist:cTF {g_fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: + \cs_if_exist:cTF {g__fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \bool_if:NTF \l_fontspec_atsui_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \bool_if:NTF \l__fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -284,9 +308,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false: + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: } { \prg_return_false: @@ -296,14 +321,20 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} - \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_language_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { @@ -318,9 +349,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \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} @@ -334,9 +366,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } @@ -348,12 +381,15 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } @@ -364,9 +400,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \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} @@ -380,11 +417,13 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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: } @@ -395,11 +434,13 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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: } @@ -408,16 +449,19 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } +\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} \cs_new:Nn \fontspec_set_fontface:NNnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \fontspec_fontwrap:n { "#1" } +\cs_set:Nn \__fontspec_fontwrap:n { "#1" } \cs_if_free:NT \font_set_eq:NN { \cs_set_eq:NN \font_set_eq:NN \tex_let:D @@ -431,7 +475,7 @@ } \cs_set:Npn \font_suppress_not_found_error: {\luatexsuppressfontnotfounderror=1} - \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} + \prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -440,13 +484,13 @@ \fi } } -\cs_new:Nn \fontspec_font_set:Nnn +\cs_new:Nn \__fontspec_font_set:Nnn { - \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_set:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } -\cs_new:Nn \fontspec_font_gset:Nnn +\cs_new:Nn \__fontspec_font_gset:Nnn { - \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_gset:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } \prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { @@ -460,33 +504,32 @@ { \group_begin: \font_suppress_not_found_error: - \fontspec_init: + \__fontspec_init: + \tl_set:Nx \l_fontspec_fontname_tl {#2} \tl_remove_all:Nn \l_fontspec_fontname_tl {~} - \tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \fontspec_preparse_features:nN {#1} \l_fontspec_fontname_tl - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } - \fontspec_set_font_type: - \fontspec_font_gset:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \fontspec_set_scriptlang: - \fontspec_get_features:n {} - \bool_set_false:N \l_fontspec_firsttime_bool - \fontspec_save_family:nT {#2} + \__fontspec_extract_all_features:n {#1} + \__fontspec_preparse_features: + + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} + \bool_set_false:N \l__fontspec_firsttime_bool + + \__fontspec_save_family:nTF {#2} { - \fontspec_save_fontinfo:nn {#1} {#2} + \__fontspec_save_fontinfo: + \__fontspec_find_autofonts: \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} - \fontspec_set_upright: - \fontspec_set_bold: - \fontspec_set_italic: - \fontspec_set_slanted: - \fontspec_set_bold_italic: - \fontspec_set_bold_slanted: - } - \fontspec_info:nxx {defining-font} {#1} {#2} + \__fontspec_set_faces: + \__fontspec_info:nxx {defining-font} {#1} {#2} + } + { + } \group_end: } \cs_new:Nn \__fontspec_load_external_fontoptions:N @@ -498,311 +541,316 @@ { \file_input:n {\l__fontspec_tmp_tl.fontspec} } } } -\cs_new:Nn \fontspec_preparse_features:nN +\cs_new:Nn \__fontspec_extract_all_features:n { - \exp_args:NV \fontspec_if_detect_external:nT #2 - { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \keys_set_known:nxN {fontspec-preparse-external} + + \bool_if:NTF \l__fontspec_disable_defaults_bool + { + \clist_set:Nx \l__fontspec_all_features_clist + {#1} + } { - \g_fontspec_default_fontopts_tl - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #1 + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_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 + + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } } - \l_fontspec_keys_leftover_clist + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + } +\cs_new:Nn \__fontspec_preparse_features: + { + \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } + + \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 - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_keys_leftover_clist} - \l_fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist} - \l_fontspec_fontfeat_clist + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } +\cs_new:Nn \__fontspec_load_font: + { + \__fontspec_font_set:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } + \__fontspec_set_font_type: + \__fontspec_font_gset:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly } -\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} +\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} { - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { - \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l__fontspec_tmpa_bool \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_tmpa_bool \clist_map_break: } + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } } - \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } -\cs_set:Nn \fontspec_fullname:n +\cs_set:Nn \__fontspec_fullname:n { - \fontspec_namewrap:n { #1 \l_fontspec_extension_tl } + \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } \l_fontspec_renderer_tl - \l_fontspec_optical_size_tl - } -%% Now we have a unique (in fact, too unique!) string that contains -\prg_new_conditional:Nnn \fontspec_save_family:n {T} - { - \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \cs_if_exist:cTF {g_fontspec_family_#1_int} - { \int_gincr:c {g_fontspec_family_#1_int} } - { \int_new:c {g_fontspec_family_#1_int} } - \tl_set:Nx \l_fontspec_tmp_tl {#1} - \tl_remove_all:Nn \l_fontspec_tmp_tl {~} - \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \l_fontspec_tmp_tl ( \int_use:c {g_fontspec_family_#1_int} ) - } - } - \tl_gset:Nv \l_fontspec_family_tl {g_fontspec_UID_\l_fontspec_fontid_tl} - \cs_if_exist:cTF {g_fontspec_ \l_fontspec_family_tl _prop} - \prg_return_false: \prg_return_true: + \l__fontspec_optical_size_tl } -\cs_new:Nn \fontspec_set_scriptlang: +\cs_new:Nn \__fontspec_set_scriptlang: { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { - \tl_if_empty:NTF \l_fontspec_script_name_tl + \tl_if_empty:NTF \l__fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { - \tl_set:Nn \l_fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l_fontspec_lang_name_tl + \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} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} } { - \fontspec_info:n {no-scripts} + \__fontspec_info:n {no-scripts} } } { - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} } } } -\cs_generate_variant:Nn \prop_gput:Nnn {cnV} -\cs_generate_variant:Nn \prop_gput:Nnn {cnx} -\cs_new:Nn \fontspec_save_fontinfo:nn +\prg_new_conditional:Nnn \__fontspec_save_family:n {TF} { - \prop_new:c {g_fontspec_ \l_fontspec_family_tl _prop} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {fontname} {#2} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {options} {\g_fontspec_default_fontopts_tl #1} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {fontdef} + \cs_if_exist:NT \l__fontspec_nfss_fam_tl { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_tl } - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - - \tl_gset:cx {zf@family@fontname\l_fontspec_family_tl} {#2} - \tl_gset:cx {zf@family@options\l_fontspec_family_tl} {\g_fontspec_default_fontopts_tl #1} - \tl_gset:cx {zf@family@fontdef\l_fontspec_family_tl} + \cs_if_exist:cF {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - \tl_gset:cV {g_fontspec_script_num_(\l_fontspec_family_tl)_tl} \l_fontspec_script_int - \tl_gset:cV {g_fontspec_lang_num_(\l_fontspec_family_tl)_tl} \l_fontspec_language_int - \tl_gset_eq:cN {g_fontspec_script_(\l_fontspec_family_tl)_tl} \l_fontspec_script_tl - \tl_gset_eq:cN {g_fontspec_lang_(\l_fontspec_family_tl)_tl} \l_fontspec_lang_tl - } -\cs_new:Nn \fontspec_set_upright: - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl - \mddefault \updefault \l_fontspec_fontfeat_up_clist - } -\cs_new:Nn \fontspec_set_bold: - { - \bool_if:NF \l_fontspec_nobf_bool - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } + \cs_if_exist:cTF {g__fontspec_family_#1_int} + { \int_gincr:c {g__fontspec_family_#1_int} } + { \int_new:c {g__fontspec_family_#1_int} } + \tl_set:Nx \l__fontspec_tmp_tl {#1} + \tl_remove_all:Nn \l__fontspec_tmp_tl {~} + \tl_gset:cx {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist + \l__fontspec_tmp_tl ( \int_use:c {g__fontspec_family_#1_int} ) } } + \tl_gset:Nv \l_fontspec_family_tl {g__fontspec_UID_\l__fontspec_fontid_tl} + \cs_if_exist:cTF {g__fontspec_ \l_fontspec_family_tl _prop} + \prg_return_false: \prg_return_true: } -\cs_new:Nn \fontspec_set_italic: +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} +\cs_new:Nn \__fontspec_save_fontinfo: { - \bool_if:NF \l_fontspec_noit_bool + \prop_new:c {g__fontspec_ \l_fontspec_family_tl _prop} + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { \l__fontspec_basename_tl } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontdef} { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } - { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } - \mddefault \itdefault \l_fontspec_fontfeat_it_clist + \__fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } -\cs_new:Nn \fontspec_set_slanted: +\cs_new:Nn \__fontspec_find_autofonts: { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} { - \fontspec_make_font_shapes:nnnn - \l_fontspec_fontname_sl_tl \mddefault \sldefault - \l_fontspec_fontfeat_sl_clist + \__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} } - } -\cs_new:Nn \fontspec_set_bold_italic: - { - \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} + + \bool_if:NF \l__fontspec_nobf_bool { - \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} - } - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} - } - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl - } - \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist + \__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} } + + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfsl_tl {\l_fontspec_fontname_sl_tl} {/B} + } +\cs_new:Nn \__fontspec_set_faces: + { + \__fontspec_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:oooo \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} + } +\cs_new:Nn \__fontspec_set_font_type: + { + \bool_set_true:N \l__fontspec_ot_bool } -\cs_new:Nn \fontspec_set_bold_slanted: +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_new:Nn \__fontspec_set_autofont:Nnn { - \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl + \bool_if:NF \l__fontspec_external_bool + { + \tl_if_empty:xF {#2} { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \tl_if_empty:NT #1 { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } } } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist } } -\cs_new:Nn \fontspec_set_font_type: + +\prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \bool_set_true:N \l_fontspec_icu_bool + \__fontspec_font_set:Nnn \l_tmpa_font { \__fontspec_fullname:n {#1} } {\f@size pt} + \__fontspec_font_set:Nnn \l_tmpb_font { \__fontspec_fullname:n {#1#2} } {\f@size pt} + \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } } -\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn +\cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { - \bool_if:NF \l_fontspec_external_bool - { - \fontspec_font_set:Nnn \l_tmpa_font - { \fontspec_fullname:n {#1} } {\f@size pt} - \fontspec_font_set:Nnn \l_tmpb_font - { \fontspec_fullname:n {#1#2} } {\f@size pt} - \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \fontspec_info:nx {no-font-shape} {#1#2} } - { \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5} } - } - } -\cs_new:Nn \fontspec_make_font_shapes:nnnn { \group_begin: - \__fontspec_load_fontname:n {#1} - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } - - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl - { - \bool_if:NF \l_fontspec_nosc_bool - { - \fontspec_make_smallcaps:T - { - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , Letters=SmallCaps , \l_fontspec_fontfeat_sc_clist - } - } - } - } - { - \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , \l_fontspec_fontfeat_sc_clist - } - } + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, #4 } {#5} \group_end: } + \cs_new:Nn \__fontspec_load_fontname:n { \tl_set:Nx \l_fontspec_fontname_tl {#1} \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} } + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } } -\cs_new:Nn \fontspec_declare_shape:nnn +\cs_new:Nn \__fontspec_declare_shape:nnnn { - \clist_if_empty:NTF \l_fontspec_sizefeat_clist - { \__fontspec_declare_shape_nosizing:n {#3} } - { \__fontspec_declare_shape_withsizing:n {#3} } - \use:x + \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} { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} {#2} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} + \tl_clear:N \l__fontspec_size_tl + \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed + + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \l__fontspec_sizing_leftover_clist + \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } + + % "normal" + \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_tl {#3} {} + + % small caps + \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 + } + + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_sc_tl {#3} {\l__fontspec_fontfeat_curr_clist} + } + } + + \__fontspec_declare_shapes_normal:nn {#1} {#2} \__fontspec_declare_shape_slanted:nn {#1} {#2} \__fontspec_declare_shape_loginfo:nnn {#1} {#2} {#3} } -\cs_new:Nn \__fontspec_declare_shape_nosizing:n +\cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} + +\cs_new:Nn \__fontspec_setup_nfss:Nnn { - \fontspec_get_features:n {#1} - \tl_set:Nx \l_fontspec_nfss_tl + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist + { #2 , \l__fontspec_sizing_leftover_clist , #3 } + + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_fontwrap:n { - <-> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } + \__fontspec_fullname:n { \l_fontspec_fontname_tl } + : \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + } } -\cs_new:Nn \__fontspec_declare_shape_withsizing:n - { - \tl_clear:N \l_fontspec_nfss_tl - \clist_map_inline:Nn \l_fontspec_sizefeat_clist - { - - \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl - \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } - \l_fontspec_keys_leftover_clist - - \tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} } - \fontspec_get_features:n { #1 , \l_fontspec_keys_leftover_clist } +\cs_new:Nn \__fontspec_declare_shapes_normal:nn + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} - \tl_put_right:Nx \l_fontspec_nfss_tl - { - <\l_fontspec_size_tl> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n { \l_fontspec_sizedfont_tl } - : \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - } + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} + {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} + {\l__fontspec_nfss_sc_tl}{\l__fontspec_postadjust_tl} } } + +\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} + } +\cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn { \bool_if:nT @@ -811,11 +859,8 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \use:x - { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl} - } + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } \cs_new:Nn \__fontspec_declare_shape_loginfo:nnn @@ -826,23 +871,29 @@ *~ '\exp_not:N \str_case:nnn {#1/#2} { {\mddefault/\updefault} {normal} - {\mddefault/\scdefault} {small~ caps} {\bfdefault/\updefault} {bold} - {\bfdefault/\scdefault} {bold~ small~ caps} {\mddefault/\itdefault} {italic} - {\mddefault/\sidefault} {italic~ small~ caps} {\bfdefault/\itdefault} {bold~ italic} + } {#2/#3}'~ + with~ NFSS~ spec.: \exp_not:N \\ + \l__fontspec_nfss_tl + \exp_not:n { \\ \\ } + *~ '\exp_not:N \str_case:nnn {#1/\scdefault} + { + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\sidefault} {italic~ small~ caps} {\bfdefault/\sidefault} {bold~ italic~ small~ caps} } {#2/#3}'~ with~ NFSS~ spec.: \exp_not:N \\ - \l_fontspec_nfss_tl - \tl_if_empty:NF \l_fontspec_postadjust_tl + \l__fontspec_nfss_sc_tl + \tl_if_empty:NF \l__fontspec_postadjust_tl { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \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 +\clist_set:Nn \l__fontspec_pre_feat_sclist { mode = \l_fontspec_mode_tl ; \tl_if_empty:NF \l_fontspec_script_tl @@ -851,30 +902,28 @@ language = \l_fontspec_lang_tl ; } } -\cs_new:Nn \fontspec_update_fontid:n +\cs_set:Nn \__fontspec_get_features:Nn { - \bool_if:NT \l_fontspec_firsttime_bool + \sclist_clear:N \l__fontspec_rawfeatures_sclist + \tl_clear:N \l__fontspec_scale_tl + \tl_set_eq:NN \l__fontspec_opacity_tl \g__fontspec_opacity_tl + \tl_set_eq:NN \l__fontspec_hexcol_tl \g__fontspec_hexcol_tl + \tl_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_clear:N \l__fontspec_wordspace_adjust_tl + \tl_clear:N \l__fontspec_punctspace_adjust_tl + + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \l__fontspec_keys_leftover_clist + \keys_set:nx {fontspec} {\l__fontspec_keys_leftover_clist} + \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } { - \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} + \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } -\cs_set:Nn \fontspec_get_features:n - { - \sclist_clear:N \l_fontspec_rawfeatures_sclist - \tl_clear:N \l_fontspec_scale_tl - \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl - \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl - \tl_clear:N \l_fontspec_postadjust_tl - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_fontfeat_clist,#1} - \l_fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l_fontspec_keys_leftover_clist} - \str_if_eq_x:nnF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } - { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } - { - \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} - } + \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } +\tl_clear:N \l__fontspec_family_label_tl \tl_clear:N \l_fontspec_fontname_bf_tl \tl_clear:N \l_fontspec_fontname_it_tl \tl_clear:N \l_fontspec_fake_slant_tl @@ -883,96 +932,106 @@ \tl_clear:N \l_fontspec_fontname_sl_tl \tl_clear:N \l_fontspec_fontname_bfsl_tl \tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l_fontspec_fontfeat_up_clist -\tl_clear:N \l_fontspec_fontfeat_bf_clist -\tl_clear:N \l_fontspec_fontfeat_it_clist -\tl_clear:N \l_fontspec_fontfeat_bfit_clist -\tl_clear:N \l_fontspec_fontfeat_sl_clist -\tl_clear:N \l_fontspec_fontfeat_bfsl_clist -\tl_clear:N \l_fontspec_fontfeat_sc_clist -\tl_clear:N \l_fontspec_script_name_tl +\tl_clear:N \l__fontspec_fontfeat_up_clist +\tl_clear:N \l__fontspec_fontfeat_bf_clist +\tl_clear:N \l__fontspec_fontfeat_it_clist +\tl_clear:N \l__fontspec_fontfeat_bfit_clist +\tl_clear:N \l__fontspec_fontfeat_sl_clist +\tl_clear:N \l__fontspec_fontfeat_bfsl_clist +\tl_clear:N \l__fontspec_fontfeat_sc_clist +\tl_clear:N \l__fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l_fontspec_lang_name_tl +\tl_clear:N \l__fontspec_lang_name_tl \tl_clear:N \l_fontspec_lang_tl -\clist_clear:N \l_fontspec_sizefeat_clist -\tl_new:N \g_fontspec_hexcol_tl -\tl_new:N \g_fontspec_opacity_tl -\tl_set:Nn \g_fontspec_hexcol_tl {000000} -\tl_set:Nn \g_fontspec_opacity_tl {FF~} -\cs_set:Npn \fontspec_init: - { - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_true:N \l_fontspec_firsttime_bool - \cs_set:Npn \fontspec_namewrap:n ##1 { ##1 } - \tl_clear:N \l_fontspec_optical_size_tl +\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } + +\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} +\tl_new:N \g__fontspec_hexcol_tl +\tl_new:N \g__fontspec_opacity_tl +\tl_set:Nn \g__fontspec_hexcol_tl {000000} +\tl_set:Nn \g__fontspec_opacity_tl {FF~} +\cs_set:Npn \__fontspec_init: + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \cs_set:Npn \__fontspec_namewrap:n ##1 { ##1 } + \tl_clear:N \l__fontspec_optical_size_tl \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl + \tl_clear:N \g__fontspec_curr_series_tl + + % This is for detecting font families when assigning default features. + % Replace defaults for the standard families because they're not set in the usual way: + \exp_args:NV \str_case:nnn {\l__fontspec_family_label_tl} + { + {\rmdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_rmfamily_family} } + {\sfdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_sffamily_family} } + {\ttdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_ttfamily_family} } + }{} + \tl_set:Nn \l_fontspec_mode_tl {node} \luatexprehyphenchar =`\- % fixme \luatexposthyphenchar = 0 % fixme \luatexpreexhyphenchar = 0 % fixme \luatexpostexhyphenchar= 0 % fixme } -\cs_set:Nn \fontspec_make_ot_smallcaps:T +\cs_set:Nn \fontspec_make_ot_smallcaps:TF { - \fontspec_check_ot_feat:nT {+smcp} { #1 } + \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} } -\cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T +\cs_set_eq:NN \__fontspec_make_smallcaps:TF \fontspec_make_ot_smallcaps:TF \cs_set_eq:NN \sclist_clear:N \tl_clear:N \cs_new:Nn \sclist_gput_right:Nn { \tl_gput_right:Nn #1 {#2;} } \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} -\cs_new:Nn \fontspec_update_featstr:n +\cs_new:Nn \__fontspec_update_featstr:n { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} + \sclist_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1} } } \cs_new:Nn \fontspec_make_feature:nnn - { \fontspec_make_ICU_feature:n {#3} } + { \fontspec_make_OT_feature:n {#3} } \cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx} \cs_new:Nn \fontspec_make_AAT_feature:nn { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {aat-feature-not-exist} } + { \__fontspec_warning:n {aat-feature-not-exist} } { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} { - \fontspec_update_fontid:n {+#1,#2} - \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } - { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } -\cs_new:Nn \fontspec_make_ICU_feature:n +\cs_new:Nn \fontspec_make_OT_feature:n { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {icu-feature-not-exist} } + { \__fontspec_warning:n {icu-feature-not-exist} } { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } } \cs_new_protected:Nn \fontspec_make_numbered_feature:nn { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1=#2} - \fontspec_update_featstr:n { #1 = #2 } + \__fontspec_update_featstr:n { #1 = #2 } } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } \cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn} -\cs_new:Nn \fontspec_define_font_feature:n +\cs_new:Nn \__fontspec_define_font_feature:n { \keys_define:nn {fontspec} { #1 .multichoice: } } -\cs_new:Nn \fontspec_define_feature_option:nnnnn +\cs_new:Nn \__fontspec_define_feature_option:nnnnn { \keys_define:nn {fontspec} { @@ -1071,31 +1130,30 @@ { \keys_define:nn {#1} { #2 .code:n = {#3} } } -\bool_new:N \l_fontspec_external_bool +\bool_new:N \l__fontspec_external_bool \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { - \bool_set_true:N \l_fontspec_nobf_bool - \bool_set_true:N \l_fontspec_noit_bool - \bool_set_true:N \l_fontspec_external_bool - \cs_gset:Npn \fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \cs_gset:Npn \__fontspec_namewrap:n ##1 { [ #1 ##1 ] } } \aliasfontfeature{ExternalLocation}{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 + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } } -\tl_clear:N \l_fontspec_extension_tl +\tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { Renderer .choice_code:n = { - \fontspec_update_fontid:n {+rend:\l_keys_choice_tl} \int_compare:nTF {\l_keys_choice_int <= 3} { - \fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/ICU/Graphite} + \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} } { \tl_set:Nv \l_fontspec_mode_tl @@ -1103,165 +1161,237 @@ } } , - Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic} + Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} -\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU} +\tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} +\tl_set:cn {g_fontspec_renderer_tag_OpenType} {/OT} \tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR} \tl_set:cn {g_fontspec_mode_tag_Full} {node} \tl_set:cn {g_fontspec_mode_tag_Basic} {base} \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} { - \tl_set:Nn \l_fontspec_script_name_tl {#1} - \fontspec_update_fontid:n {+script:#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} - \fontspec_update_fontid:n {+language:#1} + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } +\seq_new:N \g__fontspec_bf_series_seq +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} + { + \tl_gset:Nx \g__fontspec_curr_series_tl { #1 } + \seq_gput_right:Nx \g__fontspec_bf_series_seq { #1 } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} - \fontspec_update_fontid:n {up:#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {FontName} + { + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + } +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nobf_bool - \fontspec_update_fontid:n {nobf} + \bool_set_true:N \l__fontspec_nobf_bool } { - \bool_set_false:N \l_fontspec_nobf_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} - \fontspec_update_fontid:n {bf:#1} + \bool_set_false:N \l__fontspec_nobf_bool + \fontspec_complete_fontname:Nn \l__fontspec_curr_bfname_tl {#1} + + \seq_if_empty:NT \g__fontspec_bf_series_seq + { + \tl_gset:Nx \g__fontspec_curr_series_tl {\bfdefault} + \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} + } + \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} + { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } + + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl + } } +\prop_new:N \l__fontspec_nfss_prop \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_noit_bool - \fontspec_update_fontid:n {noit} + \bool_set_true:N \l__fontspec_noit_bool } { - \bool_set_false:N \l_fontspec_noit_bool + \bool_set_false:N \l__fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} - \fontspec_update_fontid:n {it:#1} } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} - \fontspec_update_fontid:n {bfit:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} - \fontspec_update_fontid:n {sl:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} - \fontspec_update_fontid:n {bfsl:#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nosc_bool - \fontspec_update_fontid:n {nosc} + \bool_set_true:N \l__fontspec_nosc_bool } { - \bool_set_true:N \l_fontspec_nosc_bool + \bool_set_false:N \l__fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} - \fontspec_update_fontid:n {sc:#1} } } \cs_set:Nn \fontspec_complete_fontname:Nn { - \tl_set:Nn #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl} + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} \tl_remove_all:Nn #1 {~} } \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_up_clist { , #1} - \fontspec_update_fontid:n {rmfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bf_clist {, #1} - \fontspec_update_fontid:n {bffeat:#1} + \ + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_it_clist {, #1} - \fontspec_update_fontid:n {itfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfit_clist {, #1} - \fontspec_update_fontid:n {bfitfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_sl_clist {, #1} - \fontspec_update_fontid:n {slfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfsl_clist {, #1} - \fontspec_update_fontid:n {bfslfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fontfeat_sc_clist {, #1} + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} } - \fontspec_update_fontid:n {scfeat:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} { - \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \fontspec_update_fontid:n {sizefeat:#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 + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } +\__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} + { + % dummy + } +\__fontspec_keys_define_code:nnn {fontspec} {Font} + { + % 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} {NFSSFamily} + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + \cs_undefine:c {g__fontspec_UID_\l__fontspec_fontid_tl} + \tl_if_exist:NT \l_fontspec_family_tl + { \cs_undefine:c {g__fontspec_ \l_fontspec_family_tl _prop} } + } +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\prop_new:N \l__fontspec_nfssfont_prop +\__fontspec_keys_define_code:nnn {fontspec} {FontFace} + { + \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } + \tl_set_eq:NN \l__fontspec_this_feat_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_font_tl + \int_compare:nT { \clist_count:N \l__fontspec_arg_tl = 1 } + { + \tl_if_in:NnF \l__fontspec_arg_tl {=} + { + \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_feat_tl + } + } + + \__fontspec_add_nfssfont:oooo + {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} + } +\cs_new:Nn \__fontspec_add_nfssfont:nnnn + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \keys_set_known:noN {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} } + } } +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {ooo} +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {oooo} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnn {#1} { - {MatchLowercase} { \fontspec_calc_scale:n {5} } - {MatchUppercase} { \fontspec_calc_scale:n {8} } + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } } - { \tl_set:Nx \l_fontspec_scale_tl {#1} } - \fontspec_update_fontid:n {+scale:\l_fontspec_scale_tl} - \tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] } + { \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 +\cs_new:Nn \__fontspec_calc_scale:n { \group_begin: \rmfamily - \fontspec_set_font_dimen:NnN \l_fontspec_tmpa_dim {#1} \font - \fontspec_set_font_dimen:NnN \l_fontspec_tmpb_dim {#1} \l_fontspec_font - \fp_set_from_dim:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpa_dim } - \fp_set_from_dim:Nn \l_fontspec_tmpb_fp { \l_fontspec_tmpb_dim } - \fp_div:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpb_fp } - \tl_gset:Nx \l_fontspec_scale_tl { \fp_use:N \l_fontspec_tmpa_fp } - \fontspec_info:n {set-scale} + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \fp_set_from_dim:Nn \l__fontspec_tmpa_fp { \l__fontspec_tmpa_dim } + \fp_set_from_dim:Nn \l__fontspec_tmpb_fp { \l__fontspec_tmpb_dim } + \fp_div:Nn \l__fontspec_tmpa_fp { \l__fontspec_tmpb_fp } + \tl_gset:Nx \l__fontspec_scale_tl { \fp_use:N \l__fontspec_tmpa_fp } + \__fontspec_info:n {set-scale} \group_end: } -\cs_new:Nn \fontspec_set_font_dimen:NnN +\cs_new:Nn \__fontspec_set_font_dimen:NnN { \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} @@ -1279,15 +1409,14 @@ } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} { - \fontspec_update_fontid:n {+wordspace:#1} - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #1 \fontdimen 3 \font @@ -1295,7 +1424,7 @@ } } { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #2 \fontdimen 3 \font @@ -1305,26 +1434,37 @@ } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} { - \fontspec_update_fontid:n {+punctspace:#1} - \tl_put_right:Nx \l_fontspec_postadjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } + \str_case_x:nnn {#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_keys_define_code:nnn {fontspec} {FontAdjustment} { - \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} - \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_fontid:n {+tracking:#1} - \fontspec_update_featstr:n{letterspace=#1} + \__fontspec_update_featstr:n {letterspace=#1} } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} { - \fontspec_update_fontid:n {+hyphenchar:#1} \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { @@ -1333,99 +1473,92 @@ { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_zero \luatexprehyphenchar = \l_fontspec_hyphenchar_tl \scan_stop: } } - { \fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{#1} } } } \__fontspec_keys_define_code:nnn {fontspec} {Color} { - \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF { \token_to_str:N \color@ #1 } { - \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl } { \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_fontspec_hexcol_tl {#1} } + { \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} } + \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 \g_fontspec_opacity_tl + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice-col} {#7#8} } + \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_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} -\int_new:N \l_fontspec_tmp_int +\int_new:N \l__fontspec_tmp_int \__fontspec_keys_define_code:nnn {fontspec} {Opacity} { - \fontspec_update_fontid:n {+opac:#1} - \int_set:Nn \l_fontspec_tmp_int {255} - \_int_mult_truncate:Nn \l_fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } } - \tl_set:Nx \l_fontspec_opacity_tl + \tl_set:Nx \l__fontspec_opacity_tl { - \int_compare:nT { \l_fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l_fontspec_tmp_int } + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hexadecimal:n { \l__fontspec_tmp_int } } } \__fontspec_keys_define_code:nnn {fontspec} {Mapping} { \str_if_eq:nnTF {#1} {tex-text} { - \fontspec_warning:n {no-mapping-ligtex} + \__fontspec_warning:n {no-mapping-ligtex} \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} \keys_set:nn {fontspec} { Ligatures=TeX } } - { \fontspec_warning:n {no-mapping} } + { \__fontspec_warning:n {no-mapping} } } \__fontspec_keys_define_code:nnn {fontspec} {FeatureFile} { - \fontspec_update_fontid:n {+fea:#1} - \fontspec_update_featstr:n{featurefile=#1} + \__fontspec_update_featstr:n { featurefile = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { - \fontspec_update_fontid:n {+weight:#1} - \fontspec_update_featstr:n{weight=#1} + \__fontspec_update_featstr:n{weight=#1} } \__fontspec_keys_define_code:nnn {fontspec} {Width} { - \fontspec_update_fontid:n {+width:#1} - \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} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} } \keys_define:nn {fontspec} { FakeSlant .code:n = { - \fontspec_update_fontid:n {+slant:#1} - \fontspec_update_featstr:n{slant=#1} + \__fontspec_update_featstr:n{slant=#1} }, FakeSlant .default:n = {0.2} } @@ -1433,33 +1566,30 @@ { FakeStretch .code:n = { - \fontspec_update_fontid:n {+extend:#1} - \fontspec_update_featstr:n{extend=#1} + \__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 + \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} + \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 - - \fontspec_update_fontid:n {fakeit:#1} + \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 + \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} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -1470,128 +1600,125 @@ { AutoFakeBold .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \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} + \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 - - \fontspec_update_fontid:n {fakebf:#1} + \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 + \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} + \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_define_font_feature:n{Ligatures} -\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} +\__fontspec_define_font_feature:n{Ligatures} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} \keys_define:nn {fontspec} { Ligatures / TeX .code:n = { - \fontspec_update_fontid:n {+tlig+trep} - \fontspec_update_featstr:n{+tlig;+trep} - } - } -\fontspec_define_font_feature:n{Letters} -\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} -\fontspec_define_font_feature:n{Numbers} -\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} + \__fontspec_update_featstr:n { +tlig; +trep } + } + } +\__fontspec_define_font_feature:n{Letters} +\__fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\__fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\__fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\__fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\__fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\__fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} +\__fontspec_define_font_feature:n{Numbers} +\__fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\__fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} \luatex_if_engine:T { - \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} - } -\fontspec_define_font_feature:n {Contextuals} -\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} -\fontspec_define_font_feature:n{Diacritics} -\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} -\fontspec_define_font_feature:n{Kerning} -\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -\fontspec_define_font_feature:n{VerticalPosition} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\fontspec_define_font_feature:n{Fractions} -\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} -\fontspec_define_font_feature:n { Alternate } + \__fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} + } +\__fontspec_define_font_feature:n {Contextuals} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\__fontspec_define_font_feature:n{Diacritics} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\__fontspec_define_font_feature:n{Kerning} +\__fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\__fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\__fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +\__fontspec_define_font_feature:n{VerticalPosition} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\__fontspec_define_font_feature:n{Fractions} +\__fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\__fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} +\__fontspec_define_font_feature:n { Alternate } \keys_define:nn {fontspec} { Alternate .default:n = {0} , @@ -1602,7 +1729,7 @@ } } \cs_set:Nn \fontspec_salt:n { +salt = #1 } -\fontspec_define_font_feature:n {Variant} +\__fontspec_define_font_feature:n {Variant} \keys_define:nn {fontspec} { Variant .default:n = {0} , @@ -1613,7 +1740,7 @@ } } \aliasfontfeature{Variant}{StylisticSet} -\fontspec_define_font_feature:n { CharacterVariant } +\__fontspec_define_font_feature:n { CharacterVariant } \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w @@ -1634,63 +1761,50 @@ } } } -\keys_define:nn {fontspec} - { - ScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=0} - \fontspec_update_featstr:n{+sstyle} - }, - ScriptScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=1} - \fontspec_update_featstr:n{+ssstyle} - } - } -\fontspec_define_font_feature:n{Style} -\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} -\fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} -\fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} +\__fontspec_define_font_feature:n{Style} +\__fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\__fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\__fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\__fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\__fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\__fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\__fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\__fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\__fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} +\__fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} +\__fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} \fontspec_define_numbered_feat:nnnn {Style} {MathScript} {+ssty} {0} \fontspec_define_numbered_feat:nnnn {Style} {MathScriptScript} {+ssty} {1} -\fontspec_define_font_feature:n{CJKShape} -\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} -\fontspec_define_font_feature:n{CharacterWidth} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} -\fontspec_define_font_feature:n { Annotation } +\__fontspec_define_font_feature:n{CJKShape} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\__fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\__fontspec_define_font_feature:n{CharacterWidth} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} +\__fontspec_define_font_feature:n { Annotation } \keys_define:nn {fontspec} { Annotation .default:n = {0} , @@ -1704,15 +1818,13 @@ Vertical .choice: , Vertical / RotatedGlyphs .code:n = { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_make_feature:nnn{}{}{+vrt2} - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } { - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } } } @@ -1960,18 +2072,16 @@ \fontspec_check_lang:nTF {TRK} { \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TRK} } { \fontspec_check_lang:nTF {TUR} { \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TUR} } { - \fontspec_warning:nx {language-not-exist} {Turkish} + \__fontspec_warning:nx {language-not-exist} {Turkish} \keys_set:nn {fontspec} {Language=Default} } } @@ -1979,14 +2089,12 @@ } \__fontspec_keys_define_code:nnn {fontspec}{ Language / Default } { - \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} \int_zero:N \l_fontspec_language_int } \__fontspec_keys_define_code:nnn {fontspec} {RawFeature} { - \fontspec_update_fontid:n {+Raw:#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } \providecommand*{\sidefault}{si} \DeclareRobustCommand{\sishape} @@ -2027,23 +2135,23 @@ } \@ifpackageloaded{euler} { - \bool_set_true:N \g_fontspec_package_euler_loaded_bool + \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool } { - \bool_set_false:N \g_fontspec_package_euler_loaded_bool + \bool_set_false:N \g__fontspec_pkg_euler_loaded_bool } \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { - \bool_if:NTF \g_fontspec_package_euler_loaded_bool - { \bool_set_true:N \g_fontspec_math_euler_bool } - { \fontspec_error:n {euler-too-late} } + \bool_if:NTF \g__fontspec_pkg_euler_loaded_bool + { \bool_set_true:N \g__fontspec_math_euler_bool } + { \__fontspec_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -2062,13 +2170,13 @@ \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi \group_end: - \bool_if:NF \g_fontspec_math_euler_bool + \bool_if:NF \g__fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63} - \bool_if:NF \g_fontspec_math_lucida_bool + \bool_if:NF \g__fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} @@ -2101,67 +2209,67 @@ \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} } } - \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\itdefault - \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\mddefault\updefault - \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\mddefault\updefault - \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \tl_if_empty:NTF \g_fontspec_bfmathrm_tl + \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault + \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault + \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \tl_if_empty:NTF \g__fontspec_bfmathrm_tl { - \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\itdefault + \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\itdefault } { - \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\updefault - \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault + \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault } - \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\bfdefault\updefault + \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault + \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault } \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{iwona} { - \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@iwona@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{kurier} { - \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@kurier@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{fourier}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{lmodern}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} - \bool_if:NT \g_fontspec_math_bool - { - \fontspec_info:n {setup-math} + \@ifpackageloaded{fouriernc}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{fourier}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{lmodern}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathpazo}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathptmx}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{MinionPro}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g__fontspec_math_bool}{} + \bool_if:NT \g__fontspec_math_bool + { + \__fontspec_info:n {setup-math} \fontspec_setup_maths: } } \AtBeginDocument{\fontspec_maybe_setup_maths:} -\bool_if:NT \g_fontspec_cfg_bool +\bool_if:NT \g__fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} @@ -2176,7 +2284,7 @@ } \ExplSyntaxOff %% -%% Copyright 2004--2013 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2014 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index 98b152f2117..82479c61ab3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-patches} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \RequirePackage{fixltx2e}[2006/03/24] @@ -131,7 +131,7 @@ { \addfontfeature{Numbers=Lining} #1 } } %% -%% Copyright 2004--2013 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2014 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index c392b552f6c..9821d3987d5 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-xetex} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -26,120 +26,146 @@ \tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl -\tl_put_right:Nn \document +\AtBeginDocument { \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl } \RequirePackage{xunicode} -\DeclareDocumentCommand \fontspec { O{} m } +\DeclareDocumentCommand \fontspec { O{} m O{} } { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1,#3}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m } +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m } +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m } +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} \normalfont + \ignorespaces } \cs_set_eq:NN \setromanfont \setmainfont -\tl_new:N \g_fontspec_mathrm_tl -\tl_new:N \g_fontspec_bfmathrm_tl -\tl_new:N \g_fontspec_mathsf_tl -\tl_new:N \g_fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m } +\tl_new:N \g__fontspec_mathrm_tl +\tl_new:N \g__fontspec_bfmathrm_tl +\tl_new:N \g__fontspec_mathsf_tl +\tl_new:N \g__fontspec_mathtt_tl +\DeclareDocumentCommand \setmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m } +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathsf { O{} m } +\DeclareDocumentCommand \setmathsf { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathtt { O{} m } +\DeclareDocumentCommand \setmathtt { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\tl_set:Nn \g_fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g_fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g_fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m } +\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_select:nn{#2}{#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont } } } -\DeclareDocumentCommand \newfontface { m O{} m } +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } -\tl_new:N \g_fontspec_default_fontopts_tl +\clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop -\DeclareDocumentCommand \defaultfontfeatures { o m } +\DeclareDocumentCommand \defaultfontfeatures { t+ o m } { - \IfNoValueTF {#1} - { \__fontspec_set_default_features:n {#2} } - { \__fontspec_set_font_default_features:nn {#1} {#2} } + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } -\cs_new:Nn \__fontspec_set_default_features:n +\cs_new:Nn \__fontspec_set_default_features:nn { - \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g__fontspec_default_fontopts_clist {#2} } -\cs_new:Nn \__fontspec_set_font_default_features:nn +\cs_new:Nn \__fontspec_set_font_default_features:nnn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_gput:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l__fontspec_tmp_tl { \cs:w g__fontspec_ \cs_to_str:N ##1 _family\cs_end: } } + { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } + + \IfBooleanTF {#1} + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + { \tl_clear:N \l__fontspec_tmpb_tl } + \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} + \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_put:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } + } + } } + \cs_new:Nn \__fontspec_sanitise_fontname:Nn { \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } + +\bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF + { \group_begin: - \tl_clear:N \g_fontspec_default_fontopts_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {options} \l__fontspec_options_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontname} \l__fontspec_fontname_tl + \bool_set_true:N \l__fontspec_disable_defaults_bool \use:x { - \exp_not:N\fontspec_select:nn - {\csname zf@family@options\f@family\endcsname,#1} - {\csname zf@family@fontname\f@family\endcsname} + \exp_not:N \fontspec_select:nn + { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} } \group_end: \fontfamily\l_fontspec_family_tl\selectfont - \else - \fontspec_warning:n {addfontfeatures-ignored} - \fi + } + { + \__fontspec_warning:n {addfontfeatures-ignored} + } \ignorespaces } \cs_set_eq:NN \addfontfeature \addfontfeatures @@ -149,28 +175,27 @@ { #1 .code:n = { - \fontspec_update_fontid:n {+zf-#1} - \fontspec_update_featstr:n {#2} + \__fontspec_update_featstr:n {#2} } } } \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \fontspec_define_font_feature:n {#1} } + { \__fontspec_define_font_feature:n {#1} } \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \fontspec_define_feature_option:nnnnn{#1}{#2}{#3}{#4}{} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{#3}{#4}{} } -\DeclareDocumentCommand \newICUfeature {mmm} +\DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \fontspec_define_font_feature:n{#1} } + { \__fontspec_define_font_feature:n {#1} } \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} - { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \fontspec_define_feature_option:nnnnn{#1}{#2}{}{}{#3} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{}{}{#3} } -\cs_set_eq:NN \newopentypefeature \newICUfeature +\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \keys_if_exist:nnTF {fontspec} {#1} @@ -194,7 +219,7 @@ } } { - \fontspec_warning:nx {rename-feature-not-exist} {#1} + \__fontspec_warning:nx {rename-feature-not-exist} {#1} } } } @@ -212,18 +237,17 @@ \keys_define:nn { fontspec } { Script / #1 .code:n = \fontspec_check_script:nTF {#2} { - \fontspec_update_fontid:n {+script=#1} \tl_set:Nn \l_fontspec_script_tl {#2} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} } { \fontspec_check_script:nTF {latn} { - \fontspec_warning:nx {script-not-exist-latn} {#1} + \__fontspec_warning:nx {script-not-exist-latn} {#1} \keys_set:nn {fontspec} {Script=Latin} } { - \fontspec_warning:nx {script-not-exist} {#1} + \__fontspec_warning:nx {script-not-exist} {#1} } } } @@ -239,32 +263,32 @@ \keys_define:nn { fontspec } { Language / #1 .code:n = \fontspec_check_lang:nTF {#2} { - \fontspec_update_fontid:n {+lang=#1} \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} } { - \fontspec_warning:nx {language-not-exist} {#1} + \__fontspec_warning:nx {language-not-exist} {#1} \keys_set:nn { fontspec } { Language = Default } } } } \DeclareDocumentCommand \DeclareFontsExtensions {m} { - \tl_set:Nn \l_fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l_fontspec_extensions_clist {~} + \clist_set:Nn \l__fontspec_extensions_clist { #1 } + \tl_remove_all:Nn \l__fontspec_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \cs_if_exist:cTF {g_fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: + \cs_if_exist:cTF {g__fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \bool_if:NTF \l_fontspec_atsui_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \bool_if:NTF \l__fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -281,9 +305,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false: + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: } { \prg_return_false: @@ -293,14 +318,20 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} - \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_language_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { @@ -315,9 +346,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \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} @@ -331,9 +363,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } @@ -345,12 +378,15 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } @@ -361,9 +397,10 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \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} @@ -377,11 +414,13 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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: } @@ -392,11 +431,13 @@ { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} - \fontspec_set_font_type: - \bool_if:NTF \l_fontspec_icu_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \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: } @@ -405,16 +446,19 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } +\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} \cs_new:Nn \fontspec_set_fontface:NNnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \fontspec_fontwrap:n { "#1" } +\cs_set:Nn \__fontspec_fontwrap:n { "#1" } \cs_if_free:NT \font_set_eq:NN { \cs_set_eq:NN \font_set_eq:NN \tex_let:D @@ -428,7 +472,7 @@ } \cs_set:Npn \font_suppress_not_found_error: {\suppressfontnotfounderror=1} - \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} + \prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -437,13 +481,13 @@ \fi } } -\cs_new:Nn \fontspec_font_set:Nnn +\cs_new:Nn \__fontspec_font_set:Nnn { - \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_set:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } -\cs_new:Nn \fontspec_font_gset:Nnn +\cs_new:Nn \__fontspec_font_gset:Nnn { - \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_gset:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } \prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { @@ -457,32 +501,31 @@ { \group_begin: \font_suppress_not_found_error: - \fontspec_init: + \__fontspec_init: + \tl_set:Nx \l_fontspec_fontname_tl {#2} - \tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \fontspec_preparse_features:nN {#1} \l_fontspec_fontname_tl - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } - \fontspec_set_font_type: - \fontspec_font_gset:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \fontspec_set_scriptlang: - \fontspec_get_features:n {} - \bool_set_false:N \l_fontspec_firsttime_bool - \fontspec_save_family:nT {#2} + \__fontspec_extract_all_features:n {#1} + \__fontspec_preparse_features: + + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} + \bool_set_false:N \l__fontspec_firsttime_bool + + \__fontspec_save_family:nTF {#2} { - \fontspec_save_fontinfo:nn {#1} {#2} + \__fontspec_save_fontinfo: + \__fontspec_find_autofonts: \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} - \fontspec_set_upright: - \fontspec_set_bold: - \fontspec_set_italic: - \fontspec_set_slanted: - \fontspec_set_bold_italic: - \fontspec_set_bold_slanted: - } - \fontspec_info:nxx {defining-font} {#1} {#2} + \__fontspec_set_faces: + \__fontspec_info:nxx {defining-font} {#1} {#2} + } + { + } \group_end: } \cs_new:Nn \__fontspec_load_external_fontoptions:N @@ -494,334 +537,339 @@ { \file_input:n {\l__fontspec_tmp_tl.fontspec} } } } -\cs_new:Nn \fontspec_preparse_features:nN +\cs_new:Nn \__fontspec_extract_all_features:n { - \exp_args:NV \fontspec_if_detect_external:nT #2 - { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \keys_set_known:nxN {fontspec-preparse-external} + + \bool_if:NTF \l__fontspec_disable_defaults_bool { - \g_fontspec_default_fontopts_tl - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #1 + \clist_set:Nx \l__fontspec_all_features_clist + {#1} } - \l_fontspec_keys_leftover_clist + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_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 + + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #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 } + } +\cs_new:Nn \__fontspec_preparse_features: + { + \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } + + \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 - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_keys_leftover_clist} - \l_fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist} - \l_fontspec_fontfeat_clist + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } +\cs_new:Nn \__fontspec_load_font: + { + \__fontspec_font_set:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } + \__fontspec_set_font_type: + \__fontspec_font_gset:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly } -\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} +\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} { - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { - \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l__fontspec_tmpa_bool \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_tmpa_bool \clist_map_break: } + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } } - \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } -\cs_set:Nn \fontspec_fullname:n +\cs_set:Nn \__fontspec_fullname:n { - \fontspec_namewrap:n { #1 \l_fontspec_extension_tl } + \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } \l_fontspec_renderer_tl - \l_fontspec_optical_size_tl - } -%% Now we have a unique (in fact, too unique!) string that contains -\prg_new_conditional:Nnn \fontspec_save_family:n {T} - { - \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \cs_if_exist:cTF {g_fontspec_family_#1_int} - { \int_gincr:c {g_fontspec_family_#1_int} } - { \int_new:c {g_fontspec_family_#1_int} } - \tl_set:Nx \l_fontspec_tmp_tl {#1} - \tl_remove_all:Nn \l_fontspec_tmp_tl {~} - \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \l_fontspec_tmp_tl ( \int_use:c {g_fontspec_family_#1_int} ) - } - } - \tl_gset:Nv \l_fontspec_family_tl {g_fontspec_UID_\l_fontspec_fontid_tl} - \cs_if_exist:cTF {g_fontspec_ \l_fontspec_family_tl _prop} - \prg_return_false: \prg_return_true: + \l__fontspec_optical_size_tl } -\cs_new:Nn \fontspec_set_scriptlang: +\cs_new:Nn \__fontspec_set_scriptlang: { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { - \tl_if_empty:NTF \l_fontspec_script_name_tl + \tl_if_empty:NTF \l__fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { - \tl_set:Nn \l_fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l_fontspec_lang_name_tl + \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} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} } { - \fontspec_info:n {no-scripts} + \__fontspec_info:n {no-scripts} } } { - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec} {Language=\l__fontspec_lang_name_tl} } } } -\cs_generate_variant:Nn \prop_gput:Nnn {cnV} -\cs_generate_variant:Nn \prop_gput:Nnn {cnx} -\cs_new:Nn \fontspec_save_fontinfo:nn +\prg_new_conditional:Nnn \__fontspec_save_family:n {TF} { - \prop_new:c {g_fontspec_ \l_fontspec_family_tl _prop} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {fontname} {#2} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {options} {\g_fontspec_default_fontopts_tl #1} - \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {fontdef} + \cs_if_exist:NT \l__fontspec_nfss_fam_tl { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_tl } - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - - \tl_gset:cx {zf@family@fontname\l_fontspec_family_tl} {#2} - \tl_gset:cx {zf@family@options\l_fontspec_family_tl} {\g_fontspec_default_fontopts_tl #1} - \tl_gset:cx {zf@family@fontdef\l_fontspec_family_tl} + \cs_if_exist:cF {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - \tl_gset:cV {g_fontspec_script_num_(\l_fontspec_family_tl)_tl} \l_fontspec_script_int - \tl_gset:cV {g_fontspec_lang_num_(\l_fontspec_family_tl)_tl} \l_fontspec_language_int - \tl_gset_eq:cN {g_fontspec_script_(\l_fontspec_family_tl)_tl} \l_fontspec_script_tl - \tl_gset_eq:cN {g_fontspec_lang_(\l_fontspec_family_tl)_tl} \l_fontspec_lang_tl - } -\cs_new:Nn \fontspec_set_upright: - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl - \mddefault \updefault \l_fontspec_fontfeat_up_clist - } -\cs_new:Nn \fontspec_set_bold: - { - \bool_if:NF \l_fontspec_nobf_bool - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } + \cs_if_exist:cTF {g__fontspec_family_#1_int} + { \int_gincr:c {g__fontspec_family_#1_int} } + { \int_new:c {g__fontspec_family_#1_int} } + \tl_set:Nx \l__fontspec_tmp_tl {#1} + \tl_remove_all:Nn \l__fontspec_tmp_tl {~} + \tl_gset:cx {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist + \l__fontspec_tmp_tl ( \int_use:c {g__fontspec_family_#1_int} ) } } + \tl_gset:Nv \l_fontspec_family_tl {g__fontspec_UID_\l__fontspec_fontid_tl} + \cs_if_exist:cTF {g__fontspec_ \l_fontspec_family_tl _prop} + \prg_return_false: \prg_return_true: } -\cs_new:Nn \fontspec_set_italic: - { - \bool_if:NF \l_fontspec_noit_bool - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } - { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } - \mddefault \itdefault \l_fontspec_fontfeat_it_clist - } - } -\cs_new:Nn \fontspec_set_slanted: +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} +\cs_new:Nn \__fontspec_save_fontinfo: { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \prop_new:c {g__fontspec_ \l_fontspec_family_tl _prop} + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { \l__fontspec_basename_tl } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontdef} { - \fontspec_make_font_shapes:nnnn - \l_fontspec_fontname_sl_tl \mddefault \sldefault - \l_fontspec_fontfeat_sl_clist + \__fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g__fontspec_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } -\cs_new:Nn \fontspec_set_bold_italic: +\cs_new:Nn \__fontspec_find_autofonts: { - \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} { - \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} - } - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} - } - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl - } - \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist + \__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} } - } -\cs_new:Nn \fontspec_set_bold_slanted: - { - \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl + + \bool_if:NF \l__fontspec_nobf_bool { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist - } + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} } + + \bool_if:NF \l__fontspec_noit_bool { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + \__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} + } +\cs_new:Nn \__fontspec_set_faces: + { + \__fontspec_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:oooo \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} } -\cs_new:Nn \fontspec_set_font_type: +\cs_new:Nn \__fontspec_set_font_type: { - \bool_set_false:N \l_fontspec_tfm_bool - \bool_set_false:N \l_fontspec_atsui_bool - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_false:N \l_fontspec_mm_bool - \bool_set_false:N \l_fontspec_graphite_bool + \bool_set_false:N \l__fontspec_tfm_bool + \bool_set_false:N \l__fontspec_atsui_bool + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_false:N \l__fontspec_mm_bool + \bool_set_false:N \l__fontspec_graphite_bool \ifcase\XeTeXfonttype\l_fontspec_font - \bool_set_true:N \l_fontspec_tfm_bool + \bool_set_true:N \l__fontspec_tfm_bool \or - \bool_set_true:N \l_fontspec_atsui_bool + \bool_set_true:N \l__fontspec_atsui_bool \ifnum\XeTeXcountvariations\l_fontspec_font > \c_zero - \bool_set_true:N \l_fontspec_mm_bool + \bool_set_true:N \l__fontspec_mm_bool \fi \or - \bool_set_true:N \l_fontspec_icu_bool + \bool_set_true:N \l__fontspec_ot_bool \fi \tl_if_empty:NT \l_fontspec_renderer_tl { - \bool_if:NTF \l_fontspec_atsui_bool + \bool_if:NTF \l__fontspec_atsui_bool { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } { - \bool_if:NT \l_fontspec_icu_bool - { \tl_set:Nn \l_fontspec_renderer_tl {/ICU} } + \bool_if:NT \l__fontspec_ot_bool + { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } } } } -\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_new:Nn \__fontspec_set_autofont:Nnn { - \bool_if:NF \l_fontspec_external_bool + \bool_if:NF \l__fontspec_external_bool { - \fontspec_font_set:Nnn \l_tmpa_font - { \fontspec_fullname:n {#1} } {\f@size pt} - \fontspec_font_set:Nnn \l_tmpb_font - { \fontspec_fullname:n {#1#2} } {\f@size pt} - \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \fontspec_info:nx {no-font-shape} {#1#2} } - { \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5} } + \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} } + } + } } } -\cs_new:Nn \fontspec_make_font_shapes:nnnn { - \group_begin: +\prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} + { + \__fontspec_font_set:Nnn \l_tmpa_font { \__fontspec_fullname:n {#1} } {\f@size pt} + \__fontspec_font_set:Nnn \l_tmpb_font { \__fontspec_fullname:n {#1#2} } {\f@size pt} + \str_if_eq_x:nnTF { \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_load_fontname:n {#1} - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } - - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl - { - \bool_if:NF \l_fontspec_nosc_bool - { - \fontspec_make_smallcaps:T - { - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , Letters=SmallCaps , \l_fontspec_fontfeat_sc_clist - } - } - } - } - { - \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , \l_fontspec_fontfeat_sc_clist - } - } + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, #4 } {#5} \group_end: } + \cs_new:Nn \__fontspec_load_fontname:n { \tl_set:Nx \l_fontspec_fontname_tl {#1} \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} } + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } } -\cs_new:Nn \fontspec_declare_shape:nnn +\cs_new:Nn \__fontspec_declare_shape:nnnn { - \clist_if_empty:NTF \l_fontspec_sizefeat_clist - { \__fontspec_declare_shape_nosizing:n {#3} } - { \__fontspec_declare_shape_withsizing:n {#3} } - \use:x + \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} { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} {#2} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} + \tl_clear:N \l__fontspec_size_tl + \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed + + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \l__fontspec_sizing_leftover_clist + \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } + + % "normal" + \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_tl {#3} {} + + % small caps + \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 + } + + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_sc_tl {#3} {\l__fontspec_fontfeat_curr_clist} + } + } + + \__fontspec_declare_shapes_normal:nn {#1} {#2} \__fontspec_declare_shape_slanted:nn {#1} {#2} \__fontspec_declare_shape_loginfo:nnn {#1} {#2} {#3} } -\cs_new:Nn \__fontspec_declare_shape_nosizing:n +\cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} + +\cs_new:Nn \__fontspec_setup_nfss:Nnn { - \fontspec_get_features:n {#1} - \tl_set:Nx \l_fontspec_nfss_tl + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist + { #2 , \l__fontspec_sizing_leftover_clist , #3 } + + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_fontwrap:n { - <-> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } + \__fontspec_fullname:n { \l_fontspec_fontname_tl } + : \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + } } -\cs_new:Nn \__fontspec_declare_shape_withsizing:n - { - \tl_clear:N \l_fontspec_nfss_tl - \clist_map_inline:Nn \l_fontspec_sizefeat_clist - { - - \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl - \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } - \l_fontspec_keys_leftover_clist - - \tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} } - \fontspec_get_features:n { #1 , \l_fontspec_keys_leftover_clist } +\cs_new:Nn \__fontspec_declare_shapes_normal:nn + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} - \tl_put_right:Nx \l_fontspec_nfss_tl - { - <\l_fontspec_size_tl> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n { \l_fontspec_sizedfont_tl } - : \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - } + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} + {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} + {\l__fontspec_nfss_sc_tl}{\l__fontspec_postadjust_tl} } } + +\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} + } +\cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn { \bool_if:nT @@ -830,11 +878,8 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \use:x - { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl} - } + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } \cs_new:Nn \__fontspec_declare_shape_loginfo:nnn @@ -845,25 +890,31 @@ *~ '\exp_not:N \str_case:nnn {#1/#2} { {\mddefault/\updefault} {normal} - {\mddefault/\scdefault} {small~ caps} {\bfdefault/\updefault} {bold} - {\bfdefault/\scdefault} {bold~ small~ caps} {\mddefault/\itdefault} {italic} - {\mddefault/\sidefault} {italic~ small~ caps} {\bfdefault/\itdefault} {bold~ italic} + } {#2/#3}'~ + with~ NFSS~ spec.: \exp_not:N \\ + \l__fontspec_nfss_tl + \exp_not:n { \\ \\ } + *~ '\exp_not:N \str_case:nnn {#1/\scdefault} + { + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\sidefault} {italic~ small~ caps} {\bfdefault/\sidefault} {bold~ italic~ small~ caps} } {#2/#3}'~ with~ NFSS~ spec.: \exp_not:N \\ - \l_fontspec_nfss_tl - \tl_if_empty:NF \l_fontspec_postadjust_tl + \l__fontspec_nfss_sc_tl + \tl_if_empty:NF \l__fontspec_postadjust_tl { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \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 +\clist_set:Nn \l__fontspec_pre_feat_sclist { - \bool_if:NT \l_fontspec_icu_bool + \bool_if:NT \l__fontspec_ot_bool { \tl_if_empty:NF \l_fontspec_script_tl { @@ -872,30 +923,28 @@ } } } -\cs_new:Nn \fontspec_update_fontid:n +\cs_set:Nn \__fontspec_get_features:Nn { - \bool_if:NT \l_fontspec_firsttime_bool + \sclist_clear:N \l__fontspec_rawfeatures_sclist + \tl_clear:N \l__fontspec_scale_tl + \tl_set_eq:NN \l__fontspec_opacity_tl \g__fontspec_opacity_tl + \tl_set_eq:NN \l__fontspec_hexcol_tl \g__fontspec_hexcol_tl + \tl_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_clear:N \l__fontspec_wordspace_adjust_tl + \tl_clear:N \l__fontspec_punctspace_adjust_tl + + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \l__fontspec_keys_leftover_clist + \keys_set:nx {fontspec} {\l__fontspec_keys_leftover_clist} + \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } { - \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} + \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } -\cs_set:Nn \fontspec_get_features:n - { - \sclist_clear:N \l_fontspec_rawfeatures_sclist - \tl_clear:N \l_fontspec_scale_tl - \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl - \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl - \tl_clear:N \l_fontspec_postadjust_tl - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_fontfeat_clist,#1} - \l_fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l_fontspec_keys_leftover_clist} - \str_if_eq_x:nnF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } - { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } - { - \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} - } + \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } +\tl_clear:N \l__fontspec_family_label_tl \tl_clear:N \l_fontspec_fontname_bf_tl \tl_clear:N \l_fontspec_fontname_it_tl \tl_clear:N \l_fontspec_fake_slant_tl @@ -904,61 +953,74 @@ \tl_clear:N \l_fontspec_fontname_sl_tl \tl_clear:N \l_fontspec_fontname_bfsl_tl \tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l_fontspec_fontfeat_up_clist -\tl_clear:N \l_fontspec_fontfeat_bf_clist -\tl_clear:N \l_fontspec_fontfeat_it_clist -\tl_clear:N \l_fontspec_fontfeat_bfit_clist -\tl_clear:N \l_fontspec_fontfeat_sl_clist -\tl_clear:N \l_fontspec_fontfeat_bfsl_clist -\tl_clear:N \l_fontspec_fontfeat_sc_clist -\tl_clear:N \l_fontspec_script_name_tl +\tl_clear:N \l__fontspec_fontfeat_up_clist +\tl_clear:N \l__fontspec_fontfeat_bf_clist +\tl_clear:N \l__fontspec_fontfeat_it_clist +\tl_clear:N \l__fontspec_fontfeat_bfit_clist +\tl_clear:N \l__fontspec_fontfeat_sl_clist +\tl_clear:N \l__fontspec_fontfeat_bfsl_clist +\tl_clear:N \l__fontspec_fontfeat_sc_clist +\tl_clear:N \l__fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l_fontspec_lang_name_tl +\tl_clear:N \l__fontspec_lang_name_tl \tl_clear:N \l_fontspec_lang_tl -\clist_clear:N \l_fontspec_sizefeat_clist -\tl_new:N \g_fontspec_hexcol_tl -\tl_new:N \g_fontspec_opacity_tl -\tl_set:Nn \g_fontspec_hexcol_tl {000000} -\tl_set:Nn \g_fontspec_opacity_tl {FF~} -\cs_set:Npn \fontspec_init: - { - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_true:N \l_fontspec_firsttime_bool - \cs_set:Npn \fontspec_namewrap:n ##1 { ##1 } - \tl_clear:N \l_fontspec_optical_size_tl +\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } + +\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} +\tl_new:N \g__fontspec_hexcol_tl +\tl_new:N \g__fontspec_opacity_tl +\tl_set:Nn \g__fontspec_hexcol_tl {000000} +\tl_set:Nn \g__fontspec_opacity_tl {FF~} +\cs_set:Npn \__fontspec_init: + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \cs_set:Npn \__fontspec_namewrap:n ##1 { ##1 } + \tl_clear:N \l__fontspec_optical_size_tl \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl + \tl_clear:N \g__fontspec_curr_series_tl + + % This is for detecting font families when assigning default features. + % Replace defaults for the standard families because they're not set in the usual way: + \exp_args:NV \str_case:nnn {\l__fontspec_family_label_tl} + { + {\rmdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_rmfamily_family} } + {\sfdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_sffamily_family} } + {\ttdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_ttfamily_family} } + }{} + } -\cs_set:Nn \fontspec_make_ot_smallcaps:T +\cs_set:Nn \fontspec_make_ot_smallcaps:TF { - \fontspec_check_ot_feat:nT {+smcp} { #1 } + \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} } -\cs_set:Nn \fontspec_make_smallcaps:T +\cs_set:Nn \__fontspec_make_smallcaps:TF { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ot_smallcaps:T {#1} } + \bool_if:NTF \l__fontspec_ot_bool + { \fontspec_make_ot_smallcaps:TF {#1} {#2} } { - \bool_if:NT \l_fontspec_atsui_bool - { \fontspec_make_AAT_feature_string:nnT {3}{3} { #1 } } + \bool_if:NT \l__fontspec_atsui_bool + { \fontspec_make_AAT_feature_string:nnTF {3}{3} {#1} {#2} } } } \cs_set_eq:NN \sclist_clear:N \tl_clear:N \cs_new:Nn \sclist_gput_right:Nn { \tl_gput_right:Nn #1 {#2;} } \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} -\cs_new:Nn \fontspec_update_featstr:n +\cs_new:Nn \__fontspec_update_featstr:n { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} + \sclist_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1} } } \cs_new:Nn \fontspec_make_feature:nnn { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ICU_feature:n {#3} } + \bool_if:NTF \l__fontspec_ot_bool + { \fontspec_make_OT_feature:n {#3} } { - \bool_if:NT \l_fontspec_atsui_bool + \bool_if:NT \l__fontspec_atsui_bool { \fontspec_make_AAT_feature:nn {#1}{#2} } } } @@ -966,44 +1028,41 @@ \cs_new:Nn \fontspec_make_AAT_feature:nn { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {aat-feature-not-exist} } + { \__fontspec_warning:n {aat-feature-not-exist} } { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} { - \fontspec_update_fontid:n {+#1,#2} - \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } - { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } -\cs_new:Nn \fontspec_make_ICU_feature:n +\cs_new:Nn \fontspec_make_OT_feature:n { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {icu-feature-not-exist} } + { \__fontspec_warning:n {icu-feature-not-exist} } { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } } \cs_new_protected:Nn \fontspec_make_numbered_feature:nn { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1=#2} - \fontspec_update_featstr:n { #1 = #2 } + \__fontspec_update_featstr:n { #1 = #2 } } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } \cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn} -\cs_new:Nn \fontspec_define_font_feature:n +\cs_new:Nn \__fontspec_define_font_feature:n { \keys_define:nn {fontspec} { #1 .multichoice: } } -\cs_new:Nn \fontspec_define_feature_option:nnnnn +\cs_new:Nn \__fontspec_define_feature_option:nnnnn { \keys_define:nn {fontspec} { @@ -1136,199 +1195,270 @@ { \keys_define:nn {#1} { #2 .code:n = {#3} } } -\bool_new:N \l_fontspec_external_bool +\bool_new:N \l__fontspec_external_bool \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { - \bool_set_true:N \l_fontspec_nobf_bool - \bool_set_true:N \l_fontspec_noit_bool - \bool_set_true:N \l_fontspec_external_bool - \cs_gset:Npn \fontspec_namewrap:n ##1 { [ #1 ##1 ] } - \keys_set:nn {fontspec-renderer} {Renderer=ICU} + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \cs_gset:Npn \__fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} } \aliasfontfeature{ExternalLocation}{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 + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } } -\tl_clear:N \l_fontspec_extension_tl +\tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { Renderer .choice_code:n = { - \fontspec_update_fontid:n {+rend:\l_keys_choice_tl} \int_compare:nTF {\l_keys_choice_int <= 3} { \tl_set:Nv \l_fontspec_renderer_tl { g_fontspec_renderer_tag_ \l_keys_choice_tl } } { - \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} + \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} } } , - Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic} + Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} -\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU} +\tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} +\tl_set:cn {g_fontspec_renderer_tag_OpenType} {/OT} \tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR} \tl_set:cn {g_fontspec_mode_tag_Full} {node} \tl_set:cn {g_fontspec_mode_tag_Basic} {base} \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} { - \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_script_name_tl {#1} - \fontspec_update_fontid:n {+script:#1} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l__fontspec_script_name_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} { - \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \fontspec_update_fontid:n {+language:#1} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } +\seq_new:N \g__fontspec_bf_series_seq +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} + { + \tl_gset:Nx \g__fontspec_curr_series_tl { #1 } + \seq_gput_right:Nx \g__fontspec_bf_series_seq { #1 } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} - \fontspec_update_fontid:n {up:#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {FontName} + { + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + } +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nobf_bool - \fontspec_update_fontid:n {nobf} + \bool_set_true:N \l__fontspec_nobf_bool } { - \bool_set_false:N \l_fontspec_nobf_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} - \fontspec_update_fontid:n {bf:#1} + \bool_set_false:N \l__fontspec_nobf_bool + \fontspec_complete_fontname:Nn \l__fontspec_curr_bfname_tl {#1} + + \seq_if_empty:NT \g__fontspec_bf_series_seq + { + \tl_gset:Nx \g__fontspec_curr_series_tl {\bfdefault} + \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} + } + \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} + { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } + + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl + } } +\prop_new:N \l__fontspec_nfss_prop \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_noit_bool - \fontspec_update_fontid:n {noit} + \bool_set_true:N \l__fontspec_noit_bool } { - \bool_set_false:N \l_fontspec_noit_bool + \bool_set_false:N \l__fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} - \fontspec_update_fontid:n {it:#1} } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} - \fontspec_update_fontid:n {bfit:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} - \fontspec_update_fontid:n {sl:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} - \fontspec_update_fontid:n {bfsl:#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nosc_bool - \fontspec_update_fontid:n {nosc} + \bool_set_true:N \l__fontspec_nosc_bool } { - \bool_set_true:N \l_fontspec_nosc_bool + \bool_set_false:N \l__fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} - \fontspec_update_fontid:n {sc:#1} } } \cs_set:Nn \fontspec_complete_fontname:Nn { - \tl_set:Nn #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl} + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} } \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_up_clist { , #1} - \fontspec_update_fontid:n {rmfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bf_clist {, #1} - \fontspec_update_fontid:n {bffeat:#1} + \ + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_it_clist {, #1} - \fontspec_update_fontid:n {itfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfit_clist {, #1} - \fontspec_update_fontid:n {bfitfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_sl_clist {, #1} - \fontspec_update_fontid:n {slfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfsl_clist {, #1} - \fontspec_update_fontid:n {bfslfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fontfeat_sc_clist {, #1} + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} } - \fontspec_update_fontid:n {scfeat:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} { - \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \fontspec_update_fontid:n {sizefeat:#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 + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } +\__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} + { + % dummy + } +\__fontspec_keys_define_code:nnn {fontspec} {Font} + { + % 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} {NFSSFamily} + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + \cs_undefine:c {g__fontspec_UID_\l__fontspec_fontid_tl} + \tl_if_exist:NT \l_fontspec_family_tl + { \cs_undefine:c {g__fontspec_ \l_fontspec_family_tl _prop} } + } +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\prop_new:N \l__fontspec_nfssfont_prop +\__fontspec_keys_define_code:nnn {fontspec} {FontFace} + { + \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } + \tl_set_eq:NN \l__fontspec_this_feat_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_font_tl + \int_compare:nT { \clist_count:N \l__fontspec_arg_tl = 1 } + { + \tl_if_in:NnF \l__fontspec_arg_tl {=} + { + \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_feat_tl + } + } + + \__fontspec_add_nfssfont:oooo + {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} + } +\cs_new:Nn \__fontspec_add_nfssfont:nnnn + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \keys_set_known:noN {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} } + } + } +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {ooo} +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {oooo} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnn {#1} { - {MatchLowercase} { \fontspec_calc_scale:n {5} } - {MatchUppercase} { \fontspec_calc_scale:n {8} } + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } } - { \tl_set:Nx \l_fontspec_scale_tl {#1} } - \fontspec_update_fontid:n {+scale:\l_fontspec_scale_tl} - \tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] } + { \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 +\cs_new:Nn \__fontspec_calc_scale:n { \group_begin: \rmfamily - \fontspec_set_font_dimen:NnN \l_fontspec_tmpa_dim {#1} \font - \fontspec_set_font_dimen:NnN \l_fontspec_tmpb_dim {#1} \l_fontspec_font - \fp_set_from_dim:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpa_dim } - \fp_set_from_dim:Nn \l_fontspec_tmpb_fp { \l_fontspec_tmpb_dim } - \fp_div:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpb_fp } - \tl_gset:Nx \l_fontspec_scale_tl { \fp_use:N \l_fontspec_tmpa_fp } - \fontspec_info:n {set-scale} + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \fp_set_from_dim:Nn \l__fontspec_tmpa_fp { \l__fontspec_tmpa_dim } + \fp_set_from_dim:Nn \l__fontspec_tmpb_fp { \l__fontspec_tmpb_dim } + \fp_div:Nn \l__fontspec_tmpa_fp { \l__fontspec_tmpb_fp } + \tl_gset:Nx \l__fontspec_scale_tl { \fp_use:N \l__fontspec_tmpa_fp } + \__fontspec_info:n {set-scale} \group_end: } -\cs_new:Nn \fontspec_set_font_dimen:NnN +\cs_new:Nn \__fontspec_set_font_dimen:NnN { \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} @@ -1346,15 +1476,14 @@ } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} { - \fontspec_update_fontid:n {+wordspace:#1} - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #1 \fontdimen 3 \font @@ -1362,7 +1491,7 @@ } } { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #2 \fontdimen 3 \font @@ -1372,26 +1501,37 @@ } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} { - \fontspec_update_fontid:n {+punctspace:#1} - \tl_put_right:Nx \l_fontspec_postadjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } + \str_case_x:nnn {#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_keys_define_code:nnn {fontspec} {FontAdjustment} { - \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} - \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_fontid:n {+tracking:#1} - \fontspec_update_featstr:n{letterspace=#1} + \__fontspec_update_featstr:n {letterspace=#1} } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} { - \fontspec_update_fontid:n {+hyphenchar:#1} \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { @@ -1400,106 +1540,97 @@ { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: } } - { \fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{#1} } } } \__fontspec_keys_define_code:nnn {fontspec} {Color} { - \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF { \token_to_str:N \color@ #1 } { - \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl } { \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_fontspec_hexcol_tl {#1} } + { \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} } + \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 \g_fontspec_opacity_tl + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice-col} {#7#8} } + \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_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} -\int_new:N \l_fontspec_tmp_int +\int_new:N \l__fontspec_tmp_int \__fontspec_keys_define_code:nnn {fontspec} {Opacity} { - \fontspec_update_fontid:n {+opac:#1} - \int_set:Nn \l_fontspec_tmp_int {255} - \_int_mult_truncate:Nn \l_fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } } - \tl_set:Nx \l_fontspec_opacity_tl + \tl_set:Nx \l__fontspec_opacity_tl { - \int_compare:nT { \l_fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l_fontspec_tmp_int } + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hexadecimal:n { \l__fontspec_tmp_int } } } \__fontspec_keys_define_code:nnn {fontspec} {Mapping} { - \fontspec_update_fontid:n {+map:#1} - \fontspec_update_featstr:n{mapping=#1} + \__fontspec_update_featstr:n { mapping = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {FeatureFile} { - \fontspec_update_fontid:n {+fea:#1} - \fontspec_update_featstr:n{featurefile=#1} + \__fontspec_update_featstr:n { featurefile = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { - \fontspec_update_fontid:n {+weight:#1} - \fontspec_update_featstr:n{weight=#1} + \__fontspec_update_featstr:n{weight=#1} } \__fontspec_keys_define_code:nnn {fontspec} {Width} { - \fontspec_update_fontid:n {+width:#1} - \fontspec_update_featstr:n{width=#1} + \__fontspec_update_featstr:n{width=#1} } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} } { - \bool_if:NT \l_fontspec_mm_bool + \bool_if:NT \l__fontspec_mm_bool { - \fontspec_update_fontid:n {+size:#1} - \fontspec_update_featstr:n{optical size=#1} + \__fontspec_update_featstr:n { optical size = #1 } } } - \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool } + \bool_if:nT { !\l__fontspec_ot_bool && !\l__fontspec_mm_bool } { - \bool_if:NT \l_fontspec_firsttime_bool - { \fontspec_warning:n {no-opticals} } + \bool_if:NT \l__fontspec_firsttime_bool + { \__fontspec_warning:n {no-opticals} } } } \keys_define:nn {fontspec} { FakeSlant .code:n = { - \fontspec_update_fontid:n {+slant:#1} - \fontspec_update_featstr:n{slant=#1} + \__fontspec_update_featstr:n{slant=#1} }, FakeSlant .default:n = {0.2} } @@ -1507,8 +1638,7 @@ { FakeStretch .code:n = { - \fontspec_update_fontid:n {+extend:#1} - \fontspec_update_featstr:n{extend=#1} + \__fontspec_update_featstr:n{extend=#1} }, FakeStretch .default:n = {1.2} } @@ -1516,8 +1646,7 @@ { FakeBold .code:n = { - \fontspec_update_fontid:n {+embolden:#1} - \fontspec_update_featstr:n{embolden=#1} + \__fontspec_update_featstr:n {embolden=#1} }, FakeBold .default:n = {1.5} } @@ -1525,20 +1654,18 @@ { AutoFakeSlant .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \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} + \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 - - \fontspec_update_fontid:n {fakeit:#1} + \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 + \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} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -1549,128 +1676,125 @@ { AutoFakeBold .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \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} + \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 - - \fontspec_update_fontid:n {fakebf:#1} + \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 + \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} + \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_define_font_feature:n{Ligatures} -\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} +\__fontspec_define_font_feature:n{Ligatures} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} \keys_define:nn {fontspec} { Ligatures / TeX .code:n = { - \fontspec_update_fontid:n {+map:tex-text} - \fontspec_update_featstr:n{mapping=tex-text} - } - } -\fontspec_define_font_feature:n{Letters} -\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} -\fontspec_define_font_feature:n{Numbers} -\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} + \__fontspec_update_featstr:n { mapping = tex-text } + } + } +\__fontspec_define_font_feature:n{Letters} +\__fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\__fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\__fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\__fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\__fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\__fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} +\__fontspec_define_font_feature:n{Numbers} +\__fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\__fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} \luatex_if_engine:T { - \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} - } -\fontspec_define_font_feature:n {Contextuals} -\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} -\fontspec_define_font_feature:n{Diacritics} -\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} -\fontspec_define_font_feature:n{Kerning} -\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -\fontspec_define_font_feature:n{VerticalPosition} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\fontspec_define_font_feature:n{Fractions} -\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} -\fontspec_define_font_feature:n { Alternate } + \__fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} + } +\__fontspec_define_font_feature:n {Contextuals} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\__fontspec_define_font_feature:n{Diacritics} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\__fontspec_define_font_feature:n{Kerning} +\__fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\__fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\__fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +\__fontspec_define_font_feature:n{VerticalPosition} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\__fontspec_define_font_feature:n{Fractions} +\__fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\__fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} +\__fontspec_define_font_feature:n { Alternate } \keys_define:nn {fontspec} { Alternate .default:n = {0} , @@ -1681,7 +1805,7 @@ } } \cs_set:Nn \fontspec_salt:n { +salt = #1 } -\fontspec_define_font_feature:n {Variant} +\__fontspec_define_font_feature:n {Variant} \keys_define:nn {fontspec} { Variant .default:n = {0} , @@ -1692,7 +1816,7 @@ } } \aliasfontfeature{Variant}{StylisticSet} -\fontspec_define_font_feature:n { CharacterVariant } +\__fontspec_define_font_feature:n { CharacterVariant } \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w @@ -1713,63 +1837,50 @@ } } } -\keys_define:nn {fontspec} - { - ScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=0} - \fontspec_update_featstr:n{+sstyle} - }, - ScriptScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=1} - \fontspec_update_featstr:n{+ssstyle} - } - } -\fontspec_define_font_feature:n{Style} -\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} -\fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} -\fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} +\__fontspec_define_font_feature:n{Style} +\__fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\__fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\__fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\__fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\__fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\__fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\__fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\__fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\__fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} +\__fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} +\__fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} \fontspec_define_numbered_feat:nnnn {Style} {MathScript} {+ssty} {0} \fontspec_define_numbered_feat:nnnn {Style} {MathScriptScript} {+ssty} {1} -\fontspec_define_font_feature:n{CJKShape} -\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} -\fontspec_define_font_feature:n{CharacterWidth} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} -\fontspec_define_font_feature:n { Annotation } +\__fontspec_define_font_feature:n{CJKShape} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\__fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\__fontspec_define_font_feature:n{CharacterWidth} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} +\__fontspec_define_font_feature:n { Annotation } \keys_define:nn {fontspec} { Annotation .default:n = {0} , @@ -1783,15 +1894,13 @@ Vertical .choice: , Vertical / RotatedGlyphs .code:n = { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_make_feature:nnn{}{}{+vrt2} - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } { - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } } } @@ -2039,18 +2148,16 @@ \fontspec_check_lang:nTF {TRK} { \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TRK} } { \fontspec_check_lang:nTF {TUR} { \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} - \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TUR} } { - \fontspec_warning:nx {language-not-exist} {Turkish} + \__fontspec_warning:nx {language-not-exist} {Turkish} \keys_set:nn {fontspec} {Language=Default} } } @@ -2058,14 +2165,12 @@ } \__fontspec_keys_define_code:nnn {fontspec}{ Language / Default } { - \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} \int_zero:N \l_fontspec_language_int } \__fontspec_keys_define_code:nnn {fontspec} {RawFeature} { - \fontspec_update_fontid:n {+Raw:#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } \providecommand*{\sidefault}{si} \DeclareRobustCommand{\sishape} @@ -2106,23 +2211,23 @@ } \@ifpackageloaded{euler} { - \bool_set_true:N \g_fontspec_package_euler_loaded_bool + \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool } { - \bool_set_false:N \g_fontspec_package_euler_loaded_bool + \bool_set_false:N \g__fontspec_pkg_euler_loaded_bool } \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { - \bool_if:NTF \g_fontspec_package_euler_loaded_bool - { \bool_set_true:N \g_fontspec_math_euler_bool } - { \fontspec_error:n {euler-too-late} } + \bool_if:NTF \g__fontspec_pkg_euler_loaded_bool + { \bool_set_true:N \g__fontspec_math_euler_bool } + { \__fontspec_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -2141,13 +2246,13 @@ \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi \group_end: - \bool_if:NF \g_fontspec_math_euler_bool + \bool_if:NF \g__fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63} - \bool_if:NF \g_fontspec_math_lucida_bool + \bool_if:NF \g__fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} @@ -2180,67 +2285,67 @@ \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} } } - \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault - \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\itdefault - \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\mddefault\updefault - \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\mddefault\updefault - \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \tl_if_empty:NTF \g_fontspec_bfmathrm_tl + \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault + \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault + \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \tl_if_empty:NTF \g__fontspec_bfmathrm_tl { - \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\itdefault + \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\itdefault } { - \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\updefault - \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault + \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault } - \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\bfdefault\updefault + \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault + \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault } \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{iwona} { - \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@iwona@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{kurier} { - \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@kurier@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{fourier}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{lmodern}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} - \bool_if:NT \g_fontspec_math_bool - { - \fontspec_info:n {setup-math} + \@ifpackageloaded{fouriernc}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{fourier}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{lmodern}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathpazo}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathptmx}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{MinionPro}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g__fontspec_math_bool}{} + \bool_if:NT \g__fontspec_math_bool + { + \__fontspec_info:n {setup-math} \fontspec_setup_maths: } } \AtBeginDocument{\fontspec_maybe_setup_maths:} -\bool_if:NT \g_fontspec_cfg_bool +\bool_if:NT \g__fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} @@ -2255,7 +2360,7 @@ } \ExplSyntaxOff %% -%% Copyright 2004--2013 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2014 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg index 95111cba254..a028c587783 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg @@ -1,6 +1,15 @@ +\defaultfontfeatures + [\rmfamily,\sffamily] + {Ligatures=TeX} + +\defaultfontfeatures + [\ttfamily] + {WordSpace={1,0,0}, + PunctuationSpace=WordSpace} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%% diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index 94a9479d4e7..b1f2f299cbb 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -8,7 +8,7 @@ -- -- _________________________________________ -- The fontspec package for XeLaTeX/LuaLaTeX --- (C) 2004--2013 Will Robertson and Khaled Hosny +-- (C) 2004--2014 Will Robertson and Khaled Hosny -- -- License information appended. -- @@ -79,7 +79,7 @@ function fontspec.mathfontdimen(fnt, str) end end -- --- Copyright 2004--2013 Will Robertson <wspr81@gmail.com> +-- Copyright 2004--2014 Will Robertson <wspr81@gmail.com> -- Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> -- -- Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index e8a7d357965..c20dbb3ad22 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \RequirePackage{expl3}[2011/09/05] @@ -39,28 +39,28 @@ \msg_fatal:nn {fontspec} {cannot-use-pdftex} } } -\bool_new:N \l_fontspec_firsttime_bool -\bool_new:N \l_fontspec_nobf_bool -\bool_new:N \l_fontspec_noit_bool -\bool_new:N \l_fontspec_nosc_bool -\bool_new:N \l_fontspec_tfm_bool -\bool_new:N \l_fontspec_atsui_bool -\bool_new:N \l_fontspec_icu_bool -\bool_new:N \l_fontspec_mm_bool -\bool_new:N \l_fontspec_graphite_bool -\bool_new:N \g_fontspec_math_euler_bool -\bool_new:N \g_fontspec_math_lucida_bool -\bool_new:N \g_fontspec_package_euler_loaded_bool -\bool_new:N \g_fontspec_cfg_bool -\bool_new:N \g_fontspec_math_bool +\bool_new:N \l__fontspec_firsttime_bool +\bool_new:N \l__fontspec_nobf_bool +\bool_new:N \l__fontspec_noit_bool +\bool_new:N \l__fontspec_nosc_bool +\bool_new:N \l__fontspec_tfm_bool +\bool_new:N \l__fontspec_atsui_bool +\bool_new:N \l__fontspec_ot_bool +\bool_new:N \l__fontspec_mm_bool +\bool_new:N \l__fontspec_graphite_bool +\bool_new:N \g__fontspec_math_euler_bool +\bool_new:N \g__fontspec_math_lucida_bool +\bool_new:N \g__fontspec_pkg_euler_loaded_bool +\bool_new:N \g__fontspec_cfg_bool +\bool_new:N \g__fontspec_math_bool \int_new:N \l_fontspec_script_int \int_new:N \l_fontspec_language_int \int_new:N \l_fontspec_strnum_int -\fp_new:N \l_fontspec_tmpa_fp -\fp_new:N \l_fontspec_tmpb_fp -\dim_new:N \l_fontspec_tmpa_dim -\dim_new:N \l_fontspec_tmpb_dim -\dim_new:N \l_fontspec_tmpc_dim +\fp_new:N \l__fontspec_tmpa_fp +\fp_new:N \l__fontspec_tmpb_fp +\dim_new:N \l__fontspec_tmpa_dim +\dim_new:N \l__fontspec_tmpb_dim +\dim_new:N \l__fontspec_tmpc_dim \tl_set:Nx \c_colon_str { \tl_to_str:N : } \cs_set:Npn \use_v:nnnnn #1#2#3#4#5 {#5} \cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4} @@ -69,19 +69,19 @@ \cs_generate_variant:Nn \tl_gset:Nn {cV} \cs_generate_variant:Nn \keys_set:nn {nx} \cs_generate_variant:Nn \keys_set_known:nnN {nx} -\cs_new:Nn \_int_mult_truncate:Nn +\cs_new:Nn \__fontspec_int_mult_truncate:Nn { - \int_set:Nn #1 { \dim_eval:w #2 #1 \dim_eval_end: } + \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: } } -\cs_new:Npn \fontspec_error:n { \msg_error:nn {fontspec} } -\cs_new:Npn \fontspec_error:nx { \msg_error:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:n { \msg_warning:nn {fontspec} } -\cs_new:Npn \fontspec_warning:nx { \msg_warning:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } -\cs_new:Npn \fontspec_info:n { \msg_info:nn {fontspec} } -\cs_new:Npn \fontspec_info:nx { \msg_info:nnx {fontspec} } -\cs_new:Npn \fontspec_info:nxx { \msg_info:nnxx {fontspec} } -\cs_new:Npn \fontspec_trace:n { \msg_trace:nn {fontspec} } +\cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } +\cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:n { \msg_warning:nn {fontspec} } +\cs_new:Npn \__fontspec_warning:nx { \msg_warning:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } +\cs_new:Npn \__fontspec_info:n { \msg_info:nn {fontspec} } +\cs_new:Npn \__fontspec_info:nx { \msg_info:nnx {fontspec} } +\cs_new:Npn \__fontspec_info:nxx { \msg_info:nnxx {fontspec} } +\cs_new:Npn \__fontspec_trace:n { \msg_trace:nn {fontspec} } \msg_new:nnn {fontspec} {no-size-info} { Size~ information~ must~ be~ supplied.\\ @@ -164,13 +164,13 @@ \msg_new:nnn {fontspec} {icu-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~ - for~ ICU~ font~ '\l_fontspec_fontname_tl' + for~ OpenType~ font~ '\l_fontspec_fontname_tl' } \msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} { OpenType~ feature~ '\l_keys_key_tl=\l_keys_value_tl'~ (#1)~ not~ available~ for~ font~ '\l_fontspec_fontname_tl'~ - with~ script~ '\l_fontspec_script_name_tl'~ and~ language~ '\l_fontspec_lang_name_tl'. + with~ script~ '\l__fontspec_script_name_tl'~ and~ language~ '\l__fontspec_lang_name_tl'. } \msg_new:nnn {fontspec} {no-opticals} { @@ -180,7 +180,7 @@ { Language~ '#1'~ not~ available~ for~ font~ '\l_fontspec_fontname_tl'~ - with~ script~ '\l_fontspec_script_name_tl'.\\ + with~ script~ '\l__fontspec_script_name_tl'.\\ 'Default'~ language~ used~ instead. } \msg_new:nnn {fontspec} {only-xetex-feature} @@ -212,7 +212,7 @@ \msg_new:nnn {fontspec} {defining-font} { Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~ - with~ options~ [\g_fontspec_default_fontopts_tl #1].\\ + with~ options~ [\l__fontspec_all_features_clist].\\ \\ This~ font~ family~ consists~ of~ the~ following~ shapes: \l_fontspec_defined_shapes_tl @@ -223,7 +223,7 @@ } \msg_new:nnn {fontspec} {set-scale} { - \l_fontspec_fontname_tl\space scale ~=~ \l_fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale ~=~ \l__fontspec_scale_tl. } \msg_new:nnn {fontspec} {setup-math} { @@ -252,11 +252,11 @@ *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity } \DeclareOption{cm-default} - { \fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool} -\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool} -\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool} -\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool} + { \__fontspec_warning:n {cm-default-obsolete} } +\DeclareOption{math}{\bool_set_true:N \g__fontspec_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g__fontspec_math_bool} +\DeclareOption{config}{\bool_set_true:N \g__fontspec_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g__fontspec_cfg_bool} \DeclareOption{quiet} { \msg_redirect_module:nnn { fontspec } { warning } { info } @@ -273,7 +273,7 @@ \luatex_if_engine:T { \RequirePackage{fontspec-luatex} \endinput } \xetex_if_engine:T { \RequirePackage{fontspec-xetex} \endinput } %% -%% Copyright 2004--2013 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2014 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, |