summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx')
-rw-r--r--macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx58
1 files changed, 50 insertions, 8 deletions
diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx
index ee7e36cc88..b45a7d3c6c 100644
--- a/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx
+++ b/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx
@@ -282,13 +282,14 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:}
+% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:,\@@_font_is_kpse:}
% 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'.
-% \XeTeX's syntax is followed since \pkg{luaotfload} provides compatibility.
+% 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}
\cs_new:Nn \@@_font_is_name:
{
- \cs_set_eq:NN \@@_fontname_wrap:n \use:n
+%<XE> \cs_set_eq:NN \@@_fontname_wrap:n \use:n
+%<LU> \cs_set:Npn \@@_fontname_wrap:n ##1 { name: ##1 }
}
% \end{macrocode}
%
@@ -298,6 +299,16 @@
\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 }
+ }
+%</LU>
+%<XE>\cs_new_eq:NN \@@_font_is_kpse: \@@_font_is_file:
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_set_scriptlang:}
@@ -360,7 +371,8 @@
\str_if_eq:eeF { \l_@@_hexcol_tl \l_@@_opacity_tl }
{ \c_@@_hexcol_tl \c_@@_opacity_tl }
- { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } }
+%<XE> { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } }
+%<LU> { \@@_update_featstr:n { color = {\l_@@_hexcol_tl\l_@@_opacity_tl} } }
}
% \end{macrocode}
% \end{macro}
@@ -445,7 +457,7 @@
\prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef}
{
\@@_construct_font_call:nn {\l_fontspec_fontname_tl}
- { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist }
+ { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: }
}
\prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-num} \l_@@_script_int
\prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-num} \l_@@_language_int
@@ -649,7 +661,7 @@
\group_begin:
\@@_primitive_font_set:Nnn \l_@@_tmpa_font { \@@_construct_font_call:nn {#1} { \l_@@_pre_feat_sclist } } { \f@size pt + 1sp }
\@@_primitive_font_set:Nnn \l_@@_tmpb_font { \@@_construct_font_call:nn {#1#2} { \l_@@_pre_feat_sclist } } { \f@size pt + 1sp }
- \str_if_eq:eeTF { \@@_primitive_font_get_name:N \l_@@_tmpa_font } { \@@_primitive_font_get_name:N \l_@@_tmpb_font }
+ \cs_if_eq:NNTF \l_@@_tmpa_font \l_@@_tmpb_font
{ \group_end: \prg_return_false: }
{ \group_end: \prg_return_true: }
}
@@ -790,7 +802,7 @@
%<debug>\typeout{====~Setup~NFSS~shape:~<\l_@@_size_tl>~\l_fontspec_fontname_tl}
\@@_get_features:n { #2 , #3 , #4 }
-%<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist}
+%<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist \@@_get_variations:}
\tl_if_empty:NF \l_@@_scale_tl
{
@@ -801,7 +813,7 @@
{
<\l_@@_size_tl> \l_@@_scale_tl
\@@_construct_font_call:nn { \l_fontspec_fontname_tl }
- { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist }
+ { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: }
}
}
% \end{macrocode}
@@ -1052,6 +1064,33 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_get_variations:}
+% \cmd{\@@_get_variations:} builds the feature string representing the
+% current variation instance and/or axis settings.
+% \begin{macrocode}
+\cs_generate_variant:Nn \tl_tail:n { e }
+\cs_new:Nn \@@_format_axis:nn
+ {
+ , #1 = #2
+ }
+\cs_new:Nn \@@_get_variations:
+ {
+ \tl_if_empty:NF \g_@@_instance_tl
+ {
+ instance = { \g_@@_instance_tl };
+ }
+ \prop_if_empty:NF \g_@@_rawvariations_prop
+ {
+ axis = {
+ \tl_tail:e {
+ \prop_map_function:NN \g_@@_rawvariations_prop \@@_format_axis:nn
+ }
+ };
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Initialisation}
%
% \begin{macro}{\@@_init:}
@@ -1089,6 +1128,8 @@
\cs_new:Nn \@@_init_fontface:
{
\tl_gclear:N \g_@@_rawfeatures_sclist
+ \prop_gclear:N \g_@@_rawvariations_prop
+ \tl_gclear:N \g_@@_instance_tl
\tl_clear:N \l_@@_scale_tl
\tl_set_eq:NN \l_@@_opacity_tl \c_@@_opacity_tl
\tl_set_eq:NN \l_@@_hexcol_tl \c_@@_hexcol_tl
@@ -1210,6 +1251,7 @@
% ------------------------------------------------
% The FONTSPEC package <wspr.io/fontspec>
% ------------------------------------------------
+% Copyright 2022-2023 The LaTeX project
% Copyright 2004-2022 Will Robertson, LPPL "maintainer"
% Copyright 2009-2015 Khaled Hosny
% Copyright 2013 Philipp Gesang