summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx76
1 files changed, 46 insertions, 30 deletions
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 b45a7d3c6ca..49f019c6564 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx
@@ -1,4 +1,4 @@
-%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <wspr.io/fontspec>
+%%^^A%% fontspec-code-internal.dtx -- part of FONTSPEC <latex3.github.io/fontspec>
% \section{Internals}
%
@@ -41,6 +41,10 @@
\@@_sanitise_fontname:Nn \l_@@_fontname_up_tl {#2}
\@@_sanitise_fontname:Nn \l_@@_basename_tl {#2}
+%<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} }
@@ -55,6 +59,11 @@
%<debug>\typeout{fontid: \l_@@_fontid_tl}
\@@_preparse_features:
+
+%<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 }
+
\@@_load_font:
\@@_set_scriptlang:
\@@_get_features:n {}
@@ -84,19 +93,23 @@
%
% \begin{macro}{\@@_sanitise_fontname:Nn}
% Assigns font name |#2| to token list variable |#1| and strips extension(s) from it in the case of an external font.
-% We strip spaces for luatex for consistency with luaotfload, although I'm not sure this is necessary any more.
-% At one stage this also lowercased the name, but this step has been removed unless someone can remind me why it was necessary.
% \begin{macrocode}
\cs_new:Nn \@@_sanitise_fontname:Nn
{
\tl_set:Nx #1 {#2}
-%<LU> \tl_remove_all:Nn #1 {~}
+ \tl_trim_spaces:N #1
+ \@@_process_ext:N #1
+ }
+
+\cs_new:Nn \@@_process_ext:N
+ {
\clist_map_inline:Nn \l_@@_extensions_clist
{
\tl_if_in:NnT #1 {##1}
{
\tl_remove_once:Nn #1 {##1}
\tl_set:Nn \l_@@_extension_tl {##1}
+ \@@_font_is_file:
\clist_map_break:
}
}
@@ -141,7 +154,9 @@
% \begin{macro}{\@@_load_external_fontoptions:N}
% Load a possible \texttt{.fontspec} font configuration file.
% This file could set font-specific options for the font about to be loaded.
-% The parameter should be a tokenlist containing a sanitised fontname.
+% The parameter should be a token list containing a sanitised fontname.
+% In the past this used a space-stripped version of the name, so we check for the file
+% both with and without spaces to load it.
% \begin{macrocode}
\cs_new:Nn \@@_load_external_fontoptions:N
{
@@ -152,8 +167,15 @@
\tl_remove_all:Nn \l_@@_ext_filename_tl {~}
\prop_if_in:NVF \g_@@_fontopts_prop #1
{
- \exp_args:No \file_if_exist:nT { \l_@@_ext_filename_tl }
- { \file_input:n { \l_@@_ext_filename_tl } }
+ \exp_args:No \file_if_exist:nTF { \l_@@_ext_filename_tl }
+ {
+ \file_input:n { \l_@@_ext_filename_tl }
+ }
+ {
+ \tl_remove_all:Nn \l_@@_ext_filename_tl {~}
+ \exp_args:No \file_if_exist:nT { \l_@@_ext_filename_tl }
+ { \file_input:n { \l_@@_ext_filename_tl } }
+ }
}
}
}
@@ -282,7 +304,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:,\@@_font_is_kpse:}
+% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:}
% The \cs{@@_fontname_wrap:n} command takes the font name and either passes it through unchanged or wraps it in the syntax for loading a font `by filename'.
% For Lua\TeX\ there are two kinds kinds of filename based loading supported: Regular filename lookups which include system fonts and lookups restricted to kpse.
% \begin{macrocode}
@@ -296,18 +318,16 @@
% \begin{macrocode}
\cs_new:Nn \@@_font_is_file:
{
- \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] }
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<*LU>
-\cs_new:Nn \@@_font_is_kpse:
- {
- \cs_set:Npn \@@_fontname_wrap:n ##1 { kpse: ##1 }
+%<debug> \typeout{:: _font_is_file:}
+ \bool_set_true:N \l_@@_external_bool
+ \bool_lazy_and:nnTF { \l_@@_external_kpse_bool } { \tl_if_empty_p:N \l_@@_font_path_tl }
+ {
+ \cs_set:Npn \@@_fontname_wrap:n ##1 { kpse: ##1 }
+ }
+ {
+ \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] }
+ }
}
-%</LU>
-%<XE>\cs_new_eq:NN \@@_font_is_kpse: \@@_font_is_file:
% \end{macrocode}
% \end{macro}
%
@@ -353,17 +373,17 @@
\bool_if:NTF \l_@@_ot_bool
{
%<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"}
- \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist
+ \keys_set_known:nV {fontspec-opentype} \l_@@_keys_leftover_clist
}
{
%<debug> \typeout{::: Setting~ keys~ for~ AAT/Graphite~ font~ features:~"\l_@@_keys_leftover_clist"}
\bool_if:nT { \l_@@_atsui_bool || \l_@@_graphite_bool }
- { \keys_set:nV {fontspec-aat} \l_@@_keys_leftover_clist }
+ { \keys_set_known:nV {fontspec-aat} \l_@@_keys_leftover_clist }
}
%</XE>
%<*LU>
%<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"}
- \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist
+ \keys_set_known:nV {fontspec-opentype} \l_@@_keys_leftover_clist
%</LU>
\tl_if_empty:NF \l_@@_mapping_tl
@@ -538,7 +558,7 @@
{
\tl_set:Nx #1 {#2}
\tl_replace_all:Nnx #1 {*} {\l_@@_basename_tl}
-%<LU> \tl_remove_all:Nn #1 {~}
+ \@@_process_ext:N #1
}
% \end{macrocode}
% \end{macro}
@@ -1113,10 +1133,6 @@
\tl_gset_eq:NN \g_@@_nfss_enc_tl \g_fontspec_encoding_tl
%<*LU>
\tl_set:Nn \l_@@_mode_tl {node}
- \int_set:Nn \prehyphenchar { `\- } % fixme
- \int_zero:N \posthyphenchar % fixme
- \int_zero:N \preexhyphenchar % fixme
- \int_zero:N \postexhyphenchar % fixme
%</LU>
}
% \end{macrocode}
@@ -1249,10 +1265,10 @@
% /©
% ------------------------------------------------
-% The FONTSPEC package <wspr.io/fontspec>
+% The FONTSPEC package <latex3.github.io/fontspec>
% ------------------------------------------------
-% Copyright 2022-2023 The LaTeX project
-% Copyright 2004-2022 Will Robertson, LPPL "maintainer"
+% Copyright 2022-2024 The LaTeX project, LPPL "maintainer"
+% Copyright 2004-2022 Will Robertson
% Copyright 2009-2015 Khaled Hosny
% Copyright 2013 Philipp Gesang
% Copyright 2013-2016 Joseph Wright