diff --git a/doc/CHANGES.md b/doc/CHANGES.md index c38eb50..10f0b29 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -7,6 +7,15 @@ Change history we can no longer check for font feature existence before applying the OpenType tags. This release removes checking. (#515) + * Fix regression in loading font families constructed from fonts with different extensions; + e.g.: (#514) + + \setmainfont{MyLato} + [ + UprightFont = Lato-Regular.ttf , + BoldFont = FiraSans-Bold.otf , + ] + ## v2.9c (2024/05/03) diff --git a/fontspec-code-internal.dtx b/fontspec-code-internal.dtx index 16e2922..74130d7 100644 --- a/fontspec-code-internal.dtx +++ b/fontspec-code-internal.dtx @@ -37,13 +37,11 @@ \@@_font_suppress_not_found_error: \@@_init: - \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} - \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2} - \@@_sanitise_fontname:Nn \l_@@_basename_tl {#2} + \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2} + \tl_set_eq:NN \l_@@_fontname_up_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l_@@_basename_tl \l_fontspec_fontname_tl %\typeout{^^J::::::::::::::: l_fontspec_fontname_tl~ =~ \l_fontspec_fontname_tl } -%\typeout{::::::::::::::: _fontname_up_tl~ =~ \l_@@_fontname_up_tl } -%\typeout{::::::::::::::: l_@@_extension_tl~ =~ \l_@@_extension_tl } \@@_if_detect_external:nT {#2} { \keys_set:nn {fontspec-preparse-external} {Path} } @@ -107,6 +105,7 @@ { \tl_if_in:NnT #1 {##1} { +% \typeout{::@@_process_ext:N~ --~ Removing~ EXT:~ ##1} \tl_remove_once:Nn #1 {##1} \tl_set:Nn \l_@@_extension_tl {##1} \@@_font_is_file: @@ -143,9 +142,9 @@ { \str_if_eq:eeT { \str_lowercase:f {\l_@@_extension_tl} } {.ttc} { - \@@_sanitise_fontname:Nn \l_@@_fontname_it_tl {#1} - \@@_sanitise_fontname:Nn \l_@@_fontname_bf_tl {#1} - \@@_sanitise_fontname:Nn \l_@@_fontname_bfit_tl {#1} + \tl_set_eq:NN \l_@@_fontname_it_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l_@@_fontname_bf_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl } } % \end{macrocode} @@ -253,7 +252,8 @@ { %\typeout{:: @@_load_font} -%\typeout{Set~ base~ font~ for~ preliminary~ analysis: \@@_construct_font_call:nn { \l_@@_fontname_up_tl } {} } + \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl { \l_@@_fontname_up_tl } +%\typeout{Set~ base~ font~ for~ preliminary~ analysis:~ "\l_@@_fontname_up_tl"~ with~ features~ "\l_@@_pre_feat_sclist" } \@@_primitive_font_set:NnnF \l_@@_test_font { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } { \l_@@_pre_feat_sclist } } { \f@size pt - 2sp } @@ -543,6 +543,7 @@ % \begin{macrocode} \cs_new:Nn \@@_set_faces_aux:nnnnn { +% \typeout{:: @@_set_faces_aux:nnnnn \exp_not:n { {#1} {#2} {#3} {#4} {#5} } } \fontspec_complete_fontname:Nn \l_@@_curr_fontname_tl {#3} \@@_make_font_shapes:Nnnnn \l_@@_curr_fontname_tl {#1} {#2} {#4} {#5} } @@ -558,7 +559,6 @@ { \tl_set:Nx #1 {#2} \tl_replace_all:Nne #1 {*} {\l_@@_basename_tl} - \@@_process_ext:N #1 } % \end{macrocode} % \end{macro} diff --git a/testfiles/fontload-ext-mixed.luatex.tlg b/testfiles/fontload-ext-mixed.luatex.tlg new file mode 100644 index 0000000..4c491e5 --- /dev/null +++ b/testfiles/fontload-ext-mixed.luatex.tlg @@ -0,0 +1,15 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +LATO normally: +TU/Lato-Regular.ttf(0)/m/n: + [Lato-Regular.ttf]:mode=node;script=latn;language=dflt;+tlig; +FIRA normally: +TU/FiraSans-Bold.otf(0)/m/n: + [FiraSans-Bold.otf]:mode=node;script=latn;language=dflt;+tlig; +BOTH: +TU/MyLato(0)/m/n: + [Lato-Regular.ttf]:mode=node;script=latn;language=dflt;+tlig; +TU/MyLato(0)/b/n: + [FiraSans-Bold.otf]:mode=node;script=latn;language=dflt;+tlig; +*************** +Compilation 1 of test file completed with exit status 0 diff --git a/testfiles/fontload-ext-mixed.lvt b/testfiles/fontload-ext-mixed.lvt new file mode 100644 index 0000000..91037c5 --- /dev/null +++ b/testfiles/fontload-ext-mixed.lvt @@ -0,0 +1,26 @@ + +\input{fontspec-testsetup.tex} + +\usepackage{fontspec} + +\begin{document} + +\MSG{LATO normally:} +\setmainfont{Lato-Regular.ttf} +hello \CURRNFSS + +\MSG{FIRA normally:} +\setmainfont{FiraSans-Bold.otf} +hello \CURRNFSS + +\MSG{BOTH:} +\setmainfont{MyLato} + [ + UprightFont = Lato-Regular.ttf , + BoldFont = FiraSans-Bold.otf , + ] +hello \CURRNFSS +\bfseries +hello \CURRNFSS + +\end{document} diff --git a/testfiles/fontload-ext-mixed.tlg b/testfiles/fontload-ext-mixed.tlg new file mode 100644 index 0000000..e6d9521 --- /dev/null +++ b/testfiles/fontload-ext-mixed.tlg @@ -0,0 +1,15 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +LATO normally: +TU/Lato-Regular.ttf(0)/m/n: + "[Lato-Regular.ttf]/OT:script=latn;language=dflt;mapping=tex-text;" +FIRA normally: +TU/FiraSans-Bold.otf(0)/m/n: + "[FiraSans-Bold.otf]/OT:script=latn;language=dflt;mapping=tex-text;" +BOTH: +TU/MyLato(0)/m/n: + "[Lato-Regular.ttf]/OT:script=latn;language=dflt;mapping=tex-text;" +TU/MyLato(0)/b/n: + "[FiraSans-Bold.otf]/OT:script=latn;language=dflt;mapping=tex-text;" +*************** +Compilation 1 of test file completed with exit status 0