diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty | 147 |
1 files changed, 90 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index c3740818680..1e7ad583f4b 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/16}{2.6k}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/18}{2.6l}{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,10 +73,14 @@ \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 \int_new:N \l__fontspec_tmp_int +\int_new:N \l__fontspec_tmpa_int +\int_new:N \l__fontspec_tmpb_int +\int_new:N \l__fontspec_tmpc_int \int_new:N \l__fontspec_em_int \int_new:N \l__fontspec_emdef_int \int_new:N \l__fontspec_strong_int @@ -407,6 +411,10 @@ { 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. + } \__fontspec_msg_new:nnn {fontspec} {opa-twice} { Opacity set twice, in both Colour and Opacity.\\ @@ -1277,6 +1285,13 @@ \__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 + } } \cs_new:Nn \__fontspec_construct_font_call:nnnnnn { @@ -1306,11 +1321,30 @@ { \bool_if:NT \l__fontspec_firsttime_bool { - \tl_if_empty:NTF \l__fontspec_script_name_tl + \bool_if:NTF \l__fontspec_scripts_missing_bool + { + \__fontspec_info:n {no-scripts} + } { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} + \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_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} @@ -1318,18 +1352,6 @@ \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} } } } @@ -1755,19 +1777,21 @@ \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_zero:N #1 } + \int_set:Nn #1 { - \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 - } + `#2 * "1000000 + + `#3 * "10000 + + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100 + + \ifx \c_empty_tl #5 32 \else `#5 \fi + } + } +\cs_new_protected:Nn \__fontspec_lang_dflt_correct:N + { + \int_compare:nNnT {#1} = {1145457748} % "DFLT" + { + \int_zero:N #1 } } -\cs_generate_variant:Nn \__fontspec_iv_str_to_num:Nn {No} %%^^A%% fontspec-code-opentype.dtx -- part of FONTSPEC <wspr.io/fontspec> @@ -1879,18 +1903,23 @@ { \__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 + \int_set:Nn \l__fontspec_tmpb_int { \XeTeXOTcountlanguages #1 \l__fontspec_script_int } - \int_zero:N \l_tmpa_int + \int_zero:N \l__fontspec_tmpa_int \bool_set_false:N \l__fontspec_check_bool - \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l__fontspec_tmpa_int = \l__fontspec_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 + \int_set:Nn \l__fontspec_tmpc_int + { \XeTeXOTlanguagetag #1 \l__fontspec_script_int \l__fontspec_tmpa_int } + + \int_compare:nNnTF \l__fontspec_tmpc_int = \l__fontspec_strnum_int + { + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l__fontspec_tmpa_int {\l__fontspec_tmpb_int} + } + { + \int_incr:N \l__fontspec_tmpa_int + } } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } @@ -1902,11 +1931,12 @@ } \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F} { - \bool_if:NTF \l__fontspec_never_check_bool + \bool_if:nTF {\l__fontspec_never_check_bool || \l__fontspec_scripts_missing_bool} { \prg_return_true: } { \__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 \__fontspec_iv_str_to_num:Nx \l__fontspec_script_int {#4} \int_set:Nn \l_tmpb_int { @@ -2895,34 +2925,37 @@ { \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \bool_if:NF \l__fontspec_scripts_missing_bool { - \__fontspec_check_script:NnT \l_fontspec_font {####1} + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \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 - { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } - { - \__fontspec_check_script:NnTF \l_fontspec_font {latn} + \__fontspec_check_script:NnT \l_fontspec_font {####1} { - \__fontspec_warning:nx {script-not-exist-latn} {#1} - \tl_set:Nn \l_fontspec_script_tl {latn} + \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 + { + \str_if_eq:eeTF {#1} {Latin} { \__fontspec_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } + } + { + \__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 } + } } } } |