diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-17 21:28:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-17 21:28:23 +0000 |
commit | 590f92a6661f059e1c49b7b453c6c43149865628 (patch) | |
tree | 4a6e2c981817b1e58634f3f6c03fc48cd0c0ada8 | |
parent | df2e480fb0e83b9160de826127a9200714b9f3f2 (diff) |
fontspec (17jan19)
git-svn-id: svn://tug.org/texlive/trunk@49739 c570f23f-e606-0410-a88d-b1316a301751
15 files changed, 304 insertions, 165 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md index 3d07721fa37..9116cdb9dfd 100644 --- a/Master/texmf-dist/doc/latex/fontspec/CHANGES.md +++ b/Master/texmf-dist/doc/latex/fontspec/CHANGES.md @@ -1,6 +1,12 @@ Change history ============== +## v2.6l (2019/01/18) + + * REALLY fix crash when loading fonts that are missing a requested script. + * Lots of internal logic changes for what should have been an easy fix :( + + ## v2.6k (2019/01/16) * 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 bbb8f4f2e79..383f53e8eaa 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 a05c93ef6ba..4feee8c575d 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-feat-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx index 843e4587740..dc3db933869 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 @@ -424,34 +424,37 @@ { \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = { - \bool_set_false:N \l_@@_scriptlang_exist_bool - \clist_map_inline:nn {#2} + \bool_if:NF \l_@@_scripts_missing_bool { - \@@_check_script:NnT \l_fontspec_font {####1} + \bool_set_false:N \l_@@_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \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 - { - \str_if_eq:eeTF {#1} {Latin} - { - \@@_warning:nx {script-not-exist} {#1} - } - { - \@@_check_script:NnTF \l_fontspec_font {latn} + \@@_check_script:NnT \l_fontspec_font {####1} { - \@@_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_@@_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 + { + \str_if_eq:eeTF {#1} {Latin} { \@@_warning:nx {script-not-exist} {#1} - \keys_set:nn {fontspec-opentype} { Script = Default } + } + { + \@@_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 } + } } } } 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 da2374cde13..d73f0f62b18 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx @@ -239,6 +239,15 @@ \@@_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 + } } % \end{macrocode} % \end{macro} @@ -304,33 +313,42 @@ %<debug> \typeout{:: _set_scriptlang:} \bool_if:NT \l_@@_firsttime_bool { - \tl_if_empty:NTF \l_@@_script_name_tl + \bool_if:NTF \l_@@_scripts_missing_bool { - \@@_check_script:NnTF \l_fontspec_font {latn} +%<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_set:Nn \l_@@_script_name_tl {Latin} \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} -%<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} - } -%<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} } } } @@ -1138,25 +1156,31 @@ \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_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 } } % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn \@@_iv_str_to_num:Nn {No} +%</XE> % \end{macrocode} +% \end{macro} % +% \begin{macro}{\@@_lang_dflt_correct:N} % \begin{macrocode} +%<*XE> +\cs_new_protected:Nn \@@_lang_dflt_correct:N + { + \int_compare:nNnT {#1} = {1145457748} % "DFLT" + { + \int_zero:N #1 + } + } %</XE> % \end{macrocode} % \end{macro} 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 1adee94c741..2aa33288fe4 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx @@ -105,6 +105,7 @@ { \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} } } +%<debug>\typeout{Renderer: \l_fontspec_renderer_tl} \tl_gset:Nx \g_@@_single_feat_tl { \l_fontspec_renderer_tl } %</XE> %<*LU> @@ -120,6 +121,7 @@ { \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} } } +%<debug>\typeout{Mode: \l_fontspec_mode_tl} \tl_gset:Nx \g_@@_single_feat_tl { mode=\l_fontspec_mode_tl } %</LU> } 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 42b02254808..f80ea832584 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx @@ -239,6 +239,10 @@ { Font "\l_fontspec_fontname_tl" does not contain any OpenType `Script' information. } +\@@_msg_new:nnn {fontspec} {dflt-script} + { + Font "\l_fontspec_fontname_tl" falling back to default (DFLT) script. + } \@@_msg_new:nnn {fontspec} {opa-twice} { Opacity set twice, in both Colour and Opacity.\\ 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 ceda070f907..57087ce8a82 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx @@ -149,10 +149,12 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_script:Nn {TF,T} { +%<debug>\typeout{:: _check_script:Nn} \bool_if:NTF \l_@@_never_check_bool { \prg_return_true: } %<*XE> { +%<debug>\typeout{::::~ checking~ script~ #2} \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 } \int_zero:N \l_tmpa_int @@ -175,8 +177,17 @@ \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} } +%<debug>\typeout{::::~ checking:~"\l_@@_tmp_tl",~ "#2"} \directlua{fontspec.check_ot_script("\l_@@_tmp_tl", "#2")} - \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l__fontspec_check_bool + { +%<debug>\typeout{::::::~ TRUE} + \prg_return_true: + } + { +%<debug>\typeout{::::::~ FALSE} + \prg_return_false: + } } %</LU> } @@ -206,18 +217,23 @@ { \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2} \@@_iv_str_to_num:Nx \l_@@_script_int {#3} - \int_set:Nn \l_tmpb_int + \int_set:Nn \l_@@_tmpb_int { \XeTeXOTcountlanguages #1 \l_@@_script_int } - \int_zero:N \l_tmpa_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 } + \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 + \int_set:Nn \l_@@_tmpc_int + { \XeTeXOTlanguagetag #1 \l_@@_script_int \l_@@_tmpa_int } + + \int_compare:nNnTF \l_@@_tmpc_int = \l_@@_strnum_int + { + \bool_set_true:N \l__fontspec_check_bool + \int_set:Nn \l_@@_tmpa_int {\l_@@_tmpb_int} + } + { + \int_incr:N \l_@@_tmpa_int + } } \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false: } @@ -260,13 +276,14 @@ % \begin{macrocode} \prg_new_conditional:Nnn \@@_check_ot_feat:Nnnn {TF,F} { - \bool_if:NTF \l_@@_never_check_bool + \bool_if:nTF {\l_@@_never_check_bool || \l_@@_scripts_missing_bool} { \prg_return_true: } %<*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} + \@@_lang_dflt_correct:N \l_@@_language_int \@@_iv_str_to_num:Nx \l_@@_script_int {#4} \int_set:Nn \l_tmpb_int { 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 bdd970f3674..db0223739ae 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx @@ -67,9 +67,8 @@ % \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 +% It is used to disable checking opentype script, language, and tags +% 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} @@ -77,12 +76,23 @@ % \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 \int_new:N \l_@@_language_int \int_new:N \l_@@_strnum_int \int_new:N \l_@@_tmp_int +\int_new:N \l_@@_tmpa_int +\int_new:N \l_@@_tmpb_int +\int_new:N \l_@@_tmpc_int \int_new:N \l_@@_em_int \int_new:N \l_@@_emdef_int \int_new:N \l_@@_strong_int 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 766b3527a07..41d1ada2876 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex @@ -87,6 +87,15 @@ tag. The advantage to using these commands rather than \cmd\newfontfeature\ (see \vref{sec:newfeatures}) is the error-checking that is performed when the script or language is requested. +Both commands accept a comma-separated list of OpenType tags in order of preference. +This permits, for example, supporting both new and old versions of a language tag with +a common user interface: +\begin{Verbatim} + \newfontlanguage{Turkish}{TRK,TUR} +\end{Verbatim} +Here, a font that is requested with \verb|Script=Turkish| will first be checked for the +OpenType language tag \verb|TRK|, which will be selected if available. If not available, +the \verb|TUR| tag will be queried and used if possible as a fallback. \section{Going behind \pkg{fontspec}'s back} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index e3c5e01bde8..8f9606fc750 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/16}{2.6k}{Font selection for XeLaTeX and LuaLaTeX} + {2019/01/18}{2.6l}{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.6k", -%<lua> date = "2019/01/16", +%<lua> version = "2.6l", +%<lua> date = "2019/01/18", %<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 7382cdaa732..6c799b521b1 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/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.\\ @@ -1281,6 +1289,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 { @@ -1310,11 +1325,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_check_script:NnTF \l_fontspec_font {latn} + \__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_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} @@ -1322,18 +1356,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} } } } @@ -1817,7 +1839,13 @@ { \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: + \bool_if:NTF \l__fontspec_check_bool + { + \prg_return_true: + } + { + \prg_return_false: + } } } \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF} @@ -1848,7 +1876,7 @@ } \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_ot_validate_tag:x {#2} @@ -2754,34 +2782,37 @@ { \keys_define:nn { fontspec-opentype } { Script / #1 .code:n = { - \bool_set_false:N \l__fontspec_scriptlang_exist_bool - \clist_map_inline:nn {#2} - { - \__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: - } - } - \bool_if:NF \l__fontspec_scriptlang_exist_bool + \bool_if:NF \l__fontspec_scripts_missing_bool { - \str_if_eq:eeTF {#1} {Latin} - { - \__fontspec_warning:nx {script-not-exist} {#1} - } + \bool_set_false:N \l__fontspec_scriptlang_exist_bool + \clist_map_inline:nn {#2} { - \__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 } + } } } } 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 } + } } } } diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index cd2bd1b9063..a3b2cebcf69 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.6k", - date = "2019/01/16", + version = "2.6l", + date = "2019/01/18", 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 ca07864a63a..a5a4ba37d20 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/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> \sys_if_engine_luatex:T |