Skip to content

Commit

Permalink
fix regression preventing font families with different extensions
Browse files Browse the repository at this point in the history
closes #514
  • Loading branch information
wspr committed May 7, 2024
1 parent c6c8cd6 commit c1a235f
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 10 deletions.
9 changes: 9 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
20 changes: 10 additions & 10 deletions fontspec-code-internal.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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

%<debug>\typeout{^^J::::::::::::::: l_fontspec_fontname_tl~ =~ \l_fontspec_fontname_tl }
%<debug>\typeout{::::::::::::::: _fontname_up_tl~ =~ \l_@@_fontname_up_tl }
%<debug>\typeout{::::::::::::::: l_@@_extension_tl~ =~ \l_@@_extension_tl }

\@@_if_detect_external:nT {#2}
{ \keys_set:nn {fontspec-preparse-external} {Path} }
Expand Down Expand Up @@ -107,6 +105,7 @@
{
\tl_if_in:NnT #1 {##1}
{
%<debug> \typeout{::@@_process_ext:N~ --~ Removing~ EXT:~ ##1}
\tl_remove_once:Nn #1 {##1}
\tl_set:Nn \l_@@_extension_tl {##1}
\@@_font_is_file:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -253,7 +252,8 @@
{
%<debug>\typeout{:: @@_load_font}

%<debug>\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 }
%<debug>\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 }
Expand Down Expand Up @@ -543,6 +543,7 @@
% \begin{macrocode}
\cs_new:Nn \@@_set_faces_aux:nnnnn
{
%<debug> \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}
}
Expand All @@ -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}
Expand Down
15 changes: 15 additions & 0 deletions testfiles/fontload-ext-mixed.luatex.tlg
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions testfiles/fontload-ext-mixed.lvt
Original file line number Diff line number Diff line change
@@ -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}
15 changes: 15 additions & 0 deletions testfiles/fontload-ext-mixed.tlg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c1a235f

Please sign in to comment.