diff options
Diffstat (limited to 'Master/texmf-dist')
24 files changed, 641 insertions, 478 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md index 9116cdb9dfd..1c13d9d80e7 100644 --- a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md +++ b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md @@ -1,6 +1,14 @@ Change history ============== +## v2.7 (2019/01/24) + + * Add new `ScaleAgain` feature for compounding scale factors. + (This is largely to support `unicode-math` but may be useful by others.) + * `\oldstylenums` no longer overwritten if `textcomp` loaded after `fontspec`. + * More fixes for recent regressions (sorry!). + + ## v2.6l (2019/01/18) * REALLY fix crash when loading fonts that are missing a requested script. 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 383f53e8eaa..4665da7c7e8 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 4feee8c575d..33829360918 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-code-api.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx index f53477df080..7164cb47a88 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx @@ -267,10 +267,12 @@ % \begin{macrocode} \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset \tl_set:Nn \l_@@_family_label_tl {#1} \@@_select_font_family:nn {#2} {#3} - \tl_clear_new:N #1 + \tl_if_exist:NF #1 { \tl_new:N #1 } \tl_set_eq:NN #1 \l_fontspec_family_tl + \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset } % \end{macrocode} % @@ -285,12 +287,15 @@ % means that settings such as fontdimens will be lost. % (Discovered in unicode-math.) Investigate! % \begin{macrocode} - \cs_new:Nn \fontspec_set_fontface:NNnn +\tl_new:N \l_@@_fontface_cs_tl +\tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} +\cs_new:Nn \fontspec_set_fontface:NNnn { - \tl_set:Nn \l_@@_family_label_tl {#1} - \@@_select_font_family:nn {#3}{#4} - \global \font #1 = \fontname \l_fontspec_font \scan_stop: + \tl_set:Nn \l_@@_fontface_cs_tl {#1} + \tl_set:Nn \l_@@_family_label_tl {#2} + \@@_select_font_family:nn {#3} {#4} \tl_set_eq:NN #2 \l_fontspec_family_tl + \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset } % \end{macrocode} % \end{macro} @@ -322,7 +327,7 @@ \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} { \exp_args:Nxx \tl_if_in:nnTF - { \fontname\font } { \tl_to_str:n {#1} } + { \@@_primitive_font_current_name: } { \tl_to_str:n {#1} } { \prg_return_true: } { \prg_return_false: } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx index dc3db933869..590d69f77f5 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx @@ -44,7 +44,9 @@ \keys_define:nn {fontspec-opentype} { Ligatures / TeX .code:n = { \tl_set:Nn \l_@@_mapping_tl {tex-text} }, + Ligatures / TeX .groups:n = {opentype}, Ligatures / TeXReset .code:n = { \tl_clear:N \l_@@_mapping_tl }, + Ligatures / TeXReset .groups:n = {opentype}, } %</XE> %<LU>\@@_define_opentype_onreset:nnnnn {Ligatures} {TeX} {} { +tlig } {} @@ -313,6 +315,7 @@ \keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , + Alternate .groups:n = {opentype}, Alternate / unknown .code:n = { \clist_map_inline:nn {#1} @@ -343,6 +346,7 @@ \keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , + Variant .groups:n = {opentype} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} @@ -391,6 +395,7 @@ \keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , + Annotation .groups:n = {opentype}, Annotation / unknown .code:n = { \@@_make_OT_feature:nnn {nalt} {+nalt=#1} {} @@ -405,6 +410,7 @@ \keys_define:nn {fontspec-opentype} { Ornament .default:n = {0} , + Ornament .groups:n = {opentype}, Ornament / unknown .code:n = { \@@_make_OT_feature:nnn {ornm} { +ornm=#1 } {} @@ -419,43 +425,46 @@ % \subsection{Script} % % \begin{macrocode} -\keys_define:nn { fontspec-opentype } { Script .choice: } +\keys_define:nn {fontspec-opentype} + { + Script .choice: , + Script .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Script / #1 .code:n = { - \bool_if:NF \l_@@_scripts_missing_bool +%<debug>\typeout{Trying~[Script=#1]} + \bool_set_false:N \l_@@_scriptlang_exist_bool + \clist_map_inline:nn {#2} + { + \exp_args:No \@@_check_script:NnT \l_@@_fontface_cs_tl {####1} + { +%<debug>\typeout{Script~tag~found:~####1} + \tl_set:Nn \l_@@_script_name_tl {#1} + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l_@@_script_int {\l_@@_strnum_int} + \bool_set_true:N \l_@@_scriptlang_exist_bool + \tl_gset:Nx \g_@@_single_feat_tl { script=####1 } + \clist_map_break: + } + } + \bool_if:NF \l_@@_scriptlang_exist_bool { - \bool_set_false:N \l_@@_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \bool_if:nF { \str_if_eq_p:ee {#1} {CustomDefault} } { - \@@_check_script:NnT \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_@@_scriptlang_exist_bool - \tl_gset:Nx \g_@@_single_feat_tl { script=####1 } - \clist_map_break: - } + \tl_clear:N \l_@@_script_name_tl + \@@_warning:nx {no-script} {\l_fontspec_fontname_tl} {#1} } - \bool_if:NF \l_@@_scriptlang_exist_bool + + \bool_if:nF { - \str_if_eq:eeTF {#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_set:nn {fontspec-opentype} { Script = Default } - } - } + \str_if_eq_p:ee {#1} {Default} || + \str_if_eq_p:ee {#1} {Latin} || + \str_if_eq_p:ee {#1} {CustomDefault} + } + { + \keys_set:nn {fontspec-opentype} { Script = CustomDefault } } } } @@ -467,15 +476,19 @@ % \subsection{Language} % % \begin{macrocode} -\keys_define:nn {fontspec-opentype} { Language .choice: } +\keys_define:nn {fontspec-opentype} + { + Language .choice: , + Language .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_lang:nn { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Language / #1 .code:n = { \bool_set_false:N \l_@@_scriptlang_exist_bool \clist_map_inline:nn {#2} { - \@@_check_lang:NnTF \l_fontspec_font {#2} + \exp_args:No \@@_check_lang:NnTF \l_@@_fontface_cs_tl {#2} { \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l_@@_language_int {\l_@@_strnum_int} @@ -494,9 +507,11 @@ } % \end{macrocode} % -% \paragraph{Default} -% I can't remember why this has to be special-cased. From memory, the OpenType default -% language is hardcoded to have a zero value, although this might be some \XeTeX-specific thing. +% \paragraph{Language=Default} +% These are special-cased to avoid the additional logic above. +% From memory, the OpenType default +% language is hardcoded to have a zero value, +% although this might be some \XeTeX-specific thing. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-opentype} { Language / Default } { diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx index be5155de476..88a107896f6 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-fontload.dtx @@ -12,13 +12,13 @@ % \begin{macrocode} \cs_set:Npn \@@_primitive_font_set:Nnn #1#2#3 { - \font #1 = #2 ~at~ #3 \scan_stop: + \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } % \end{macrocode} % \begin{macrocode} \cs_set:Npn \@@_primitive_font_gset:Nnn #1#2#3 { - \global \font #1 = #2 ~at~ #3 \scan_stop: + \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } % \end{macrocode} % \end{macro} @@ -45,13 +45,32 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[pTF]{\@@_primitive_font_set:NnnTF,\@@_primitive_font_gset:NnnTF} +% \begin{macrocode} +\prg_set_conditional:Nnn \@@_primitive_font_set:Nnn {TF,T,F} + { + \@@_primitive_font_set:Nnn #1 {#2} {#3} + \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\prg_set_conditional:Nnn \@@_primitive_font_gset:Nnn {TF,T,F} + { + \@@_primitive_font_gset:Nnn #1 {#2} {#3} + \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\cs_set:Npn \@@_primitive_font_set:Onn { \exp_last_unbraced:No \@@_primitive_font_set:Nnn } +\cs_set:Npn \@@_primitive_font_set:OnnF { \exp_last_unbraced:No \@@_primitive_font_set:NnnF } +\cs_set:Npn \@@_primitive_font_gset:Onn { \exp_last_unbraced:No \@@_primitive_font_gset:Nnn } +\cs_set:Npn \@@_primitive_font_gset:OnnF { \exp_last_unbraced:No \@@_primitive_font_gset:NnnF } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[TF]{\@@_primitive_font_if_exist:n} % \begin{macrocode} \prg_set_conditional:Nnn \@@_primitive_font_if_exist:n {TF,T,F} { \group_begin: \@@_font_suppress_not_found_error: - \@@_primitive_font_set:Nnn \l_@@_primitive_font {#1} {10pt} + \@@_primitive_font_set:Nnn \l_@@_primitive_font {#1} { \f@size pt - 1sp } \@@_primitive_font_if_null:NTF \l_@@_primitive_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } @@ -81,6 +100,18 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_primitive_font_get_name:N} +% \begin{macro}{\@@_primitive_font_current_name:} +% \begin{macrocode} +\cs_new_eq:NN \@@_primitive_font_get_name:N \fontname +\cs_new:Npn \@@_primitive_font_current_name: + { + \@@_primitive_font_get_name:N \tex_font:D + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \iffalse % \begin{macrocode} %</fontspec> diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx index bb99c2a8870..a39cfe36aa1 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-graphite.dtx @@ -38,7 +38,7 @@ \tl_if_empty:nTF {#1} { \@@_warning:n {aat-feature-not-exist} } { - \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + \exp_args:No \@@_make_AAT_feature_string:NnnTF \l_@@_fontface_cs_tl {#1} {#2} { \@@_update_featstr:n {\l_fontspec_feature_string_tl} } diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx index 58979626f38..57bae3bb4d7 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx @@ -221,6 +221,28 @@ } % \end{macrocode} % +% \begin{macro}{\oldstylenums} +% This is performed only after the preamble to overwrite any redefinition by \pkg{textcomp}: +% \begin{macrocode} +\AtBeginDocument + { + \RenewDocumentCommand \oldstylenums {m} + { + \@@_main_oldstylenums:n {#1} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\liningnums} +% \begin{macrocode} +\NewDocumentCommand \liningnums {m} + { + \@@_main_liningnums:n {#1} + } +% \end{macrocode} +% \end{macro} +% % \iffalse % \begin{macrocode} %</fontspec> diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx index d73f0f62b18..9dcea4f8e0e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx @@ -38,7 +38,7 @@ \@@_init: \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2} + \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2} \@@_sanitise_fontname:Nn \l_@@_basename_tl {#2} \@@_if_detect_external:nT {#2} @@ -230,24 +230,21 @@ \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:NnnF \l_@@_test_font + { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } + { \f@size pt - 2sp } + { \@@_error:nx {font-not-found} {\l_@@_fontname_up_tl} } + %<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 - \@@_check_script:NnTF \l_fontspec_font {DFLT} - { -%<debug>\typeout{Has~Opentype~scripts} - \bool_set_false:N \l_@@_scripts_missing_bool - } - { -%<debug>\typeout{No~Opentype~scripts} - \bool_set_true:N \l_@@_scripts_missing_bool - } + \@@_set_font_type:N \l_@@_test_font + \@@_primitive_font_gset:Onn \l_@@_fontface_cs_tl + { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } + { \f@size pt } + + \l_@@_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly + } % \end{macrocode} % \end{macro} @@ -313,42 +310,11 @@ %<debug> \typeout{:: _set_scriptlang:} \bool_if:NT \l_@@_firsttime_bool { - \bool_if:NTF \l_@@_scripts_missing_bool + \tl_if_empty:NF \l_@@_script_name_tl { -%<debug> \typeout{:::: NADA} - \@@_info:n {no-scripts} - } - { - \tl_if_empty:NTF \l_@@_script_name_tl - { - \@@_check_script:NnTF \l_fontspec_font {latn} - { -%<debug> \typeout{:::: Defaulting to latn script} - \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{:::: Default script only} - \@@_info:n {dflt-script} - \keys_set:nx {fontspec-opentype} {Script=Default} - \keys_set:nx {fontspec-opentype} {Language=Default} - } - } - { - \tl_if_empty:NT \l_@@_lang_name_tl - { - \tl_set:Nn \l_@@_lang_name_tl {Default} - } -%<debug> \typeout{:::: Script=\l_@@_script_name_tl, Language=\l_@@_lang_name_tl} - \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} - } + \keys_set:nx {fontspec-opentype} {Script=\l_@@_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l_@@_lang_name_tl} } } } @@ -595,7 +561,7 @@ % be automatic (based on the font type), or specified by the user via a font feature. % % This macro sets booleans -% accordingly depending if the font in \cmd\l_fontspec_font\ is an \AAT\ +% accordingly depending if the font in \cmd\l_fontspec_test_font\ is an \AAT\ % font or an OpenType font or a font with feature axes (either \AAT\ or % Multiple Master), respectively. % \begin{macrocode} @@ -679,11 +645,12 @@ % \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:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } + \group_begin: + \@@_primitive_font_set:Nnn \l_@@_tmpa_font { \@@_construct_font_call:nn {#1} {} } { \f@size pt + 1sp } + \@@_primitive_font_set:Nnn \l_@@_tmpb_font { \@@_construct_font_call:nn {#1#2} {} } { \f@size pt + 1sp } + \str_if_eq:eeTF { \@@_primitive_font_get_name:N \l_@@_tmpa_font } { \@@_primitive_font_get_name:N \l_@@_tmpb_font } + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } } % \end{macrocode} % \end{macro} @@ -701,22 +668,23 @@ { \group_begin: \@@_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l_@@_leftover_clist - \@@_load_fontname:n {#1} + \@@_load_fontname:Nn \l_fontspec_fontname_tl {#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 +\cs_new:Nn \@@_load_fontname:Nn { -%<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 +%<debug> \typeout{:: @@_load_fontname:Nn \exp_not:N #1 (#1) {#2} } + \@@_load_external_fontoptions:Nn #1 {#2} + \prop_get:NVNF \g_@@_fontopts_prop #1 \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} } + \@@_primitive_font_set:OnnF \l_@@_fontface_cs_tl + { \@@_construct_font_call:nn {#1} {} } { \f@size pt } + { \@@_error:nx {font-not-found} {#2} } } % \end{macrocode} % @@ -776,7 +744,7 @@ %<debug>\typeout{==~ size:~\l_@@_size_tl} % "normal" - \@@_load_fontname:n {\l_@@_sizedfont_tl} + \@@_load_fontname:Nn \l_fontspec_fontname_tl {\l_@@_sizedfont_tl} \@@_setup_nfss:Nnnn \l_@@_nfss_tl {#1} {\l_@@_sizing_leftover_clist} {} %<debug> \typeout{===~ sized~ font:~ \l_@@_sizedfont_tl} @@ -797,7 +765,7 @@ \bool_set_true:N \l_@@_nosc_bool } } - { \@@_load_fontname:n {\l_@@_fontname_sc_tl} }% local for each size + { \@@_load_fontname:Nn \l_fontspec_fontname_tl {\l_@@_fontname_sc_tl} }% local for each size } \bool_if:NF \l_@@_nosc_bool @@ -818,6 +786,11 @@ \@@_get_features:n { #2 , #3 , #4 } %<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist} + \tl_if_empty:NF \l_@@_scale_tl + { + \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] } + } + \tl_put_right:Nx #1 { <\l_@@_size_tl> \l_@@_scale_tl @@ -979,7 +952,7 @@ %<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} + \exp_args:No \@@_check_ot_feat:NnTF \l_@@_fontface_cs_tl {smcp} {#1} {#2} } %<*XE> \cs_new:Nn \@@_make_smallcaps:TF @@ -988,7 +961,10 @@ { \@@_make_ot_smallcaps:TF {#1} {#2} } { \bool_if:NT \l_@@_atsui_bool - { \@@_make_AAT_feature_string:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } + { + \exp_args:No \@@_make_AAT_feature_string:NnnTF + \l_@@_fontface_cs_tl {3} {3} {#1} {#2} + } } } %</XE> @@ -1126,6 +1102,7 @@ % \begin{macrocode} \cs_new:Nn \@@_iv_str_to_num:Nn { +%<debug>\typeout{_iv_str_to_num:~#1~/~#2} \@@_strip_leading_sign:Nw #1#2 \q_nil } \cs_generate_variant:Nn \@@_iv_str_to_num:Nn {Nx} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx index 2aa33288fe4..3ed80ff740d 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx @@ -418,7 +418,16 @@ {MatchUppercase} { \@@_calc_scale:n {8} } } { \tl_set:Nx \l_@@_scale_tl {#1} } - \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] } + } +% \end{macrocode} +% +% \paragraph{ScaleAgain} +% \begin{macrocode} +\@@_keys_define_code:nnn {fontspec} {ScaleAgain} + { + \tl_if_empty:NT \l_@@_scale_tl { \tl_set:Nn \l_@@_scale_tl {1} } + \tl_set:Nx \l_@@_scale_tl { \fp_eval:n { #1 * \l_@@_scale_tl } } + \@@_info:n {set-scale} } % \end{macrocode} % @@ -447,12 +456,12 @@ \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_@@_tmpb_dim {#1} \l_@@_fontface_cs_tl \tl_set:Nx \l_@@_scale_tl { \fp_eval:n { \dim_to_fp:n {\l_@@_tmpa_dim} / - \dim_to_fp:n {\l_@@_tmpb_dim} } + \dim_to_fp:n {\l_@@_tmpb_dim} } } \@@_info:n {set-scale} @@ -597,12 +606,12 @@ { \tl_set:Nn \l_@@_hyphenchar_tl {`#1} } { \tl_set:Nn \l_@@_hyphenchar_tl { #1} } - \@@_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l_@@_hyphenchar_tl} + \exp_args:No \@@_primitive_font_glyph_if_exist:NnTF \l_@@_fontface_cs_tl {\l_@@_hyphenchar_tl} { \tl_put_right:Nn \l_@@_postadjust_tl { \@@_primitive_font_set_hyphenchar:Nn \font { \l_@@_hyphenchar_tl } } } - { \@@_error:nx {no-glyph}{#1} } + { \@@_error:nx {no-glyph}{\l_fontspec_fontname_tl}{#1} } } } @@ -719,7 +728,7 @@ \bool_if:nT { !\l_@@_ot_bool && !\l_@@_mm_bool } { \bool_if:NT \l_@@_firsttime_bool - { \@@_warning:n {no-opticals} } + { \@@_warning:n {no-opticals} {\l_fontspec_fontname_tl} } } } %</XE> diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx index f80ea832584..7136249bdf3 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx @@ -64,7 +64,7 @@ } \@@_msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl' does not contain glyph #1. + '#1' does not contain glyph #2. } \@@_msg_new:nnnn {fontspec} {euler-too-late} { @@ -135,15 +135,6 @@ { OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. } -\@@_msg_new:nnn {fontspec} {script-not-exist} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - } -\@@_msg_new:nnn {fontspec} {script-not-exist-latn} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - `Script=Latin` used instead. - } \@@_msg_new:nnn {fontspec} {aat-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl' feature not supported @@ -167,7 +158,7 @@ } \@@_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. + '#1' doesn't appear to have an Optical Size axis. } \@@_msg_new:nnn {fontspec} {language-not-exist} { @@ -235,13 +226,9 @@ { Adjusting the maths setup (use [no-math] to avoid this). } -\@@_msg_new:nnn {fontspec} {no-scripts} - { - Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. - } -\@@_msg_new:nnn {fontspec} {dflt-script} +\@@_msg_new:nnn {fontspec} {no-script} { - Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + Font "#1" does not contain requested Script "#2". } \@@_msg_new:nnn {fontspec} {opa-twice} { diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx index b067c2ff7bd..b0b7655610c 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opening.dtx @@ -160,6 +160,7 @@ \cs_generate_variant:Nn \prop_get:NnNT {NxN} \cs_generate_variant:Nn \prop_get:NnNTF {NxN} \cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty_p:n {e} \cs_generate_variant:Nn \tl_if_empty:nTF {x} \cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_generate_variant:Nn \tl_if_empty:nF {f} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx index 57087ce8a82..9508ca8c0db 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx @@ -14,7 +14,7 @@ % \begin{macrocode} \cs_new:Nn \@@_define_opentype_feature_group:n { - \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} } } % \end{macrocode} % \end{macro} @@ -44,7 +44,8 @@ \keys_define:nn {fontspec-opentype} { #1/#2 .code:n = - { \@@_remove_clashing_featstr:n {#5} } + { \@@_remove_clashing_featstr:n {#5} } , + #1/#2 .groups:n = {opentype} } } { @@ -54,7 +55,8 @@ { %<debug> \typeout{::::::::fontspec-opentype~#1/#2~=~#3/#4/#5} \@@_make_OT_feature:nnn {#3} {#4} {#5} - } + } , + #1/#2 .groups:n = {opentype} } } } @@ -116,7 +118,7 @@ \tl_if_empty:nT {#1} { \bool_set_false:N \l_@@_check_feat_bool } \bool_if:NT \l_@@_check_feat_bool { - \@@_check_ot_feat:NnF \l_fontspec_font {#1} + \exp_args:No \@@_check_ot_feat:NnF \l_@@_fontface_cs_tl {#1} { \@@_warning:nx {icu-feature-not-exist-in-font} {#1} \bool_set_false:N \l_@@_proceed_bool @@ -149,11 +151,14 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_script:Nn {TF,T} { -%<debug>\typeout{:: _check_script:Nn} +%<debug>\typeout{:: _check_script:Nn~#1~/~#2} \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } -%<*XE> { + \bool_if:nTF { \tl_if_empty_p:e {#2} } + { \prg_return_false: } + { +%<*XE> %<debug>\typeout{::::~ checking~ script~ #2} \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } @@ -169,10 +174,8 @@ \fi } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } %</XE> %<*LU> - { \@@_ot_validate_tag:x {#2} \cs_if_eq:NNTF #1 \font { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} } @@ -188,8 +191,9 @@ %<debug>\typeout{::::::~ FALSE} \prg_return_false: } - } %</LU> + } + } } % \end{macrocode} % \end{macro} @@ -211,10 +215,14 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_lang:Nnn {TF} { +%<debug>\typeout{:: _check_lang:Nn~#1~/~#2~/~#3~/} \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } -%<*XE> { + \bool_if:nTF { \tl_if_empty_p:e {#3} } + { \prg_return_false: } + { +%<*XE> \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} \@@_iv_str_to_num:Nx \l_@@_script_int {#3} \int_set:Nn \l_@@_tmpb_int @@ -236,10 +244,8 @@ } } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } %</XE> %<*LU> - { \@@_ot_validate_tag:x {#2} \@@_ot_validate_tag:x {#3} \cs_if_eq:NNTF #1 \font @@ -250,8 +256,9 @@ fontspec.check_ot_lang( "\l_@@_tmp_tl", "#2", "#3" ) } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: - } %</LU> + } + } } % \end{macrocode} % \end{macro} @@ -276,10 +283,13 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_ot_feat:Nnnn {TF,F} { - \bool_if:nTF {\l_@@_never_check_bool || \l_@@_scripts_missing_bool} + \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } -%<*XE> { + \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} } + { \prg_return_false: } + { +%<*XE> %<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} @@ -304,10 +314,8 @@ \fi } \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: - } %</XE> %<*LU> - { %<debug>\typeout{::~ fontspec_check_ot_feat:n~ {#1}} \@@_ot_validate_tag:x {#2} \@@_ot_validate_tag:x {#3} @@ -320,8 +328,9 @@ fontspec.check_ot_feat("\l_@@_tmp_tl", "#2", "#3", "#4") } \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false: - } %</LU> + } + } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx index 2df1d18f3fe..a191e39f423 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx @@ -165,25 +165,6 @@ } % \end{macrocode} % -% \subsection{\cs{oldstylenums}} -% -% -% \begin{macro}{\oldstylenums} -% \begin{macro}{\liningnums} -% This command obviously needs a redefinition. -% And we may as well provide the reverse command. -% \begin{macrocode} -\RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } -\NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } -% \end{macrocode} -% \end{macro} -% \end{macro} % % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx index 57d32e5c485..3d5644dd2af 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-scripts.dtx @@ -38,6 +38,7 @@ \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} +\newfontscript{CustomDefault}{latn,DFLT} \newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Duployan}{dupl} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx index b17020e5f8c..b7ed105edcf 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx @@ -448,6 +448,9 @@ % \end{macro} % % +% \subsection{High level conditionals} +% +% % \begin{macro}{\IfFontFeatureActiveTF} % \begin{macrocode} \cs_new:Nn \@@_main_IfFontFeatureActiveTF:nnn @@ -484,6 +487,34 @@ % \end{macrocode} % \end{macro} % +% +% \subsection{\cs{oldstylenums} and \cs{liningnums}} +% +% \begin{macro}{\oldstylenums} +% \begin{macro}{\liningnums} +% This command needs a redefinition. +% And we may as well provide the reverse command. +% \begin{macrocode} +\cs_new_protected:Nn \@@_main_oldstylenums:n + { + \group_begin: + \addfontfeature{Numbers=OldStyle} + #1 + \group_end: + } +\cs_new_protected:Nn \@@_main_liningnums:n + { + \group_begin: + \addfontfeature{Numbers=Lining} + #1 + \group_end: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% % \iffalse % \begin{macrocode} %</fontspec> diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx index db0223739ae..358acb36dca 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx @@ -76,14 +76,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\l_@@_scripts_missing_bool} -% True for a regular opentype font with at least the DFLT script. -% False for a font lacking all script (and therefore language and feature) tags. -% \begin{macrocode} -\bool_new:N \l_@@_scripts_missing_bool -% \end{macrocode} -% \end{macro} -% % \paragraph{Counters} % \begin{macrocode} \int_new:N \l_@@_script_int @@ -245,8 +237,10 @@ % % \begin{macrocode} \tl_new:N \l_@@_script_name_tl +\tl_set:Nn \l_@@_script_name_tl {CustomDefault} \tl_new:N \l_fontspec_script_tl \tl_new:N \l_@@_lang_name_tl +\tl_set:Nn \l_@@_lang_name_tl {Default} \tl_new:N \l_fontspec_lang_tl % \end{macrocode} % 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 5e3cf7fee20..60e85ca925a 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex @@ -367,15 +367,13 @@ while defining opacity in this way, if you like. In its explicit form, \feat{Scale} takes a single numeric argument for linearly scaling the font, as demonstrated in \exref{fontload}. -It is now possible to -measure the correct dimensions of the fonts loaded and -calculate values to scale them automatically. As well as a numerical argument, the \feat{Scale} feature also accepts options \opt{MatchLowercase} and \opt{MatchUppercase}, which will scale the font being selected to match the current default roman font to either the height of the lowercase or uppercase letters, respectively; these features are shown in \exref{scale}. +The amount of scaling used in each instance is reported in the \texttt{.log} file. \begin{Xexample}{scale}{Automatically calculated scale values.} \setmainfont{Georgia} @@ -385,21 +383,31 @@ uppercase letters, respectively; these features are shown in \exref{scale}. L O G O \uc F O N T \end{Xexample} -The amount of scaling used in each instance is reported in the \texttt{.log} file. -Since there is some subjectivity about the exact scaling to be used, these values -should be used to fine-tune the results. +Additional calls to the \feat{Scale} feature overwrite the settings of the former. +If you want to accumulate scale factors (useful perhaps to fine-tune the settings of +\opt{MatchLowercase}), the \feat{ScaleAgain} feature can be used as many times as +necessary. For example: +\begin{Verbatim} + [ Scale = 1.1 , Scale = 1.2 ] % -> scale of 1.2 + [ Scale = 1.1 , ScaleAgain = 1.2 ] % -> scale of 1.32 +\end{Verbatim} -Note that when |Scale=MatchLowercase| is used with |\setmainfont|, the new `main' font of the document will be scaled to match the old default. -This may be undesirable in some cases, so to achieve `natural' scaling for the main font but automatically scale all other fonts selected, you may write +Note that when |Scale=MatchLowercase| is used with |\setmainfont|, the new `main' +font of the document will be scaled to match the old default. +If you wish to automatically scale all fonts except have the main font use `natural' +scaling, you may write \begin{Verbatim} \defaultfontfeatures{ Scale = MatchLowercase } \defaultfontfeatures[\rmfamily]{ Scale = 1} \end{Verbatim} -One or both of these lines may be placed into a local |fontspec.cfg| file (see \vref{sec:config}) for this behaviour to be effected in your own documents automatically. +One or both of these lines may be placed into a local |fontspec.cfg| file +(see \vref{sec:config}) for this behaviour to be effected in your own documents +automatically. (Also see \vref{sec:defaults} for more information on setting font defaults.) + \subsection{Interword space} While the space between words can be varied on an individual 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 faf7fc3ff05..b290167279b 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex @@ -134,7 +134,9 @@ When selecting fonts by file name, any font that can be found in the default search paths may be used directly (including in the current directory) without having to explicitly define the location of the font file on disk. -Fonts selected by filename must include bold and italic variants explicitly. +Fonts selected by filename must include bold and italic variants explicitly, +unless a \texttt{.fontspec} file is supplied for the font family (see section~\ref{sec:fontspecfile}). +We'll give some first examples specifying everything explicitly: \begin{Verbatim} \setmainfont{texgyrepagella-regular.otf}[ BoldFont = texgyrepagella-bold.otf , @@ -187,7 +189,8 @@ My preference is to always be explicit and include the extension; this also allo In previous versions of the package, the |Path| feature was also provided under the alias |ExternalLocation|, but this latter name is now deprecated and should not be used for new documents. -\subsection{By custom file name} +\subsection{By custom file name using a \texttt{.fontspec} file} +\label{sec:fontspecfile} When \pkg{fontspec} is first asked to load a font, a font settings file is searched for with the name `\meta{fontname}\texttt{.fontspec}'.\footnote{Located in the current folder or within a standard \texttt{texmf} location.} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index 8f9606fc750..b18643561f4 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -71,7 +71,7 @@ \ProvidesExplFile{fontspec.dtx} %</dtx> %<*fontspec> - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{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 = "2.6l", -%<lua> date = "2019/01/18", +%<lua> version = "2.7", +%<lua> date = "2019/01/24", %<lua> description = "Font selection for XeLaTeX and LuaLaTeX", %<lua> author = "Khaled Hosny, Philipp Gesang, Will Robertson", %<lua> copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 6c799b521b1..e456b46917b 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -41,7 +41,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-luatex}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> %%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -73,7 +73,6 @@ \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool \bool_new:N \l__fontspec_never_check_bool -\bool_new:N \l__fontspec_scripts_missing_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -184,8 +183,10 @@ \tl_new:N \l__fontspec_fontname_bfsl_tl \tl_new:N \l__fontspec_fontname_sc_tl \tl_new:N \l__fontspec_script_name_tl +\tl_set:Nn \l__fontspec_script_name_tl {CustomDefault} \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl +\tl_set:Nn \l__fontspec_lang_name_tl {Default} \tl_new:N \l_fontspec_lang_tl \tl_new:N \l__fontspec_mapping_tl \tl_new:N \l__fontspec_punctspace_adjust_tl @@ -246,7 +247,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl' does not contain glyph #1. + '#1' does not contain glyph #2. } \__fontspec_msg_new:nnnn {fontspec} {euler-too-late} { @@ -312,15 +313,6 @@ { OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - `Script=Latin` used instead. - } \__fontspec_msg_new:nnn {fontspec} {aat-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl' feature not supported @@ -344,7 +336,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. + '#1' doesn't appear to have an Optical Size axis. } \__fontspec_msg_new:nnn {fontspec} {language-not-exist} { @@ -407,13 +399,9 @@ { Adjusting the maths setup (use [no-math] to avoid this). } -\__fontspec_msg_new:nnn {fontspec} {no-scripts} - { - Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. - } -\__fontspec_msg_new:nnn {fontspec} {dflt-script} +\__fontspec_msg_new:nnn {fontspec} {no-script} { - Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + Font "#1" does not contain requested Script "#2". } \__fontspec_msg_new:nnn {fontspec} {opa-twice} { @@ -520,6 +508,7 @@ \cs_generate_variant:Nn \prop_get:NnNT {NxN} \cs_generate_variant:Nn \prop_get:NnNTF {NxN} \cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty_p:n {e} \cs_generate_variant:Nn \tl_if_empty:nTF {x} \cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_generate_variant:Nn \tl_if_empty:nF {f} @@ -530,11 +519,11 @@ \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { - \font #1 = #2 ~at~ #3 \scan_stop: + \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 { - \global \font #1 = #2 ~at~ #3 \scan_stop: + \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { @@ -548,11 +537,25 @@ \prg_return_false: \fi } +\prg_set_conditional:Nnn \__fontspec_primitive_font_set:Nnn {TF,T,F} + { + \__fontspec_primitive_font_set:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\prg_set_conditional:Nnn \__fontspec_primitive_font_gset:Nnn {TF,T,F} + { + \__fontspec_primitive_font_gset:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\cs_set:Npn \__fontspec_primitive_font_set:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_set:Nnn } +\cs_set:Npn \__fontspec_primitive_font_set:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_set:NnnF } +\cs_set:Npn \__fontspec_primitive_font_gset:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_gset:Nnn } +\cs_set:Npn \__fontspec_primitive_font_gset:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_gset:NnnF } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_exist:n {TF,T,F} { \group_begin: \__fontspec_font_suppress_not_found_error: - \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} {10pt} + \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} { \f@size pt - 1sp } \__fontspec_primitive_font_if_null:NTF \l__fontspec_primitive_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } @@ -569,6 +572,11 @@ { \tex_hyphenchar:D #1 = #2 \scan_stop: } +\cs_new_eq:NN \__fontspec_primitive_font_get_name:N \fontname +\cs_new:Npn \__fontspec_primitive_font_current_name: + { + \__fontspec_primitive_font_get_name:N \tex_font:D + } %%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -683,6 +691,17 @@ { \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } +\AtBeginDocument + { + \RenewDocumentCommand \oldstylenums {m} + { + \__fontspec_main_oldstylenums:n {#1} + } + } +\NewDocumentCommand \liningnums {m} + { + \__fontspec_main_liningnums:n {#1} + } %%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -954,6 +973,20 @@ { \prg_return_true: } { \prg_return_false: } } } +\cs_new_protected:Nn \__fontspec_main_oldstylenums:n + { + \group_begin: + \addfontfeature{Numbers=OldStyle} + #1 + \group_end: + } +\cs_new_protected:Nn \__fontspec_main_liningnums:n + { + \group_begin: + \addfontfeature{Numbers=Lining} + #1 + \group_end: + } %%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -1104,18 +1137,23 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} - \tl_clear_new:N #1 + \tl_if_exist:NF #1 { \tl_new:N #1 } \tl_set_eq:NN #1 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} - \cs_new:Nn \fontspec_set_fontface:NNnn +\tl_new:N \l__fontspec_fontface_cs_tl +\tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} +\cs_new:Nn \fontspec_set_fontface:NNnn { - \tl_set:Nn \l__fontspec_family_label_tl {#1} - \__fontspec_select_font_family:nn {#3}{#4} - \global \font #1 = \fontname \l_fontspec_font \scan_stop: + \tl_set:Nn \l__fontspec_fontface_cs_tl {#1} + \tl_set:Nn \l__fontspec_family_label_tl {#2} + \__fontspec_select_font_family:nn {#3} {#4} \tl_set_eq:NN #2 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} { @@ -1131,7 +1169,7 @@ \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} { \exp_args:Nxx \tl_if_in:nnTF - { \fontname\font } { \tl_to_str:n {#1} } + { \__fontspec_primitive_font_current_name: } { \tl_to_str:n {#1} } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F} @@ -1164,7 +1202,7 @@ \__fontspec_init: \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} \__fontspec_if_detect_external:nT {#2} @@ -1282,20 +1320,19 @@ } \cs_new:Nn \__fontspec_load_font: { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \__fontspec_check_script:NnTF \l_fontspec_font {DFLT} - { - \bool_set_false:N \l__fontspec_scripts_missing_bool - } - { - \bool_set_true:N \l__fontspec_scripts_missing_bool - } + + \__fontspec_primitive_font_set:NnnF \l__fontspec_test_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt - 2sp } + { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + + \__fontspec_set_font_type:N \l__fontspec_test_font + \__fontspec_primitive_font_gset:Onn \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt } + + \l__fontspec_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn { @@ -1325,37 +1362,10 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \bool_if:NTF \l__fontspec_scripts_missing_bool - { - \__fontspec_info:n {no-scripts} - } + \tl_if_empty:NF \l__fontspec_script_name_tl { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {dflt-script} - \keys_set:nx {fontspec-opentype} {Script=Default} - \keys_set:nx {fontspec-opentype} {Language=Default} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } } } @@ -1512,28 +1522,30 @@ } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } + \group_begin: + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt + 1sp } + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } { \f@size pt + 1sp } + \str_if_eq:eeTF { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpa_font } { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpb_font } + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { \group_begin: \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {#1} \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} \group_end: } -\cs_new:Nn \__fontspec_load_fontname:n +\cs_new:Nn \__fontspec_load_fontname:Nn { - \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} - \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist + \__fontspec_load_external_fontoptions:Nn #1 {#2} + \prop_get:NVNF \g__fontspec_fontopts_prop #1 \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist - \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } + \__fontspec_primitive_font_set:OnnF \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt } + { \__fontspec_error:nx {font-not-found} {#2} } } \keys_define:nn {fontspec/fontname} { @@ -1564,7 +1576,7 @@ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } % "normal" - \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {\l__fontspec_sizing_leftover_clist} {} % small caps @@ -1582,7 +1594,7 @@ \bool_set_true:N \l__fontspec_nosc_bool } } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_fontname_sc_tl} }% local for each size } \bool_if:NF \l__fontspec_nosc_bool @@ -1596,6 +1608,11 @@ \__fontspec_get_features:n { #2 , #3 , #4 } + \tl_if_empty:NF \l__fontspec_scale_tl + { + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } + \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl @@ -1689,7 +1706,7 @@ } \cs_new:Nn \__fontspec_make_smallcaps:TF { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + \exp_args:No \__fontspec_check_ot_feat:NnTF \l__fontspec_fontface_cs_tl {smcp} {#1} {#2} } \cs_new:Nn \__fontspec_update_featstr:n { @@ -1755,7 +1772,7 @@ \cs_new:Nn \__fontspec_define_opentype_feature_group:n { - \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} } } \cs_new:Nn \__fontspec_feat_prop_add:nn { @@ -1775,7 +1792,8 @@ \keys_define:nn {fontspec-opentype} { #1/#2 .code:n = - { \__fontspec_remove_clashing_featstr:n {#5} } + { \__fontspec_remove_clashing_featstr:n {#5} } , + #1/#2 .groups:n = {opentype} } } { @@ -1784,7 +1802,8 @@ #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} - } + } , + #1/#2 .groups:n = {opentype} } } } @@ -1810,7 +1829,7 @@ \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool } \bool_if:NT \l__fontspec_check_feat_bool { - \__fontspec_check_ot_feat:NnF \l_fontspec_font {#1} + \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1} { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} \bool_set_false:N \l__fontspec_proceed_bool @@ -1834,6 +1853,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#2} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \cs_if_eq:NNTF #1 \font { \tl_set:Nx \l__fontspec_tmp_tl {\curr@fontshape/\f@size} } @@ -1847,6 +1869,7 @@ \prg_return_false: } } + } } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { @@ -1857,6 +1880,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \__fontspec_ot_validate_tag:x {#3} \cs_if_eq:NNTF #1 \font @@ -1868,6 +1894,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { @@ -1876,9 +1903,12 @@ } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} { - \bool_if:nTF {\l__fontspec_never_check_bool || \l__fontspec_scripts_missing_bool} + \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} } + { \prg_return_false: } + { \__fontspec_ot_validate_tag:x {#2} \__fontspec_ot_validate_tag:x {#3} \__fontspec_ot_validate_tag:x {#4} @@ -1891,6 +1921,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -2259,7 +2290,12 @@ {MatchUppercase} { \__fontspec_calc_scale:n {8} } } { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } +\__fontspec_keys_define_code:nnn {fontspec} {ScaleAgain} + { + \tl_if_empty:NT \l__fontspec_scale_tl { \tl_set:Nn \l__fontspec_scale_tl {1} } + \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { #1 * \l__fontspec_scale_tl } } + \__fontspec_info:n {set-scale} } \cs_new:Nn \__fontspec_calc_scale:n { @@ -2270,12 +2306,12 @@ \selectfont \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l__fontspec_fontface_cs_tl \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } + \dim_to_fp:n {\l__fontspec_tmpb_dim} } } \__fontspec_info:n {set-scale} @@ -2368,12 +2404,12 @@ { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + \exp_args:No \__fontspec_primitive_font_glyph_if_exist:NnTF \l__fontspec_fontface_cs_tl {\l__fontspec_hyphenchar_tl} { \tl_put_right:Nn \l__fontspec_postadjust_tl { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } } - { \__fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{\l_fontspec_fontname_tl}{#1} } } } @@ -2712,6 +2748,7 @@ \keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , + Alternate .groups:n = {opentype}, Alternate / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2728,6 +2765,7 @@ \keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , + Variant .groups:n = {opentype} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2763,6 +2801,7 @@ \keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , + Annotation .groups:n = {opentype}, Annotation / unknown .code:n = { \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} @@ -2772,62 +2811,68 @@ \keys_define:nn {fontspec-opentype} { Ornament .default:n = {0} , + Ornament .groups:n = {opentype}, Ornament / unknown .code:n = { \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} } } -\keys_define:nn { fontspec-opentype } { Script .choice: } +\keys_define:nn {fontspec-opentype} + { + Script .choice: , + Script .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Script / #1 .code:n = { - \bool_if:NF \l__fontspec_scripts_missing_bool + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1} { - \__fontspec_check_script:NnT \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_scriptlang_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } + \tl_set:Nn \l__fontspec_script_name_tl {#1} + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_scriptlang_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: } - \bool_if:NF \l__fontspec_scriptlang_exist_bool + } + \bool_if:NF \l__fontspec_scriptlang_exist_bool + { + \bool_if:nF { \str_if_eq_p:ee {#1} {CustomDefault} } + { + \tl_clear:N \l__fontspec_script_name_tl + \__fontspec_warning:nx {no-script} {\l_fontspec_fontname_tl} {#1} + } + + \bool_if:nF { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } - } - } + \str_if_eq_p:ee {#1} {Default} || + \str_if_eq_p:ee {#1} {Latin} || + \str_if_eq_p:ee {#1} {CustomDefault} + } + { + \keys_set:nn {fontspec-opentype} { Script = CustomDefault } } } } } } -\keys_define:nn {fontspec-opentype} { Language .choice: } +\keys_define:nn {fontspec-opentype} + { + Language .choice: , + Language .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_lang:nn { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Language / #1 .code:n = { \bool_set_false:N \l__fontspec_scriptlang_exist_bool \clist_map_inline:nn {#2} { - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2} { \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} @@ -2903,6 +2948,7 @@ \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} +\newfontscript{CustomDefault}{latn,DFLT} \newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Duployan}{dupl} @@ -3895,12 +3941,4 @@ \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: }{} } -\RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } -\NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index 1e7ad583f4b..cf7f95bf6cf 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -41,7 +41,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> %%^^A%% fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -73,7 +73,6 @@ \bool_new:N \l__fontspec_proceed_bool \bool_new:N \l__fontspec_check_feat_bool \bool_new:N \l__fontspec_never_check_bool -\bool_new:N \l__fontspec_scripts_missing_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int @@ -184,8 +183,10 @@ \tl_new:N \l__fontspec_fontname_bfsl_tl \tl_new:N \l__fontspec_fontname_sc_tl \tl_new:N \l__fontspec_script_name_tl +\tl_set:Nn \l__fontspec_script_name_tl {CustomDefault} \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl +\tl_set:Nn \l__fontspec_lang_name_tl {Default} \tl_new:N \l_fontspec_lang_tl \tl_new:N \l__fontspec_mapping_tl \tl_new:N \l__fontspec_punctspace_adjust_tl @@ -246,7 +247,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-glyph} { - '\l_fontspec_fontname_tl' does not contain glyph #1. + '#1' does not contain glyph #2. } \__fontspec_msg_new:nnnn {fontspec} {euler-too-late} { @@ -312,15 +313,6 @@ { OpenType tag '#1' is too long; script, language, and feature tags must be four characters or fewer. } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - } -\__fontspec_msg_new:nnn {fontspec} {script-not-exist-latn} - { - Font '\l_fontspec_fontname_tl' does not contain script '#1'. - `Script=Latin` used instead. - } \__fontspec_msg_new:nnn {fontspec} {aat-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl' feature not supported @@ -344,7 +336,7 @@ } \__fontspec_msg_new:nnn {fontspec} {no-opticals} { - '\l_fontspec_fontname_tl' doesn't appear to have an Optical Size axis. + '#1' doesn't appear to have an Optical Size axis. } \__fontspec_msg_new:nnn {fontspec} {language-not-exist} { @@ -407,13 +399,9 @@ { Adjusting the maths setup (use [no-math] to avoid this). } -\__fontspec_msg_new:nnn {fontspec} {no-scripts} +\__fontspec_msg_new:nnn {fontspec} {no-script} { - Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. - } -\__fontspec_msg_new:nnn {fontspec} {dflt-script} - { - Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + Font "#1" does not contain requested Script "#2". } \__fontspec_msg_new:nnn {fontspec} {opa-twice} { @@ -517,6 +505,7 @@ \cs_generate_variant:Nn \prop_get:NnNT {NxN} \cs_generate_variant:Nn \prop_get:NnNTF {NxN} \cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \tl_if_empty_p:n {e} \cs_generate_variant:Nn \tl_if_empty:nTF {x} \cs_generate_variant:Nn \tl_if_empty:nF {x} \cs_generate_variant:Nn \tl_if_empty:nF {f} @@ -527,11 +516,11 @@ \cs_set:Npn \__fontspec_primitive_font_set:Nnn #1#2#3 { - \font #1 = #2 ~at~ #3 \scan_stop: + \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_primitive_font_gset:Nnn #1#2#3 { - \global \font #1 = #2 ~at~ #3 \scan_stop: + \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop: } \cs_set:Npn \__fontspec_font_suppress_not_found_error: { @@ -545,11 +534,25 @@ \prg_return_false: \fi } +\prg_set_conditional:Nnn \__fontspec_primitive_font_set:Nnn {TF,T,F} + { + \__fontspec_primitive_font_set:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\prg_set_conditional:Nnn \__fontspec_primitive_font_gset:Nnn {TF,T,F} + { + \__fontspec_primitive_font_gset:Nnn #1 {#2} {#3} + \__fontspec_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} + } +\cs_set:Npn \__fontspec_primitive_font_set:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_set:Nnn } +\cs_set:Npn \__fontspec_primitive_font_set:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_set:NnnF } +\cs_set:Npn \__fontspec_primitive_font_gset:Onn { \exp_last_unbraced:No \__fontspec_primitive_font_gset:Nnn } +\cs_set:Npn \__fontspec_primitive_font_gset:OnnF { \exp_last_unbraced:No \__fontspec_primitive_font_gset:NnnF } \prg_set_conditional:Nnn \__fontspec_primitive_font_if_exist:n {TF,T,F} { \group_begin: \__fontspec_font_suppress_not_found_error: - \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} {10pt} + \__fontspec_primitive_font_set:Nnn \l__fontspec_primitive_font {#1} { \f@size pt - 1sp } \__fontspec_primitive_font_if_null:NTF \l__fontspec_primitive_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } @@ -566,6 +569,11 @@ { \tex_hyphenchar:D #1 = #2 \scan_stop: } +\cs_new_eq:NN \__fontspec_primitive_font_get_name:N \fontname +\cs_new:Npn \__fontspec_primitive_font_current_name: + { + \__fontspec_primitive_font_get_name:N \tex_font:D + } %%^^A%% fontspec-code-interfaces.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -680,6 +688,17 @@ { \__fontspec_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3} } +\AtBeginDocument + { + \RenewDocumentCommand \oldstylenums {m} + { + \__fontspec_main_oldstylenums:n {#1} + } + } +\NewDocumentCommand \liningnums {m} + { + \__fontspec_main_liningnums:n {#1} + } %%^^A%% fontspec-code-user.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -951,6 +970,20 @@ { \prg_return_true: } { \prg_return_false: } } } +\cs_new_protected:Nn \__fontspec_main_oldstylenums:n + { + \group_begin: + \addfontfeature{Numbers=OldStyle} + #1 + \group_end: + } +\cs_new_protected:Nn \__fontspec_main_liningnums:n + { + \group_begin: + \addfontfeature{Numbers=Lining} + #1 + \group_end: + } %%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -1101,18 +1134,23 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset \tl_set:Nn \l__fontspec_family_label_tl {#1} \__fontspec_select_font_family:nn {#2} {#3} - \tl_clear_new:N #1 + \tl_if_exist:NF #1 { \tl_new:N #1 } \tl_set_eq:NN #1 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \cs_generate_variant:Nn \fontspec_set_family:Nnn {c} - \cs_new:Nn \fontspec_set_fontface:NNnn +\tl_new:N \l__fontspec_fontface_cs_tl +\tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} +\cs_new:Nn \fontspec_set_fontface:NNnn { - \tl_set:Nn \l__fontspec_family_label_tl {#1} - \__fontspec_select_font_family:nn {#3}{#4} - \global \font #1 = \fontname \l_fontspec_font \scan_stop: + \tl_set:Nn \l__fontspec_fontface_cs_tl {#1} + \tl_set:Nn \l__fontspec_family_label_tl {#2} + \__fontspec_select_font_family:nn {#3} {#4} \tl_set_eq:NN #2 \l_fontspec_family_tl + \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset } \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} { @@ -1128,7 +1166,7 @@ \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} { \exp_args:Nxx \tl_if_in:nnTF - { \fontname\font } { \tl_to_str:n {#1} } + { \__fontspec_primitive_font_current_name: } { \tl_to_str:n {#1} } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F} @@ -1161,7 +1199,7 @@ \__fontspec_init: \__fontspec_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} + \__fontspec_sanitise_fontname:Nn \l__fontspec_fontname_up_tl {#2} \__fontspec_sanitise_fontname:Nn \l__fontspec_basename_tl {#2} \__fontspec_if_detect_external:nT {#2} @@ -1278,20 +1316,19 @@ } \cs_new:Nn \__fontspec_load_font: { - \__fontspec_primitive_font_set:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } - \__fontspec_set_font_type:N \l_fontspec_font - \__fontspec_primitive_font_gset:Nnn \l_fontspec_font - { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } {\f@size pt} - \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly - \__fontspec_check_script:NnTF \l_fontspec_font {DFLT} - { - \bool_set_false:N \l__fontspec_scripts_missing_bool - } - { - \bool_set_true:N \l__fontspec_scripts_missing_bool - } + + \__fontspec_primitive_font_set:NnnF \l__fontspec_test_font + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt - 2sp } + { \__fontspec_error:nx {font-not-found} {\l__fontspec_fontname_up_tl} } + + \__fontspec_set_font_type:N \l__fontspec_test_font + \__fontspec_primitive_font_gset:Onn \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn { \l__fontspec_fontname_up_tl } {} } + { \f@size pt } + + \l__fontspec_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly + } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn { @@ -1321,37 +1358,10 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \bool_if:NTF \l__fontspec_scripts_missing_bool + \tl_if_empty:NF \l__fontspec_script_name_tl { - \__fontspec_info:n {no-scripts} - } - { - \tl_if_empty:NTF \l__fontspec_script_name_tl - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \tl_set:Nn \l__fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } - { - \__fontspec_info:n {dflt-script} - \keys_set:nx {fontspec-opentype} {Script=Default} - \keys_set:nx {fontspec-opentype} {Language=Default} - } - } - { - \tl_if_empty:NT \l__fontspec_lang_name_tl - { - \tl_set:Nn \l__fontspec_lang_name_tl {Default} - } - \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} - \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} - } + \keys_set:nx {fontspec-opentype} {Script=\l__fontspec_script_name_tl} + \keys_set:nx {fontspec-opentype} {Language=\l__fontspec_lang_name_tl} } } } @@ -1533,28 +1543,30 @@ } \prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \__fontspec_primitive_font_set:Nnn \l_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } {\f@size pt} - \__fontspec_primitive_font_set:Nnn \l_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } {\f@size pt} - \str_if_eq:eeTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } - { \prg_return_false: } - { \prg_return_true: } + \group_begin: + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpa_font { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt + 1sp } + \__fontspec_primitive_font_set:Nnn \l__fontspec_tmpb_font { \__fontspec_construct_font_call:nn {#1#2} {} } { \f@size pt + 1sp } + \str_if_eq:eeTF { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpa_font } { \__fontspec_primitive_font_get_name:N \l__fontspec_tmpb_font } + { \group_end: \prg_return_false: } + { \group_end: \prg_return_true: } } \cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { \group_begin: \__fontspec_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l__fontspec_leftover_clist - \__fontspec_load_fontname:n {#1} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {#1} \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, \l__fontspec_leftover_clist } {#5} \group_end: } -\cs_new:Nn \__fontspec_load_fontname:n +\cs_new:Nn \__fontspec_load_fontname:Nn { - \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1} - \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_tl \l__fontspec_fontopts_clist + \__fontspec_load_external_fontoptions:Nn #1 {#2} + \prop_get:NVNF \g__fontspec_fontopts_prop #1 \l__fontspec_fontopts_clist { \clist_clear:N \l__fontspec_fontopts_clist } \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l__fontspec_fontopts_clist - \__fontspec_primitive_font_set:Nnn \l_fontspec_font { \__fontspec_construct_font_call:nn {\l_fontspec_fontname_tl} {} } {\f@size pt} - \__fontspec_primitive_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } + \__fontspec_primitive_font_set:OnnF \l__fontspec_fontface_cs_tl + { \__fontspec_construct_font_call:nn {#1} {} } { \f@size pt } + { \__fontspec_error:nx {font-not-found} {#2} } } \keys_define:nn {fontspec/fontname} { @@ -1585,7 +1597,7 @@ \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } % "normal" - \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_sizedfont_tl} \__fontspec_setup_nfss:Nnnn \l__fontspec_nfss_tl {#1} {\l__fontspec_sizing_leftover_clist} {} % small caps @@ -1603,7 +1615,7 @@ \bool_set_true:N \l__fontspec_nosc_bool } } - { \__fontspec_load_fontname:n {\l__fontspec_fontname_sc_tl} }% local for each size + { \__fontspec_load_fontname:Nn \l_fontspec_fontname_tl {\l__fontspec_fontname_sc_tl} }% local for each size } \bool_if:NF \l__fontspec_nosc_bool @@ -1617,6 +1629,11 @@ \__fontspec_get_features:n { #2 , #3 , #4 } + \tl_if_empty:NF \l__fontspec_scale_tl + { + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } + \tl_put_right:Nx #1 { <\l__fontspec_size_tl> \l__fontspec_scale_tl @@ -1712,7 +1729,7 @@ } \cs_new:Nn \__fontspec_make_ot_smallcaps:TF { - \__fontspec_check_ot_feat:NnTF \l_fontspec_font {smcp} {#1} {#2} + \exp_args:No \__fontspec_check_ot_feat:NnTF \l__fontspec_fontface_cs_tl {smcp} {#1} {#2} } \cs_new:Nn \__fontspec_make_smallcaps:TF { @@ -1720,7 +1737,10 @@ { \__fontspec_make_ot_smallcaps:TF {#1} {#2} } { \bool_if:NT \l__fontspec_atsui_bool - { \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {3}{3} {#1} {#2} } + { + \exp_args:No \__fontspec_make_AAT_feature_string:NnnTF + \l__fontspec_fontface_cs_tl {3} {3} {#1} {#2} + } } } \cs_new:Nn \__fontspec_update_featstr:n @@ -1797,7 +1817,7 @@ \cs_new:Nn \__fontspec_define_opentype_feature_group:n { - \keys_define:nn {fontspec-opentype} { #1 .multichoice: } + \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} } } \cs_new:Nn \__fontspec_feat_prop_add:nn { @@ -1817,7 +1837,8 @@ \keys_define:nn {fontspec-opentype} { #1/#2 .code:n = - { \__fontspec_remove_clashing_featstr:n {#5} } + { \__fontspec_remove_clashing_featstr:n {#5} } , + #1/#2 .groups:n = {opentype} } } { @@ -1826,7 +1847,8 @@ #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} - } + } , + #1/#2 .groups:n = {opentype} } } } @@ -1852,7 +1874,7 @@ \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool } \bool_if:NT \l__fontspec_check_feat_bool { - \__fontspec_check_ot_feat:NnF \l_fontspec_font {#1} + \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1} { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} \bool_set_false:N \l__fontspec_proceed_bool @@ -1876,6 +1898,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#2} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } \int_zero:N \l_tmpa_int @@ -1891,6 +1916,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} { @@ -1901,6 +1927,9 @@ \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \__fontspec_iv_str_to_num:Nx \l__fontspec_script_int {#3} \int_set:Nn \l__fontspec_tmpb_int @@ -1923,6 +1952,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F} { @@ -1931,9 +1961,12 @@ } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} { - \bool_if:nTF {\l__fontspec_never_check_bool || \l__fontspec_scripts_missing_bool} + \bool_if:NTF \l__fontspec_never_check_bool { \prg_return_true: } { + \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} } + { \prg_return_false: } + { \__fontspec_iv_str_to_num:Nx \l__fontspec_strnum_int {#2} \__fontspec_iv_str_to_num:Nx \l__fontspec_language_int {#3} \__fontspec_lang_dflt_correct:N \l__fontspec_language_int @@ -1958,6 +1991,7 @@ } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } + } } \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {aalt}{Access~All~Alternates} \prop_gput:Nnn \g__fontspec_all_opentype_feature_names_prop {abvf}{Above-base~Forms} @@ -2102,7 +2136,7 @@ \tl_if_empty:nTF {#1} { \__fontspec_warning:n {aat-feature-not-exist} } { - \__fontspec_make_AAT_feature_string:NnnTF \l_fontspec_font {#1}{#2} + \exp_args:No \__fontspec_make_AAT_feature_string:NnnTF \l__fontspec_fontface_cs_tl {#1} {#2} { \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } @@ -2388,7 +2422,12 @@ {MatchUppercase} { \__fontspec_calc_scale:n {8} } } { \tl_set:Nx \l__fontspec_scale_tl {#1} } - \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } + } +\__fontspec_keys_define_code:nnn {fontspec} {ScaleAgain} + { + \tl_if_empty:NT \l__fontspec_scale_tl { \tl_set:Nn \l__fontspec_scale_tl {1} } + \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { #1 * \l__fontspec_scale_tl } } + \__fontspec_info:n {set-scale} } \cs_new:Nn \__fontspec_calc_scale:n { @@ -2399,12 +2438,12 @@ \selectfont \__fontspec_set_font_dimen:NnN \l__fontspec_tmpa_dim {#1} \font - \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l_fontspec_font + \__fontspec_set_font_dimen:NnN \l__fontspec_tmpb_dim {#1} \l__fontspec_fontface_cs_tl \tl_set:Nx \l__fontspec_scale_tl { \fp_eval:n { \dim_to_fp:n {\l__fontspec_tmpa_dim} / - \dim_to_fp:n {\l__fontspec_tmpb_dim} } + \dim_to_fp:n {\l__fontspec_tmpb_dim} } } \__fontspec_info:n {set-scale} @@ -2497,12 +2536,12 @@ { \tl_set:Nn \l__fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l__fontspec_hyphenchar_tl { #1} } - \__fontspec_primitive_font_glyph_if_exist:NnTF \l_fontspec_font {\l__fontspec_hyphenchar_tl} + \exp_args:No \__fontspec_primitive_font_glyph_if_exist:NnTF \l__fontspec_fontface_cs_tl {\l__fontspec_hyphenchar_tl} { \tl_put_right:Nn \l__fontspec_postadjust_tl { \__fontspec_primitive_font_set_hyphenchar:Nn \font { \l__fontspec_hyphenchar_tl } } } - { \__fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{\l_fontspec_fontname_tl}{#1} } } } @@ -2583,7 +2622,7 @@ \bool_if:nT { !\l__fontspec_ot_bool && !\l__fontspec_mm_bool } { \bool_if:NT \l__fontspec_firsttime_bool - { \__fontspec_warning:n {no-opticals} } + { \__fontspec_warning:n {no-opticals} {\l_fontspec_fontname_tl} } } } \keys_define:nn {fontspec} @@ -2685,7 +2724,9 @@ \keys_define:nn {fontspec-opentype} { Ligatures / TeX .code:n = { \tl_set:Nn \l__fontspec_mapping_tl {tex-text} }, + Ligatures / TeX .groups:n = {opentype}, Ligatures / TeXReset .code:n = { \tl_clear:N \l__fontspec_mapping_tl }, + Ligatures / TeXReset .groups:n = {opentype}, } \__fontspec_define_opentype_feature_group:n {Letters} \__fontspec_define_opentype_feature:nnnnn {Letters} {ResetAll} {} {} @@ -2860,6 +2901,7 @@ \keys_define:nn {fontspec-opentype} { Alternate .default:n = {0} , + Alternate .groups:n = {opentype}, Alternate / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2871,6 +2913,7 @@ \keys_define:nn {fontspec-opentype} { Variant .default:n = {0} , + Variant .groups:n = {opentype} , Variant / unknown .code:n = { \clist_map_inline:nn {#1} @@ -2906,6 +2949,7 @@ \keys_define:nn {fontspec-opentype} { Annotation .default:n = {0} , + Annotation .groups:n = {opentype}, Annotation / unknown .code:n = { \__fontspec_make_OT_feature:nnn {nalt} {+nalt=#1} {} @@ -2915,62 +2959,68 @@ \keys_define:nn {fontspec-opentype} { Ornament .default:n = {0} , + Ornament .groups:n = {opentype}, Ornament / unknown .code:n = { \__fontspec_make_OT_feature:nnn {ornm} { +ornm=#1 } {} } } -\keys_define:nn { fontspec-opentype } { Script .choice: } +\keys_define:nn {fontspec-opentype} + { + Script .choice: , + Script .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_script:nn { - \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Script / #1 .code:n = { - \bool_if:NF \l__fontspec_scripts_missing_bool + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1} { - \__fontspec_check_script:NnT \l_fontspec_font {####1} - { - \tl_set:Nn \l_fontspec_script_tl {####1} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - \bool_set_true:N \l__fontspec_scriptlang_exist_bool - \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } - \clist_map_break: - } + \tl_set:Nn \l__fontspec_script_name_tl {#1} + \tl_set:Nn \l_fontspec_script_tl {####1} + \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} + \bool_set_true:N \l__fontspec_scriptlang_exist_bool + \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 } + \clist_map_break: } - \bool_if:NF \l__fontspec_scriptlang_exist_bool + } + \bool_if:NF \l__fontspec_scriptlang_exist_bool + { + \bool_if:nF { \str_if_eq_p:ee {#1} {CustomDefault} } { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} - { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} - \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int} - } - { - \__fontspec_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } - } - } + \tl_clear:N \l__fontspec_script_name_tl + \__fontspec_warning:nx {no-script} {\l_fontspec_fontname_tl} {#1} + } + + \bool_if:nF + { + \str_if_eq_p:ee {#1} {Default} || + \str_if_eq_p:ee {#1} {Latin} || + \str_if_eq_p:ee {#1} {CustomDefault} + } + { + \keys_set:nn {fontspec-opentype} { Script = CustomDefault } } } } } } -\keys_define:nn {fontspec-opentype} { Language .choice: } +\keys_define:nn {fontspec-opentype} + { + Language .choice: , + Language .groups:n = {opentype} , + } \cs_new:Nn \fontspec_new_lang:nn { - \keys_define:nn { fontspec-opentype } { Language / #1 .code:n = + \keys_define:nn {fontspec-opentype} { Language / #1 .code:n = { \bool_set_false:N \l__fontspec_scriptlang_exist_bool \clist_map_inline:nn {#2} { - \__fontspec_check_lang:NnTF \l_fontspec_font {#2} + \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2} { \tl_set:Nn \l_fontspec_lang_tl {#2} \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int} @@ -3046,6 +3096,7 @@ \newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} +\newfontscript{CustomDefault}{latn,DFLT} \newfontscript{Deseret}{dsrt} \newfontscript{Devanagari}{dev2,deva} \newfontscript{Duployan}{dupl} @@ -4175,12 +4226,4 @@ \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space: }{} } -\RenewDocumentCommand \oldstylenums {m} - { - { \addfontfeature{Numbers=OldStyle} #1 } - } -\NewDocumentCommand \liningnums {m} - { - { \addfontfeature{Numbers=Lining} #1 } - } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index a3b2cebcf69..e67eed16e82 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -23,8 +23,8 @@ fontspec = fontspec or {} local fontspec = fontspec fontspec.module = { name = "fontspec", - version = "2.6l", - date = "2019/01/18", + version = "2.7", + date = "2019/01/24", description = "Font selection for XeLaTeX and LuaLaTeX", author = "Khaled Hosny, Philipp Gesang, Will Robertson", copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index a5a4ba37d20..7178fb7f2d3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -21,7 +21,7 @@ \RequirePackage{xparse} \ProvidesExplPackage{fontspec}% - {2019/01/18}{2.6l}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/24}{2.7}{Font selection for XeLaTeX and LuaLaTeX} %%^^A%% fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec> \sys_if_engine_luatex:T |