diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-09 22:44:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-09 22:44:11 +0000 |
commit | cb2b57ca95d65bf9d9d21ec4a0109380f1e50fc0 (patch) | |
tree | 48c9056564b4dba8e32b6d00f7c22cefc3de1a2f /Master | |
parent | 94380fc2b70b1177954ffb6f51328f62ea0d07a8 (diff) |
fontspec (9jan19)
git-svn-id: svn://tug.org/texlive/trunk@49650 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
41 files changed, 3927 insertions, 3739 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md index 52d1b86295f..74daa74118f 100644 --- a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md +++ b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md @@ -1,7 +1,13 @@ Change history ============== -## v2.6i (2018/07/30) +## v2.6j (2019/01/10) + + * Re-sync with `expl3` for deprecated commands. + * Added support for `\hbar` if anyone is relying on `fontspec` to emulate legacy maths. + + +## v2.6i (2018/08/02) * Emergency bug-fix -- a one-char typo broke loading of bold fonts! * Some minor updates to the docs regarding “family names” of fonts. diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf Binary files differindex 74e8f037c45..392eb68a08f 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf Binary files differindex e353bde0765..befb4bbce75 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-api.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx index 079227f9e76..f53477df080 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-api.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-api.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Programmer's interface} % @@ -121,20 +121,18 @@ % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \@@_iv_str_to_num:Nn \l_@@_script_int {#1} - \@@_iv_str_to_num:Nn \l_@@_language_int {#2} - \@@_check_ot_feat:NnTF \font {#3} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \@@_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -145,18 +143,18 @@ % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \@@_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \@@_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -167,22 +165,22 @@ % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl - \int_set:Nn \l_@@_script_int {\l_@@_tmp_tl} - \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl + \int_set:Nn \l_@@_script_int {\l_@@_tmp_tl} + \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl - \@@_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + \@@_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -193,20 +191,18 @@ % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \tl_set:Nn \l_fontspec_script_tl {#1} - \@@_iv_str_to_num:Nn \l_@@_script_int {#1} - \@@_check_lang:NnTF \font {#2} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \@@_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -216,20 +212,20 @@ % OpenType script tag |#1|. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_tmp_tl - \str_if_eq:nVTF {#1} \l_@@_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_tmp_tl + \str_if_eq:nVTF {#1} \l_@@_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -238,20 +234,20 @@ % OpenType language tag |#1|. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \@@_set_font_type:N \font - \bool_if:NTF \l_@@_ot_bool - { - \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_tmp_tl - \str_if_eq:nVTF {#1} \l_@@_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \@@_set_font_type:N \font + \bool_if:NTF \l_@@_ot_bool + { + \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_tmp_tl + \str_if_eq:nVTF {#1} \l_@@_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } % \end{macrocode} % \end{macro} % @@ -273,6 +269,7 @@ { \tl_set:Nn \l_@@_family_label_tl {#1} \@@_select_font_family:nn {#2} {#3} + \tl_clear_new:N #1 \tl_set_eq:NN #1 \l_fontspec_family_tl } % \end{macrocode} @@ -369,7 +366,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-closing.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-closing.dtx index 0434c9fec2c..17fb823eefd 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-closing.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-closing.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> % % \section{Closing code} % @@ -12,11 +12,11 @@ % Now we just want to set up loading the \texttt{.cfg} file, if it exists. % \begin{macrocode} \bool_if:NT \g_@@_cfg_bool - { - \InputIfFileExists{fontspec.cfg} - {} - {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} - } + { + \InputIfFileExists{fontspec.cfg} + {} + { \typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.} } + } % \end{macrocode} % % \iffalse @@ -32,7 +32,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-enc.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-enc.dtx index 7ba6b562a99..fef5d81549d 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-enc.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-enc.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Extended font encodings} % @@ -161,7 +161,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-aat.dtx index 3bb7905cf71..7fc1e382b7a 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-aat.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{AAT feature definitions} % @@ -120,16 +120,16 @@ % \begin{macrocode} \@@_define_aat_feature_group:n { Alternate } \keys_define:nn {fontspec-aat} - { - Alternate .default:n = {0} , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = { - \@@_make_AAT_feature:nn {17}{##1} + \clist_map_inline:nn {#1} + { + \@@_make_AAT_feature:nn {17}{##1} + } } - } - } + } % \end{macrocode} % % @@ -137,14 +137,14 @@ % \begin{macrocode} \@@_define_aat_feature_group:n {Variant} \keys_define:nn {fontspec-aat} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \@@_make_AAT_feature:nn {18}{##1} } - } - } + { + Variant .default:n = {0} , + Variant / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \@@_make_AAT_feature:nn {18}{##1} } + } + } \aliasfontfeature{Variant}{StylisticSet} % \end{macrocode} % @@ -153,14 +153,13 @@ % \begin{macrocode} \@@_define_aat_feature_group:n {Vertical} \keys_define:nn {fontspec-aat} - { - Vertical .choice: , - Vertical / RotatedGlyphs .code:n = - { - \__fontspec_update_featstr:n {vertical} - } - } - + { + Vertical .choice: , + Vertical / RotatedGlyphs .code:n = + { + \__fontspec_update_featstr:n {vertical} + } + } % \end{macrocode} % % @@ -231,7 +230,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx index a91ee8075ff..26a75f91166 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{OpenType feature definitions} % @@ -307,19 +307,28 @@ % \section{OpenType features that need numbering} % % \subsection{Alternate} +% % \begin{macrocode} \@@_define_opentype_feature_group:n {Alternate} \keys_define:nn {fontspec-opentype} - { - Alternate .default:n = {0} , -%<LU> Alternate / Random .code:n = -%<LU> { \@@_make_OT_feature:nnn {salt}{ +salt = random }{} } , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \@@_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } - } - } + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \@@_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } + } + } +% \end{macrocode} +% +% \begin{macrocode} +%<*LU> +\keys_define:nn {fontspec-opentype} + { + Alternate / Random .code:n = + { \@@_make_OT_feature:nnn {salt}{ +salt = random }{} } , + } +%</LU> % \end{macrocode} % % \begin{macrocode} @@ -328,19 +337,20 @@ % % % \subsection{Variant / StylisticSet} +% % \begin{macrocode} \@@_define_opentype_feature_group:n {Variant} \keys_define:nn {fontspec-opentype} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Variant .default:n = {0} , + Variant / unknown .code:n = { - \@@_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + \clist_map_inline:nn {#1} + { + \@@_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + } } - } - } + } % \end{macrocode} % % \begin{macrocode} @@ -351,25 +361,26 @@ % \begin{macrocode} \@@_define_opentype_feature_group:n {CharacterVariant} \use:x - { - \cs_new:Npn \exp_not:N \fontspec_parse_cv:w - ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil - { - \@@_make_OT_feature:xxx - { cv \exp_not:N \two@digits {##1} } { +cv \exp_not:N \two@digits {##1} = ##2 } {} - } - \keys_define:nn {fontspec-opentype} - { - CharacterVariant / unknown .code:n = - { - \clist_map_inline:nn {##1} - { - \exp_not:N \fontspec_parse_cv:w - ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil - } - } - } - } + { + \cs_new:Npn \exp_not:N \fontspec_parse_cv:w + ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil + { + \@@_make_OT_feature:xxx + { cv \exp_not:N \two@digits {##1} } + { +cv \exp_not:N \two@digits {##1} = ##2 } {} + } + \keys_define:nn {fontspec-opentype} + { + CharacterVariant / unknown .code:n = + { + \clist_map_inline:nn {##1} + { + \exp_not:N \fontspec_parse_cv:w + ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil + } + } + } + } % \end{macrocode} % Possibilities: \verb|a:0:\q_nil| or \verb|a:b:0:\q_nil|. % @@ -378,13 +389,13 @@ % \begin{macrocode} \@@_define_opentype_feature_group:n {Annotation} \keys_define:nn {fontspec-opentype} - { - Annotation .default:n = {0} , - Annotation / unknown .code:n = - { - \@@_make_OT_feature:nnn {nalt} {+nalt=#1} {} - } - } + { + Annotation .default:n = {0} , + Annotation / unknown .code:n = + { + \@@_make_OT_feature:nnn {nalt} {+nalt=#1} {} + } + } % \end{macrocode} % % \subsection{Ornament} @@ -392,13 +403,13 @@ % \begin{macrocode} \@@_define_opentype_feature_group:n {Ornament} \keys_define:nn {fontspec-opentype} - { - Ornament .default:n = {0} , - Ornament / unknown .code:n = - { - \@@_make_OT_feature:nnn {ornm} { +ornm=#1 } {} - } - } + { + Ornament .default:n = {0} , + Ornament / unknown .code:n = + { + \@@_make_OT_feature:nnn {ornm} { +ornm=#1 } {} + } + } % \end{macrocode} % % @@ -410,41 +421,41 @@ % \begin{macrocode} \keys_define:nn { fontspec-opentype } { Script .choice: } \cs_new:Nn \fontspec_new_script:nn - { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = - \bool_set_false:N \l_@@_script_exist_bool - \clist_map_inline:nn {#2} - { - \@@_check_script:NnTF \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l_@@_script_int {\l_@@_strnum_int} - \bool_set_true:N \l_@@_script_exist_bool - \tl_gset:Nx \g_@@_single_feat_tl { script=####1 } - \clist_map_break: - } - { } - } - \bool_if:NF \l_@@_script_exist_bool - { - \str_if_eq:nnTF {#1} {Latin} - { - \@@_warning:nx {script-not-exist} {#1} - } - { - \@@_check_script:NnTF \l_fontspec_font {latn} - { - \@@_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l_@@_script_int {\l_@@_strnum_int} - } - { - \@@_warning:nx {script-not-exist} {#1} - } - } - } - } - } + { + \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \bool_set_false:N \l_@@_script_exist_bool + \clist_map_inline:nn {#2} + { + \@@_check_script:NnTF \l_fontspec_font {####1} + { + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l_@@_script_int {\l_@@_strnum_int} + \bool_set_true:N \l_@@_script_exist_bool + \tl_gset:Nx \g_@@_single_feat_tl { script=####1 } + \clist_map_break: + } + { } + } + \bool_if:NF \l_@@_script_exist_bool + { + \str_if_eq:nnTF {#1} {Latin} + { + \@@_warning:nx {script-not-exist} {#1} + } + { + \@@_check_script:NnTF \l_fontspec_font {latn} + { + \@@_warning:nx {script-not-exist-latn} {#1} + \tl_set:Nn \l_fontspec_script_tl {latn} + \int_set:Nn \l_@@_script_int {\l_@@_strnum_int} + } + { + \@@_warning:nx {script-not-exist} {#1} + } + } + } + } + } % \end{macrocode} % % @@ -453,63 +464,65 @@ % \begin{macrocode} \keys_define:nn { fontspec-opentype } { Language .choice: } \cs_new:Nn \fontspec_new_lang:nn - { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = - \@@_check_lang:NnTF \l_fontspec_font {#2} - { - \tl_set:Nn \l_fontspec_lang_tl {#2} - \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} - \tl_gset:Nx \g_@@_single_feat_tl { language=#2 } - } - { - \@@_warning:nx {language-not-exist} {#1} - \keys_set:nn { fontspec-opentype } { Language = Default } - } + { + \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \@@_check_lang:NnTF \l_fontspec_font {#2} + { + \tl_set:Nn \l_fontspec_lang_tl {#2} + \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} + \tl_gset:Nx \g_@@_single_feat_tl { language=#2 } + } + { + \@@_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec-opentype } { Language = Default } + } + } } - } % \end{macrocode} % % \paragraph{Default} % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-opentype}{ Language / Default } - { - \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \int_zero:N \l_@@_language_int - \tl_gset:Nn \g_@@_single_feat_tl { language=DFLT } - } + { + \tl_set:Nn \l_fontspec_lang_tl {DFLT} + \int_zero:N \l_@@_language_int + \tl_gset:Nn \g_@@_single_feat_tl { language=DFLT } + } % \end{macrocode} % % \paragraph{Turkish} Turns out that many fonts use `TUR' as their Turkish language tag rather than the specified `TRK'. So we check for both: % \begin{macrocode} \keys_define:nn {fontspec-opentype} - { - Language / Turkish .code:n = - { - \@@_check_lang:NnTF \l_fontspec_font {TRK} - { - \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TRK} - \tl_gset:Nn \g_@@_single_feat_tl { language=TRK } - } - { - \@@_check_lang:NnTF \l_fontspec_font {TUR} - { - \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TUR} - \tl_gset:Nn \g_@@_single_feat_tl { language=TUR } - } - { - \@@_warning:nx {language-not-exist} {Turkish} - \keys_set:nn {fontspec-opentype} {Language=Default} - } - } - } - } + { + Language / Turkish .code:n = + { + \@@_check_lang:NnTF \l_fontspec_font {TRK} + { + \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TRK} + \tl_gset:Nn \g_@@_single_feat_tl { language=TRK } + } + { + \@@_check_lang:NnTF \l_fontspec_font {TUR} + { + \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TUR} + \tl_gset:Nn \g_@@_single_feat_tl { language=TUR } + } + { + \@@_warning:nx {language-not-exist} {Turkish} + \keys_set:nn {fontspec-opentype} {Language=Default} + } + } + } + } % \end{macrocode} +% TODO: generalise the above +% % % \section{Backwards compatibility} -% Backwards compatibility: +% % \begin{macrocode} \cs_new:Nn \@@_ot_compat:nn { @@ -547,7 +560,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx index 41981f3814d..be5155de476 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{expl3 interface for primitive font loading} % @@ -27,7 +27,7 @@ % \begin{macrocode} \cs_set:Npn \@@_font_suppress_not_found_error: { - \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one + \int_set:Nn \suppressfontnotfounderror {1} } % \end{macrocode} % \end{macro} @@ -63,7 +63,7 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_primitive_font_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 #2 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -93,7 +93,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-graphite.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx index 1ab63f684ac..bb99c2a8870 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-graphite.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Graphite/AAT code} % @@ -13,36 +13,40 @@ % \begin{macro}{\@@_define_aat_feature_group:n} % \begin{macrocode} \cs_new:Nn \@@_define_aat_feature_group:n - { \keys_define:nn {fontspec-aat} { #1 .multichoice: } } + { + \keys_define:nn {fontspec-aat} { #1 .multichoice: } + } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_define_aat_feature:nnnn} % \begin{macrocode} \cs_new:Nn \@@_define_aat_feature:nnnn - { - \keys_define:nn {fontspec-aat} - { - #1/#2 .code:n = { \@@_make_AAT_feature:nn {#3}{#4} } - } - } + { + \keys_define:nn {fontspec-aat} + { + #1/#2 .code:n = { \@@_make_AAT_feature:nn {#3}{#4} } + } + } % \end{macrocode} % \end{macro} % \begin{macro}{\@@_make_AAT_feature:nn} % \begin{macrocode} \cs_new:Nn \@@_make_AAT_feature:nn - { - \tl_if_empty:nTF {#1} - { \@@_warning:n {aat-feature-not-exist} } - { - \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + { + \tl_if_empty:nTF {#1} + { \@@_warning:n {aat-feature-not-exist} } { - \@@_update_featstr:n {\l_fontspec_feature_string_tl} - } - { \@@_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } - } - } + \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + { + \@@_update_featstr:n {\l_fontspec_feature_string_tl} + } + { + \@@_warning:nx {aat-feature-not-exist-in-font} {#1,#2} + } + } + } % \end{macrocode} % \end{macro} % @@ -65,36 +69,37 @@ % Finally, save out the complete feature string in \cmd\l_fontspec_feature_string_tl. % \begin{macrocode} \prg_new_conditional:Nnn \@@_make_AAT_feature_string:Nnn {TF,T,F} - { - \tl_set:Nx \l_@@_tmpa_tl { \XeTeXfeaturename #1 #2 } - \tl_if_empty:NTF \l_@@_tmpa_tl - { \prg_return_false: } - { - \int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 } - { - \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} - } - { - \int_if_even:nTF {#3} - { - \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} - } - { - \tl_set:Nx \l_@@_tmpb_tl - { - \XeTeXselectorname #1 #2\space \numexpr#3-1\relax - } - \tl_if_empty:NF \l_@@_tmpb_tl { \tl_put_left:Nn \l_@@_tmpb_tl {!} } - } - } - \tl_if_empty:NTF \l_@@_tmpb_tl - { \prg_return_false: } - { - \tl_set:Nx \l_fontspec_feature_string_tl { \l_@@_tmpa_tl = \l_@@_tmpb_tl } - \prg_return_true: + { + \tl_set:Nx \l_@@_tmpa_tl { \XeTeXfeaturename #1 #2 } + \tl_if_empty:NTF \l_@@_tmpa_tl + { \prg_return_false: } + { + \int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 } + { + \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} + } + { + \int_if_even:nTF {#3} + { + \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} + } + { + \tl_set:Nx \l_@@_tmpb_tl + { + \XeTeXselectorname #1 #2\space \numexpr#3-1\relax + } + \tl_if_empty:NF \l_@@_tmpb_tl { \tl_put_left:Nn \l_@@_tmpb_tl {!} } + } + } + + \tl_if_empty:NTF \l_@@_tmpb_tl + { \prg_return_false: } + { + \tl_set:Nx \l_fontspec_feature_string_tl { \l_@@_tmpa_tl = \l_@@_tmpb_tl } + \prg_return_true: + } } - } - } + } % \end{macrocode} % \end{macro} % @@ -111,7 +116,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-interfaces.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx index 10449bf5e3b..58979626f38 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-interfaces.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{User commands}\label{sec:codeuser} % @@ -234,7 +234,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx index d115aa648d1..a8d8c49763c 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Internals} % @@ -31,47 +31,47 @@ % \end{itemize} % \begin{macrocode} \cs_new_protected:Nn \@@_select_font_family:nn - { + { %<debug>\typeout{^^J^^J::::::::::::::::::::::::::::::^^J:: fontspec_select:nn~ {#1}~ {#2} } - \group_begin: - \@@_font_suppress_not_found_error: - \@@_init: + \group_begin: + \@@_font_suppress_not_found_error: + \@@_init: - \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2} - \@@_sanitise_fontname:Nn \l_@@_basename_tl {#2} + \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} + \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2} + \@@_sanitise_fontname:Nn \l_@@_basename_tl {#2} - \@@_if_detect_external:nT {#2} - { \keys_set:nn {fontspec-preparse-external} {Path} } + \@@_if_detect_external:nT {#2} + { \keys_set:nn {fontspec-preparse-external} {Path} } - \keys_set_known:nn {fontspec-preparse-cfg} {#1} + \keys_set_known:nn {fontspec-preparse-cfg} {#1} - \@@_init_ttc:n {#2} - \@@_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} + \@@_init_ttc:n {#2} + \@@_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} - \@@_extract_all_features:n {#1} - \tl_set:Nx \l_@@_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l_@@_all_features_clist } + \@@_extract_all_features:n {#1} + \tl_set:Nx \l_@@_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l_@@_all_features_clist } %<debug>\typeout{fontid: \l_@@_fontid_tl} - \@@_preparse_features: - \@@_load_font: - \@@_set_scriptlang: - \@@_get_features:n {} - \bool_set_false:N \l_@@_firsttime_bool + \@@_preparse_features: + \@@_load_font: + \@@_set_scriptlang: + \@@_get_features:n {} + \bool_set_false:N \l_@@_firsttime_bool - \@@_save_family_needed:nTF {#2} - { - \@@_save_family:nn {#1} {#2} -%<debug> \@@_warning:nxx {defining-font} {#1} {#2} - } - { -%<debug> \typeout{Font~ family~ already~ defined.} - } - \group_end: + \@@_save_family_needed:nTF {#2} + { + \@@_save_family:nn {#1} {#2} +%<debug>\@@_warning:nxx {defining-font} {#1} {#2} + } + { +%<debug>\typeout{Font~ family~ already~ defined.} + } + \group_end: - \tl_set_eq:NN \l_fontspec_family_tl \g_@@_nfss_family_tl - } + \tl_set_eq:NN \l_fontspec_family_tl \g_@@_nfss_family_tl + } % \end{macrocode} % \end{macro} % @@ -88,19 +88,19 @@ % At one stage this also lowercased the name, but this step has been removed unless someone can remind me why it was necessary. % \begin{macrocode} \cs_new:Nn \@@_sanitise_fontname:Nn - { - \tl_set:Nx #1 {#2} + { + \tl_set:Nx #1 {#2} %<LU> \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_@@_extensions_clist - { - \tl_if_in:NnT #1 {##1} - { - \tl_remove_once:Nn #1 {##1} - \tl_set:Nn \l_@@_extension_tl {##1} - \clist_map_break: - } - } - } + \clist_map_inline:Nn \l_@@_extensions_clist + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \tl_set:Nn \l_@@_extension_tl {##1} + \clist_map_break: + } + } + } % \end{macrocode} % \end{macro} % @@ -108,17 +108,17 @@ % Check if either the fontname ends with a known font extension. % \begin{macrocode} \prg_new_conditional:Nnn \@@_if_detect_external:n {T} - { + { %<debug> \typeout{:: @@_if_detect_external:n { \exp_not:n {#1} } } - \clist_map_inline:Nn \l_@@_extensions_clist - { - \bool_set_false:N \l_@@_tmpa_bool - \exp_args:Nx % <- this should be handled earlier - \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_@@_tmpa_bool \clist_map_break: } - } - \bool_if:NTF \l_@@_tmpa_bool \prg_return_true: \prg_return_false: - } + \clist_map_inline:Nn \l_@@_extensions_clist + { + \bool_set_false:N \l_@@_tmpa_bool + \exp_args:Nx % <- this should be handled earlier + \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} + { \bool_set_true:N \l_@@_tmpa_bool \clist_map_break: } + } + \bool_if:NTF \l_@@_tmpa_bool \prg_return_true: \prg_return_false: + } % \end{macrocode} % \end{macro} % @@ -127,14 +127,14 @@ % so prepopulate the fontnames to avoid needing to do it manually. % \begin{macrocode} \cs_new:Nn \@@_init_ttc:n - { - \str_if_eq_x:nnT { \str_lower_case:f {\l_@@_extension_tl} } {.ttc} - { - \@@_sanitise_fontname:Nn \l_@@_fontname_it_tl {#1} - \@@_sanitise_fontname:Nn \l_@@_fontname_bf_tl {#1} - \@@_sanitise_fontname:Nn \l_@@_fontname_bfit_tl {#1} - } - } + { + \str_if_eq:eeT { \str_lower_case:f {\l_@@_extension_tl} } {.ttc} + { + \@@_sanitise_fontname:Nn \l_@@_fontname_it_tl {#1} + \@@_sanitise_fontname:Nn \l_@@_fontname_bf_tl {#1} + \@@_sanitise_fontname:Nn \l_@@_fontname_bfit_tl {#1} + } + } % \end{macrocode} % \end{macro} % @@ -163,29 +163,29 @@ % \begin{macro}{\@@_extract_all_features:} % \begin{macrocode} \cs_new:Nn \@@_extract_all_features:n - { + { %<debug> \typeout{:: @@_extract_all_features:n { \unexpanded {#1} } } - \bool_if:NTF \l_@@_disable_defaults_bool - { - \clist_set:Nx \l_@@_all_features_clist {#1} - } - { - \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_tl \l_@@_fontopts_clist - { \clist_clear:N \l_@@_fontopts_clist } + \bool_if:NTF \l_@@_disable_defaults_bool + { + \clist_set:Nx \l_@@_all_features_clist {#1} + } + { + \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_tl \l_@@_fontopts_clist + { \clist_clear:N \l_@@_fontopts_clist } - \prop_get:NVNF \g_@@_fontopts_prop \l_@@_family_label_tl \l_@@_family_fontopts_clist - { \clist_clear:N \l_@@_family_fontopts_clist } - \tl_clear:N \l_@@_family_label_tl + \prop_get:NVNF \g_@@_fontopts_prop \l_@@_family_label_tl \l_@@_family_fontopts_clist + { \clist_clear:N \l_@@_family_fontopts_clist } + \tl_clear:N \l_@@_family_label_tl - \clist_set:Nx \l_@@_all_features_clist - { - \g_@@_default_fontopts_clist, - \l_@@_family_fontopts_clist, - \l_@@_fontopts_clist, - #1 - } - } - } + \clist_set:Nx \l_@@_all_features_clist + { + \g_@@_default_fontopts_clist, + \l_@@_family_fontopts_clist, + \l_@@_fontopts_clist, + #1 + } + } + } % \end{macrocode} % \end{macro} % @@ -200,46 +200,46 @@ % information is extracted for the names of the other shape fonts. % \begin{macrocode} \cs_new:Nn \@@_preparse_features: - { + { %<debug> \typeout{:: @@_preparse_features:} % \end{macrocode} % Detect if external fonts are to be used, possibly automatically, and % parse fontspec features for bold/italic fonts and their features. % \begin{macrocode} - \@@_keys_set_known:nxN {fontspec-preparse-external} - { \l_@@_all_features_clist } - \l_@@_keys_leftover_clist + \@@_keys_set_known:nxN {fontspec-preparse-external} + { \l_@@_all_features_clist } + \l_@@_keys_leftover_clist % \end{macrocode} % When \cmd{\l_fontspec_fontname_tl} is augmented with a prefix or whatever to create % the name of the upright font (\cmd{\l_@@_fontname_up_tl}), this latter is the new `general % font name' to use. % \begin{macrocode} - \tl_set_eq:NN \l_fontspec_fontname_tl \l_@@_fontname_up_tl - \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_keys_leftover_clist} - \l_@@_keys_leftover_clist - \@@_keys_set_known:nxN {fontspec-preparse} {\l_@@_keys_leftover_clist} - \l_@@_fontfeat_clist - } + \tl_set_eq:NN \l_fontspec_fontname_tl \l_@@_fontname_up_tl + \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_keys_leftover_clist} + \l_@@_keys_leftover_clist + \@@_keys_set_known:nxN {fontspec-preparse} {\l_@@_keys_leftover_clist} + \l_@@_fontfeat_clist + } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_load_font:} % \begin{macrocode} \cs_new:Nn \@@_load_font: - { + { %<debug>\typeout{:: @@_load_font} %<debug>\typeout{Set~ base~ font~ for~ preliminary~ analysis: \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } - \@@_primitive_font_set:Nnn \l_fontspec_font - { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } {\f@size pt} - \@@_primitive_font_if_null:NT \l_fontspec_font { \@@_error:nx {font-not-found} {\l_@@_fontname_up_tl} } - \@@_set_font_type:N \l_fontspec_font + \@@_primitive_font_set:Nnn \l_fontspec_font + { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } {\f@size pt} + \@@_primitive_font_if_null:NT \l_fontspec_font { \@@_error:nx {font-not-found} {\l_@@_fontname_up_tl} } + \@@_set_font_type:N \l_fontspec_font %<debug>\typeout{Set~ base~ font~ properly: \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } - \@@_primitive_font_gset:Nnn \l_fontspec_font - { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - } + \@@_primitive_font_gset:Nnn \l_fontspec_font + { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } {\f@size pt} + \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly + } % \end{macrocode} % \end{macro} % @@ -254,25 +254,25 @@ % We check if \meta{Font features} are empty and if so don't add in the separator colon. % \begin{macrocode} \cs_new:Nn \@@_construct_font_call:nnnnnn - { + { %<XE> " \@@_fontname_wrap:n { #1 #2 #3 } %<LU> " \@@_fontname_wrap:n { #1 #2 } #3 #4 #5 - \str_if_eq_x:nnF {#6}{} {:#6} " - } + \str_if_eq:eeF {#6}{} {:#6} " + } % \end{macrocode} % In practice, we don't use the six-argument version, since most arguments are constructed on-the-fly: % \begin{macrocode} \cs_new:Nn \@@_construct_font_call:nn - { - \@@_construct_font_call:nnnnnn - {#1} - \l_@@_extension_tl - \l_@@_ttc_index_tl - \l_fontspec_renderer_tl - \l_@@_optical_size_tl - {#2} - } + { + \@@_construct_font_call:nnnnnn + {#1} + \l_@@_extension_tl + \l_@@_ttc_index_tl + \l_fontspec_renderer_tl + \l_@@_optical_size_tl + {#2} + } % \end{macrocode} % \end{macro} % @@ -284,6 +284,9 @@ { \cs_set_eq:NN \@@_fontname_wrap:n \use:n } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Nn \@@_font_is_file: { \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] } @@ -297,35 +300,40 @@ % none are explicitly requested. Similarly with the language settings. % \begin{macrocode} \cs_new:Nn \@@_set_scriptlang: - { - \bool_if:NT \l_@@_firsttime_bool - { - \tl_if_empty:NTF \l_@@_script_name_tl - { - \@@_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l_@@_script_name_tl {Latin} - \tl_if_empty:NT \l_@@_lang_name_tl - { - \tl_set:Nn \l_@@_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} - } - { - \@@_info:n {no-scripts} - } - } - { - \tl_if_empty:NT \l_@@_lang_name_tl - { - \tl_set:Nn \l_@@_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} - } - } - } + { +%<debug> \typeout{:: _set_scriptlang:} + \bool_if:NT \l_@@_firsttime_bool + { + \tl_if_empty:NTF \l_@@_script_name_tl + { + \@@_check_script:NnTF \l_fontspec_font {latn} + { + \tl_set:Nn \l_@@_script_name_tl {Latin} + \tl_if_empty:NT \l_@@_lang_name_tl + { + \tl_set:Nn \l_@@_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} +%<debug> \typeout{:::: Script=\l_@@_script_name_tl, Language=\l_@@_lang_name_tl} + } + { +%<debug> \typeout{:::: NADA} + \@@_info:n {no-scripts} + \bool_set_true:N \l_@@_never_check_bool + } + } + { + \tl_if_empty:NT \l_@@_lang_name_tl + { + \tl_set:Nn \l_@@_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} +%<debug> \typeout{:::: Script=\l_@@_script_name_tl, Language=\l_@@_lang_name_tl} + } + } + } % \end{macrocode} % \end{macro} % @@ -340,38 +348,36 @@ % specials) will not work. % \begin{macrocode} \cs_new:Nn \@@_get_features:n - { + { %<debug> \typeout{:: @@_get_features:Nn { \exp_not:n {#1} } } - \@@_init_fontface: - \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#1} - \l_@@_keys_leftover_clist - \@@_keys_set_known:nxN {fontspec} {\l_@@_keys_leftover_clist} \l_@@_keys_leftover_clist + \@@_init_fontface: + \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#1} + \l_@@_keys_leftover_clist + \@@_keys_set_known:nxN {fontspec} {\l_@@_keys_leftover_clist} \l_@@_keys_leftover_clist %<*XE> - \bool_if:NTF \l_@@_ot_bool - { + \bool_if:NTF \l_@@_ot_bool + { %<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"} - % \tracingall - \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist - % \EROROR - } - { + \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist + } + { %<debug> \typeout{::: Setting~ keys~ for~ AAT/Graphite~ font~ features:~"\l_@@_keys_leftover_clist"} - \bool_if:nT { \l_@@_atsui_bool || \l_@@_graphite_bool } - { \keys_set:nV {fontspec-aat} \l_@@_keys_leftover_clist } - } + \bool_if:nT { \l_@@_atsui_bool || \l_@@_graphite_bool } + { \keys_set:nV {fontspec-aat} \l_@@_keys_leftover_clist } + } %</XE> %<*LU> %<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"} - \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist + \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist %</LU> - \tl_if_empty:NF \l_@@_mapping_tl - { \@@_update_featstr:n { mapping = \l_@@_mapping_tl } } + \tl_if_empty:NF \l_@@_mapping_tl + { \@@_update_featstr:n { mapping = \l_@@_mapping_tl } } - \str_if_eq_x:nnF { \l_@@_hexcol_tl \l_@@_opacity_tl } - { \c_@@_hexcol_tl \c_@@_opacity_tl } - { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } } - } + \str_if_eq:eeF { \l_@@_hexcol_tl \l_@@_opacity_tl } + { \c_@@_hexcol_tl \c_@@_opacity_tl } + { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } } + } % \end{macrocode} % \end{macro} % @@ -412,6 +418,8 @@ \prg_return_true: } } +% \end{macrocode} +% \begin{macrocode} \cs_new:Nn \@@_save_fontid_family:nn { \prop_get:NnNTF \g_@@_family_int_prop {#2} \l_@@_tmp_tl @@ -446,20 +454,20 @@ % Saves the relevant font information for future processing. % \begin{macrocode} \cs_new:Nn \@@_save_fontinfo:n - { - \prop_new:c {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} - \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontname} { #1 } - \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {options} { \l_@@_all_features_clist } - \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef} - { - \@@_construct_font_call:nn {\l_fontspec_fontname_tl} - { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } - } - \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-num} \l_@@_script_int - \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-num} \l_@@_language_int - \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - } + { + \prop_new:c {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} + \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontname} { #1 } + \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {options} { \l_@@_all_features_clist } + \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef} + { + \@@_construct_font_call:nn {\l_fontspec_fontname_tl} + { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } + } + \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-num} \l_@@_script_int + \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-num} \l_@@_language_int + \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } % \end{macrocode} % \end{macro} % @@ -477,47 +485,50 @@ % \begin{macro}{\@@_find_autofonts:} % \begin{macrocode} \cs_new:Nn \@@_find_autofonts: - { - \bool_if:nF {\l_@@_noit_bool || \l_@@_nobf_bool} - { - \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_it_tl} {/B} - \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_bf_tl} {/I} - \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} - } + { + \bool_if:nF {\l_@@_noit_bool || \l_@@_nobf_bool} + { + \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_it_tl} {/B} + \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_bf_tl} {/I} + \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} + } - \bool_if:NF \l_@@_nobf_bool - { - \@@_set_autofont:Nnn \l_@@_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} - } + \bool_if:NF \l_@@_nobf_bool + { + \@@_set_autofont:Nnn \l_@@_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + } - \bool_if:NF \l_@@_noit_bool - { - \@@_set_autofont:Nnn \l_@@_fontname_it_tl {\l_fontspec_fontname_tl} {/I} - } + \bool_if:NF \l_@@_noit_bool + { + \@@_set_autofont:Nnn \l_@@_fontname_it_tl {\l_fontspec_fontname_tl} {/I} + } - \@@_set_autofont:Nnn \l_@@_fontname_bfsl_tl {\l_@@_fontname_sl_tl} {/B} - } + \@@_set_autofont:Nnn \l_@@_fontname_bfsl_tl {\l_@@_fontname_sl_tl} {/B} + } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_set_faces:} % \begin{macrocode} \cs_new:Nn \@@_set_faces: - { - \@@_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l_@@_fontfeat_up_clist - \@@_add_nfssfont:nnnn \bfdefault \updefault \l_@@_fontname_bf_tl \l_@@_fontfeat_bf_clist - \@@_add_nfssfont:nnnn \mddefault \itdefault \l_@@_fontname_it_tl \l_@@_fontfeat_it_clist - \@@_add_nfssfont:nnnn \mddefault \sldefault \l_@@_fontname_sl_tl \l_@@_fontfeat_sl_clist - \@@_add_nfssfont:nnnn \bfdefault \itdefault \l_@@_fontname_bfit_tl \l_@@_fontfeat_bfit_clist - \@@_add_nfssfont:nnnn \bfdefault \sldefault \l_@@_fontname_bfsl_tl \l_@@_fontfeat_bfsl_clist + { + \@@_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l_@@_fontfeat_up_clist + \@@_add_nfssfont:nnnn \bfdefault \updefault \l_@@_fontname_bf_tl \l_@@_fontfeat_bf_clist + \@@_add_nfssfont:nnnn \mddefault \itdefault \l_@@_fontname_it_tl \l_@@_fontfeat_it_clist + \@@_add_nfssfont:nnnn \mddefault \sldefault \l_@@_fontname_sl_tl \l_@@_fontfeat_sl_clist + \@@_add_nfssfont:nnnn \bfdefault \itdefault \l_@@_fontname_bfit_tl \l_@@_fontfeat_bfit_clist + \@@_add_nfssfont:nnnn \bfdefault \sldefault \l_@@_fontname_bfsl_tl \l_@@_fontfeat_bfsl_clist - \prop_map_inline:Nn \l_@@_nfssfont_prop { \@@_set_faces_aux:nnnnn ##2 } - } + \prop_map_inline:Nn \l_@@_nfssfont_prop { \@@_set_faces_aux:nnnnn ##2 } + } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Nn \@@_set_faces_aux:nnnnn - { - \fontspec_complete_fontname:Nn \l_@@_curr_fontname_tl {#3} - \@@_make_font_shapes:Nnnnn \l_@@_curr_fontname_tl {#1} {#2} {#4} {#5} - } + { + \fontspec_complete_fontname:Nn \l_@@_curr_fontname_tl {#3} + \@@_make_font_shapes:Nnnnn \l_@@_curr_fontname_tl {#1} {#2} {#4} {#5} + } % \end{macrocode} % \end{macro} % @@ -527,11 +538,11 @@ % (``\texttt{Baskerville Semibold}'') or in abbreviation (``\texttt{* Semibold}''). % \begin{macrocode} \cs_new:Nn \fontspec_complete_fontname:Nn - { - \tl_set:Nx #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_@@_basename_tl} + { + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l_@@_basename_tl} %<LU> \tl_remove_all:Nn #1 {~} - } + } % \end{macrocode} % \end{macro} % @@ -542,19 +553,19 @@ % \darg{fontspec features} % \begin{macrocode} \cs_new:Nn \@@_add_nfssfont:nnnn - { - \tl_set:Nx \l_@@_this_font_tl {#3} + { + \tl_set:Nx \l_@@_this_font_tl {#3} - \tl_if_empty:xTF {#4} - { \clist_set:Nn \l_@@_sizefeat_clist {Size={-}} } - { \@@_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l_@@_tmp_tl } + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l_@@_sizefeat_clist {Size={-}} } + { \@@_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l_@@_tmp_tl } - \tl_if_empty:NF \l_@@_this_font_tl - { - \prop_put:Nxx \l_@@_nfssfont_prop {#1/#2} - { {#1}{#2}{\l_@@_this_font_tl}{#4}{\l_@@_sizefeat_clist} } - } - } + \tl_if_empty:NF \l_@@_this_font_tl + { + \prop_put:Nxx \l_@@_nfssfont_prop {#1/#2} + { {#1}{#2}{\l_@@_this_font_tl}{#4}{\l_@@_sizefeat_clist} } + } + } % \end{macrocode} % \end{macro} % @@ -571,29 +582,34 @@ % Multiple Master), respectively. % \begin{macrocode} \cs_new:Nn \@@_set_font_type:N - { + { %<debug> \typeout{:: @@_set_font_type:} %<*XE> - \bool_set_false:N \l_@@_tfm_bool - \bool_set_false:N \l_@@_atsui_bool - \bool_set_false:N \l_@@_ot_bool - \bool_set_false:N \l_@@_mm_bool - \bool_set_false:N \l_@@_graphite_bool - \ifcase\XeTeXfonttype #1 - \bool_set_true:N \l_@@_tfm_bool - \or - \bool_set_true:N \l_@@_atsui_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } - \ifnum\XeTeXcountvariations #1 > \c_zero - \bool_set_true:N \l_@@_mm_bool - \fi - \or - \bool_set_true:N \l_@@_ot_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } - \or - \bool_set_true:N \l_@@_graphite_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} } - \fi + \bool_set_false:N \l_@@_tfm_bool + \bool_set_false:N \l_@@_atsui_bool + \bool_set_false:N \l_@@_ot_bool + \bool_set_false:N \l_@@_mm_bool + \bool_set_false:N \l_@@_graphite_bool + \ifcase\XeTeXfonttype #1 +%<debug> \typeout{:::: TFM} + \bool_set_true:N \l_@@_tfm_bool + \or +%<debug> \typeout{:::: AAT} + \bool_set_true:N \l_@@_atsui_bool + \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } + \ifnum\XeTeXcountvariations #1 > 0\relax +%<debug> \typeout{:::: MM} + \bool_set_true:N \l_@@_mm_bool + \fi + \or +%<debug> \typeout{:::: OpenType} + \bool_set_true:N \l_@@_ot_bool + \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } + \or +%<debug> \typeout{:::: Graphite} + \bool_set_true:N \l_@@_graphite_bool + \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} } + \fi %</XE> % \end{macrocode} % If automatic, the \cmd{\l_fontspec_renderer_tl} token list will still be @@ -604,9 +620,9 @@ % LuaTeX only supports one: % \begin{macrocode} %<*LU> - \bool_set_true:N \l_@@_ot_bool + \bool_set_true:N \l_@@_ot_bool %</LU> - } + } % \end{macrocode} % \end{macro} % @@ -626,29 +642,31 @@ % Otherwise, we have a match. % \begin{macrocode} \cs_new:Nn \@@_set_autofont:Nnn - { - \bool_if:NF \l_@@_external_bool - { - \tl_if_empty:xF {#2} - { - \tl_if_empty:NT #1 - { - \@@_if_autofont:nnTF {#2} {#3} - { \tl_set:Nx #1 {#2#3} } - { \@@_info:nx {no-font-shape} {#2#3} } - } - } - } - } - + { + \bool_if:NF \l_@@_external_bool + { + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \@@_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \@@_info:nx {no-font-shape} {#2#3} } + } + } + } + } +% \end{macrocode} +% +% \begin{macrocode} \prg_new_conditional:Nnn \@@_if_autofont:nn {T,TF} - { - \@@_primitive_font_set:Nnn \l_tmpa_font { \@@_construct_font_call:nn {#1} {} } {\f@size pt} - \@@_primitive_font_set:Nnn \l_tmpb_font { \@@_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } - } + { + \@@_primitive_font_set:Nnn \l_tmpa_font { \@@_construct_font_call:nn {#1} {} } {\f@size pt} + \@@_primitive_font_set:Nnn \l_tmpb_font { \@@_construct_font_call:nn {#1#2} {} } {\f@size pt} + \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } + } % \end{macrocode} % \end{macro} % @@ -662,24 +680,26 @@ % question. % \begin{macrocode} \cs_new:Nn \@@_make_font_shapes:Nnnnn - { - \group_begin: - \@@_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l_@@_leftover_clist - \@@_load_fontname:n {#1} - \@@_declare_shape:nnxx {#2} {#3} { \l_@@_fontopts_clist, \l_@@_leftover_clist } {#5} - \group_end: - } - + { + \group_begin: + \@@_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l_@@_leftover_clist + \@@_load_fontname:n {#1} + \@@_declare_shape:nnxx {#2} {#3} { \l_@@_fontopts_clist, \l_@@_leftover_clist } {#5} + \group_end: + } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Nn \@@_load_fontname:n - { + { %<debug> \typeout{:: @@_load_fontname:n {#1} } \@@_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_tl \l_@@_fontopts_clist - { \clist_clear:N \l_@@_fontopts_clist } + { \clist_clear:N \l_@@_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l_@@_fontopts_clist \@@_primitive_font_set:Nnn \l_fontspec_font { \@@_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} \@@_primitive_font_if_null:NT \l_fontspec_font { \@@_error:nx {font-not-found} {#1} } - } + } % \end{macrocode} % % \begin{macrocode} @@ -705,19 +725,22 @@ % {\par\centering |SizeFeatures={{<one>},{<two>},{<three>}}|.\par} % \begin{macrocode} \cs_new:Nn \@@_declare_shape:nnnn - { + { %<debug>\typeout{=~ declare_shape:~{\l_fontspec_fontname_tl}~{#1}~{#2}} - \tl_clear:N \l_@@_nfss_tl - \tl_clear:N \l_@@_nfss_sc_tl - \tl_set_eq:NN \l_@@_saved_fontname_tl \l_fontspec_fontname_tl + \tl_clear:N \l_@@_nfss_tl + \tl_clear:N \l_@@_nfss_sc_tl + \tl_set_eq:NN \l_@@_saved_fontname_tl \l_fontspec_fontname_tl - \exp_args:Nx \clist_map_inline:nn {#4} { \@@_setup_single_size:nn {#3} {##1} } + \exp_args:Nx \clist_map_inline:nn {#4} { \@@_setup_single_size:nn {#3} {##1} } - \@@_declare_shapes_normal:nn {#1} {#2} - \@@_declare_shapes_smcaps:nn {#1} {#2} - \@@_declare_shape_slanted:nn {#1} {#2} - \@@_declare_shape_loginfo:nn {#1} {#2} - } + \@@_declare_shapes_normal:nn {#1} {#2} + \@@_declare_shapes_smcaps:nn {#1} {#2} + \@@_declare_shape_slanted:nn {#1} {#2} + \@@_declare_shape_loginfo:nn {#1} {#2} + } +% \end{macrocode} +% +% \begin{macrocode} \cs_generate_variant:Nn \@@_declare_shape:nnnn {nnxx} % \end{macrocode} % \end{macro} @@ -743,27 +766,27 @@ \clist_set_eq:NN \l_@@_fontfeat_curr_clist \l_@@_fontfeat_sc_clist \bool_if:NF \l_@@_nosc_bool - { - \tl_if_empty:NTF \l_@@_fontname_sc_tl - { - \@@_make_smallcaps:TF - { + { + \tl_if_empty:NTF \l_@@_fontname_sc_tl + { + \@@_make_smallcaps:TF + { %<debug>\typeout{====~Small~ caps~ found.} - \clist_put_left:Nn \l_@@_fontfeat_curr_clist {Letters=SmallCaps} - } - { + \clist_put_left:Nn \l_@@_fontfeat_curr_clist {Letters=SmallCaps} + } + { %<debug>\typeout{====~Small~ caps~ not~ found.} - \bool_set_true:N \l_@@_nosc_bool - } - } - { \@@_load_fontname:n {\l_@@_fontname_sc_tl} }% local for each size - } + \bool_set_true:N \l_@@_nosc_bool + } + } + { \@@_load_fontname:n {\l_@@_fontname_sc_tl} }% local for each size + } \bool_if:NF \l_@@_nosc_bool - { - \@@_setup_nfss:Nnnn \l_@@_nfss_sc_tl - {#1} {\l_@@_sizing_leftover_clist} {\l_@@_fontfeat_curr_clist} - } + { + \@@_setup_nfss:Nnnn \l_@@_nfss_sc_tl + {#1} {\l_@@_sizing_leftover_clist} {\l_@@_fontfeat_curr_clist} + } } % \end{macrocode} % \end{macro} @@ -771,19 +794,19 @@ % \begin{macro}{\@@_setup_nfss:Nnnn} % \begin{macrocode} \cs_new:Nn \@@_setup_nfss:Nnnn - { + { %<debug>\typeout{====~Setup~NFSS~shape:~<\l_@@_size_tl>~\l_fontspec_fontname_tl} - \@@_get_features:n { #2 , #3 , #4 } + \@@_get_features:n { #2 , #3 , #4 } %<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist} - \tl_put_right:Nx #1 - { - <\l_@@_size_tl> \l_@@_scale_tl - \@@_construct_font_call:nn { \l_fontspec_fontname_tl } - { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } - } - } + \tl_put_right:Nx #1 + { + <\l_@@_size_tl> \l_@@_scale_tl + \@@_construct_font_call:nn { \l_fontspec_fontname_tl } + { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } + } + } % \end{macrocode} % \end{macro} % @@ -807,7 +830,9 @@ { \@@_combo_sc_shape:n {#2} } {\l_@@_nfss_sc_tl} {\l_@@_postadjust_tl} } } - +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Nn \@@_combo_sc_shape:n { \tl_if_exist:cTF { \@@_shape_merge:nn {#1} {\scdefault} } @@ -820,14 +845,14 @@ % \begin{macro}{\@@_DeclareFontShape:nnnnnn} % \begin{macrocode} \cs_new:Nn \@@_DeclareFontShape:nnnnnn - { + { %<debug>\typeout{DeclareFontShape:~{#1}{#2}{#3}{#4}...} - \group_begin: - \normalsize - \cs_undefine:c {#1/#2/#3/#4/\f@size} - \group_end: - \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} - } + \group_begin: + \normalsize + \cs_undefine:c {#1/#2/#3/#4/\f@size} + \group_end: + \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } \cs_generate_variant:Nn \@@_DeclareFontShape:nnnnnn {xxxxxx} % \end{macrocode} % @@ -839,17 +864,17 @@ % We should test when a slanted font has been specified and not run this code if so, but the \verb|\@@_set_slanted:| code will overwrite this anyway if necessary. % \begin{macrocode} \cs_new:Nn \@@_declare_shape_slanted:nn - { - \bool_if:nT - { - \str_if_eq_x_p:nn {#2} {\itdefault} && - !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) - } - { - \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{#1}{\sldefault} - {<->ssub*\g_@@_nfss_family_tl/#1/\itdefault}{\l_@@_postadjust_tl} - } - } + { + \bool_if:nT + { + \str_if_eq_p:ee {#2} {\itdefault} && + !(\str_if_eq_p:ee {\itdefault} {\sldefault}) + } + { + \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{#1}{\sldefault} + {<->ssub*\g_@@_nfss_family_tl/#1/\itdefault}{\l_@@_postadjust_tl} + } + } % \end{macrocode} % \end{macro} % @@ -857,41 +882,42 @@ % Lastly some informative messaging. % \begin{macrocode} \cs_new:Nn \@@_declare_shape_loginfo:nn - { - \tl_gput_right:Nx \g_@@_defined_shapes_tl - { - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn {#1/#2} - { - {\mddefault/\updefault} {'normal'~} - {\bfdefault/\updefault} {'bold'~} - {\mddefault/\itdefault} {'italic'~} - {\mddefault/\sldefault} {'slanted'~} - {\bfdefault/\itdefault} {'bold~ italic'~} - {\bfdefault/\sldefault} {'bold~ slanted'~} - } (#1/#2)~ - with~ NFSS~ spec.:~ - \l_@@_nfss_tl - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn { #1 / \@@_combo_sc_shape:n {#2} } - { - {\mddefault/\scdefault} {'small~ caps'~} - {\bfdefault/\scdefault} {'bold~ small~ caps'~} - {\mddefault/\itscdefault} {'italic~ small~ caps'~} - {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} - {\mddefault/\slscdefault} {'slanted~ small~ caps'~} - {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} - }~( #1 / \@@_combo_sc_shape:n {#2} )~ - with~ NFSS~ spec.:~ - \l_@@_nfss_sc_tl - \tl_if_empty:fF {\l_@@_postadjust_tl} - { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_@@_postadjust_tl - } - } - } + { + \tl_gput_right:Nx \g_@@_defined_shapes_tl + { + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn {#1/#2} + { + {\mddefault/\updefault} {'normal'~} + {\bfdefault/\updefault} {'bold'~} + {\mddefault/\itdefault} {'italic'~} + {\mddefault/\sldefault} {'slanted'~} + {\bfdefault/\itdefault} {'bold~ italic'~} + {\bfdefault/\sldefault} {'bold~ slanted'~} + } (#1/#2)~ + with~ NFSS~ spec.:~ + \l_@@_nfss_tl + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn { #1 / \@@_combo_sc_shape:n {#2} } + { + {\mddefault/\scdefault} {'small~ caps'~} + {\bfdefault/\scdefault} {'bold~ small~ caps'~} + {\mddefault/\itscdefault} {'italic~ small~ caps'~} + {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} + {\mddefault/\slscdefault} {'slanted~ small~ caps'~} + {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} + }~( #1 / \@@_combo_sc_shape:n {#2} )~ + with~ NFSS~ spec.:~ + \l_@@_nfss_sc_tl + \tl_if_empty:fF {\l_@@_postadjust_tl} + { + \exp_not:N \\ and~ font~ adjustment~ code: + \exp_not:N \\ \l_@@_postadjust_tl + } + } + } % \end{macrocode} -% Maybe |\str_if_eq_x:nnF| would be better? +% Maybe |\str_if_eq:eeF| would be better? % \end{macro} % % @@ -903,26 +929,26 @@ % \begin{macrocode} \tl_set:Nn \l_@@_pre_feat_sclist %<*XE> - { - \bool_if:NT \l_@@_ot_bool - { - \tl_if_empty:NF \l_fontspec_script_tl - { - script = \l_fontspec_script_tl ; - language = \l_fontspec_lang_tl ; - } - } - } + { + \bool_if:NT \l_@@_ot_bool + { + \tl_if_empty:NF \l_fontspec_script_tl + { + script = \l_fontspec_script_tl ; + language = \l_fontspec_lang_tl ; + } + } + } %</XE> %<*LU> - { - mode = \l_fontspec_mode_tl ; - \tl_if_empty:NF \l_fontspec_script_tl - { - script = \l_fontspec_script_tl ; - language = \l_fontspec_lang_tl ; - } - } + { + mode = \l_fontspec_mode_tl ; + \tl_if_empty:NF \l_fontspec_script_tl + { + script = \l_fontspec_script_tl ; + language = \l_fontspec_lang_tl ; + } + } %</LU> % \end{macrocode} % \end{macro} @@ -934,19 +960,19 @@ % \begin{macrocode} %<LU>\cs_new:Nn \@@_make_smallcaps:TF %<XE>\cs_new:Nn \@@_make_ot_smallcaps:TF - { - \@@_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} - } + { + \@@_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + } %<*XE> \cs_new:Nn \@@_make_smallcaps:TF - { - \bool_if:NTF \l_@@_ot_bool - { \@@_make_ot_smallcaps:TF {#1} {#2} } - { - \bool_if:NT \l_@@_atsui_bool - { \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } - } - } + { + \bool_if:NTF \l_@@_ot_bool + { \@@_make_ot_smallcaps:TF {#1} {#2} } + { + \bool_if:NT \l_@@_atsui_bool + { \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } + } + } %</XE> % \end{macrocode} % \end{macro} @@ -992,26 +1018,26 @@ % Check whether they're assigned to globally or not.) % \begin{macrocode} \cs_set:Npn \@@_init: - { + { %<debug> \typeout{:: @@_init:} - \bool_set_false:N \l_@@_ot_bool - \bool_set_true:N \l_@@_firsttime_bool - \@@_font_is_name: - \tl_clear:N \l_@@_font_path_tl - \tl_clear:N \l_@@_optical_size_tl - \tl_clear:N \l_@@_ttc_index_tl - \tl_clear:N \l_fontspec_renderer_tl - \tl_gclear:N \g_@@_defined_shapes_tl - \tl_gclear:N \g_@@_curr_series_tl - \tl_gset_eq:NN \g_@@_nfss_enc_tl \g_fontspec_encoding_tl + \bool_set_false:N \l_@@_ot_bool + \bool_set_true:N \l_@@_firsttime_bool + \@@_font_is_name: + \tl_clear:N \l_@@_font_path_tl + \tl_clear:N \l_@@_optical_size_tl + \tl_clear:N \l_@@_ttc_index_tl + \tl_clear:N \l_fontspec_renderer_tl + \tl_gclear:N \g_@@_defined_shapes_tl + \tl_gclear:N \g_@@_curr_series_tl + \tl_gset_eq:NN \g_@@_nfss_enc_tl \g_fontspec_encoding_tl %<*LU> - \tl_set:Nn \l_fontspec_mode_tl {node} - \int_set:Nn \luatex_prehyphenchar:D { `\- } % fixme - \int_zero:N \luatex_posthyphenchar:D % fixme - \int_zero:N \luatex_preexhyphenchar:D % fixme - \int_zero:N \luatex_postexhyphenchar:D % fixme + \tl_set:Nn \l_fontspec_mode_tl {node} + \int_set:Nn \prehyphenchar { `\- } % fixme + \int_zero:N \posthyphenchar % fixme + \int_zero:N \preexhyphenchar % fixme + \int_zero:N \postexhyphenchar % fixme %</LU> - } + } % \end{macrocode} % \end{macro} % @@ -1034,42 +1060,108 @@ % % \subsection{Miscellaneous} % +% \begin{macro}{\@@_ot_validate_tag:n} +% This macro takes an OpenType tag and validates it. +% \begin{macrocode} +%<*LU> +% \end{macrocode} +% \begin{macrocode} +\cs_new_protected:Nn \@@_ot_validate_tag:n + { + \@@_ot_validate_tag:w #1 \q_nil + } +\cs_generate_variant:Nn \@@_ot_validate_tag:n {x} +% \end{macrocode} +% +% \begin{macrocode} +\cs_set:Npn \@@_ot_validate_tag:w #1 #2 \q_nil + { + \bool_if:nTF { \str_if_eq_p:nn {#1} {+} || \str_if_eq_p:nn {#1} {-} } + { \@@_ot_validate_tag_aux:w #2 \c_empty_tl \c_empty_tl \q_nil } + { \@@_ot_validate_tag_aux:w #1#2 \c_empty_tl \c_empty_tl \q_nil } + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_set:Npn \@@_ot_validate_tag_aux:w #1#2#3#4#5 \q_nil + { + \int_compare:nT { \tl_count:n {#5} > 2 } + { \@@_error:nx {ot-tag-too-long} {#1#2#3#4#5} } + } +% \end{macrocode} +% \begin{macrocode} +%</LU> +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_iv_str_to_num:Nn} % This macro takes a four character string and converts it to the % numerical representation required for \XeTeX\ OpenType script/language/feature % purposes. The output is stored in |#1|. % -% The reason it's ugly is because the input can be of the form of any of these: +% This code is not used in Lua\TeX, as the checking for that engine is done via Lua code +% provided by \pkg{luaotfload}. +% \begin{macrocode} +%<*XE> +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Nn \@@_iv_str_to_num:Nn + { + \@@_strip_leading_sign:Nw #1#2 \q_nil + } +\cs_generate_variant:Nn \@@_iv_str_to_num:Nn {Nx} +% \end{macrocode} +% +% The input can be of the form of any of these: % `|abcd|', `|abc|', `|abc |', `|ab|', `|ab |', \etc. % (It is assumed the first two chars are \emph{always} not spaces.) So this macro -% reads in the string, delimited by a space; this input is padded with \cmd\@empty s +% reads in the string padded with \cmd\@empty s, % and anything beyond four chars is snipped. The \cmd\@empty s then are used to reconstruct % the spaces in the string to number calculation. % % For backwards compatibility this code also strips a leading |+| or |-|. +% % \begin{macrocode} -\cs_new:Nn \@@_iv_str_to_num:Nn - { - \@@_strip_leading_sign:Nw #1#2 \q_nil - } \cs_set:Npn \@@_strip_leading_sign:Nw #1#2#3 \q_nil { \bool_if:nTF { \str_if_eq_p:nn {#2} {+} || \str_if_eq_p:nn {#2} {-} } { \@@_iv_str_to_num:w #1 \q_nil #3 \c_empty_tl \c_empty_tl \q_nil } { \@@_iv_str_to_num:w #1 \q_nil #2#3 \c_empty_tl \c_empty_tl \q_nil } } +% \end{macrocode} +% If input string (after sign is stripped) is more than 4 chars, \verb|#6| will contain +% `\meta{excess}\cs{c_empty_tl}\cs{c_empty_tl}'. Therefore use \verb|#6| to verify string length. +% \begin{macrocode} \cs_set:Npn \@@_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil - { - \int_set:Nn #1 - { - `#2 * "1000000 - + `#3 * "10000 - + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 - + \ifx \c_empty_tl #5 32 \else `#5 \fi - } - } + { + \int_compare:nT { \tl_count:n {#6} > 2 } + { \@@_error:nx {ot-tag-too-long} {#2#3#4#5#6} } + + \str_if_eq:eeTF {#2#3#4#5#6} {DFLT} + { + \int_set:Nn #1 {0} + } + { + + \int_set:Nn #1 + { + `#2 * "1000000 + + `#3 * "10000 + + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 + + \ifx \c_empty_tl #5 32 \else `#5 \fi + } + } + } +% \end{macrocode} +% +% \begin{macrocode} \cs_generate_variant:Nn \@@_iv_str_to_num:Nn {No} % \end{macrocode} +% +% \begin{macrocode} +%</XE> +% \end{macrocode} % \end{macro} % % @@ -1086,7 +1178,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx index 5ea78c405dc..1adee94c741 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Font loading (\pkg{keyval}) definitions} % @@ -58,16 +58,16 @@ % argument given defines the file path of the font. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse-external} {Path} - { - \bool_set_true:N \l_@@_nobf_bool - \bool_set_true:N \l_@@_noit_bool - \bool_set_true:N \l_@@_external_bool - \tl_set:Nn \l_@@_font_path_tl {#1} - \@@_font_is_file: + { + \bool_set_true:N \l_@@_nobf_bool + \bool_set_true:N \l_@@_noit_bool + \bool_set_true:N \l_@@_external_bool + \tl_set:Nn \l_@@_font_path_tl {#1} + \@@_font_is_file: %<*XE> - \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} %</XE> - } + } \aliasfontfeature{Path}{ExternalLocation} \@@_keys_define_code:nnn {fontspec} {Path} {} % \end{macrocode} @@ -78,13 +78,13 @@ % to use. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse-external} {Extension} - { - \tl_set:Nn \l_@@_extension_tl {#1} - \bool_if:NF \l_@@_external_bool - { - \keys_set:nn {fontspec-preparse-external} {Path} - } - } + { + \tl_set:Nn \l_@@_extension_tl {#1} + \bool_if:NF \l_@@_external_bool + { + \keys_set:nn {fontspec-preparse-external} {Path} + } + } \tl_clear:N \l_@@_extension_tl \@@_keys_define_code:nnn {fontspec} {Extension} {} % \end{macrocode} @@ -94,36 +94,37 @@ % This feature must be processed before all others (the other font shape and features options are also pre-parsed for convenience) because the renderer determines the format of the features and even whether certain features are available. % \begin{macrocode} \keys_define:nn {fontspec-renderer} - { - Renderer .choices:nn = - {AAT,ICU,OpenType,Graphite,Full,Basic} - { - \int_compare:nTF {\l_keys_choice_int <= 4} { + { + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} + { + \int_compare:nTF {\l_keys_choice_int <= 4} + { %<*XE> - \tl_set:Nx \l_fontspec_renderer_tl - { - \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} } - } - \tl_gset:Nx \g_@@_single_feat_tl { \l_fontspec_renderer_tl } + \tl_set:Nx \l_fontspec_renderer_tl + { + \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} } + } + \tl_gset:Nx \g_@@_single_feat_tl { \l_fontspec_renderer_tl } %</XE> %<*LU> - \@@_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} + \@@_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} %</LU> - } - { + } + { %<*XE> - \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic} + \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic} %</XE> %<*LU> - \tl_set:Nx \l_fontspec_mode_tl - { - \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } - } - \tl_gset:Nx \g_@@_single_feat_tl { mode=\l_fontspec_mode_tl } + \tl_set:Nx \l_fontspec_mode_tl + { + \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } + } + \tl_gset:Nx \g_@@_single_feat_tl { mode=\l_fontspec_mode_tl } %</LU> - } - } - } + } + } + } % \end{macrocode} % % \subsection{Pre-parsed features} @@ -132,35 +133,35 @@ % See later for the resolutions from \pkg{fontspec} features to OpenType definitions. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {Script} - { + { %<XE> \keys_set:nn {fontspec-renderer} {Renderer=OpenType} - \tl_set:Nn \l_@@_script_name_tl {#1} - } + \tl_set:Nn \l_@@_script_name_tl {#1} + } % \end{macrocode} % Exactly the same: % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {Language} - { + { %<XE> \keys_set:nn {fontspec-renderer} {Renderer=OpenType} - \tl_set:Nn \l_@@_lang_name_tl {#1} - } + \tl_set:Nn \l_@@_lang_name_tl {#1} + } % \end{macrocode} % % % \paragraph{TTC font index} % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {FontIndex} - { - \str_if_eq_x:nnF { \str_lower_case:f {\l_@@_extension_tl} } {.ttc} - { \@@_warning:n {font-index-needs-ttc} } + { + \str_if_eq:eeF { \str_lower_case:f {\l_@@_extension_tl} } {.ttc} + { \@@_warning:n {font-index-needs-ttc} } %<XE> \tl_set:Nn \l_@@_ttc_index_tl {:#1} %<LU> \tl_set:Nn \l_@@_ttc_index_tl {(#1)} - } + } \@@_keys_define_code:nnn {fontspec} {FontIndex} - { + { %<XE> \tl_set:Nn \l_@@_ttc_index_tl {:#1} %<LU> \tl_set:Nn \l_@@_ttc_index_tl {(#1)} - } + } % \end{macrocode} % % \subsection{Font faces} @@ -275,80 +276,80 @@ % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} - { - \clist_set:Nn \l_@@_fontfeat_up_clist {#1} - } + { + \clist_set:Nn \l_@@_fontfeat_up_clist {#1} + } \@@_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} - { - \clist_set:Nn \l_@@_fontfeat_bf_clist {#1} + { + \clist_set:Nn \l_@@_fontfeat_bf_clist {#1} % \prop_put:NxV \l_@@_nfss_prop % {BoldFont-\g_@@_curr_series_tl} \l_@@_curr_bfname_tl - } + } \@@_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} - { - \clist_set:Nn \l_@@_fontfeat_it_clist {#1} - } + { + \clist_set:Nn \l_@@_fontfeat_it_clist {#1} + } \@@_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} - { - \clist_set:Nn \l_@@_fontfeat_bfit_clist {#1} - } + { + \clist_set:Nn \l_@@_fontfeat_bfit_clist {#1} + } \@@_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} - { - \clist_set:Nn \l_@@_fontfeat_sl_clist {#1} - } + { + \clist_set:Nn \l_@@_fontfeat_sl_clist {#1} + } \@@_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} - { - \clist_set:Nn \l_@@_fontfeat_bfsl_clist {#1} - } + { + \clist_set:Nn \l_@@_fontfeat_bfsl_clist {#1} + } % \end{macrocode} % Note that small caps features can vary by shape, so these in fact \emph{aren't} pre-parsed. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {SmallCapsFeatures} - { - \bool_if:NF \l_@@_firsttime_bool - { - \clist_set:Nn \l_@@_fontfeat_sc_clist {#1} - } - } + { + \bool_if:NF \l_@@_firsttime_bool + { + \clist_set:Nn \l_@@_fontfeat_sc_clist {#1} + } + } % \end{macrocode} % % \paragraph{Features varying by size} % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} - { - \clist_set:Nn \l_@@_sizefeat_clist {#1} - \clist_put_right:Nn \l_@@_fontfeat_up_clist { SizeFeatures = {#1} } - } + { + \clist_set:Nn \l_@@_sizefeat_clist {#1} + \clist_put_right:Nn \l_@@_fontfeat_up_clist { SizeFeatures = {#1} } + } \@@_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} - { - \clist_set:Nn \l_@@_sizefeat_clist {#1} - \tl_if_empty:NT \l_@@_this_font_tl - { \tl_set:Nn \l_@@_this_font_tl { -- } } % needs to be non-empty as a flag - } + { + \clist_set:Nn \l_@@_sizefeat_clist {#1} + \tl_if_empty:NT \l_@@_this_font_tl + { \tl_set:Nn \l_@@_this_font_tl { -- } } % needs to be non-empty as a flag + } \@@_keys_define_code:nnn {fontspec-preparse-nested} {Font} - { - \tl_set:Nn \l_@@_this_font_tl {#1} - } + { + \tl_set:Nn \l_@@_this_font_tl {#1} + } \@@_keys_define_code:nnn {fontspec} {SizeFeatures} - { - % dummy - } + { + % dummy + } \@@_keys_define_code:nnn {fontspec} {Font} - { - % dummy - } + { + % dummy + } % \end{macrocode} % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-sizing} {Size} - { - \tl_set:Nn \l_@@_size_tl {#1} - } + { + \tl_set:Nn \l_@@_size_tl {#1} + } \@@_keys_define_code:nnn {fontspec-sizing} {Font} - { - \fontspec_complete_fontname:Nn \l_@@_sizedfont_tl {#1} - } + { + \fontspec_complete_fontname:Nn \l_@@_sizedfont_tl {#1} + } % \end{macrocode} % % @@ -361,9 +362,9 @@ % For the very brave. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} - { - \tl_gset:Nx \g_@@_nfss_enc_tl { #1 } - } + { + \tl_gset:Nx \g_@@_nfss_enc_tl { #1 } + } % \end{macrocode} % % \paragraph{NFSS family} @@ -371,9 +372,9 @@ % (By default \pkg{fontspec} auto-generates one based on the font name.) % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} - { - \tl_set:Nx \l_@@_nfss_fam_tl { #1 } - } + { + \tl_set:Nx \l_@@_nfss_fam_tl { #1 } + } % \end{macrocode} % % \paragraph{NFSS series/shape} @@ -408,15 +409,15 @@ % the auto-scaling cases. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Scale} - { - \str_case:nnF {#1} - { - {MatchLowercase} { \@@_calc_scale:n {5} } - {MatchUppercase} { \@@_calc_scale:n {8} } - } - { \tl_set:Nx \l_@@_scale_tl {#1} } - \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] } - } + { + \str_case:nnF {#1} + { + {MatchLowercase} { \@@_calc_scale:n {5} } + {MatchUppercase} { \@@_calc_scale:n {8} } + } + { \tl_set:Nx \l_@@_scale_tl {#1} } + \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] } + } % \end{macrocode} % % \begin{macro}{\@@_calc_scale:n} @@ -436,25 +437,27 @@ % appropriately.) % \begin{macrocode} \cs_new:Nn \@@_calc_scale:n - { - \group_begin: + { + \group_begin: - \fontencoding { \encodingdefault } - \fontfamily { \rmdefault } - \selectfont + \fontencoding { \encodingdefault } + \fontfamily { \rmdefault } + \selectfont - \@@_set_font_dimen:NnN \l_@@_tmpa_dim {#1} \font - \@@_set_font_dimen:NnN \l_@@_tmpb_dim {#1} \l_fontspec_font + \@@_set_font_dimen:NnN \l_@@_tmpa_dim {#1} \font + \@@_set_font_dimen:NnN \l_@@_tmpb_dim {#1} \l_fontspec_font - \tl_gset:Nx \l_@@_scale_tl - { - \fp_eval:n { \dim_to_fp:n {\l_@@_tmpa_dim} / - \dim_to_fp:n {\l_@@_tmpb_dim} } - } + \tl_set:Nx \l_@@_scale_tl + { + \fp_eval:n { \dim_to_fp:n {\l_@@_tmpa_dim} / + \dim_to_fp:n {\l_@@_tmpb_dim} } + } - \@@_info:n {set-scale} - \group_end: - } + \@@_info:n {set-scale} + \exp_args:NNNx + \group_end: + \tl_set:Nx \l_@@_scale_tl { \l_@@_scale_tl } + } % \end{macrocode} % \end{macro} % @@ -467,21 +470,21 @@ % We assume in this case that the font contains either an `X' or an `x'. % \begin{macrocode} \cs_new:Nn \@@_set_font_dimen:NnN - { - \dim_set:Nn #1 { \fontdimen #2 #3 } - \dim_compare:nNnT #1 = {0pt} - { - \settoheight #1 - { - \str_if_eq:nnTF {#3} {\font} \rmfamily #3 - \int_case:nnF #2 - { - {5} {x} % x-height - {8} {X} % cap-height - } {?} % "else" clause; never reached. - } - } - } + { + \dim_set:Nn #1 { \fontdimen #2 #3 } + \dim_compare:nNnT #1 = {0pt} + { + \settoheight #1 + { + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 + \int_case:nnF #2 + { + {5} {x} % x-height + {8} {X} % cap-height + } {?} % "else" clause; never reached. + } + } + } % \end{macrocode} % \end{macro} % @@ -491,10 +494,10 @@ % font being loaded. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {WordSpace} - { - \bool_if:NF \l_@@_firsttime_bool - { \_fontspec_parse_wordspace:w #1,,,\q_stop } - } + { + \bool_if:NF \l_@@_firsttime_bool + { \_fontspec_parse_wordspace:w #1,,,\q_stop } + } \@@_aff_error:n {WordSpace} % \end{macrocode} % @@ -504,25 +507,25 @@ % If the former input, it executes |{X,X,X}|. % \begin{macrocode} \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop - { - \tl_if_empty:nTF {#4} - { - \tl_set:Nn \l_@@_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #1 \fontdimen 3 \font - \fontdimen 4 \font = #1 \fontdimen 4 \font - } - } - { - \tl_set:Nn \l_@@_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #2 \fontdimen 3 \font - \fontdimen 4 \font = #3 \fontdimen 4 \font - } - } - } + { + \tl_if_empty:nTF {#4} + { + \tl_set:Nn \l_@@_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #1 \fontdimen 3 \font + \fontdimen 4 \font = #1 \fontdimen 4 \font + } + } + { + \tl_set:Nn \l_@@_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #2 \fontdimen 3 \font + \fontdimen 4 \font = #3 \fontdimen 4 \font + } + } + } % \end{macrocode} % \end{macro} % @@ -530,25 +533,25 @@ % Scaling factor for the nominal \cmd\fontdimen \#7. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {PunctuationSpace} - { - \str_case_x:nnF {#1} - { - {WordSpace} - { - \tl_set:Nn \l_@@_punctspace_adjust_tl - { \fontdimen 7 \font = 0 \fontdimen 2 \font } - } - {TwiceWordSpace} - { - \tl_set:Nn \l_@@_punctspace_adjust_tl - { \fontdimen 7 \font = 1 \fontdimen 2 \font } - } - } - { - \tl_set:Nn \l_@@_punctspace_adjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } - } - } + { + \str_case_e:nnF {#1} + { + {WordSpace} + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } + } \@@_aff_error:n {PunctuationSpace} % \end{macrocode} % @@ -556,17 +559,17 @@ % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {FontAdjustment} - { - \tl_put_right:Nx \l_@@_postadjust_tl {#1} - } + { + \tl_put_right:Nx \l_@@_postadjust_tl {#1} + } % \end{macrocode} % % \paragraph{Letterspacing} % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {LetterSpace} - { - \@@_update_featstr:n {letterspace=#1} - } + { + \@@_update_featstr:n {letterspace=#1} + } % \end{macrocode} % % \paragraph{Hyphenation character} @@ -579,28 +582,28 @@ % for that engine. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {HyphenChar} - { - \str_if_eq:nnTF {#1} {None} - { - \tl_put_right:Nn \l_@@_postadjust_tl - { \@@_primitive_font_set_hyphenchar:Nn \font {-1} } - } - { - \@@_warning:nx {only-xetex-feature} {HyphenChar} + { + \str_if_eq:nnTF {#1} {None} + { + \tl_put_right:Nn \l_@@_postadjust_tl + { \@@_primitive_font_set_hyphenchar:Nn \font {-1} } + } + { + \@@_warning:nx {only-xetex-feature} {HyphenChar} - \tl_if_single:nTF {#1} - { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } - { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } + \tl_if_single:nTF {#1} + { \tl_set:Nn \l_@@_hyphenchar_tl {`#1} } + { \tl_set:Nn \l_@@_hyphenchar_tl { #1} } - \@@_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} - { - \tl_put_right:Nn \l_@@_postadjust_tl - { \@@_primitive_font_set_hyphenchar:Nn \font { \l_fontspec_hyphenchar_tl } } - } - { \@@_error:nx {no-glyph}{#1} } + \@@_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_@@_hyphenchar_tl} + { + \tl_put_right:Nn \l_@@_postadjust_tl + { \@@_primitive_font_set_hyphenchar:Nn \font { \l_@@_hyphenchar_tl } } + } + { \@@_error:nx {no-glyph}{#1} } - } - } + } + } \@@_aff_error:n {HyphenChar} % \end{macrocode} % @@ -608,55 +611,55 @@ % Hooks into pkg{xcolor}, which names its colours \texttt{\char`\\color@<name>}. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Color} - { - \cs_if_exist:cTF { \token_to_str:N \color@ #1 } - { - \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl - } - { - \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_@@_hexcol_tl {#1} } - { - \int_compare:nTF { \tl_count:n {#1} == 8 } - { \fontspec_parse_colour:viii #1 } - { - \bool_if:NF \l_@@_firsttime_bool - { \@@_warning:nx {bad-colour} {#1} } - } - } - } - } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l_@@_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {bad-colour} {#1} } + } + } + } + } % \end{macrocode} % % \begin{macrocode} \cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 - { - \tl_set:Nn \l_@@_hexcol_tl {#1#2#3#4#5#6} - \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl - { - \bool_if:NF \l_@@_firsttime_bool - { \@@_warning:nx {opa-twice-col} {#7#8} } - } - \tl_set:Nn \l_@@_opacity_tl {#7#8} - } + { + \tl_set:Nn \l_@@_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl + { + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {opa-twice-col} {#7#8} } + } + \tl_set:Nn \l_@@_opacity_tl {#7#8} + } \aliasfontfeature{Color}{Colour} % \end{macrocode} % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Opacity} - { - \int_set:Nn \l_@@_tmp_int {255} - \@@_int_mult_truncate:Nn \l_@@_tmp_int { #1 } - \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl - { - \bool_if:NF \l_@@_firsttime_bool - { \@@_warning:nx {opa-twice} {#1} } - } - \tl_set:Nx \l_@@_opacity_tl - { - \int_compare:nT { \l_@@_tmp_int <= "F } {0} % zero pad - \int_to_hex:n { \l_@@_tmp_int } - } - } + { + \int_set:Nn \l_@@_tmp_int {255} + \@@_int_mult_truncate:Nn \l_@@_tmp_int { #1 } + \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl + { + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {opa-twice} {#1} } + } + \tl_set:Nx \l_@@_opacity_tl + { + \int_compare:nT { \l_@@_tmp_int <= "F } {0} % zero pad + \int_to_hex:n { \l_@@_tmp_int } + } + } % \end{macrocode} % % @@ -674,15 +677,15 @@ %</XE> %<*LU> \@@_keys_define_code:nnn {fontspec-opentype} {Mapping} - { - \str_if_eq:nnTF {#1} {tex-text} - { - \@@_warning:n {no-mapping-ligtex} - \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} - \keys_set:nn {fontspec-opentype} { Ligatures=TeX } - } - { \@@_warning:n {no-mapping} } - } + { + \str_if_eq:nnTF {#1} {tex-text} + { + \@@_warning:n {no-mapping-ligtex} + \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} + \keys_set:nn {fontspec-opentype} { Ligatures=TeX } + } + { \@@_warning:n {no-mapping} } + } %</LU> % \end{macrocode} % @@ -691,37 +694,37 @@ % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Weight} - { - \@@_update_featstr:n{weight=#1} - } + { + \@@_update_featstr:n{weight=#1} + } \@@_keys_define_code:nnn {fontspec} {Width} - { - \@@_update_featstr:n{width=#1} - } + { + \@@_update_featstr:n{width=#1} + } \@@_keys_define_code:nnn {fontspec} {OpticalSize} %<*XE> - { - \bool_if:NTF \l_@@_ot_bool - { - \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} - } - { - \bool_if:NT \l_@@_mm_bool - { - \@@_update_featstr:n { optical size = #1 } - } - } - \bool_if:nT { !\l_@@_ot_bool && !\l_@@_mm_bool } - { - \bool_if:NT \l_@@_firsttime_bool - { \@@_warning:n {no-opticals} } - } - } + { + \bool_if:NTF \l_@@_ot_bool + { + \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} + } + { + \bool_if:NT \l_@@_mm_bool + { + \@@_update_featstr:n { optical size = #1 } + } + } + \bool_if:nT { !\l_@@_ot_bool && !\l_@@_mm_bool } + { + \bool_if:NT \l_@@_firsttime_bool + { \@@_warning:n {no-opticals} } + } + } %</XE> %<*LU> - { - \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} - } + { + \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} + } %</LU> % \end{macrocode} % @@ -729,36 +732,36 @@ % These are to be specified to apply directly to a font shape: % \begin{macrocode} \keys_define:nn {fontspec} - { - FakeSlant .code:n = - { - \@@_update_featstr:n{slant=#1} - }, - FakeSlant .default:n = {0.2} -} + { + FakeSlant .code:n = + { + \@@_update_featstr:n {slant=#1} + }, + FakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - FakeStretch .code:n = - { - \@@_update_featstr:n{extend=#1} - }, - FakeStretch .default:n = {1.2} -} + { + FakeStretch .code:n = + { + \@@_update_featstr:n {extend=#1} + }, + FakeStretch .default:n = {1.2} + } %<*XE> \keys_define:nn {fontspec} - { - FakeBold .code:n = - { - \@@_update_featstr:n {embolden=#1} - }, - FakeBold .default:n = {1.5} - } + { + FakeBold .code:n = + { + \@@_update_featstr:n {embolden=#1} + }, + FakeBold .default:n = {1.5} + } %</XE> %<*LU> \keys_define:nn {fontspec} - { - FakeBold .code:n = { \@@_warning:n {fakebold-only-xetex} } - } + { + FakeBold .code:n = { \@@_warning:n {fakebold-only-xetex} } + } %</LU> % \end{macrocode} % These are to be given to a shape that has no real bold/italic @@ -773,52 +776,52 @@ % \pkg{fontspec}.) % \begin{macrocode} \keys_define:nn {fontspec} - { - AutoFakeSlant .code:n = - { - \bool_if:NT \l_@@_firsttime_bool - { - \tl_set:Nn \l_@@_fake_slant_tl {#1} - \clist_put_right:Nn \l_@@_fontfeat_it_clist {FakeSlant=#1} - \tl_set_eq:NN \l_@@_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_@@_noit_bool + { + AutoFakeSlant .code:n = + { + \bool_if:NT \l_@@_firsttime_bool + { + \tl_set:Nn \l_@@_fake_slant_tl {#1} + \clist_put_right:Nn \l_@@_fontfeat_it_clist {FakeSlant=#1} + \tl_set_eq:NN \l_@@_fontname_it_tl \l_fontspec_fontname_tl + \bool_set_false:N \l_@@_noit_bool - \tl_if_empty:NF \l_@@_fake_embolden_tl - { - \clist_put_right:Nx \l_@@_fontfeat_bfit_clist - {FakeBold=\l_@@_fake_embolden_tl} - \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeSlant=#1} - \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeSlant .default:n = {0.2} -} + \tl_if_empty:NF \l_@@_fake_embolden_tl + { + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist + {FakeBold=\l_@@_fake_embolden_tl} + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeSlant=#1} + \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeSlant .default:n = {0.2} + } % \end{macrocode} % Same but reversed: % \begin{macrocode} \keys_define:nn {fontspec} - { - AutoFakeBold .code:n = - { - \bool_if:NT \l_@@_firsttime_bool - { - \tl_set:Nn \l_@@_fake_embolden_tl {#1} - \clist_put_right:Nn \l_@@_fontfeat_bf_clist {FakeBold=#1} - \tl_set_eq:NN \l_@@_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_@@_nobf_bool + { + AutoFakeBold .code:n = + { + \bool_if:NT \l_@@_firsttime_bool + { + \tl_set:Nn \l_@@_fake_embolden_tl {#1} + \clist_put_right:Nn \l_@@_fontfeat_bf_clist {FakeBold=#1} + \tl_set_eq:NN \l_@@_fontname_bf_tl \l_fontspec_fontname_tl + \bool_set_false:N \l_@@_nobf_bool - \tl_if_empty:NF \l_@@_fake_slant_tl - { - \clist_put_right:Nx \l_@@_fontfeat_bfit_clist - {FakeSlant=\l_@@_fake_slant_tl} - \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeBold=#1} - \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeBold .default:n = {1.5} -} + \tl_if_empty:NF \l_@@_fake_slant_tl + { + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist + {FakeSlant=\l_@@_fake_slant_tl} + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeBold=#1} + \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeBold .default:n = {1.5} + } % \end{macrocode} % % @@ -827,13 +830,13 @@ % already memorised the OpenType abbreviations and don't mind not having error checking. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-opentype} {RawFeature} - { - \@@_update_featstr:n {#1} - } + { + \@@_update_featstr:n {#1} + } \@@_keys_define_code:nnn {fontspec-aat} {RawFeature} - { - \@@_update_featstr:n {#1} - } + { + \@@_update_featstr:n {#1} + } % \end{macrocode} % % @@ -852,7 +855,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-lang.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-lang.dtx index 886fea87b78..adcdcb8a355 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-lang.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-lang.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Font language definitions} % @@ -406,7 +406,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-load.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-load.dtx index 102800b98c2..809b282921e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-load.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-load.dtx @@ -60,7 +60,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-math.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx index 77eaa1228f9..aedef402cd8 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-math.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-math.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-math.dtx -- part of FONTSPEC <wspr.io/fontspec> % % \section{Selecting maths fonts} % Here, the fonts used in math mode are redefined to correspond to the @@ -145,6 +145,7 @@ \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} + \renewcommand{\hbar}{{\mathchar"AF\mkern-9mu h}}% TODO: test with other fonts } } % \end{macrocode} @@ -242,7 +243,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-msg.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx index 8358a874d54..64aa1b96212 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-msg.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> % % \section{Error/warning/info messages} % @@ -131,6 +131,10 @@ { Option '#2' of font feature '#1' overwritten. } +\@@_msg_new:nnn {fontspec} {ot-tag-too-long} + { + OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. + } \@@_msg_new:nnn {fontspec} {script-not-exist-latn} { Font '\l_fontspec_fontname_tl' does not contain script '#1'.\\ @@ -274,7 +278,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-opening.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx index 323428058bc..b067c2ff7bd 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-opening.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> % % \section{Opening code} % @@ -91,10 +91,10 @@ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument - { - \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl - \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl - } + { + \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl + \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl + } % \end{macrocode} % That latin encoding definition is repeated to suppress font warnings. % Something to do with \cmd\select@language\ ending up in the \texttt{.aux} @@ -183,7 +183,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx index a808789d8e9..e7820d14dfb 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{OpenType definitions code} % @@ -74,11 +74,11 @@ % % \begin{macrocode} \cs_new:Nn \@@_define_opentype_onoffreset:nnnnn - { - \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} - \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_off:n {#2} } {#3} {-#4} {} - \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {+#4,-#4} - } + { + \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} + \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_off:n {#2} } {#3} {-#4} {} + \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {+#4,-#4} + } % \end{macrocode} % \end{macro} % @@ -90,10 +90,10 @@ % \darg{Tags to remove (clist)} % \begin{macrocode} \cs_new:Nn \@@_define_opentype_onreset:nnnnn - { - \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} - \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {#4} - } + { + \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} + \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {#4} + } % \end{macrocode} % \end{macro} % @@ -144,7 +144,7 @@ % % \begin{macro}{\@@_check_script:NnTF} % This macro takes an OpenType script tag and checks if it exists in the current -% font. The output boolean is \cmd\@tempswatrue. \cmd\l_@@_script_int\ is used to store +% font. \cmd\l_@@_script_int\ is used to store % the number corresponding to the script tag string. % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_script:Nn {TF} @@ -152,83 +152,97 @@ \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } %<*XE> - { - \@@_iv_str_to_num:Nn \l_@@_strnum_int {#2} - \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } - \int_zero:N \l_tmpa_int - \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum \XeTeXOTscripttag #1 \l_tmpa_int = \l_@@_strnum_int - \bool_set_true:N \l__fontspec_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } + { + \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} + \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l__fontspec_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum \XeTeXOTscripttag #1 \l_tmpa_int = \l_@@_strnum_int + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } %</XE> %<*LU> - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } - \directlua{fontspec.check_ot_script("\l_@@_tmp_tl", "#2")} - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } + { + \@@_ot_validate_tag:x {#2} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } + \directlua{fontspec.check_ot_script("\l_@@_tmp_tl", "#2")} + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } %</LU> - } + } % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_check_lang:NnnTF} % \begin{macro}{\@@_check_lang:NnTF} % This macro takes an OpenType language tag and checks if it exists in the current -% font/script. The output boolean is \cmd\@tempswatrue. \cmd\l_@@_language_int\ is used to store +% font/script. \cmd\l_@@_language_int\ is used to store % the number corresponding to the language tag string. % The script used is whatever's held in \cmd\l_@@_script_int. By default, that's the % number corresponding to `|latn|'. % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_lang:Nn {TF} { + \@@_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:} + } +% \end{macrocode} +% +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_check_lang:Nnn {TF} + { \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } %<*XE> - { - \@@_iv_str_to_num:Nn \l_@@_strnum_int {#2} - \int_set:Nn \l_tmpb_int - { \XeTeXOTcountlanguages #1 \l_@@_script_int } - \int_zero:N \l_tmpa_int - \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum\XeTeXOTlanguagetag #1 \l_@@_script_int \l_tmpa_int = \l_@@_strnum_int - \bool_set_true:N \l__fontspec_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } + { + \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} + \@@_iv_str_to_num:Nx \l_@@_script_int {#3} + \int_set:Nn \l_tmpb_int + { \XeTeXOTcountlanguages #1 \l_@@_script_int } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l__fontspec_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum\XeTeXOTlanguagetag #1 \l_@@_script_int \l_tmpa_int = \l_@@_strnum_int + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } %</XE> %<*LU> - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_lang( "\l_@@_tmp_tl", "#2", "\l_fontspec_script_tl" ) + \@@_ot_validate_tag:x {#2} + \@@_ot_validate_tag:x {#3} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_lang( "\l_@@_tmp_tl", "#2", "#3" ) + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } %</LU> } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_check_ot_feat:NnTF} +% \begin{macro}{\@@_check_ot_feat:NnnnTF} % This macro takes an OpenType feature tag and checks if it exists in the current % font/script/language. % \cmd\l_@@_strnum_int\ is used to store the number corresponding to the feature tag string. @@ -238,52 +252,63 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_ot_feat:Nn {TF,F} { + \@@_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl} + {\prg_return_true:} {\prg_return_false:} + } +% \end{macrocode} +% +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_check_ot_feat:Nnnn {TF,F} + { \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } %<*XE> - { -%<debug>\typeout{::~ fontspec_check_ot_feat:n~ {#1}} - \int_set:Nn \l_tmpb_int - { - \XeTeXOTcountfeatures #1 - \l_@@_script_int - \l_@@_language_int - } - \@@_iv_str_to_num:Nn \l_@@_strnum_int {#2} - \int_zero:N \l_tmpa_int - \bool_set_false:N \l_@@_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum\XeTeXOTfeaturetag #1 \l_@@_script_int \l_@@_language_int - \l_tmpa_int =\l_@@_strnum_int - \bool_set_true:N \l_@@_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: - } + { +%<debug>\typeout{::~ fontspec_check_ot_feat:nnn~ {#2}{#3}{#4}} + \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} + \@@_iv_str_to_num:Nx \l_@@_language_int {#3} + \@@_iv_str_to_num:Nx \l_@@_script_int {#4} + \int_set:Nn \l_tmpb_int + { + \XeTeXOTcountfeatures #1 + \l_@@_script_int + \l_@@_language_int + } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l_@@_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum\XeTeXOTfeaturetag #1 \l_@@_script_int \l_@@_language_int + \l_tmpa_int =\l_@@_strnum_int + \bool_set_true:N \l_@@_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: + } %</XE> %<*LU> - { -%<debug>\typeout{::~ fontspec_check_ot_feat:n~ {#1}} - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_feat( - "\l_@@_tmp_tl", "#2", - "\l_fontspec_lang_tl", "\l_fontspec_script_tl" - ) +%<debug>\typeout{::~ fontspec_check_ot_feat:n~ {#1}} + \@@_ot_validate_tag:x {#2} + \@@_ot_validate_tag:x {#3} + \@@_ot_validate_tag:x {#4} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_feat("\l_@@_tmp_tl", "#2", "#3", "#4") + } + \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: } - \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: - } %</LU> } % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{OpenType feature information} % @@ -411,6 +436,7 @@ \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation} \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {zero}{Slashed~Zero} % \end{macrocode} +% TODO: move the above elsewhere!! % % \iffalse % \begin{macrocode} @@ -426,7 +452,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx index c466d9fd45e..2df1d18f3fe 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Patching code} % @@ -12,16 +12,16 @@ % This macro is courtesy of Frank Mittelbach and the \LaTeXe\ source code. % \begin{macrocode} \DeclareRobustCommand{\-} - { - \discretionary - { - \char\ifnum\hyphenchar\font<\z@ - \xlx@defaulthyphenchar - \else - \hyphenchar\font - \fi - }{}{} - } + { + \discretionary + { + \char\ifnum\hyphenchar\font<\z@ + \xlx@defaulthyphenchar + \else + \hyphenchar\font + \fi + }{}{} + } \def\xlx@defaulthyphenchar{`\-} % \end{macrocode} % \end{macro} @@ -35,11 +35,11 @@ % Print \unichar{2423}{Open box}, which is used to visibly display a space character. % \begin{macrocode} \cs_new:Nn \fontspec_visible_space: - { - \@@_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \char"2423\scan_stop: } - { \fontspec_visible_space_fallback: } - } + { + \@@_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \char"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } % \end{macrocode} % \end{macro} % @@ -47,12 +47,12 @@ % If the current font doesn't have \unichar{2423}{Open box}, use Latin Modern Mono instead. % \begin{macrocode} \cs_new:Nn \fontspec_visible_space_fallback: - { { - \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} - \textvisiblespace + { + \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} + \textvisiblespace + } } - } % \end{macrocode} % \end{macro} % @@ -74,13 +74,13 @@ % Redefine \cmd\verb\ to use \cmd\fontspec_print_visible_spaces:. % \begin{macrocode} \def\verb - { - \relax\ifmmode\hbox\else\leavevmode\null\fi - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\@@sverb\@verb - } + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\@@sverb\@verb + } \def\@@sverb{\fontspec_print_visible_spaces:\@sverb} % \end{macrocode} % \end{macro} @@ -89,35 +89,35 @@ % It's better to put small things into \cmd\AtBeginDocument, so here we go: % \begin{macrocode} \AtBeginDocument - { - \fontspec_patch_verbatim: - \fontspec_patch_moreverb: - \fontspec_patch_fancyvrb: - \fontspec_patch_listings: - } + { + \fontspec_patch_verbatim: + \fontspec_patch_moreverb: + \fontspec_patch_fancyvrb: + \fontspec_patch_listings: + } % \end{macrocode} % % \begin{environment}{verbatim*} % With the \pkg{verbatim} package. % \begin{macrocode} \cs_set:Npn \fontspec_patch_verbatim: - { - \@ifpackageloaded{verbatim} - { - \cs_set:cpn {verbatim*} - { - \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - } + { + \@ifpackageloaded{verbatim} + { + \cs_set:cpn {verbatim*} + { + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + } % \end{macrocode} % This is for vanilla \LaTeX. % \begin{macrocode} - { - \cs_set:cpn {verbatim*} - { - \@verbatim \fontspec_print_visible_spaces: \@sxverbatim - } - } + { + \cs_set:cpn {verbatim*} + { + \@verbatim \fontspec_print_visible_spaces: \@sxverbatim + } + } } % \end{macrocode} % \end{environment} @@ -127,41 +127,42 @@ % The main |listing*| environment inherits this definition. % \begin{macrocode} \cs_set:Npn \fontspec_patch_moreverb: - { - \@ifpackageloaded{moreverb}{ - \cs_set:cpn {listingcont*} - { - \cs_set:Npn \verbatim@processline - { - \thelisting@line \global\advance\listing@line\c_one - \the\verbatim@line\par - } - \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - }{} - } + { + \@ifpackageloaded{moreverb} + { + \cs_set:cpn {listingcont*} + { + \cs_set:Npn \verbatim@processline + { + \thelisting@line \global\advance\listing@line1\relax + \the\verbatim@line\par + } + \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + }{} + } % \end{macrocode} % \end{environment} % % \pkg{listings} and \pkg{fancvrb} make things nice and easy: % \begin{macrocode} \cs_set:Npn \fontspec_patch_fancyvrb: - { - \@ifpackageloaded{fancyvrb} - { - \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{fancyvrb} + { + \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: + }{} + } % \end{macrocode} % % \begin{macrocode} \cs_set:Npn \fontspec_patch_listings: - { - \@ifpackageloaded{listings} - { - \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{listings} + { + \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: + }{} + } % \end{macrocode} % % \subsection{\cs{oldstylenums}} @@ -173,13 +174,13 @@ % And we may as well provide the reverse command. % \begin{macrocode} \RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } + { + { \addfontfeature{Numbers=OldStyle} #1 } + } \NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } + { + { \addfontfeature{Numbers=Lining} #1 } + } % \end{macrocode} % \end{macro} % \end{macro} @@ -196,7 +197,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-scripts.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx index 480d53e865a..57d32e5c485 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-scripts.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Font script definitions} % @@ -171,7 +171,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx index 173de1f9c81..b17020e5f8c 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-user.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{User command internals} % \label{sec:codeinternal} @@ -48,7 +48,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} + \str_if_eq:eeT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } \@@_setmainfont_hook:nn {#1} {#2} \normalfont @@ -72,7 +72,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} + \str_if_eq:eeT {\familydefault} {\sfdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } \@@_setsansfont_hook:nn {#1} {#2} \normalfont @@ -96,7 +96,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} + \str_if_eq:eeT {\familydefault} {\ttdefault} { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl } \@@_setmonofont_hook:nn {#1} {#2} \normalfont @@ -497,7 +497,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx index 2b928d8ad41..c7ca26bb0e3 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> % % \section{Declaration of variables} % @@ -59,7 +59,6 @@ \bool_new:N \l_@@_disable_defaults_bool \bool_new:N \l_@@_alias_bool \bool_new:N \l_@@_external_bool -\bool_new:N \l_@@_never_check_bool \bool_new:N \l_@@_defining_encoding_bool \bool_new:N \l_@@_script_exist_bool \bool_new:N \g_@@_em_normalise_slant_bool @@ -67,6 +66,17 @@ \bool_new:N \l_@@_check_feat_bool % \end{macrocode} % +% \begin{macro}{\l_@@_never_check_bool} +% This boolean is overloaded. It is used to disable checking opentype script, language, and tags +% for two purposes: when a font has no opentype features, we just turn it true (i.e., disable checking); +% and, when running checking code that has a user-defined return path we want to allow the higher-level +% code to dictate the logic. +% TODO: tidy this up! +% \begin{macrocode} +\bool_new:N \l_@@_never_check_bool +% \end{macrocode} +% \end{macro} +% % \paragraph{Counters} % \begin{macrocode} \int_new:N \l_@@_script_int @@ -187,6 +197,10 @@ \tl_new:N \l_@@_emshape_query_tl \tl_new:N \l_@@_em_switch_tl \tl_new:N \l_@@_em_tmp_tl +\tl_new:N \l_@@_strong_tmp_tl +\tl_new:N \l_@@_strong_switch_tl +\tl_new:N \l_@@_hyphenchar_tl +\tl_new:N \l_@@_smcp_shape_tl % \end{macrocode} % % \begin{macrocode} @@ -269,7 +283,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-xfss.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-xfss.dtx index 9361eb81e5d..1d408074909 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-xfss.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-xfss.dtx @@ -1,4 +1,4 @@ -%%^^A%% fontspec-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> % \section{Changes to the NFSS} % @@ -19,10 +19,10 @@ \providecommand*\itscdefault{\itdefault\scdefault} \providecommand*\slscdefault{\sldefault\scdefault} \DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape{\itscdefault}\selectfont - } + { + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont + } \DeclareTextFontCommand{\textsi}{\sishape} % \end{macrocode} % \end{macro} \end{macro} @@ -76,25 +76,25 @@ % The original |\..shape| commands are redefined to use the merge shape macro. % \begin{macrocode} \DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_merge_shape:n\itdefault - } + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } \DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_merge_shape:n\sldefault - } + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } \DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_merge_shape:n\scdefault - } + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } \DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_merge_shape:n\updefault - } + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } % \end{macrocode} % \end{macro} \end{macro} \end{macro} \end{macro} % @@ -274,7 +274,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code.ltx b/Master/texmf-dist/source/latex/fontspec/fontspec-code.ltx index b42b8e1b6a2..c164175b5fa 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code.ltx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code.ltx @@ -30,7 +30,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex index 243282eab42..766b3527a07 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex @@ -324,7 +324,7 @@ OpenType language tag |#1|. % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-enc.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-enc.tex index 577c162172a..42a30d41f51 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-enc.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-enc.tex @@ -204,7 +204,7 @@ the process of defining Unicode font range encodings: % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex index f7c0c724a7a..5e3cf7fee20 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex @@ -160,8 +160,8 @@ separate font features may be defined to their respective shapes See \exref{itfeat}. \begin{Xexample}{itfeat}{Features for, say, just italics.} -\fontspec{EBGaramond12-Regular.otf}% - [ItalicFont=EBGaramond12-Italic.otf] +\fontspec{EBGaramond-Regular.otf}% + [ItalicFont=EBGaramond-Italic.otf] \itshape Don’t Ask Victoria! \\ \addfontfeature{ItalicFeatures={Style=Swash}} Don’t Ask Victoria! \\ @@ -602,7 +602,7 @@ Also see the OpenType \opt{Uppercase} option of the \feat{Letters} feature (\vre % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex index 9cbfb0e56c4..faf7fc3ff05 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex @@ -619,7 +619,7 @@ if it were a `naked' control sequence; \eg, `|M. \fontspec{...} N|' and % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex index 401b3d15195..c8677e4c106 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex @@ -240,7 +240,7 @@ An example for setting up a font family for use with \cs{strong} is discussed in % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex index c62e84cecc2..f10958b09ef 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex @@ -46,7 +46,7 @@ Please refer to the \LuaTeX/\pkg{luaotfload} documentation for more details. % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex index 1e7e6c712d0..38a449e902b 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex @@ -493,9 +493,10 @@ Japanese typography for annotations. For fonts with multiple |salt| OpenType features, use the fontspec \feat{Alternate} feature instead. -\Exref{style-alt} and \exref{style-hist} both contain glyph -substitutions with similar characteristics. -Note the occasional inconsistency with which font features are labelled; a long-tailed `Q' could turn up anywhere! +\Exref{style-alt} shows an example of a font feature that involves glyph substitution +for particular letters within an alphabet. +Other options in these categories operate in similar ways, with the choice of how +particular substitutions are organised with which feature largely up to the font designer. \begin{Xexample}[firstline=2]{style-alt}{Example of the \opt{Alternate} option of the \feat{Style} feature.} \Large @@ -505,24 +506,10 @@ Note the occasional inconsistency with which font features are labelled; a long- M Q W \end{Xexample} -\begin{Xexample}[firstline=2]{style-hist}{Example of the \opt{Historic} option of the \feat{Style} feature.} - \Large - \fontspec{Adobe Jenson Pro} - M Q Z \\ - \addfontfeature{Style=Historic} - M Q Z -\end{Xexample} - In other features, larger breadths of changes can be seen, covering -the style of an entire alphabet. See \exref{style-titl} and \exref{style-itrub}; in the latter, the \opt{Italic} option affects the Latin text and the \opt{Ruby} option the Japanese. - -\begin{Xexample}[firstline=2]{style-titl}{Example of the \opt{TitlingCaps} option of the \feat{Style} feature.} - \Large - \fontspec{Adobe Garamond Pro} - TITLING CAPS \\ - \addfontfeature{Style=TitlingCaps} - TITLING CAPS -\end{Xexample} +the style of an entire alphabet. +See \exref{style-itrub}; here, the \opt{Italic} option affects the Latin text +and the \opt{Ruby} option the Japanese. \begin{Xexample}[firstline=2]{style-itrub}{Example of the \opt{Italic} and \opt{Ruby} options of the \feat{Style} feature.} \Large \def\kana{ようこそ ワカヨタレソ} @@ -546,6 +533,7 @@ in \exref{style-hvkana}: the horizontal style is slightly wider. \end{Xexample} \subsection{Diacritics} + Specifies how combining diacritics should be placed. These will usually be controlled automatically according to the Script setting. @@ -744,33 +732,17 @@ particular font. These correspond to the OpenType features |cv01| to |cv99|. For each character that can be varied, it is possible to select among possible options for that particular glyph. -For example, in \exref{cv} a variety of glyphs for the character `v' are -selected, in which |5| corresponds to the character `v' for this font feature, +For example, in the example below, variants are chosen for glyphs `4' and `5', and the trailing |:|\meta{n} corresponds to which variety to choose. -Georg Duffner's open source Garamond revival font\footnote{\url{http://www.georgduffner.at/ebgaramond/}} is used in this example. +\begin{Verbatim} + \fontspec{EB Garamond 12 Italic}[CharacterVariant={4,5:2}] \& violet +\end{Verbatim} +The numbering is entirely font-soecific. Glyph `5' might be the character `v', for example. Character variants are specifically designed not to conflict with each -other, so you can enable them individually per character as shown in -\exref{cv2}. (Unlike stylistic alternates, say.) - +other, so you can enable them individually per character. +(Unlike stylistic alternates, say.) Note that the indexing starts from zero. -\begin{Lexample}[firstline=2]{cv}{The \feat{CharacterVariant} feature showing off Georg Duffner's open source Garamond revival font.} - \huge - \fontspec{EB Garamond 12 Italic} very \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant=5] very \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant=5:0] very \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant=5:1] very \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant=5:2] very \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant=5:3] very -\end{Lexample} - -\begin{Lexample}[firstline=2]{cv2}{The \feat{CharacterVariant} feature selecting multiple variants simultaneously.} - \huge - \fontspec{EB Garamond 12 Italic} \& violet \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant={4}] \& violet \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant={5:2}] \& violet \\ - \fontspec{EB Garamond 12 Italic}[CharacterVariant={4,5:2}] \& violet -\end{Lexample} \subsubsection{Alternates --- \texttt{salt}} @@ -1446,7 +1418,7 @@ Thanks to \name{Jonathan Kew}, \name{Yves Codet} and % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex index 46963cc0b46..8c1d4f1647e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex @@ -19,12 +19,12 @@ selected by \pkg{fontspec}. The \feat{Mapping} feature enables a \XeTeX\ text-mapping scheme, with an example shown in \exref{mapping}. \begin{Xexample}{mapping}{\XeTeX's \feat{Mapping} feature.} - \fontspec{Cochin}[Mapping=tex-text] + \fontspec{texgyrepagella-regular.otf}[Mapping=tex-text] ``!`A small amount of---text!'' \end{Xexample} Only one mapping can be active at a time and a second call to \feat{Mapping} -will simply override the first. +will override the first. Using the |tex-text| mapping is also equivalent to writing |Ligatures=TeX|. The use of the latter syntax is recommended for better compatibility with \LuaTeX\ documents. @@ -368,7 +368,7 @@ options: \opt{Off}, % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx index 80d55bc0f44..4f04001f1f7 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx @@ -89,7 +89,7 @@ end % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index 8a9475e6db5..e3f4907a98c 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -10,26 +10,26 @@ \gdef\FONTSPECDTX{ \DTX{fontspec.dtx} \DTX{fontspec-code-load.dtx} - \DTX{fontspec-vars.dtx} - \DTX{fontspec-msg.dtx} - \DTX{fontspec-opening.dtx} - \DTX{fontspec-fontload.dtx} - \DTX{fontspec-interfaces.dtx} - \DTX{fontspec-user.dtx} - \DTX{fontspec-api.dtx} - \DTX{fontspec-internal.dtx} - \DTX{fontspec-opentype.dtx} - \DTX{fontspec-graphite.dtx} - \DTX{fontspec-keyval.dtx} - \DTX{fontspec-feat-opentype.dtx} - \DTX{fontspec-scripts.dtx} - \DTX{fontspec-lang.dtx} - \DTX{fontspec-feat-aat.dtx} - \DTX{fontspec-enc.dtx} - \DTX{fontspec-math.dtx} - \DTX{fontspec-closing.dtx} - \DTX{fontspec-xfss.dtx} - \DTX{fontspec-patches.dtx} + \DTX{fontspec-code-vars.dtx} + \DTX{fontspec-code-msg.dtx} + \DTX{fontspec-code-opening.dtx} + \DTX{fontspec-code-fontload.dtx} + \DTX{fontspec-code-interfaces.dtx} + \DTX{fontspec-code-user.dtx} + \DTX{fontspec-code-api.dtx} + \DTX{fontspec-code-internal.dtx} + \DTX{fontspec-code-opentype.dtx} + \DTX{fontspec-code-graphite.dtx} + \DTX{fontspec-code-keyval.dtx} + \DTX{fontspec-code-feat-opentype.dtx} + \DTX{fontspec-code-scripts.dtx} + \DTX{fontspec-code-lang.dtx} + \DTX{fontspec-code-feat-aat.dtx} + \DTX{fontspec-code-enc.dtx} + \DTX{fontspec-code-math.dtx} + \DTX{fontspec-code-closing.dtx} + \DTX{fontspec-code-xfss.dtx} + \DTX{fontspec-code-patches.dtx} } %</dtx> % \end{macrocode} @@ -71,7 +71,7 @@ \ProvidesExplFile{fontspec.dtx} %</dtx> %<*fontspec> - {2018/07/30}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/10}{2.6j}{Font selection for XeLaTeX and LuaLaTeX} %</fontspec> % \end{macrocode} % @@ -90,8 +90,8 @@ %<lua>local fontspec = fontspec %<lua>fontspec.module = { %<lua> name = "fontspec", -%<lua> version = "v2.6h", -%<lua> date = "2018/07/30", +%<lua> version = "2.6j", +%<lua> date = "2019/01/10", %<lua> description = "Font selection for XeLaTeX and LuaLaTeX", %<lua> author = "Khaled Hosny, Philipp Gesang, Will Robertson", %<lua> copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", @@ -105,7 +105,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.ins b/Master/texmf-dist/source/latex/fontspec/fontspec.ins index e3164f1944e..bd49db003ba 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.ins +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.ins @@ -48,7 +48,7 @@ the conditions of the LaTeX Project Public License, version 1.3c or higher % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.ltx b/Master/texmf-dist/source/latex/fontspec/fontspec.ltx index 74472eedf18..7ee948df547 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.ltx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.ltx @@ -28,7 +28,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2018 Will Robertson, LPPL "maintainer" +% Copyright 2004-2019 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 14cba40dacd..17a012c3d66 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -6,26 +6,26 @@ %% %% fontspec.dtx (with options: `fontspec,LU') %% fontspec-code-load.dtx (with options: `fontspec,LU') -%% fontspec-vars.dtx (with options: `fontspec,LU') -%% fontspec-msg.dtx (with options: `fontspec,LU') -%% fontspec-opening.dtx (with options: `fontspec,LU') -%% fontspec-fontload.dtx (with options: `fontspec,LU') -%% fontspec-interfaces.dtx (with options: `fontspec,LU') -%% fontspec-user.dtx (with options: `fontspec,LU') -%% fontspec-api.dtx (with options: `fontspec,LU') -%% fontspec-internal.dtx (with options: `fontspec,LU') -%% fontspec-opentype.dtx (with options: `fontspec,LU') -%% fontspec-graphite.dtx (with options: `fontspec,LU') -%% fontspec-keyval.dtx (with options: `fontspec,LU') -%% fontspec-feat-opentype.dtx (with options: `fontspec,LU') -%% fontspec-scripts.dtx (with options: `fontspec,LU') -%% fontspec-lang.dtx (with options: `fontspec,LU') -%% fontspec-feat-aat.dtx (with options: `fontspec,LU') -%% fontspec-enc.dtx (with options: `fontspec,LU') -%% fontspec-math.dtx (with options: `fontspec,LU') -%% fontspec-closing.dtx (with options: `fontspec,LU') -%% fontspec-xfss.dtx (with options: `fontspec,LU') -%% fontspec-patches.dtx (with options: `fontspec,LU') +%% fontspec-code-vars.dtx (with options: `fontspec,LU') +%% fontspec-code-msg.dtx (with options: `fontspec,LU') +%% fontspec-code-opening.dtx (with options: `fontspec,LU') +%% fontspec-code-fontload.dtx (with options: `fontspec,LU') +%% fontspec-code-interfaces.dtx (with options: `fontspec,LU') +%% fontspec-code-user.dtx (with options: `fontspec,LU') +%% fontspec-code-api.dtx (with options: `fontspec,LU') +%% fontspec-code-internal.dtx (with options: `fontspec,LU') +%% fontspec-code-opentype.dtx (with options: `fontspec,LU') +%% fontspec-code-graphite.dtx (with options: `fontspec,LU') +%% fontspec-code-keyval.dtx (with options: `fontspec,LU') +%% fontspec-code-feat-opentype.dtx (with options: `fontspec,LU') +%% fontspec-code-scripts.dtx (with options: `fontspec,LU') +%% fontspec-code-lang.dtx (with options: `fontspec,LU') +%% fontspec-code-feat-aat.dtx (with options: `fontspec,LU') +%% fontspec-code-enc.dtx (with options: `fontspec,LU') +%% fontspec-code-math.dtx (with options: `fontspec,LU') +%% fontspec-code-closing.dtx (with options: `fontspec,LU') +%% fontspec-code-xfss.dtx (with options: `fontspec,LU') +%% fontspec-code-patches.dtx (with options: `fontspec,LU') %% ------------------------------------------------ %% The FONTSPEC package <wspr.io/fontspec> %% ------------------------------------------------ @@ -41,10 +41,10 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-luatex}% - {2018/07/30}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/10}{2.6j}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_new:N \l__fontspec_firsttime_bool \bool_new:N \l__fontspec_nobf_bool \bool_new:N \l__fontspec_noit_bool @@ -67,12 +67,12 @@ \bool_new:N \l__fontspec_disable_defaults_bool \bool_new:N \l__fontspec_alias_bool \bool_new:N \l__fontspec_external_bool -\bool_new:N \l__fontspec_never_check_bool \bool_new:N \l__fontspec_defining_encoding_bool \bool_new:N \l__fontspec_script_exist_bool \bool_new:N \g__fontspec_em_normalise_slant_bool \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool +\bool_new:N \l__fontspec_never_check_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -158,6 +158,10 @@ \tl_new:N \l__fontspec_emshape_query_tl \tl_new:N \l__fontspec_em_switch_tl \tl_new:N \l__fontspec_em_tmp_tl +\tl_new:N \l__fontspec_strong_tmp_tl +\tl_new:N \l__fontspec_strong_switch_tl +\tl_new:N \l__fontspec_hyphenchar_tl +\tl_new:N \l__fontspec_smcp_shape_tl \tl_new:N \g__fontspec_mathrm_tl \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl @@ -192,7 +196,7 @@ \tl_new:N \l__fontspec_sffamily_family_tl \tl_new:N \l__fontspec_ttfamily_family_tl -%%^^A%% fontspec-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } \cs_new:Npn \__fontspec_error:nn { \msg_error:nnn {fontspec} } \cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } @@ -300,6 +304,10 @@ { Option '#2' of font feature '#1' overwritten. } +\__fontspec_msg_new:nnn {fontspec} {ot-tag-too-long} + { + OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. + } \__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} { Font '\l_fontspec_fontname_tl' does not contain script '#1'.\\ @@ -420,7 +428,7 @@ } \char_set_catcode_ignore:n {32} -%%^^A%% fontspec-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareOption{cm-default} { \__fontspec_warning:n {cm-default-obsolete} @@ -473,10 +481,10 @@ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument - { - \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl - \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl - } + { + \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl + \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl + } \bool_if:NT \g__fontspec_euenc_bool { \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile @@ -511,7 +519,7 @@ \cs_generate_variant:Nn \tl_if_eq:nnT {ox} \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} -%%^^A%% fontspec-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { @@ -523,7 +531,7 @@ } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { - \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one + \int_set:Nn \suppressfontnotfounderror {1} } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_null:N {p,TF,T,F} { @@ -544,7 +552,7 @@ } \prg_new_conditional:Nnn \__fontspec_primitive_font_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 #2 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -555,7 +563,7 @@ \tex_hyphenchar:D #1 = #2 \scan_stop: } -%%^^A%% fontspec-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> \NewDocumentCommand \fontspec { O{} m O{} } { @@ -669,7 +677,7 @@ \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } -%%^^A%% fontspec-user.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_main_fontspec:nn { @@ -690,7 +698,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} + \str_if_eq:eeT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmainfont_hook:nn {#1} {#2} \normalfont @@ -708,7 +716,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} + \str_if_eq:eeT {\familydefault} {\sfdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setsansfont_hook:nn {#1} {#2} \normalfont @@ -726,7 +734,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} + \str_if_eq:eeT {\familydefault} {\ttdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmonofont_hook:nn {#1} {#2} \normalfont @@ -940,7 +948,7 @@ } } -%%^^A%% fontspec-api.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { @@ -1002,99 +1010,96 @@ } } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_language_int {#2} - \__fontspec_check_ot_feat:NnTF \font {#3} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl - \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl - \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \tl_set:Nn \l_fontspec_script_tl {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_check_lang:NnTF \font {#2} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } \cs_new:Nn \fontspec_set_family:Nnn { \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} + \tl_clear_new:N #1 \tl_set_eq:NN #1 \l_fontspec_family_tl } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} @@ -1143,81 +1148,81 @@ { \prg_return_false: } } -%%^^A%% fontspec-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new_protected:Nn \__fontspec_select_font_family:nn - { - \group_begin: - \__fontspec_font_suppress_not_found_error: - \__fontspec_init: + { + \group_begin: + \__fontspec_font_suppress_not_found_error: + \__fontspec_init: - \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} + \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} - \__fontspec_if_detect_external:nT {#2} - { \keys_set:nn {fontspec-preparse-external} {Path} } + \__fontspec_if_detect_external:nT {#2} + { \keys_set:nn {fontspec-preparse-external} {Path} } - \keys_set_known:nn {fontspec-preparse-cfg} {#1} + \keys_set_known:nn {fontspec-preparse-cfg} {#1} - \__fontspec_init_ttc:n {#2} - \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_init_ttc:n {#2} + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_extract_all_features:n {#1} - \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + \__fontspec_extract_all_features:n {#1} + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } - \__fontspec_preparse_features: - \__fontspec_load_font: - \__fontspec_set_scriptlang: - \__fontspec_get_features:n {} - \bool_set_false:N \l__fontspec_firsttime_bool + \__fontspec_preparse_features: + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:n {} + \bool_set_false:N \l__fontspec_firsttime_bool - \__fontspec_save_family_needed:nTF {#2} - { - \__fontspec_save_family:nn {#1} {#2} - } - { - } - \group_end: + \__fontspec_save_family_needed:nTF {#2} + { + \__fontspec_save_family:nn {#1} {#2} + } + { + } + \group_end: - \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl - } + \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl + } \cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn %% deprecated, for compatibility only \cs_new:Nn \__fontspec_sanitise_fontname:Nn - { - \tl_set:Nx #1 {#2} + { + \tl_set:Nx #1 {#2} \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \tl_if_in:NnT #1 {##1} - { - \tl_remove_once:Nn #1 {##1} - \tl_set:Nn \l__fontspec_extension_tl {##1} - \clist_map_break: - } - } - } + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \tl_set:Nn \l__fontspec_extension_tl {##1} + \clist_map_break: + } + } + } \prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} - { - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \bool_set_false:N \l__fontspec_tmpa_bool - \exp_args:Nx % <- this should be handled earlier - \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } - } - \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: - } + { + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \bool_set_false:N \l__fontspec_tmpa_bool + \exp_args:Nx % <- this should be handled earlier + \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } + } + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: + } \cs_new:Nn \__fontspec_init_ttc:n - { - \str_if_eq_x:nnT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} - } - } + { + \str_if_eq:eeT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} + } + } \cs_new:Nn \__fontspec_load_external_fontoptions:Nn { \bool_if:NT \l__fontspec_fontcfg_bool @@ -1233,67 +1238,67 @@ } } \cs_new:Nn \__fontspec_extract_all_features:n - { - \bool_if:NTF \l__fontspec_disable_defaults_bool - { - \clist_set:Nx \l__fontspec_all_features_clist {#1} - } - { - \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { + \bool_if:NTF \l__fontspec_disable_defaults_bool + { + \clist_set:Nx \l__fontspec_all_features_clist {#1} + } + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist - { \clist_clear:N \l__fontspec_family_fontopts_clist } - \tl_clear:N \l__fontspec_family_label_tl + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist + { \clist_clear:N \l__fontspec_family_fontopts_clist } + \tl_clear:N \l__fontspec_family_label_tl - \clist_set:Nx \l__fontspec_all_features_clist - { - \g__fontspec_default_fontopts_clist, - \l__fontspec_family_fontopts_clist, - \l__fontspec_fontopts_clist, - #1 - } - } - } + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } + } + } \cs_new:Nn \__fontspec_preparse_features: - { + { - \__fontspec_keys_set_known:nxN {fontspec-preparse-external} - { \l__fontspec_all_features_clist } - \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} + { \l__fontspec_all_features_clist } + \l__fontspec_keys_leftover_clist - \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} - \l__fontspec_keys_leftover_clist - \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} - \l__fontspec_fontfeat_clist - } + \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } \cs_new:Nn \__fontspec_load_font: - { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - } + { + \__fontspec_primitive_font_set:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} + \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + \__fontspec_set_font_type:N \l_fontspec_font + \__fontspec_primitive_font_gset:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} + \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn - { + { " \__fontspec_fontname_wrap:n { #1 #2 } #3 #4 #5 - \str_if_eq_x:nnF {#6}{} {:#6} " - } + \str_if_eq:eeF {#6}{} {:#6} " + } \cs_new:Nn \__fontspec_construct_font_call:nn - { - \__fontspec_construct_font_call:nnnnnn - {#1} - \l__fontspec_extension_tl - \l__fontspec_ttc_index_tl - \l_fontspec_renderer_tl - \l__fontspec_optical_size_tl - {#2} - } + { + \__fontspec_construct_font_call:nnnnnn + {#1} + \l__fontspec_extension_tl + \l__fontspec_ttc_index_tl + \l_fontspec_renderer_tl + \l__fontspec_optical_size_tl + {#2} + } \cs_new:Nn \__fontspec_font_is_name: { \cs_set_eq:NN \__fontspec_fontname_wrap:n \use:n @@ -1303,50 +1308,51 @@ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] } } \cs_new:Nn \__fontspec_set_scriptlang: - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {no-scripts} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - } - } + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_if_empty:NTF \l__fontspec_script_name_tl + { + \__fontspec_check_script:NnTF \l_fontspec_font {latn} + { + \tl_set:Nn \l__fontspec_script_name_tl {Latin} + \tl_if_empty:NT \l__fontspec_lang_name_tl + { + \tl_set:Nn \l__fontspec_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} + } + { + \__fontspec_info:n {no-scripts} + \bool_set_true:N \l__fontspec_never_check_bool + } + } + { + \tl_if_empty:NT \l__fontspec_lang_name_tl + { + \tl_set:Nn \l__fontspec_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} + } + } + } \cs_new:Nn \__fontspec_get_features:n - { - \__fontspec_init_fontface: - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} - \l__fontspec_keys_leftover_clist - \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist - \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist - - \tl_if_empty:NF \l__fontspec_mapping_tl - { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } - - \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } - { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } - { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } + { + \__fontspec_init_fontface: + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } + + \str_if_eq:eeF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } + { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } + } \prg_new_conditional:Nnn \__fontspec_save_family_needed:n { TF } { @@ -1393,141 +1399,139 @@ \__fontspec_info:nxx {defining-font} {#1} {#2} } \cs_new:Nn \__fontspec_save_fontinfo:n - { - \prop_new:c {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontname} { #1 } - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {options} { \l__fontspec_all_features_clist } - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontdef} - { - \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} - { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } - } - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num} \l__fontspec_language_int - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - } + { + \prop_new:c {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontname} { #1 } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontdef} + { + \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } + } + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num} \l__fontspec_language_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } \cs_new:Nn \__fontspec_find_autofonts: - { - \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} - } + { + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} + } - \bool_if:NF \l__fontspec_nobf_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} - } + \bool_if:NF \l__fontspec_nobf_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + } - \bool_if:NF \l__fontspec_noit_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} - } + \bool_if:NF \l__fontspec_noit_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} + } - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} - } + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} + } \cs_new:Nn \__fontspec_set_faces: - { - \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist - \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist - \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist - - \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } - } + { + \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } + } \cs_new:Nn \__fontspec_set_faces_aux:nnnnn - { - \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} - \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} + \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} + } \cs_new:Nn \fontspec_complete_fontname:Nn - { - \tl_set:Nx #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} + { + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} \tl_remove_all:Nn #1 {~} - } + } \cs_new:Nn \__fontspec_add_nfssfont:nnnn - { - \tl_set:Nx \l__fontspec_this_font_tl {#3} + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} - \tl_if_empty:xTF {#4} - { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } - { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } - \tl_if_empty:NF \l__fontspec_this_font_tl - { - \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} - { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } - } - } + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } + } \cs_new:Nn \__fontspec_set_font_type:N - { - \bool_set_true:N \l__fontspec_ot_bool - } + { + \bool_set_true:N \l__fontspec_ot_bool + } \cs_new:Nn \__fontspec_set_autofont:Nnn - { - \bool_if:NF \l__fontspec_external_bool - { - \tl_if_empty:xF {#2} - { - \tl_if_empty:NT #1 - { - \__fontspec_if_autofont:nnTF {#2} {#3} - { \tl_set:Nx #1 {#2#3} } - { \__fontspec_info:nx {no-font-shape} {#2#3} } - } - } - } - } - + { + \bool_if:NF \l__fontspec_external_bool + { + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } + } + } + } + } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} - { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } - } + { + \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} + \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } + } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn - { - \group_begin: - \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} - \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} - \group_end: - } - + { + \group_begin: + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist + \__fontspec_load_fontname:n {#1} + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} + \group_end: + } \cs_new:Nn \__fontspec_load_fontname:n - { + { \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } - } + } \keys_define:nn {fontspec/fontname} { Font .tl_set:N = \l_fontspec_fontname_tl , Font .groups:n = {getfontname} , } \cs_new:Nn \__fontspec_declare_shape:nnnn - { - \tl_clear:N \l__fontspec_nfss_tl - \tl_clear:N \l__fontspec_nfss_sc_tl - \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl + { + \tl_clear:N \l__fontspec_nfss_tl + \tl_clear:N \l__fontspec_nfss_sc_tl + \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl - \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } + \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } - \__fontspec_declare_shapes_normal:nn {#1} {#2} - \__fontspec_declare_shapes_smcaps:nn {#1} {#2} - \__fontspec_declare_shape_slanted:nn {#1} {#2} - \__fontspec_declare_shape_loginfo:nn {#1} {#2} - } + \__fontspec_declare_shapes_normal:nn {#1} {#2} + \__fontspec_declare_shapes_smcaps:nn {#1} {#2} + \__fontspec_declare_shape_slanted:nn {#1} {#2} + \__fontspec_declare_shape_loginfo:nn {#1} {#2} + } \cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} \cs_new:Nn \__fontspec_setup_single_size:nn { @@ -1546,38 +1550,38 @@ \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist \bool_if:NF \l__fontspec_nosc_bool - { - \tl_if_empty:NTF \l__fontspec_fontname_sc_tl - { - \__fontspec_make_smallcaps:TF - { - \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} - } - { - \bool_set_true:N \l__fontspec_nosc_bool - } - } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size - } + { + \tl_if_empty:NTF \l__fontspec_fontname_sc_tl + { + \__fontspec_make_smallcaps:TF + { + \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} + } + { + \bool_set_true:N \l__fontspec_nosc_bool + } + } + { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + } \bool_if:NF \l__fontspec_nosc_bool - { - \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl - {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} - } + { + \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl + {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} + } } \cs_new:Nn \__fontspec_setup_nfss:Nnnn - { + { - \__fontspec_get_features:n { #2 , #3 , #4 } + \__fontspec_get_features:n { #2 , #3 , #4 } - \tl_put_right:Nx #1 - { - <\l__fontspec_size_tl> \l__fontspec_scale_tl - \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } - { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } - } - } + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } + } + } \cs_new:Nn \__fontspec_declare_shapes_normal:nn { \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl} {\g__fontspec_nfss_family_tl} @@ -1591,7 +1595,6 @@ { \__fontspec_combo_sc_shape:n {#2} } {\l__fontspec_nfss_sc_tl} {\l__fontspec_postadjust_tl} } } - \cs_new:Nn \__fontspec_combo_sc_shape:n { \tl_if_exist:cTF { \__fontspec_shape_merge:nn {#1} {\scdefault} } @@ -1599,73 +1602,74 @@ { \scdefault } } \cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn - { - \group_begin: - \normalsize - \cs_undefine:c {#1/#2/#3/#4/\f@size} - \group_end: - \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} - } + { +\group_begin: +\normalsize +\cs_undefine:c {#1/#2/#3/#4/\f@size} +\group_end: +\DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } \cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn - { - \bool_if:nT - { - \str_if_eq_x_p:nn {#2} {\itdefault} && - !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) - } - { - \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{#1}{\sldefault} - {<->ssub*\g__fontspec_nfss_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} - } - } + { + \bool_if:nT + { + \str_if_eq_p:ee {#2} {\itdefault} && + !(\str_if_eq_p:ee {\itdefault} {\sldefault}) + } + { + \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{#1}{\sldefault} + {<->ssub*\g__fontspec_nfss_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} + } + } \cs_new:Nn \__fontspec_declare_shape_loginfo:nn - { - \tl_gput_right:Nx \g__fontspec_defined_shapes_tl - { - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn {#1/#2} - { - {\mddefault/\updefault} {'normal'~} - {\bfdefault/\updefault} {'bold'~} - {\mddefault/\itdefault} {'italic'~} - {\mddefault/\sldefault} {'slanted'~} - {\bfdefault/\itdefault} {'bold~ italic'~} - {\bfdefault/\sldefault} {'bold~ slanted'~} - } (#1/#2)~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_tl - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } - { - {\mddefault/\scdefault} {'small~ caps'~} - {\bfdefault/\scdefault} {'bold~ small~ caps'~} - {\mddefault/\itscdefault} {'italic~ small~ caps'~} - {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} - {\mddefault/\slscdefault} {'slanted~ small~ caps'~} - {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} - }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_sc_tl - \tl_if_empty:fF {\l__fontspec_postadjust_tl} - { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl - } - } - } + { + \tl_gput_right:Nx \g__fontspec_defined_shapes_tl + { + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn {#1/#2} + { + {\mddefault/\updefault} {'normal'~} + {\bfdefault/\updefault} {'bold'~} + {\mddefault/\itdefault} {'italic'~} + {\mddefault/\sldefault} {'slanted'~} + {\bfdefault/\itdefault} {'bold~ italic'~} + {\bfdefault/\sldefault} {'bold~ slanted'~} + } (#1/#2)~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_tl + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } + { + {\mddefault/\scdefault} {'small~ caps'~} + {\bfdefault/\scdefault} {'bold~ small~ caps'~} + {\mddefault/\itscdefault} {'italic~ small~ caps'~} + {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} + {\mddefault/\slscdefault} {'slanted~ small~ caps'~} + {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} + }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_sc_tl + \tl_if_empty:fF {\l__fontspec_postadjust_tl} + { + \exp_not:N \\ and~ font~ adjustment~ code: + \exp_not:N \\ \l__fontspec_postadjust_tl + } + } + } \tl_set:Nn \l__fontspec_pre_feat_sclist - { - mode = \l_fontspec_mode_tl ; - \tl_if_empty:NF \l_fontspec_script_tl - { - script = \l_fontspec_script_tl ; - language = \l_fontspec_lang_tl ; - } - } + { + mode = \l_fontspec_mode_tl ; + \tl_if_empty:NF \l_fontspec_script_tl + { + script = \l_fontspec_script_tl ; + language = \l_fontspec_lang_tl ; + } + } \cs_new:Nn \__fontspec_make_smallcaps:TF - { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} - } + { + \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + } \cs_new:Nn \__fontspec_update_featstr:n { \bool_if:NF \l__fontspec_firsttime_bool @@ -1682,23 +1686,23 @@ } } \cs_set:Npn \__fontspec_init: - { - \bool_set_false:N \l__fontspec_ot_bool - \bool_set_true:N \l__fontspec_firsttime_bool - \__fontspec_font_is_name: - \tl_clear:N \l__fontspec_font_path_tl - \tl_clear:N \l__fontspec_optical_size_tl - \tl_clear:N \l__fontspec_ttc_index_tl - \tl_clear:N \l_fontspec_renderer_tl - \tl_gclear:N \g__fontspec_defined_shapes_tl - \tl_gclear:N \g__fontspec_curr_series_tl - \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl - \tl_set:Nn \l_fontspec_mode_tl {node} - \int_set:Nn \luatex_prehyphenchar:D { `\- } % fixme - \int_zero:N \luatex_posthyphenchar:D % fixme - \int_zero:N \luatex_preexhyphenchar:D % fixme - \int_zero:N \luatex_postexhyphenchar:D % fixme - } + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \__fontspec_font_is_name: + \tl_clear:N \l__fontspec_font_path_tl + \tl_clear:N \l__fontspec_optical_size_tl + \tl_clear:N \l__fontspec_ttc_index_tl + \tl_clear:N \l_fontspec_renderer_tl + \tl_gclear:N \g__fontspec_defined_shapes_tl + \tl_gclear:N \g__fontspec_curr_series_tl + \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl + \tl_set:Nn \l_fontspec_mode_tl {node} + \int_set:Nn \prehyphenchar { `\- } % fixme + \int_zero:N \posthyphenchar % fixme + \int_zero:N \preexhyphenchar % fixme + \int_zero:N \postexhyphenchar % fixme + } \cs_new:Nn \__fontspec_init_fontface: { \tl_gclear:N \g__fontspec_rawfeatures_sclist @@ -1709,29 +1713,24 @@ \tl_clear:N \l__fontspec_wordspace_adjust_tl \tl_clear:N \l__fontspec_punctspace_adjust_tl } -\cs_new:Nn \__fontspec_iv_str_to_num:Nn +\cs_new_protected:Nn \__fontspec_ot_validate_tag:n { - \__fontspec_strip_leading_sign:Nw #1#2 \q_nil + \__fontspec_ot_validate_tag:w #1 \q_nil } -\cs_set:Npn \__fontspec_strip_leading_sign:Nw #1#2#3 \q_nil +\cs_generate_variant:Nn \__fontspec_ot_validate_tag:n {x} +\cs_set:Npn \__fontspec_ot_validate_tag:w #1 #2 \q_nil { - \bool_if:nTF { \str_if_eq_p:nn {#2} {+} || \str_if_eq_p:nn {#2} {-} } - { \__fontspec_iv_str_to_num:w #1 \q_nil #3 \c_empty_tl \c_empty_tl \q_nil } - { \__fontspec_iv_str_to_num:w #1 \q_nil #2#3 \c_empty_tl \c_empty_tl \q_nil } + \bool_if:nTF { \str_if_eq_p:nn {#1} {+} || \str_if_eq_p:nn {#1} {-} } + { \__fontspec_ot_validate_tag_aux:w #2 \c_empty_tl \c_empty_tl \q_nil } + { \__fontspec_ot_validate_tag_aux:w #1#2 \c_empty_tl \c_empty_tl \q_nil } + } +\cs_set:Npn \__fontspec_ot_validate_tag_aux:w #1#2#3#4#5 \q_nil + { + \int_compare:nT { \tl_count:n {#5} > 2 } + { \__fontspec_error:nx {ot-tag-too-long} {#1#2#3#4#5} } } -\cs_set:Npn \__fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil - { - \int_set:Nn #1 - { - `#2 * "1000000 - + `#3 * "10000 - + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 - + \ifx \c_empty_tl #5 32 \else `#5 \fi - } - } -\cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {No} -%%^^A%% fontspec-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_define_opentype_feature_group:n { @@ -1771,16 +1770,16 @@ \cs_new:Nn \__fontspec_feat_off:n {#1Off} \cs_new:Nn \__fontspec_feat_reset:n {#1Reset} \cs_new:Nn \__fontspec_define_opentype_onoffreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} + } \cs_new:Nn \__fontspec_define_opentype_onreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} + } \cs_new:Nn \__fontspec_make_OT_feature:nnn { @@ -1813,46 +1812,58 @@ { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua{fontspec.check_ot_script("\l__fontspec_tmp_tl", "#2")} - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + { + \__fontspec_ot_validate_tag:x {#2} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua{fontspec.check_ot_script("\l__fontspec_tmp_tl", "#2")} + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } } - } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { + \__fontspec_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_lang:Nnn {TF} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_lang( "\l__fontspec_tmp_tl", "#2", "\l_fontspec_script_tl" ) + \__fontspec_ot_validate_tag:x {#2} + \__fontspec_ot_validate_tag:x {#3} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_lang( "\l__fontspec_tmp_tl", "#2", "#3" ) + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { + \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl} + {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \cs_if_eq:NNTF #1 \font - { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } - { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } - \directlua { - fontspec.check_ot_feat( - "\l__fontspec_tmp_tl", "#2", - "\l_fontspec_lang_tl", "\l_fontspec_script_tl" - ) + \__fontspec_ot_validate_tag:x {#2} + \__fontspec_ot_validate_tag:x {#3} + \__fontspec_ot_validate_tag:x {#4} + \cs_if_eq:NNTF #1 \font + { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } + { \tl_set:Nx \l__fontspec_tmp_tl {\cs_to_str:N #1} } + \directlua + { + fontspec.check_ot_feat("\l__fontspec_tmp_tl", "#2", "#3", "#4") + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -1977,10 +1988,10 @@ \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {zero}{Slashed~Zero} -%%^^A%% fontspec-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> \clist_gset:Nn \g__fontspec_all_keyval_modules_clist { @@ -2006,60 +2017,61 @@ \bool_set_false:N \l__fontspec_fontcfg_bool } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Path} - { - \bool_set_true:N \l__fontspec_nobf_bool - \bool_set_true:N \l__fontspec_noit_bool - \bool_set_true:N \l__fontspec_external_bool - \tl_set:Nn \l__fontspec_font_path_tl {#1} - \__fontspec_font_is_file: - } + { + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \tl_set:Nn \l__fontspec_font_path_tl {#1} + \__fontspec_font_is_file: + } \aliasfontfeature{Path}{ExternalLocation} \__fontspec_keys_define_code:nnn {fontspec} {Path} {} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} - { - \tl_set:Nn \l__fontspec_extension_tl {#1} - \bool_if:NF \l__fontspec_external_bool - { - \keys_set:nn {fontspec-preparse-external} {Path} - } - } + { + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool + { + \keys_set:nn {fontspec-preparse-external} {Path} + } + } \tl_clear:N \l__fontspec_extension_tl \__fontspec_keys_define_code:nnn {fontspec} {Extension} {} \keys_define:nn {fontspec-renderer} - { - Renderer .choices:nn = - {AAT,ICU,OpenType,Graphite,Full,Basic} - { - \int_compare:nTF {\l_keys_choice_int <= 4} { - \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} - } - { - \tl_set:Nx \l_fontspec_mode_tl - { - \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } - } - \tl_gset:Nx \g__fontspec_single_feat_tl { mode=\l_fontspec_mode_tl } - } - } - } + { + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} + { + \int_compare:nTF {\l_keys_choice_int <= 4} + { + \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} + } + { + \tl_set:Nx \l_fontspec_mode_tl + { + \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } + } + \tl_gset:Nx \g__fontspec_single_feat_tl { mode=\l_fontspec_mode_tl } + } + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} - { - \tl_set:Nn \l__fontspec_script_name_tl {#1} - } + { + \tl_set:Nn \l__fontspec_script_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} - { - \tl_set:Nn \l__fontspec_lang_name_tl {#1} - } + { + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {FontIndex} - { - \str_if_eq_x:nnF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { \__fontspec_warning:n {font-index-needs-ttc} } + { + \str_if_eq:eeF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { \__fontspec_warning:n {font-index-needs-ttc} } \tl_set:Nn \l__fontspec_ttc_index_tl {(#1)} - } + } \__fontspec_keys_define_code:nnn {fontspec} {FontIndex} - { + { \tl_set:Nn \l__fontspec_ttc_index_tl {(#1)} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l__fontspec_fontname_up_tl {#1} @@ -2125,76 +2137,76 @@ } } \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + { + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} - { - \bool_if:NF \l__fontspec_firsttime_bool - { - \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} - } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \tl_if_empty:NT \l__fontspec_this_font_tl - { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \tl_if_empty:NT \l__fontspec_this_font_tl + { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} - { - \tl_set:Nn \l__fontspec_this_font_tl {#1} - } + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec} {Font} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Size} - { - \tl_set:Nn \l__fontspec_size_tl {#1} - } + { + \tl_set:Nn \l__fontspec_size_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Font} - { - \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} - { - \tl_gset:Nx \g__fontspec_nfss_enc_tl { #1 } - } + { + \tl_gset:Nx \g__fontspec_nfss_enc_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} - { - \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } - } + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec} {FontFace} { \tl_clear:N \l__fontspec_this_font_tl @@ -2213,271 +2225,273 @@ {\use_i:nnn #1} {\use_ii:nnn #1} {\l__fontspec_this_font_tl} {\l__fontspec_this_feat_clist} } \__fontspec_keys_define_code:nnn {fontspec} {Scale} - { - \str_case:nnF {#1} - { - {MatchLowercase} { \__fontspec_calc_scale:n {5} } - {MatchUppercase} { \__fontspec_calc_scale:n {8} } - } - { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } - } + { + \str_case:nnF {#1} + { + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } + } + { \tl_set:Nx \l__fontspec_scale_tl {#1} } + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } \cs_new:Nn \__fontspec_calc_scale:n - { - \group_begin: + { + \group_begin: - \fontencoding { \encodingdefault } - \fontfamily { \rmdefault } - \selectfont + \fontencoding { \encodingdefault } + \fontfamily { \rmdefault } + \selectfont - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font - \tl_gset:Nx \l__fontspec_scale_tl - { - \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } - } + \tl_set:Nx \l__fontspec_scale_tl + { + \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / + \dim_to_fp:n {\l__fontspec_tmpb_dim} } + } - \__fontspec_info:n {set-scale} - \group_end: - } + \__fontspec_info:n {set-scale} + \exp_args:NNNx + \group_end: + \tl_set:Nx \l__fontspec_scale_tl { \l__fontspec_scale_tl } + } \cs_new:Nn \__fontspec_set_font_dimen:NnN - { - \dim_set:Nn #1 { \fontdimen #2 #3 } - \dim_compare:nNnT #1 = {0pt} - { - \settoheight #1 - { - \str_if_eq:nnTF {#3} {\font} \rmfamily #3 - \int_case:nnF #2 - { - {5} {x} % x-height - {8} {X} % cap-height - } {?} % "else" clause; never reached. - } - } - } + { + \dim_set:Nn #1 { \fontdimen #2 #3 } + \dim_compare:nNnT #1 = {0pt} + { + \settoheight #1 + { + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 + \int_case:nnF #2 + { + {5} {x} % x-height + {8} {X} % cap-height + } {?} % "else" clause; never reached. + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} - { - \bool_if:NF \l__fontspec_firsttime_bool - { \_fontspec_parse_wordspace:w #1,,,\q_stop } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \_fontspec_parse_wordspace:w #1,,,\q_stop } + } \__fontspec_aff_error:n {WordSpace} \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop - { - \tl_if_empty:nTF {#4} - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #1 \fontdimen 3 \font - \fontdimen 4 \font = #1 \fontdimen 4 \font - } - } - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #2 \fontdimen 3 \font - \fontdimen 4 \font = #3 \fontdimen 4 \font - } - } - } + { + \tl_if_empty:nTF {#4} + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #1 \fontdimen 3 \font + \fontdimen 4 \font = #1 \fontdimen 4 \font + } + } + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #2 \fontdimen 3 \font + \fontdimen 4 \font = #3 \fontdimen 4 \font + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} - { - \str_case_x:nnF {#1} - { - {WordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 0 \fontdimen 2 \font } - } - {TwiceWordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 1 \fontdimen 2 \font } - } - } - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } - } - } + { + \str_case_e:nnF {#1} + { + {WordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } + } \__fontspec_aff_error:n {PunctuationSpace} \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} - { - \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} - } + { + \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {LetterSpace} - { - \__fontspec_update_featstr:n {letterspace=#1} - } + { + \__fontspec_update_featstr:n {letterspace=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} - { - \str_if_eq:nnTF {#1} {None} - { - \tl_put_right:Nn \l__fontspec_postadjust_tl - { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } - } - { - \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} + { + \str_if_eq:nnTF {#1} {None} + { + \tl_put_right:Nn \l__fontspec_postadjust_tl + { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } + } + { + \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} - \tl_if_single:nTF {#1} - { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } - { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } + \tl_if_single:nTF {#1} + { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } + { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} - { - \tl_put_right:Nn \l__fontspec_postadjust_tl - { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l_fontspec_hyphenchar_tl } } - } - { \__fontspec_error:nx {no-glyph}{#1} } + \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + { + \tl_put_right:Nn \l__fontspec_postadjust_tl + { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } + } + { \__fontspec_error:nx {no-glyph}{#1} } - } - } + } + } \__fontspec_aff_error:n {HyphenChar} \__fontspec_keys_define_code:nnn {fontspec} {Color} - { - \cs_if_exist:cTF { \token_to_str:N \color@ #1 } - { - \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl - } - { - \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } - { - \int_compare:nTF { \tl_count:n {#1} == 8 } - { \fontspec_parse_colour:viii #1 } - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {bad-colour} {#1} } - } - } - } - } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } + } + } + } + } \cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 - { - \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} - \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice-col} {#7#8} } - } - \tl_set:Nn \l__fontspec_opacity_tl {#7#8} - } + { + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice-col} {#7#8} } + } + \tl_set:Nn \l__fontspec_opacity_tl {#7#8} + } \aliasfontfeature{Color}{Colour} \__fontspec_keys_define_code:nnn {fontspec} {Opacity} - { - \int_set:Nn \l__fontspec_tmp_int {255} - \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice} {#1} } - } - \tl_set:Nx \l__fontspec_opacity_tl - { - \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hex:n { \l__fontspec_tmp_int } - } - } + { + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } + } + \tl_set:Nx \l__fontspec_opacity_tl + { + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hex:n { \l__fontspec_tmp_int } + } + } \__fontspec_keys_define_code:nnn {fontspec-opentype} {Mapping} - { - \str_if_eq:nnTF {#1} {tex-text} - { - \__fontspec_warning:n {no-mapping-ligtex} - \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} - \keys_set:nn {fontspec-opentype} { Ligatures=TeX } - } - { \__fontspec_warning:n {no-mapping} } - } + { + \str_if_eq:nnTF {#1} {tex-text} + { + \__fontspec_warning:n {no-mapping-ligtex} + \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} + \keys_set:nn {fontspec-opentype} { Ligatures=TeX } + } + { \__fontspec_warning:n {no-mapping} } + } \__fontspec_keys_define_code:nnn {fontspec} {Weight} - { - \__fontspec_update_featstr:n{weight=#1} - } + { + \__fontspec_update_featstr:n{weight=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {Width} - { - \__fontspec_update_featstr:n{width=#1} - } + { + \__fontspec_update_featstr:n{width=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} - { - \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} - } + { + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} + } \keys_define:nn {fontspec} - { - FakeSlant .code:n = - { - \__fontspec_update_featstr:n{slant=#1} - }, - FakeSlant .default:n = {0.2} -} + { + FakeSlant .code:n = + { + \__fontspec_update_featstr:n {slant=#1} + }, + FakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - FakeStretch .code:n = - { - \__fontspec_update_featstr:n{extend=#1} - }, - FakeStretch .default:n = {1.2} -} + { + FakeStretch .code:n = + { + \__fontspec_update_featstr:n {extend=#1} + }, + FakeStretch .default:n = {1.2} + } \keys_define:nn {fontspec} - { - FakeBold .code:n = { \__fontspec_warning:n {fakebold-only-xetex} } - } + { + FakeBold .code:n = { \__fontspec_warning:n {fakebold-only-xetex} } + } \keys_define:nn {fontspec} - { - AutoFakeSlant .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_slant_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_noit_bool - - \tl_if_empty:NF \l__fontspec_fake_embolden_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeBold=\l__fontspec_fake_embolden_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeSlant .default:n = {0.2} -} + { + AutoFakeSlant .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_slant_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_noit_bool + + \tl_if_empty:NF \l__fontspec_fake_embolden_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeBold=\l__fontspec_fake_embolden_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - AutoFakeBold .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_nobf_bool - - \tl_if_empty:NF \l__fontspec_fake_slant_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeSlant=\l__fontspec_fake_slant_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeBold .default:n = {1.5} -} + { + AutoFakeBold .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_nobf_bool + + \tl_if_empty:NF \l__fontspec_fake_slant_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeSlant=\l__fontspec_fake_slant_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeBold .default:n = {1.5} + } \__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } \__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } -%%^^A%% fontspec-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \__fontspec_feat_prop_add:nn {salt} { Alternate\,=\,$N$ } \__fontspec_feat_prop_add:nn {nalt} { Annotation\,=\,$N$ } @@ -2669,152 +2683,156 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {ProportionalMetrics} {vpal} {vpal} {+valt,+vhal} \__fontspec_define_opentype_feature_group:n {Alternate} \keys_define:nn {fontspec-opentype} - { - Alternate .default:n = {0} , - Alternate / Random .code:n = - { \__fontspec_make_OT_feature:nnn {salt}{ +salt = random }{} } , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } - } - } + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } + } + } +\keys_define:nn {fontspec-opentype} + { + Alternate / Random .code:n = + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = random }{} } , + } \aliasfontfeature{Alternate}{StylisticAlternates} \__fontspec_define_opentype_feature_group:n {Variant} \keys_define:nn {fontspec-opentype} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Variant .default:n = {0} , + Variant / unknown .code:n = { - \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + \clist_map_inline:nn {#1} + { + \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + } } - } - } + } \aliasfontfeature{Variant}{StylisticSet} \__fontspec_define_opentype_feature_group:n {CharacterVariant} \use:x - { - \cs_new:Npn \exp_not:N \fontspec_parse_cv:w - ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil - { - \__fontspec_make_OT_feature:xxx - { cv \exp_not:N \two@digits {##1} } { +cv \exp_not:N \two@digits {##1} = ##2 } {} - } - \keys_define:nn {fontspec-opentype} - { - CharacterVariant / unknown .code:n = - { - \clist_map_inline:nn {##1} - { - \exp_not:N \fontspec_parse_cv:w - ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil - } - } - } - } + { + \cs_new:Npn \exp_not:N \fontspec_parse_cv:w + ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil + { + \__fontspec_make_OT_feature:xxx + { cv \exp_not:N \two@digits {##1} } + { +cv \exp_not:N \two@digits {##1} = ##2 } {} + } + \keys_define:nn {fontspec-opentype} + { + CharacterVariant / unknown .code:n = + { + \clist_map_inline:nn {##1} + { + \exp_not:N \fontspec_parse_cv:w + ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil + } + } + } + } \__fontspec_define_opentype_feature_group:n {Annotation} \keys_define:nn {fontspec-opentype} - { - Annotation .default:n = {0} , - Annotation / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} - } - } + { + Annotation .default:n = {0} , + Annotation / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} + } + } \__fontspec_define_opentype_feature_group:n {Ornament} \keys_define:nn {fontspec-opentype} - { - Ornament .default:n = {0} , - Ornament / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} - } - } + { + Ornament .default:n = {0} , + Ornament / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} + } + } \keys_define:nn { fontspec-opentype } { Script .choice: } \cs_new:Nn \fontspec_new_script:nn - { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = - \bool_set_false:N \l__fontspec_script_exist_bool - \clist_map_inline:nn {#2} - { - \__fontspec_check_script:NnTF \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_script_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } - { } - } - \bool_if:NF \l__fontspec_script_exist_bool - { - \str_if_eq:nnTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - } - } - } - } + { + \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \bool_set_false:N \l__fontspec_script_exist_bool + \clist_map_inline:nn {#2} + { + \__fontspec_check_script:NnTF \l_fontspec_font {####1} + { + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_script_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: + } + { } + } + \bool_if:NF \l__fontspec_script_exist_bool + { + \str_if_eq:nnTF {#1} {Latin} + { + \__fontspec_warning:nx {script-not-exist} {#1} + } + { + \__fontspec_check_script:NnTF \l_fontspec_font {latn} + { + \__fontspec_warning:nx {script-not-exist-latn} {#1} + \tl_set:Nn \l_fontspec_script_tl {latn} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + } + { + \__fontspec_warning:nx {script-not-exist} {#1} + } + } + } + } + } \keys_define:nn { fontspec-opentype } { Language .choice: } \cs_new:Nn \fontspec_new_lang:nn - { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} - { - \tl_set:Nn \l_fontspec_lang_tl {#2} - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } - } - { - \__fontspec_warning:nx {language-not-exist} {#1} - \keys_set:nn { fontspec-opentype } { Language = Default } - } + { + \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + { + \tl_set:Nn \l_fontspec_lang_tl {#2} + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } + } + { + \__fontspec_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec-opentype } { Language = Default } + } + } } - } \__fontspec_keys_define_code:nnn {fontspec-opentype}{ Language / Default } - { - \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \int_zero:N \l__fontspec_language_int - \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } - } + { + \tl_set:Nn \l_fontspec_lang_tl {DFLT} + \int_zero:N \l__fontspec_language_int + \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } + } \keys_define:nn {fontspec-opentype} - { - Language / Turkish .code:n = - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TRK} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } - } - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TUR} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } - } - { - \__fontspec_warning:nx {language-not-exist} {Turkish} - \keys_set:nn {fontspec-opentype} {Language=Default} - } - } - } - } + { + Language / Turkish .code:n = + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TRK} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } + } + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TUR} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } + } + { + \__fontspec_warning:nx {language-not-exist} {Turkish} + \keys_set:nn {fontspec-opentype} {Language=Default} + } + } + } + } \cs_new:Nn \__fontspec_ot_compat:nn { \aliasfontfeatureoption {#1} {#2Off} {No#2} @@ -2837,7 +2855,7 @@ \__fontspec_ot_compat:nn {Diacritics} {AboveBase} \__fontspec_ot_compat:nn {Diacritics} {BelowBase} -%%^^A%% fontspec-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontscript{Adlam}{adlm} \newfontscript{Ahom}{ahom} @@ -2984,7 +3002,7 @@ \newfontscript{N'ko}{nko~} \newfontscript{Oriya}{ory2,orya} -%%^^A%% fontspec-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontlanguage{Abaza}{ABA} \newfontlanguage{Abkhazian}{ABK} @@ -3369,10 +3387,10 @@ \newfontlanguage{Zande}{ZND} \newfontlanguage{Zulu}{ZUL} -%%^^A%% fontspec-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand\UnicodeFontFile[2]{"[#1]:#2"} \providecommand\UnicodeFontName[2]{"#1:#2"} @@ -3462,7 +3480,7 @@ { \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} } } -%%^^A%% fontspec-math.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-math.dtx -- part of FONTSPEC <wspr.io/fontspec> \@ifpackageloaded{euler} { \bool_gset_true:N \g__fontspec_pkg_euler_loaded_bool } { \bool_gset_false:N \g__fontspec_pkg_euler_loaded_bool } @@ -3533,6 +3551,7 @@ \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} + \renewcommand{\hbar}{{\mathchar"AF\mkern-9mu h}}% TODO: test with other fonts } } \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault @@ -3595,23 +3614,23 @@ } \AtBeginDocument{\fontspec_maybe_setup_maths:} -%%^^A%% fontspec-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_if:NT \g__fontspec_cfg_bool - { - \InputIfFileExists{fontspec.cfg} - {} - {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} - } + { + \InputIfFileExists{fontspec.cfg} + {} + { \typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.} } + } -%%^^A%% fontspec-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand*\itscdefault{\itdefault\scdefault} \providecommand*\slscdefault{\sldefault\scdefault} \DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape{\itscdefault}\selectfont - } + { + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont + } \DeclareTextFontCommand{\textsi}{\sishape} \cs_new:Nn \__fontspec_shape_merge:nn { c__fontspec_shape_#1_#2_tl } \tl_const:cn { \__fontspec_shape_merge:nn \itdefault \scdefault } {\itscdefault} @@ -3642,25 +3661,25 @@ \prg_return_true: \prg_return_false: } \DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_merge_shape:n\itdefault - } + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } \DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_merge_shape:n\sldefault - } + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } \DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_merge_shape:n\scdefault - } + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } \DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_merge_shape:n\updefault - } + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } \cs_new_protected:Npn \emfontdeclare #1 { \prop_gclear:N \g__fontspec_em_prop @@ -3763,33 +3782,33 @@ \strongfontdeclare{ \bfseries } \emfontdeclare{ \emshape, \eminnershape } -%%^^A%% fontspec-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareRobustCommand{\-} - { - \discretionary - { - \char\ifnum\hyphenchar\font<\z@ - \xlx@defaulthyphenchar - \else - \hyphenchar\font - \fi - }{}{} - } + { + \discretionary + { + \char\ifnum\hyphenchar\font<\z@ + \xlx@defaulthyphenchar + \else + \hyphenchar\font + \fi + }{}{} + } \def\xlx@defaulthyphenchar{`\-} \cs_new:Nn \fontspec_visible_space: - { - \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \char"2423\scan_stop: } - { \fontspec_visible_space_fallback: } - } + { + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \char"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } \cs_new:Nn \fontspec_visible_space_fallback: - { { - \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} - \textvisiblespace + { + \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} + \textvisiblespace + } } - } \group_begin: \char_set_catcode_active:n{"20}% \cs_gset:Npn\fontspec_print_visible_spaces:{% @@ -3798,71 +3817,72 @@ }% \group_end: \def\verb - { - \relax\ifmmode\hbox\else\leavevmode\null\fi - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\__fontspecsverb\@verb - } + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\__fontspecsverb\@verb + } \def\__fontspecsverb{\fontspec_print_visible_spaces:\@sverb} \AtBeginDocument - { - \fontspec_patch_verbatim: - \fontspec_patch_moreverb: - \fontspec_patch_fancyvrb: - \fontspec_patch_listings: - } + { + \fontspec_patch_verbatim: + \fontspec_patch_moreverb: + \fontspec_patch_fancyvrb: + \fontspec_patch_listings: + } \cs_set:Npn \fontspec_patch_verbatim: - { - \@ifpackageloaded{verbatim} - { - \cs_set:cpn {verbatim*} - { - \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - } - { - \cs_set:cpn {verbatim*} - { - \@verbatim \fontspec_print_visible_spaces: \@sxverbatim - } - } + { + \@ifpackageloaded{verbatim} + { + \cs_set:cpn {verbatim*} + { + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + } + { + \cs_set:cpn {verbatim*} + { + \@verbatim \fontspec_print_visible_spaces: \@sxverbatim + } + } } \cs_set:Npn \fontspec_patch_moreverb: - { - \@ifpackageloaded{moreverb}{ - \cs_set:cpn {listingcont*} - { - \cs_set:Npn \verbatim@processline - { - \thelisting@line \global\advance\listing@line\c_one - \the\verbatim@line\par - } - \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - }{} - } + { + \@ifpackageloaded{moreverb} + { + \cs_set:cpn {listingcont*} + { + \cs_set:Npn \verbatim@processline + { + \thelisting@line \global\advance\listing@line1\relax + \the\verbatim@line\par + } + \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + }{} + } \cs_set:Npn \fontspec_patch_fancyvrb: - { - \@ifpackageloaded{fancyvrb} - { - \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{fancyvrb} + { + \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: + }{} + } \cs_set:Npn \fontspec_patch_listings: - { - \@ifpackageloaded{listings} - { - \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{listings} + { + \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: + }{} + } \RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } + { + { \addfontfeature{Numbers=OldStyle} #1 } + } \NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } + { + { \addfontfeature{Numbers=Lining} #1 } + } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index e9ba96a3392..2620e3def8f 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -6,26 +6,26 @@ %% %% fontspec.dtx (with options: `fontspec,XE') %% fontspec-code-load.dtx (with options: `fontspec,XE') -%% fontspec-vars.dtx (with options: `fontspec,XE') -%% fontspec-msg.dtx (with options: `fontspec,XE') -%% fontspec-opening.dtx (with options: `fontspec,XE') -%% fontspec-fontload.dtx (with options: `fontspec,XE') -%% fontspec-interfaces.dtx (with options: `fontspec,XE') -%% fontspec-user.dtx (with options: `fontspec,XE') -%% fontspec-api.dtx (with options: `fontspec,XE') -%% fontspec-internal.dtx (with options: `fontspec,XE') -%% fontspec-opentype.dtx (with options: `fontspec,XE') -%% fontspec-graphite.dtx (with options: `fontspec,XE') -%% fontspec-keyval.dtx (with options: `fontspec,XE') -%% fontspec-feat-opentype.dtx (with options: `fontspec,XE') -%% fontspec-scripts.dtx (with options: `fontspec,XE') -%% fontspec-lang.dtx (with options: `fontspec,XE') -%% fontspec-feat-aat.dtx (with options: `fontspec,XE') -%% fontspec-enc.dtx (with options: `fontspec,XE') -%% fontspec-math.dtx (with options: `fontspec,XE') -%% fontspec-closing.dtx (with options: `fontspec,XE') -%% fontspec-xfss.dtx (with options: `fontspec,XE') -%% fontspec-patches.dtx (with options: `fontspec,XE') +%% fontspec-code-vars.dtx (with options: `fontspec,XE') +%% fontspec-code-msg.dtx (with options: `fontspec,XE') +%% fontspec-code-opening.dtx (with options: `fontspec,XE') +%% fontspec-code-fontload.dtx (with options: `fontspec,XE') +%% fontspec-code-interfaces.dtx (with options: `fontspec,XE') +%% fontspec-code-user.dtx (with options: `fontspec,XE') +%% fontspec-code-api.dtx (with options: `fontspec,XE') +%% fontspec-code-internal.dtx (with options: `fontspec,XE') +%% fontspec-code-opentype.dtx (with options: `fontspec,XE') +%% fontspec-code-graphite.dtx (with options: `fontspec,XE') +%% fontspec-code-keyval.dtx (with options: `fontspec,XE') +%% fontspec-code-feat-opentype.dtx (with options: `fontspec,XE') +%% fontspec-code-scripts.dtx (with options: `fontspec,XE') +%% fontspec-code-lang.dtx (with options: `fontspec,XE') +%% fontspec-code-feat-aat.dtx (with options: `fontspec,XE') +%% fontspec-code-enc.dtx (with options: `fontspec,XE') +%% fontspec-code-math.dtx (with options: `fontspec,XE') +%% fontspec-code-closing.dtx (with options: `fontspec,XE') +%% fontspec-code-xfss.dtx (with options: `fontspec,XE') +%% fontspec-code-patches.dtx (with options: `fontspec,XE') %% ------------------------------------------------ %% The FONTSPEC package <wspr.io/fontspec> %% ------------------------------------------------ @@ -41,10 +41,10 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2018/07/30}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/10}{2.6j}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> -%%^^A%% fontspec-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_new:N \l__fontspec_firsttime_bool \bool_new:N \l__fontspec_nobf_bool \bool_new:N \l__fontspec_noit_bool @@ -67,12 +67,12 @@ \bool_new:N \l__fontspec_disable_defaults_bool \bool_new:N \l__fontspec_alias_bool \bool_new:N \l__fontspec_external_bool -\bool_new:N \l__fontspec_never_check_bool \bool_new:N \l__fontspec_defining_encoding_bool \bool_new:N \l__fontspec_script_exist_bool \bool_new:N \g__fontspec_em_normalise_slant_bool \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool +\bool_new:N \l__fontspec_never_check_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -158,6 +158,10 @@ \tl_new:N \l__fontspec_emshape_query_tl \tl_new:N \l__fontspec_em_switch_tl \tl_new:N \l__fontspec_em_tmp_tl +\tl_new:N \l__fontspec_strong_tmp_tl +\tl_new:N \l__fontspec_strong_switch_tl +\tl_new:N \l__fontspec_hyphenchar_tl +\tl_new:N \l__fontspec_smcp_shape_tl \tl_new:N \g__fontspec_mathrm_tl \tl_new:N \g__fontspec_bfmathrm_tl \tl_new:N \g__fontspec_mathsf_tl @@ -192,7 +196,7 @@ \tl_new:N \l__fontspec_sffamily_family_tl \tl_new:N \l__fontspec_ttfamily_family_tl -%%^^A%% fontspec-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-msg.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } \cs_new:Npn \__fontspec_error:nn { \msg_error:nnn {fontspec} } \cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } @@ -300,6 +304,10 @@ { Option '#2' of font feature '#1' overwritten. } +\__fontspec_msg_new:nnn {fontspec} {ot-tag-too-long} + { + OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. + } \__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} { Font '\l_fontspec_fontname_tl' does not contain script '#1'.\\ @@ -420,7 +428,7 @@ } \char_set_catcode_ignore:n {32} -%%^^A%% fontspec-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opening.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareOption{cm-default} { \__fontspec_warning:n {cm-default-obsolete} @@ -473,10 +481,10 @@ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl \AtBeginDocument - { - \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl - \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl - } + { + \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl + \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl + } \bool_if:NT \g__fontspec_euenc_bool { \RequirePackage{xunicode} @@ -508,7 +516,7 @@ \cs_generate_variant:Nn \tl_if_eq:nnT {ox} \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} -%%^^A%% fontspec-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-fontload.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { @@ -520,7 +528,7 @@ } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { - \int_set_eq:NN \xetex_suppressfontnotfounderror:D \c_one + \int_set:Nn \suppressfontnotfounderror {1} } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_null:N {p,TF,T,F} { @@ -541,7 +549,7 @@ } \prg_new_conditional:Nnn \__fontspec_primitive_font_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 #2 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -552,7 +560,7 @@ \tex_hyphenchar:D #1 = #2 \scan_stop: } -%%^^A%% fontspec-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> \NewDocumentCommand \fontspec { O{} m O{} } { @@ -666,7 +674,7 @@ \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } -%%^^A%% fontspec-user.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_main_fontspec:nn { @@ -687,7 +695,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\rmdefault} + \str_if_eq:eeT {\familydefault} {\rmdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmainfont_hook:nn {#1} {#2} \normalfont @@ -705,7 +713,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\sfdefault} + \str_if_eq:eeT {\familydefault} {\sfdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setsansfont_hook:nn {#1} {#2} \normalfont @@ -723,7 +731,7 @@ \exp_not:N \selectfont } } - \str_if_eq_x:nnT {\familydefault} {\ttdefault} + \str_if_eq:eeT {\familydefault} {\ttdefault} { \tl_set_eq:NN \encodingdefault \g__fontspec_nfss_enc_tl } \__fontspec_setmonofont_hook:nn {#1} {#2} \normalfont @@ -937,7 +945,7 @@ } } -%%^^A%% fontspec-api.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { @@ -999,99 +1007,96 @@ } } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_language_int {#2} - \__fontspec_check_ot_feat:NnTF \font {#3} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \__fontspec_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl - \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl} + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l_fontspec_script_tl - \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \tl_set:Nn \l_fontspec_script_tl {#1} - \__fontspec_iv_str_to_num:Nn \l__fontspec_script_int {#1} - \__fontspec_check_lang:NnTF \font {#2} \prg_return_true: \prg_return_false: - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \__fontspec_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false: + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} - { - \fontspec_if_fontspec_font:TF - { - \__fontspec_set_font_type:N \font - \bool_if:NTF \l__fontspec_ot_bool - { - \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl - \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl - {\prg_return_true:} {\prg_return_false:} - } - { \prg_return_false: } - } - { \prg_return_false: } - } + { + \fontspec_if_fontspec_font:TF + { + \__fontspec_set_font_type:N \font + \bool_if:NTF \l__fontspec_ot_bool + { + \prop_get:cnN {g__fontspec_fontinfo_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl + {\prg_return_true:} {\prg_return_false:} + } + { \prg_return_false: } + } + { \prg_return_false: } + } \cs_new:Nn \fontspec_set_family:Nnn { \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} + \tl_clear_new:N #1 \tl_set_eq:NN #1 \l_fontspec_family_tl } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} @@ -1140,80 +1145,80 @@ { \prg_return_false: } } -%%^^A%% fontspec-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new_protected:Nn \__fontspec_select_font_family:nn - { - \group_begin: - \__fontspec_font_suppress_not_found_error: - \__fontspec_init: + { + \group_begin: + \__fontspec_font_suppress_not_found_error: + \__fontspec_init: - \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} + \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} - \__fontspec_if_detect_external:nT {#2} - { \keys_set:nn {fontspec-preparse-external} {Path} } + \__fontspec_if_detect_external:nT {#2} + { \keys_set:nn {fontspec-preparse-external} {Path} } - \keys_set_known:nn {fontspec-preparse-cfg} {#1} + \keys_set_known:nn {fontspec-preparse-cfg} {#1} - \__fontspec_init_ttc:n {#2} - \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} + \__fontspec_init_ttc:n {#2} + \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_extract_all_features:n {#1} - \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + \__fontspec_extract_all_features:n {#1} + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } - \__fontspec_preparse_features: - \__fontspec_load_font: - \__fontspec_set_scriptlang: - \__fontspec_get_features:n {} - \bool_set_false:N \l__fontspec_firsttime_bool + \__fontspec_preparse_features: + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:n {} + \bool_set_false:N \l__fontspec_firsttime_bool - \__fontspec_save_family_needed:nTF {#2} - { - \__fontspec_save_family:nn {#1} {#2} - } - { - } - \group_end: + \__fontspec_save_family_needed:nTF {#2} + { + \__fontspec_save_family:nn {#1} {#2} + } + { + } + \group_end: - \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl - } + \tl_set_eq:NN \l_fontspec_family_tl \g__fontspec_nfss_family_tl + } \cs_set_eq:NN \fontspec_select:nn \__fontspec_select_font_family:nn %% deprecated, for compatibility only \cs_new:Nn \__fontspec_sanitise_fontname:Nn - { - \tl_set:Nx #1 {#2} - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \tl_if_in:NnT #1 {##1} - { - \tl_remove_once:Nn #1 {##1} - \tl_set:Nn \l__fontspec_extension_tl {##1} - \clist_map_break: - } - } - } + { + \tl_set:Nx #1 {#2} + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \tl_if_in:NnT #1 {##1} + { + \tl_remove_once:Nn #1 {##1} + \tl_set:Nn \l__fontspec_extension_tl {##1} + \clist_map_break: + } + } + } \prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} - { - \clist_map_inline:Nn \l__fontspec_extensions_clist - { - \bool_set_false:N \l__fontspec_tmpa_bool - \exp_args:Nx % <- this should be handled earlier - \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } - } - \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: - } + { + \clist_map_inline:Nn \l__fontspec_extensions_clist + { + \bool_set_false:N \l__fontspec_tmpa_bool + \exp_args:Nx % <- this should be handled earlier + \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } + } + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: + } \cs_new:Nn \__fontspec_init_ttc:n - { - \str_if_eq_x:nnT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} - } - } + { + \str_if_eq:eeT { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_it_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bf_tl {#1} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_bfit_tl {#1} + } + } \cs_new:Nn \__fontspec_load_external_fontoptions:Nn { \bool_if:NT \l__fontspec_fontcfg_bool @@ -1229,67 +1234,67 @@ } } \cs_new:Nn \__fontspec_extract_all_features:n - { - \bool_if:NTF \l__fontspec_disable_defaults_bool - { - \clist_set:Nx \l__fontspec_all_features_clist {#1} - } - { - \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { + \bool_if:NTF \l__fontspec_disable_defaults_bool + { + \clist_set:Nx \l__fontspec_all_features_clist {#1} + } + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } - \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist - { \clist_clear:N \l__fontspec_family_fontopts_clist } - \tl_clear:N \l__fontspec_family_label_tl + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist + { \clist_clear:N \l__fontspec_family_fontopts_clist } + \tl_clear:N \l__fontspec_family_label_tl - \clist_set:Nx \l__fontspec_all_features_clist - { - \g__fontspec_default_fontopts_clist, - \l__fontspec_family_fontopts_clist, - \l__fontspec_fontopts_clist, - #1 - } - } - } + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } + } + } \cs_new:Nn \__fontspec_preparse_features: - { + { - \__fontspec_keys_set_known:nxN {fontspec-preparse-external} - { \l__fontspec_all_features_clist } - \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} + { \l__fontspec_all_features_clist } + \l__fontspec_keys_leftover_clist - \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} - \l__fontspec_keys_leftover_clist - \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} - \l__fontspec_fontfeat_clist - } + \tl_set_eq:NN \l_fontspec_fontname_tl \l__fontspec_fontname_up_tl + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } \cs_new:Nn \__fontspec_load_font: - { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - } + { + \__fontspec_primitive_font_set:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} + \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + \__fontspec_set_font_type:N \l_fontspec_font + \__fontspec_primitive_font_gset:Nnn \l_fontspec_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} + \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn - { + { " \__fontspec_fontname_wrap:n { #1 #2 #3 } #4 #5 - \str_if_eq_x:nnF {#6}{} {:#6} " - } + \str_if_eq:eeF {#6}{} {:#6} " + } \cs_new:Nn \__fontspec_construct_font_call:nn - { - \__fontspec_construct_font_call:nnnnnn - {#1} - \l__fontspec_extension_tl - \l__fontspec_ttc_index_tl - \l_fontspec_renderer_tl - \l__fontspec_optical_size_tl - {#2} - } + { + \__fontspec_construct_font_call:nnnnnn + {#1} + \l__fontspec_extension_tl + \l__fontspec_ttc_index_tl + \l_fontspec_renderer_tl + \l__fontspec_optical_size_tl + {#2} + } \cs_new:Nn \__fontspec_font_is_name: { \cs_set_eq:NN \__fontspec_fontname_wrap:n \use:n @@ -1299,59 +1304,58 @@ \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] } } \cs_new:Nn \__fontspec_set_scriptlang: - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {no-scripts} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - } - } + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_if_empty:NTF \l__fontspec_script_name_tl + { + \__fontspec_check_script:NnTF \l_fontspec_font {latn} + { + \tl_set:Nn \l__fontspec_script_name_tl {Latin} + \tl_if_empty:NT \l__fontspec_lang_name_tl + { + \tl_set:Nn \l__fontspec_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} + } + { + \__fontspec_info:n {no-scripts} + \bool_set_true:N \l__fontspec_never_check_bool + } + } + { + \tl_if_empty:NT \l__fontspec_lang_name_tl + { + \tl_set:Nn \l__fontspec_lang_name_tl {Default} + } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} + } + } + } \cs_new:Nn \__fontspec_get_features:n - { - \__fontspec_init_fontface: - \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} - \l__fontspec_keys_leftover_clist - \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist - \bool_if:NTF \l__fontspec_ot_bool - { - % \tracingall - \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist - % \EROROR - } - { - \bool_if:nT { \l__fontspec_atsui_bool || \l__fontspec_graphite_bool } - { \keys_set:nV {fontspec-aat} \l__fontspec_keys_leftover_clist } - } + { + \__fontspec_init_fontface: + \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#1} + \l__fontspec_keys_leftover_clist + \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist + \bool_if:NTF \l__fontspec_ot_bool + { + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + } + { + \bool_if:nT { \l__fontspec_atsui_bool || \l__fontspec_graphite_bool } + { \keys_set:nV {fontspec-aat} \l__fontspec_keys_leftover_clist } + } - \tl_if_empty:NF \l__fontspec_mapping_tl - { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } - \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } - { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } - { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } + \str_if_eq:eeF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \c__fontspec_hexcol_tl \c__fontspec_opacity_tl } + { \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } + } \prg_new_conditional:Nnn \__fontspec_save_family_needed:n { TF } { @@ -1398,159 +1402,157 @@ \__fontspec_info:nxx {defining-font} {#1} {#2} } \cs_new:Nn \__fontspec_save_fontinfo:n - { - \prop_new:c {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontname} { #1 } - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {options} { \l__fontspec_all_features_clist } - \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontdef} - { - \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} - { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } - } - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num} \l__fontspec_language_int - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl - \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl - } + { + \prop_new:c {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontname} { #1 } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {fontdef} + { + \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } + } + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num} \l__fontspec_language_int + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } \cs_new:Nn \__fontspec_find_autofonts: - { - \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} - } + { + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l__fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} + } - \bool_if:NF \l__fontspec_nobf_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} - } + \bool_if:NF \l__fontspec_nobf_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + } - \bool_if:NF \l__fontspec_noit_bool - { - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} - } + \bool_if:NF \l__fontspec_noit_bool + { + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} + } - \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} - } + \__fontspec_set_autofont:Nnn \l__fontspec_fontname_bfsl_tl {\l__fontspec_fontname_sl_tl} {/B} + } \cs_new:Nn \__fontspec_set_faces: - { - \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist - \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist - \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist - \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist - - \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } - } + { + \__fontspec_add_nfssfont:nnnn \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \updefault \l__fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:nnnn \mddefault \itdefault \l__fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:nnnn \mddefault \sldefault \l__fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \itdefault \l__fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:nnnn \bfdefault \sldefault \l__fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } + } \cs_new:Nn \__fontspec_set_faces_aux:nnnnn - { - \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} - \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} + \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} + } \cs_new:Nn \fontspec_complete_fontname:Nn - { - \tl_set:Nx #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} - } + { + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} + } \cs_new:Nn \__fontspec_add_nfssfont:nnnn - { - \tl_set:Nx \l__fontspec_this_font_tl {#3} + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} - \tl_if_empty:xTF {#4} - { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } - { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \__fontspec_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } - \tl_if_empty:NF \l__fontspec_this_font_tl - { - \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} - { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } - } - } + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } + } \cs_new:Nn \__fontspec_set_font_type:N - { - \bool_set_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 #1 - \bool_set_true:N \l__fontspec_tfm_bool - \or - \bool_set_true:N \l__fontspec_atsui_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } - \ifnum\XeTeXcountvariations #1 > \c_zero - \bool_set_true:N \l__fontspec_mm_bool - \fi - \or - \bool_set_true:N \l__fontspec_ot_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } - \or - \bool_set_true:N \l__fontspec_graphite_bool - \tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} } - \fi - } + { +\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 #1 +\bool_set_true:N \l__fontspec_tfm_bool +\or +\bool_set_true:N \l__fontspec_atsui_bool +\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } +\ifnum\XeTeXcountvariations #1 > 0\relax +\bool_set_true:N \l__fontspec_mm_bool +\fi +\or +\bool_set_true:N \l__fontspec_ot_bool +\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } +\or +\bool_set_true:N \l__fontspec_graphite_bool +\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} } +\fi + } \cs_new:Nn \__fontspec_set_autofont:Nnn - { - \bool_if:NF \l__fontspec_external_bool - { - \tl_if_empty:xF {#2} - { - \tl_if_empty:NT #1 - { - \__fontspec_if_autofont:nnTF {#2} {#3} - { \tl_set:Nx #1 {#2#3} } - { \__fontspec_info:nx {no-font-shape} {#2#3} } - } - } - } - } - + { + \bool_if:NF \l__fontspec_external_bool + { + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } + } + } + } + } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} - { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } - } + { + \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} + \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} + \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } + } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn - { - \group_begin: - \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} - \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} - \group_end: - } - + { + \group_begin: + \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist + \__fontspec_load_fontname:n {#1} + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} + \group_end: + } \cs_new:Nn \__fontspec_load_fontname:n - { + { \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist - { \clist_clear:N \l__fontspec_fontopts_clist } + { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } - } + } \keys_define:nn {fontspec/fontname} { Font .tl_set:N = \l_fontspec_fontname_tl , Font .groups:n = {getfontname} , } \cs_new:Nn \__fontspec_declare_shape:nnnn - { - \tl_clear:N \l__fontspec_nfss_tl - \tl_clear:N \l__fontspec_nfss_sc_tl - \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl + { + \tl_clear:N \l__fontspec_nfss_tl + \tl_clear:N \l__fontspec_nfss_sc_tl + \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl - \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } + \exp_args:Nx \clist_map_inline:nn {#4} { \__fontspec_setup_single_size:nn {#3} {##1} } - \__fontspec_declare_shapes_normal:nn {#1} {#2} - \__fontspec_declare_shapes_smcaps:nn {#1} {#2} - \__fontspec_declare_shape_slanted:nn {#1} {#2} - \__fontspec_declare_shape_loginfo:nn {#1} {#2} - } + \__fontspec_declare_shapes_normal:nn {#1} {#2} + \__fontspec_declare_shapes_smcaps:nn {#1} {#2} + \__fontspec_declare_shape_slanted:nn {#1} {#2} + \__fontspec_declare_shape_loginfo:nn {#1} {#2} + } \cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} \cs_new:Nn \__fontspec_setup_single_size:nn { @@ -1569,38 +1571,38 @@ \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist \bool_if:NF \l__fontspec_nosc_bool - { - \tl_if_empty:NTF \l__fontspec_fontname_sc_tl - { - \__fontspec_make_smallcaps:TF - { - \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} - } - { - \bool_set_true:N \l__fontspec_nosc_bool - } - } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size - } + { + \tl_if_empty:NTF \l__fontspec_fontname_sc_tl + { + \__fontspec_make_smallcaps:TF + { + \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} + } + { + \bool_set_true:N \l__fontspec_nosc_bool + } + } + { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + } \bool_if:NF \l__fontspec_nosc_bool - { - \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl - {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} - } + { + \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_sc_tl + {#1} {\l__fontspec_sizing_leftover_clist} {\l__fontspec_fontfeat_curr_clist} + } } \cs_new:Nn \__fontspec_setup_nfss:Nnnn - { + { - \__fontspec_get_features:n { #2 , #3 , #4 } + \__fontspec_get_features:n { #2 , #3 , #4 } - \tl_put_right:Nx #1 - { - <\l__fontspec_size_tl> \l__fontspec_scale_tl - \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } - { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } - } - } + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_construct_font_call:nn { \l_fontspec_fontname_tl } + { \l__fontspec_pre_feat_sclist \g__fontspec_rawfeatures_sclist } + } + } \cs_new:Nn \__fontspec_declare_shapes_normal:nn { \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl} {\g__fontspec_nfss_family_tl} @@ -1614,7 +1616,6 @@ { \__fontspec_combo_sc_shape:n {#2} } {\l__fontspec_nfss_sc_tl} {\l__fontspec_postadjust_tl} } } - \cs_new:Nn \__fontspec_combo_sc_shape:n { \tl_if_exist:cTF { \__fontspec_shape_merge:nn {#1} {\scdefault} } @@ -1622,84 +1623,85 @@ { \scdefault } } \cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn - { - \group_begin: - \normalsize - \cs_undefine:c {#1/#2/#3/#4/\f@size} - \group_end: - \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} - } + { +\group_begin: +\normalsize +\cs_undefine:c {#1/#2/#3/#4/\f@size} +\group_end: +\DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } \cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn - { - \bool_if:nT - { - \str_if_eq_x_p:nn {#2} {\itdefault} && - !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) - } - { - \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{#1}{\sldefault} - {<->ssub*\g__fontspec_nfss_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} - } - } + { + \bool_if:nT + { + \str_if_eq_p:ee {#2} {\itdefault} && + !(\str_if_eq_p:ee {\itdefault} {\sldefault}) + } + { + \__fontspec_DeclareFontShape:xxxxxx {\g__fontspec_nfss_enc_tl}{\g__fontspec_nfss_family_tl}{#1}{\sldefault} + {<->ssub*\g__fontspec_nfss_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} + } + } \cs_new:Nn \__fontspec_declare_shape_loginfo:nn - { - \tl_gput_right:Nx \g__fontspec_defined_shapes_tl - { - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn {#1/#2} - { - {\mddefault/\updefault} {'normal'~} - {\bfdefault/\updefault} {'bold'~} - {\mddefault/\itdefault} {'italic'~} - {\mddefault/\sldefault} {'slanted'~} - {\bfdefault/\itdefault} {'bold~ italic'~} - {\bfdefault/\sldefault} {'bold~ slanted'~} - } (#1/#2)~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_tl - \exp_not:n { \\ } - -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } - { - {\mddefault/\scdefault} {'small~ caps'~} - {\bfdefault/\scdefault} {'bold~ small~ caps'~} - {\mddefault/\itscdefault} {'italic~ small~ caps'~} - {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} - {\mddefault/\slscdefault} {'slanted~ small~ caps'~} - {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} - }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ - with~ NFSS~ spec.:~ - \l__fontspec_nfss_sc_tl - \tl_if_empty:fF {\l__fontspec_postadjust_tl} - { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl - } - } - } + { + \tl_gput_right:Nx \g__fontspec_defined_shapes_tl + { + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn {#1/#2} + { + {\mddefault/\updefault} {'normal'~} + {\bfdefault/\updefault} {'bold'~} + {\mddefault/\itdefault} {'italic'~} + {\mddefault/\sldefault} {'slanted'~} + {\bfdefault/\itdefault} {'bold~ italic'~} + {\bfdefault/\sldefault} {'bold~ slanted'~} + } (#1/#2)~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_tl + \exp_not:n { \\ } + -~ \exp_not:N \str_case:nn { #1 / \__fontspec_combo_sc_shape:n {#2} } + { + {\mddefault/\scdefault} {'small~ caps'~} + {\bfdefault/\scdefault} {'bold~ small~ caps'~} + {\mddefault/\itscdefault} {'italic~ small~ caps'~} + {\bfdefault/\itscdefault} {'bold~ italic~ small~ caps'~} + {\mddefault/\slscdefault} {'slanted~ small~ caps'~} + {\bfdefault/\slscdefault} {'bold~ slanted~ small~ caps'~} + }~( #1 / \__fontspec_combo_sc_shape:n {#2} )~ + with~ NFSS~ spec.:~ + \l__fontspec_nfss_sc_tl + \tl_if_empty:fF {\l__fontspec_postadjust_tl} + { + \exp_not:N \\ and~ font~ adjustment~ code: + \exp_not:N \\ \l__fontspec_postadjust_tl + } + } + } \tl_set:Nn \l__fontspec_pre_feat_sclist - { - \bool_if:NT \l__fontspec_ot_bool - { - \tl_if_empty:NF \l_fontspec_script_tl - { - script = \l_fontspec_script_tl ; - language = \l_fontspec_lang_tl ; - } - } - } + { + \bool_if:NT \l__fontspec_ot_bool + { + \tl_if_empty:NF \l_fontspec_script_tl + { + script = \l_fontspec_script_tl ; + language = \l_fontspec_lang_tl ; + } + } + } \cs_new:Nn \__fontspec_make_ot_smallcaps:TF - { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} - } + { + \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + } \cs_new:Nn \__fontspec_make_smallcaps:TF - { - \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:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } - } - } + { + \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:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } + } + } \cs_new:Nn \__fontspec_update_featstr:n { \bool_if:NF \l__fontspec_firsttime_bool @@ -1716,18 +1718,18 @@ } } \cs_set:Npn \__fontspec_init: - { - \bool_set_false:N \l__fontspec_ot_bool - \bool_set_true:N \l__fontspec_firsttime_bool - \__fontspec_font_is_name: - \tl_clear:N \l__fontspec_font_path_tl - \tl_clear:N \l__fontspec_optical_size_tl - \tl_clear:N \l__fontspec_ttc_index_tl - \tl_clear:N \l_fontspec_renderer_tl - \tl_gclear:N \g__fontspec_defined_shapes_tl - \tl_gclear:N \g__fontspec_curr_series_tl - \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl - } + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \__fontspec_font_is_name: + \tl_clear:N \l__fontspec_font_path_tl + \tl_clear:N \l__fontspec_optical_size_tl + \tl_clear:N \l__fontspec_ttc_index_tl + \tl_clear:N \l_fontspec_renderer_tl + \tl_gclear:N \g__fontspec_defined_shapes_tl + \tl_gclear:N \g__fontspec_curr_series_tl + \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl + } \cs_new:Nn \__fontspec_init_fontface: { \tl_gclear:N \g__fontspec_rawfeatures_sclist @@ -1742,6 +1744,7 @@ { \__fontspec_strip_leading_sign:Nw #1#2 \q_nil } +\cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {Nx} \cs_set:Npn \__fontspec_strip_leading_sign:Nw #1#2#3 \q_nil { \bool_if:nTF { \str_if_eq_p:nn {#2} {+} || \str_if_eq_p:nn {#2} {-} } @@ -1749,18 +1752,28 @@ { \__fontspec_iv_str_to_num:w #1 \q_nil #2#3 \c_empty_tl \c_empty_tl \q_nil } } \cs_set:Npn \__fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil - { - \int_set:Nn #1 - { - `#2 * "1000000 - + `#3 * "10000 - + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 - + \ifx \c_empty_tl #5 32 \else `#5 \fi - } - } + { + \int_compare:nT { \tl_count:n {#6} > 2 } + { \__fontspec_error:nx {ot-tag-too-long} {#2#3#4#5#6} } + + \str_if_eq:eeTF {#2#3#4#5#6} {DFLT} + { + \int_set:Nn #1 {0} + } + { + + \int_set:Nn #1 + { + `#2 * "1000000 + + `#3 * "10000 + + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 + + \ifx \c_empty_tl #5 32 \else `#5 \fi + } + } + } \cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {No} -%%^^A%% fontspec-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_define_opentype_feature_group:n { @@ -1800,16 +1813,16 @@ \cs_new:Nn \__fontspec_feat_off:n {#1Off} \cs_new:Nn \__fontspec_feat_reset:n {#1Reset} \cs_new:Nn \__fontspec_define_opentype_onoffreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_off:n {#2} } {#3} {-#4} {} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {+#4,-#4} + } \cs_new:Nn \__fontspec_define_opentype_onreset:nnnnn - { - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} - \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} - } + { + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5} + \exp_args:Nnx \__fontspec_define_opentype_feature:nnnnn {#1} { \__fontspec_feat_reset:n {#2} } {} {} {#4} + } \cs_new:Nn \__fontspec_make_OT_feature:nnn { @@ -1842,71 +1855,83 @@ { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \__fontspec_iv_str_to_num:Nn \l__fontspec_strnum_int {#2} - \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } - \int_zero:N \l_tmpa_int - \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum \XeTeXOTscripttag #1 \l_tmpa_int = \l__fontspec_strnum_int - \bool_set_true:N \l__fontspec_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } - } + { + \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} + \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l__fontspec_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum \XeTeXOTscripttag #1 \l_tmpa_int = \l__fontspec_strnum_int + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } + } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { + \__fontspec_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_lang:Nnn {TF} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \__fontspec_iv_str_to_num:Nn \l__fontspec_strnum_int {#2} - \int_set:Nn \l_tmpb_int - { \XeTeXOTcountlanguages #1 \l__fontspec_script_int } - \int_zero:N \l_tmpa_int - \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum\XeTeXOTlanguagetag #1 \l__fontspec_script_int \l_tmpa_int = \l__fontspec_strnum_int - \bool_set_true:N \l__fontspec_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } + { + \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} + \__fontspec_iv_str_to_num:Nx \l__fontspec_script_int {#3} + \int_set:Nn \l_tmpb_int + { \XeTeXOTcountlanguages #1 \l__fontspec_script_int } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l__fontspec_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum\XeTeXOTlanguagetag #1 \l__fontspec_script_int \l_tmpa_int = \l__fontspec_strnum_int + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { + \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl} + {\prg_return_true:} {\prg_return_false:} + } +\prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} + { \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } - { - \int_set:Nn \l_tmpb_int - { - \XeTeXOTcountfeatures #1 - \l__fontspec_script_int - \l__fontspec_language_int - } - \__fontspec_iv_str_to_num:Nn \l__fontspec_strnum_int {#2} - \int_zero:N \l_tmpa_int - \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } - { - \ifnum\XeTeXOTfeaturetag #1 \l__fontspec_script_int \l__fontspec_language_int - \l_tmpa_int =\l__fontspec_strnum_int - \bool_set_true:N \l__fontspec_check_bool - \int_set:Nn \l_tmpa_int {\l_tmpb_int} - \else - \int_incr:N \l_tmpa_int - \fi - } - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } + { + \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} + \__fontspec_iv_str_to_num:Nx \l__fontspec_language_int {#3} + \__fontspec_iv_str_to_num:Nx \l__fontspec_script_int {#4} + \int_set:Nn \l_tmpb_int + { + \XeTeXOTcountfeatures #1 + \l__fontspec_script_int + \l__fontspec_language_int + } + \int_zero:N \l_tmpa_int + \bool_set_false:N \l__fontspec_check_bool + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + { + \ifnum\XeTeXOTfeaturetag #1 \l__fontspec_script_int \l__fontspec_language_int + \l_tmpa_int =\l__fontspec_strnum_int + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_tmpa_int {\l_tmpb_int} + \else + \int_incr:N \l_tmpa_int + \fi + } + \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -2031,64 +2056,69 @@ \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {zero}{Slashed~Zero} -%%^^A%% fontspec-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-graphite.dtx -- part of FONTSPEC <wspr.io/fontspec> \cs_new:Nn \__fontspec_define_aat_feature_group:n - { \keys_define:nn {fontspec-aat} { #1 .multichoice: } } + { + \keys_define:nn {fontspec-aat} { #1 .multichoice: } + } \cs_new:Nn \__fontspec_define_aat_feature:nnnn - { - \keys_define:nn {fontspec-aat} - { - #1/#2 .code:n = { \__fontspec_make_AAT_feature:nn {#3}{#4} } - } - } + { + \keys_define:nn {fontspec-aat} + { + #1/#2 .code:n = { \__fontspec_make_AAT_feature:nn {#3}{#4} } + } + } \cs_new:Nn \__fontspec_make_AAT_feature:nn - { - \tl_if_empty:nTF {#1} - { \__fontspec_warning:n {aat-feature-not-exist} } - { - \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + { + \tl_if_empty:nTF {#1} + { \__fontspec_warning:n {aat-feature-not-exist} } { - \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} - } - { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } - } - } + \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + { + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + } + { + \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} + } + } + } \prg_new_conditional:Nnn \__fontspec_make_AAT_feature_string:Nnn {TF,T,F} - { - \tl_set:Nx \l__fontspec_tmpa_tl { \XeTeXfeaturename #1 #2 } - \tl_if_empty:NTF \l__fontspec_tmpa_tl - { \prg_return_false: } - { - \int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 } - { - \tl_set:Nx \l__fontspec_tmpb_tl {\XeTeXselectorname #1 #2\space #3} - } - { - \int_if_even:nTF {#3} - { - \tl_set:Nx \l__fontspec_tmpb_tl {\XeTeXselectorname #1 #2\space #3} - } - { - \tl_set:Nx \l__fontspec_tmpb_tl - { - \XeTeXselectorname #1 #2\space \numexpr#3-1\relax - } - \tl_if_empty:NF \l__fontspec_tmpb_tl { \tl_put_left:Nn \l__fontspec_tmpb_tl {!} } - } - } - \tl_if_empty:NTF \l__fontspec_tmpb_tl - { \prg_return_false: } - { - \tl_set:Nx \l_fontspec_feature_string_tl { \l__fontspec_tmpa_tl = \l__fontspec_tmpb_tl } - \prg_return_true: + { + \tl_set:Nx \l__fontspec_tmpa_tl { \XeTeXfeaturename #1 #2 } + \tl_if_empty:NTF \l__fontspec_tmpa_tl + { \prg_return_false: } + { + \int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 } + { + \tl_set:Nx \l__fontspec_tmpb_tl {\XeTeXselectorname #1 #2\space #3} + } + { + \int_if_even:nTF {#3} + { + \tl_set:Nx \l__fontspec_tmpb_tl {\XeTeXselectorname #1 #2\space #3} + } + { + \tl_set:Nx \l__fontspec_tmpb_tl + { + \XeTeXselectorname #1 #2\space \numexpr#3-1\relax + } + \tl_if_empty:NF \l__fontspec_tmpb_tl { \tl_put_left:Nn \l__fontspec_tmpb_tl {!} } + } + } + + \tl_if_empty:NTF \l__fontspec_tmpb_tl + { \prg_return_false: } + { + \tl_set:Nx \l_fontspec_feature_string_tl { \l__fontspec_tmpa_tl = \l__fontspec_tmpb_tl } + \prg_return_true: + } } - } - } + } -%%^^A%% fontspec-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-keyval.dtx -- part of FONTSPEC <wspr.io/fontspec> \clist_gset:Nn \g__fontspec_all_keyval_modules_clist { @@ -2114,63 +2144,64 @@ \bool_set_false:N \l__fontspec_fontcfg_bool } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Path} - { - \bool_set_true:N \l__fontspec_nobf_bool - \bool_set_true:N \l__fontspec_noit_bool - \bool_set_true:N \l__fontspec_external_bool - \tl_set:Nn \l__fontspec_font_path_tl {#1} - \__fontspec_font_is_file: - \keys_set:nn {fontspec-renderer} {Renderer=OpenType} - } + { + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \tl_set:Nn \l__fontspec_font_path_tl {#1} + \__fontspec_font_is_file: + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + } \aliasfontfeature{Path}{ExternalLocation} \__fontspec_keys_define_code:nnn {fontspec} {Path} {} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} - { - \tl_set:Nn \l__fontspec_extension_tl {#1} - \bool_if:NF \l__fontspec_external_bool - { - \keys_set:nn {fontspec-preparse-external} {Path} - } - } + { + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool + { + \keys_set:nn {fontspec-preparse-external} {Path} + } + } \tl_clear:N \l__fontspec_extension_tl \__fontspec_keys_define_code:nnn {fontspec} {Extension} {} \keys_define:nn {fontspec-renderer} - { - Renderer .choices:nn = - {AAT,ICU,OpenType,Graphite,Full,Basic} - { - \int_compare:nTF {\l_keys_choice_int <= 4} { - \tl_set:Nx \l_fontspec_renderer_tl - { - \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} } - } - \tl_gset:Nx \g__fontspec_single_feat_tl { \l_fontspec_renderer_tl } - } - { - \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} - } - } - } + { + Renderer .choices:nn = + {AAT,ICU,OpenType,Graphite,Full,Basic} + { + \int_compare:nTF {\l_keys_choice_int <= 4} + { + \tl_set:Nx \l_fontspec_renderer_tl + { + \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} } + } + \tl_gset:Nx \g__fontspec_single_feat_tl { \l_fontspec_renderer_tl } + } + { + \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} + } + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} - { + { \keys_set:nn {fontspec-renderer} {Renderer=OpenType} - \tl_set:Nn \l__fontspec_script_name_tl {#1} - } + \tl_set:Nn \l__fontspec_script_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} - { + { \keys_set:nn {fontspec-renderer} {Renderer=OpenType} - \tl_set:Nn \l__fontspec_lang_name_tl {#1} - } + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {FontIndex} - { - \str_if_eq_x:nnF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} - { \__fontspec_warning:n {font-index-needs-ttc} } + { + \str_if_eq:eeF { \str_lower_case:f {\l__fontspec_extension_tl} } {.ttc} + { \__fontspec_warning:n {font-index-needs-ttc} } \tl_set:Nn \l__fontspec_ttc_index_tl {:#1} - } + } \__fontspec_keys_define_code:nnn {fontspec} {FontIndex} - { + { \tl_set:Nn \l__fontspec_ttc_index_tl {:#1} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l__fontspec_fontname_up_tl {#1} @@ -2236,76 +2267,76 @@ } } \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + { + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} - } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} - { - \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} - } + { + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} - { - \bool_if:NF \l__fontspec_firsttime_bool - { - \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} - } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} + } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} - { - \clist_set:Nn \l__fontspec_sizefeat_clist {#1} - \tl_if_empty:NT \l__fontspec_this_font_tl - { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag - } + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \tl_if_empty:NT \l__fontspec_this_font_tl + { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag + } \__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} - { - \tl_set:Nn \l__fontspec_this_font_tl {#1} - } + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec} {Font} - { - % dummy - } + { + % dummy + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Size} - { - \tl_set:Nn \l__fontspec_size_tl {#1} - } + { + \tl_set:Nn \l__fontspec_size_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Font} - { - \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} - } + { + \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding} - { - \tl_gset:Nx \g__fontspec_nfss_enc_tl { #1 } - } + { + \tl_gset:Nx \g__fontspec_nfss_enc_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} - { - \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } - } + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec} {FontFace} { \tl_clear:N \l__fontspec_this_font_tl @@ -2324,175 +2355,177 @@ {\use_i:nnn #1} {\use_ii:nnn #1} {\l__fontspec_this_font_tl} {\l__fontspec_this_feat_clist} } \__fontspec_keys_define_code:nnn {fontspec} {Scale} - { - \str_case:nnF {#1} - { - {MatchLowercase} { \__fontspec_calc_scale:n {5} } - {MatchUppercase} { \__fontspec_calc_scale:n {8} } - } - { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } - } + { + \str_case:nnF {#1} + { + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } + } + { \tl_set:Nx \l__fontspec_scale_tl {#1} } + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } \cs_new:Nn \__fontspec_calc_scale:n - { - \group_begin: + { + \group_begin: - \fontencoding { \encodingdefault } - \fontfamily { \rmdefault } - \selectfont + \fontencoding { \encodingdefault } + \fontfamily { \rmdefault } + \selectfont - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font - \tl_gset:Nx \l__fontspec_scale_tl - { - \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } - } + \tl_set:Nx \l__fontspec_scale_tl + { + \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / + \dim_to_fp:n {\l__fontspec_tmpb_dim} } + } - \__fontspec_info:n {set-scale} - \group_end: - } + \__fontspec_info:n {set-scale} + \exp_args:NNNx + \group_end: + \tl_set:Nx \l__fontspec_scale_tl { \l__fontspec_scale_tl } + } \cs_new:Nn \__fontspec_set_font_dimen:NnN - { - \dim_set:Nn #1 { \fontdimen #2 #3 } - \dim_compare:nNnT #1 = {0pt} - { - \settoheight #1 - { - \str_if_eq:nnTF {#3} {\font} \rmfamily #3 - \int_case:nnF #2 - { - {5} {x} % x-height - {8} {X} % cap-height - } {?} % "else" clause; never reached. - } - } - } + { + \dim_set:Nn #1 { \fontdimen #2 #3 } + \dim_compare:nNnT #1 = {0pt} + { + \settoheight #1 + { + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 + \int_case:nnF #2 + { + {5} {x} % x-height + {8} {X} % cap-height + } {?} % "else" clause; never reached. + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} - { - \bool_if:NF \l__fontspec_firsttime_bool - { \_fontspec_parse_wordspace:w #1,,,\q_stop } - } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \_fontspec_parse_wordspace:w #1,,,\q_stop } + } \__fontspec_aff_error:n {WordSpace} \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop - { - \tl_if_empty:nTF {#4} - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #1 \fontdimen 3 \font - \fontdimen 4 \font = #1 \fontdimen 4 \font - } - } - { - \tl_set:Nn \l__fontspec_wordspace_adjust_tl - { - \fontdimen 2 \font = #1 \fontdimen 2 \font - \fontdimen 3 \font = #2 \fontdimen 3 \font - \fontdimen 4 \font = #3 \fontdimen 4 \font - } - } - } + { + \tl_if_empty:nTF {#4} + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #1 \fontdimen 3 \font + \fontdimen 4 \font = #1 \fontdimen 4 \font + } + } + { + \tl_set:Nn \l__fontspec_wordspace_adjust_tl + { + \fontdimen 2 \font = #1 \fontdimen 2 \font + \fontdimen 3 \font = #2 \fontdimen 3 \font + \fontdimen 4 \font = #3 \fontdimen 4 \font + } + } + } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} - { - \str_case_x:nnF {#1} - { - {WordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 0 \fontdimen 2 \font } - } - {TwiceWordSpace} - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = 1 \fontdimen 2 \font } - } - } - { - \tl_set:Nn \l__fontspec_punctspace_adjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } - } - } + { + \str_case_e:nnF {#1} + { + {WordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } + } \__fontspec_aff_error:n {PunctuationSpace} \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} - { - \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} - } + { + \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} + } \__fontspec_keys_define_code:nnn {fontspec} {LetterSpace} - { - \__fontspec_update_featstr:n {letterspace=#1} - } + { + \__fontspec_update_featstr:n {letterspace=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} - { - \str_if_eq:nnTF {#1} {None} - { - \tl_put_right:Nn \l__fontspec_postadjust_tl - { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } - } - { - \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} + { + \str_if_eq:nnTF {#1} {None} + { + \tl_put_right:Nn \l__fontspec_postadjust_tl + { \__fontspec_primitive_font_set_hyphenchar:Nn \font {-1} } + } + { + \__fontspec_warning:nx {only-xetex-feature} {HyphenChar} - \tl_if_single:nTF {#1} - { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } - { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } + \tl_if_single:nTF {#1} + { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } + { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} - { - \tl_put_right:Nn \l__fontspec_postadjust_tl - { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l_fontspec_hyphenchar_tl } } - } - { \__fontspec_error:nx {no-glyph}{#1} } + \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + { + \tl_put_right:Nn \l__fontspec_postadjust_tl + { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } + } + { \__fontspec_error:nx {no-glyph}{#1} } - } - } + } + } \__fontspec_aff_error:n {HyphenChar} \__fontspec_keys_define_code:nnn {fontspec} {Color} - { - \cs_if_exist:cTF { \token_to_str:N \color@ #1 } - { - \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl - } - { - \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } - { - \int_compare:nTF { \tl_count:n {#1} == 8 } - { \fontspec_parse_colour:viii #1 } - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {bad-colour} {#1} } - } - } - } - } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } + } + } + } + } \cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 - { - \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} - \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice-col} {#7#8} } - } - \tl_set:Nn \l__fontspec_opacity_tl {#7#8} - } + { + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice-col} {#7#8} } + } + \tl_set:Nn \l__fontspec_opacity_tl {#7#8} + } \aliasfontfeature{Color}{Colour} \__fontspec_keys_define_code:nnn {fontspec} {Opacity} - { - \int_set:Nn \l__fontspec_tmp_int {255} - \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl - { - \bool_if:NF \l__fontspec_firsttime_bool - { \__fontspec_warning:nx {opa-twice} {#1} } - } - \tl_set:Nx \l__fontspec_opacity_tl - { - \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hex:n { \l__fontspec_tmp_int } - } - } + { + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \c__fontspec_opacity_tl + { + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } + } + \tl_set:Nx \l__fontspec_opacity_tl + { + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hex:n { \l__fontspec_tmp_int } + } + } \__fontspec_keys_define_code:nnn {fontspec-aat} {Mapping} { \tl_set:Nn \l__fontspec_mapping_tl { #1 } @@ -2502,109 +2535,109 @@ \tl_set:Nn \l__fontspec_mapping_tl { #1 } } \__fontspec_keys_define_code:nnn {fontspec} {Weight} - { - \__fontspec_update_featstr:n{weight=#1} - } + { + \__fontspec_update_featstr:n{weight=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {Width} - { - \__fontspec_update_featstr:n{width=#1} - } + { + \__fontspec_update_featstr:n{width=#1} + } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} - { - \bool_if:NTF \l__fontspec_ot_bool - { - \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} - } - { - \bool_if:NT \l__fontspec_mm_bool - { - \__fontspec_update_featstr:n { optical size = #1 } - } - } - \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:NTF \l__fontspec_ot_bool + { + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} + } + { + \bool_if:NT \l__fontspec_mm_bool + { + \__fontspec_update_featstr:n { optical size = #1 } + } + } + \bool_if:nT { !\l__fontspec_ot_bool && !\l__fontspec_mm_bool } + { + \bool_if:NT \l__fontspec_firsttime_bool + { \__fontspec_warning:n {no-opticals} } + } + } \keys_define:nn {fontspec} - { - FakeSlant .code:n = - { - \__fontspec_update_featstr:n{slant=#1} - }, - FakeSlant .default:n = {0.2} -} + { + FakeSlant .code:n = + { + \__fontspec_update_featstr:n {slant=#1} + }, + FakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - FakeStretch .code:n = - { - \__fontspec_update_featstr:n{extend=#1} - }, - FakeStretch .default:n = {1.2} -} + { + FakeStretch .code:n = + { + \__fontspec_update_featstr:n {extend=#1} + }, + FakeStretch .default:n = {1.2} + } \keys_define:nn {fontspec} - { - FakeBold .code:n = - { - \__fontspec_update_featstr:n {embolden=#1} - }, - FakeBold .default:n = {1.5} - } + { + FakeBold .code:n = + { + \__fontspec_update_featstr:n {embolden=#1} + }, + FakeBold .default:n = {1.5} + } \keys_define:nn {fontspec} - { - AutoFakeSlant .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_slant_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_noit_bool - - \tl_if_empty:NF \l__fontspec_fake_embolden_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeBold=\l__fontspec_fake_embolden_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeSlant .default:n = {0.2} -} + { + AutoFakeSlant .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_slant_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_it_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_noit_bool + + \tl_if_empty:NF \l__fontspec_fake_embolden_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeBold=\l__fontspec_fake_embolden_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeSlant .default:n = {0.2} + } \keys_define:nn {fontspec} - { - AutoFakeBold .code:n = - { - \bool_if:NT \l__fontspec_firsttime_bool - { - \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l__fontspec_nobf_bool - - \tl_if_empty:NF \l__fontspec_fake_slant_tl - { - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist - {FakeSlant=\l__fontspec_fake_slant_tl} - \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} - \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl - } - } - }, - AutoFakeBold .default:n = {1.5} -} + { + AutoFakeBold .code:n = + { + \bool_if:NT \l__fontspec_firsttime_bool + { + \tl_set:Nn \l__fontspec_fake_embolden_tl {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bf_tl \l_fontspec_fontname_tl + \bool_set_false:N \l__fontspec_nobf_bool + + \tl_if_empty:NF \l__fontspec_fake_slant_tl + { + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist + {FakeSlant=\l__fontspec_fake_slant_tl} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} + \tl_set_eq:NN \l__fontspec_fontname_bfit_tl \l_fontspec_fontname_tl + } + } + }, + AutoFakeBold .default:n = {1.5} + } \__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } \__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature} - { - \__fontspec_update_featstr:n {#1} - } + { + \__fontspec_update_featstr:n {#1} + } -%%^^A%% fontspec-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> \__fontspec_feat_prop_add:nn {salt} { Alternate\,=\,$N$ } \__fontspec_feat_prop_add:nn {nalt} { Annotation\,=\,$N$ } @@ -2799,150 +2832,151 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Vertical} {ProportionalMetrics} {vpal} {vpal} {+valt,+vhal} \__fontspec_define_opentype_feature_group:n {Alternate} \keys_define:nn {fontspec-opentype} - { - Alternate .default:n = {0} , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } - } - } + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \__fontspec_make_OT_feature:nnn {salt}{ +salt = ##1 }{} } + } + } \aliasfontfeature{Alternate}{StylisticAlternates} \__fontspec_define_opentype_feature_group:n {Variant} \keys_define:nn {fontspec-opentype} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Variant .default:n = {0} , + Variant / unknown .code:n = { - \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + \clist_map_inline:nn {#1} + { + \__fontspec_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {} + } } - } - } + } \aliasfontfeature{Variant}{StylisticSet} \__fontspec_define_opentype_feature_group:n {CharacterVariant} \use:x - { - \cs_new:Npn \exp_not:N \fontspec_parse_cv:w - ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil - { - \__fontspec_make_OT_feature:xxx - { cv \exp_not:N \two@digits {##1} } { +cv \exp_not:N \two@digits {##1} = ##2 } {} - } - \keys_define:nn {fontspec-opentype} - { - CharacterVariant / unknown .code:n = - { - \clist_map_inline:nn {##1} - { - \exp_not:N \fontspec_parse_cv:w - ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil - } - } - } - } + { + \cs_new:Npn \exp_not:N \fontspec_parse_cv:w + ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil + { + \__fontspec_make_OT_feature:xxx + { cv \exp_not:N \two@digits {##1} } + { +cv \exp_not:N \two@digits {##1} = ##2 } {} + } + \keys_define:nn {fontspec-opentype} + { + CharacterVariant / unknown .code:n = + { + \clist_map_inline:nn {##1} + { + \exp_not:N \fontspec_parse_cv:w + ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil + } + } + } + } \__fontspec_define_opentype_feature_group:n {Annotation} \keys_define:nn {fontspec-opentype} - { - Annotation .default:n = {0} , - Annotation / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} - } - } + { + Annotation .default:n = {0} , + Annotation / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} + } + } \__fontspec_define_opentype_feature_group:n {Ornament} \keys_define:nn {fontspec-opentype} - { - Ornament .default:n = {0} , - Ornament / unknown .code:n = - { - \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} - } - } + { + Ornament .default:n = {0} , + Ornament / unknown .code:n = + { + \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} + } + } \keys_define:nn { fontspec-opentype } { Script .choice: } \cs_new:Nn \fontspec_new_script:nn - { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = - \bool_set_false:N \l__fontspec_script_exist_bool - \clist_map_inline:nn {#2} - { - \__fontspec_check_script:NnTF \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_script_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } - { } - } - \bool_if:NF \l__fontspec_script_exist_bool - { - \str_if_eq:nnTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - } - } - } - } + { + \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \bool_set_false:N \l__fontspec_script_exist_bool + \clist_map_inline:nn {#2} + { + \__fontspec_check_script:NnTF \l_fontspec_font {####1} + { + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_script_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: + } + { } + } + \bool_if:NF \l__fontspec_script_exist_bool + { + \str_if_eq:nnTF {#1} {Latin} + { + \__fontspec_warning:nx {script-not-exist} {#1} + } + { + \__fontspec_check_script:NnTF \l_fontspec_font {latn} + { + \__fontspec_warning:nx {script-not-exist-latn} {#1} + \tl_set:Nn \l_fontspec_script_tl {latn} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + } + { + \__fontspec_warning:nx {script-not-exist} {#1} + } + } + } + } + } \keys_define:nn { fontspec-opentype } { Language .choice: } \cs_new:Nn \fontspec_new_lang:nn - { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} - { - \tl_set:Nn \l_fontspec_lang_tl {#2} - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } - } - { - \__fontspec_warning:nx {language-not-exist} {#1} - \keys_set:nn { fontspec-opentype } { Language = Default } - } + { + \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + { + \tl_set:Nn \l_fontspec_lang_tl {#2} + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 } + } + { + \__fontspec_warning:nx {language-not-exist} {#1} + \keys_set:nn { fontspec-opentype } { Language = Default } + } + } } - } \__fontspec_keys_define_code:nnn {fontspec-opentype}{ Language / Default } - { - \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \int_zero:N \l__fontspec_language_int - \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } - } + { + \tl_set:Nn \l_fontspec_lang_tl {DFLT} + \int_zero:N \l__fontspec_language_int + \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT } + } \keys_define:nn {fontspec-opentype} - { - Language / Turkish .code:n = - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TRK} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } - } - { - \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} - { - \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} - \tl_set:Nn \l_fontspec_lang_tl {TUR} - \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } - } - { - \__fontspec_warning:nx {language-not-exist} {Turkish} - \keys_set:nn {fontspec-opentype} {Language=Default} - } - } - } - } + { + Language / Turkish .code:n = + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TRK} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TRK} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TRK } + } + { + \__fontspec_check_lang:NnTF \l_fontspec_font {TUR} + { + \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} + \tl_set:Nn \l_fontspec_lang_tl {TUR} + \tl_gset:Nn \g__fontspec_single_feat_tl { language=TUR } + } + { + \__fontspec_warning:nx {language-not-exist} {Turkish} + \keys_set:nn {fontspec-opentype} {Language=Default} + } + } + } + } \cs_new:Nn \__fontspec_ot_compat:nn { \aliasfontfeatureoption {#1} {#2Off} {No#2} @@ -2965,7 +2999,7 @@ \__fontspec_ot_compat:nn {Diacritics} {AboveBase} \__fontspec_ot_compat:nn {Diacritics} {BelowBase} -%%^^A%% fontspec-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-scripts.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontscript{Adlam}{adlm} \newfontscript{Ahom}{ahom} @@ -3112,7 +3146,7 @@ \newfontscript{N'ko}{nko~} \newfontscript{Oriya}{ory2,orya} -%%^^A%% fontspec-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-lang.dtx -- part of FONTSPEC <wspr.io/fontspec> \newfontlanguage{Abaza}{ABA} \newfontlanguage{Abkhazian}{ABK} @@ -3497,7 +3531,7 @@ \newfontlanguage{Zande}{ZND} \newfontlanguage{Zulu}{ZUL} -%%^^A%% fontspec-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-feat-aat.dtx -- part of FONTSPEC <wspr.io/fontspec> \__fontspec_define_aat_feature_group:n {Ligatures} @@ -3569,37 +3603,36 @@ \__fontspec_define_aat_feature:nnnn {Fractions} {Diagonal} {11} {2} \__fontspec_define_aat_feature_group:n { Alternate } \keys_define:nn {fontspec-aat} - { - Alternate .default:n = {0} , - Alternate / unknown .code:n = - { - \clist_map_inline:nn {#1} + { + Alternate .default:n = {0} , + Alternate / unknown .code:n = { - \__fontspec_make_AAT_feature:nn {17}{##1} + \clist_map_inline:nn {#1} + { + \__fontspec_make_AAT_feature:nn {17}{##1} + } } - } - } + } \__fontspec_define_aat_feature_group:n {Variant} \keys_define:nn {fontspec-aat} - { - Variant .default:n = {0} , - Variant / unknown .code:n = - { - \clist_map_inline:nn {#1} - { \__fontspec_make_AAT_feature:nn {18}{##1} } - } - } + { + Variant .default:n = {0} , + Variant / unknown .code:n = + { + \clist_map_inline:nn {#1} + { \__fontspec_make_AAT_feature:nn {18}{##1} } + } + } \aliasfontfeature{Variant}{StylisticSet} \__fontspec_define_aat_feature_group:n {Vertical} \keys_define:nn {fontspec-aat} - { - Vertical .choice: , - Vertical / RotatedGlyphs .code:n = - { - \__fontspec_update_featstr:n {vertical} - } - } - + { + Vertical .choice: , + Vertical / RotatedGlyphs .code:n = + { + \__fontspec_update_featstr:n {vertical} + } + } \__fontspec_define_aat_feature_group:n {Style} \__fontspec_define_aat_feature:nnnn {Style} {Italic} {32} {2} \__fontspec_define_aat_feature:nnnn {Style} {Ruby} {28} {2} @@ -3638,7 +3671,7 @@ \__fontspec_define_aat_feature:nnnn {Annotation} {BlackRoundSquare} {24} {10} \__fontspec_define_aat_feature:nnnn {Annotation} {DoubleCircle} {24} {11} -%%^^A%% fontspec-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-enc.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand\UnicodeFontFile[2]{"[#1]:#2"} \providecommand\UnicodeFontName[2]{"#1:#2"} @@ -3728,7 +3761,7 @@ { \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} } } -%%^^A%% fontspec-math.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-math.dtx -- part of FONTSPEC <wspr.io/fontspec> \@ifpackageloaded{euler} { \bool_gset_true:N \g__fontspec_pkg_euler_loaded_bool } { \bool_gset_false:N \g__fontspec_pkg_euler_loaded_bool } @@ -3799,6 +3832,7 @@ \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} + \renewcommand{\hbar}{{\mathchar"AF\mkern-9mu h}}% TODO: test with other fonts } } \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault @@ -3861,23 +3895,23 @@ } \AtBeginDocument{\fontspec_maybe_setup_maths:} -%%^^A%% fontspec-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-closing.dtx -- part of FONTSPEC <wspr.io/fontspec> \bool_if:NT \g__fontspec_cfg_bool - { - \InputIfFileExists{fontspec.cfg} - {} - {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} - } + { + \InputIfFileExists{fontspec.cfg} + {} + { \typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.} } + } -%%^^A%% fontspec-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-xfss.dtx -- part of FONTSPEC <wspr.io/fontspec> \providecommand*\itscdefault{\itdefault\scdefault} \providecommand*\slscdefault{\sldefault\scdefault} \DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape{\itscdefault}\selectfont - } + { + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont + } \DeclareTextFontCommand{\textsi}{\sishape} \cs_new:Nn \__fontspec_shape_merge:nn { c__fontspec_shape_#1_#2_tl } \tl_const:cn { \__fontspec_shape_merge:nn \itdefault \scdefault } {\itscdefault} @@ -3908,25 +3942,25 @@ \prg_return_true: \prg_return_false: } \DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_merge_shape:n\itdefault - } + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } \DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_merge_shape:n\sldefault - } + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } \DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_merge_shape:n\scdefault - } + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } \DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_merge_shape:n\updefault - } + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } \cs_new_protected:Npn \emfontdeclare #1 { \prop_gclear:N \g__fontspec_em_prop @@ -4029,33 +4063,33 @@ \strongfontdeclare{ \bfseries } \emfontdeclare{ \emshape, \eminnershape } -%%^^A%% fontspec-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> +%%^^A%% fontspec-code-patches.dtx -- part of FONTSPEC <wspr.io/fontspec> \DeclareRobustCommand{\-} - { - \discretionary - { - \char\ifnum\hyphenchar\font<\z@ - \xlx@defaulthyphenchar - \else - \hyphenchar\font - \fi - }{}{} - } + { + \discretionary + { + \char\ifnum\hyphenchar\font<\z@ + \xlx@defaulthyphenchar + \else + \hyphenchar\font + \fi + }{}{} + } \def\xlx@defaulthyphenchar{`\-} \cs_new:Nn \fontspec_visible_space: - { - \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} - { \char"2423\scan_stop: } - { \fontspec_visible_space_fallback: } - } + { + \__fontspec_primitive_font_glyph_if_exist:NnTF \font {"2423} + { \char"2423\scan_stop: } + { \fontspec_visible_space_fallback: } + } \cs_new:Nn \fontspec_visible_space_fallback: - { { - \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} - \textvisiblespace + { + \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} + \textvisiblespace + } } - } \group_begin: \char_set_catcode_active:n{"20}% \cs_gset:Npn\fontspec_print_visible_spaces:{% @@ -4064,71 +4098,72 @@ }% \group_end: \def\verb - { - \relax\ifmmode\hbox\else\leavevmode\null\fi - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\__fontspecsverb\@verb - } + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\__fontspecsverb\@verb + } \def\__fontspecsverb{\fontspec_print_visible_spaces:\@sverb} \AtBeginDocument - { - \fontspec_patch_verbatim: - \fontspec_patch_moreverb: - \fontspec_patch_fancyvrb: - \fontspec_patch_listings: - } + { + \fontspec_patch_verbatim: + \fontspec_patch_moreverb: + \fontspec_patch_fancyvrb: + \fontspec_patch_listings: + } \cs_set:Npn \fontspec_patch_verbatim: - { - \@ifpackageloaded{verbatim} - { - \cs_set:cpn {verbatim*} - { - \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - } - { - \cs_set:cpn {verbatim*} - { - \@verbatim \fontspec_print_visible_spaces: \@sxverbatim - } - } + { + \@ifpackageloaded{verbatim} + { + \cs_set:cpn {verbatim*} + { + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + } + { + \cs_set:cpn {verbatim*} + { + \@verbatim \fontspec_print_visible_spaces: \@sxverbatim + } + } } \cs_set:Npn \fontspec_patch_moreverb: - { - \@ifpackageloaded{moreverb}{ - \cs_set:cpn {listingcont*} - { - \cs_set:Npn \verbatim@processline - { - \thelisting@line \global\advance\listing@line\c_one - \the\verbatim@line\par - } - \@verbatim \fontspec_print_visible_spaces: \verbatim@start - } - }{} - } + { + \@ifpackageloaded{moreverb} + { + \cs_set:cpn {listingcont*} + { + \cs_set:Npn \verbatim@processline + { + \thelisting@line \global\advance\listing@line1\relax + \the\verbatim@line\par + } + \@verbatim \fontspec_print_visible_spaces: \verbatim@start + } + }{} + } \cs_set:Npn \fontspec_patch_fancyvrb: - { - \@ifpackageloaded{fancyvrb} - { - \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{fancyvrb} + { + \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space: + }{} + } \cs_set:Npn \fontspec_patch_listings: - { - \@ifpackageloaded{listings} - { - \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: - }{} - } + { + \@ifpackageloaded{listings} + { + \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: + }{} + } \RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } + { + { \addfontfeature{Numbers=OldStyle} #1 } + } \NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } + { + { \addfontfeature{Numbers=Lining} #1 } + } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index f72f7b381d0..61da037b2bc 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -23,8 +23,8 @@ fontspec = fontspec or {} local fontspec = fontspec fontspec.module = { name = "fontspec", - version = "v2.6h", - date = "2018/07/30", + version = "2.6j", + date = "2019/01/10", description = "Font selection for XeLaTeX and LuaLaTeX", author = "Khaled Hosny, Philipp Gesang, Will Robertson", copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index c191cb3b6ac..cbea552a1f3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -21,7 +21,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec}% - {2018/07/30}{v2.6h}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/10}{2.6j}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> \sys_if_engine_luatex:T |