summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx130
1 files changed, 67 insertions, 63 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx
index 7a78ac73b7c..d9a27a22fe3 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx
@@ -57,7 +57,7 @@
\@@_preparse_features:
\@@_load_font:
\@@_set_scriptlang:
- \@@_get_features:Nn \l_@@_rawfeatures_sclist {}
+ \@@_get_features:n {}
\bool_set_false:N \l_@@_firsttime_bool
\@@_save_family_needed:nTF {#2}
@@ -69,6 +69,8 @@
%<debug> \typeout{Font~ family~ already~ defined.}
}
\group_end:
+
+ \tl_set_eq:NN \l_fontspec_family_tl \g_@@_nfss_family_tl
}
% \end{macrocode}
% \end{macro}
@@ -337,11 +339,11 @@
% Do not set the colour if not explicitly spec'd else \verb|\color| (using
% specials) will not work.
% \begin{macrocode}
-\cs_new:Nn \@@_get_features:Nn
+\cs_new:Nn \@@_get_features:n
{
-%<debug> \typeout{:: @@_get_features:Nn \exp_not:N #1 { \exp_not:n {#2} } }
+%<debug> \typeout{:: @@_get_features:Nn { \exp_not:n {#1} } }
\@@_init_fontface:
- \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#2}
+ \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#1}
\l_@@_keys_leftover_clist
\@@_keys_set_known:nxN {fontspec} {\l_@@_keys_leftover_clist} \l_@@_keys_leftover_clist
%<*XE>
@@ -367,10 +369,8 @@
{ \@@_update_featstr:n { mapping = \l_@@_mapping_tl } }
\str_if_eq_x:nnF { \l_@@_hexcol_tl \l_@@_opacity_tl }
- { \g_@@_hexcol_tl \g_@@_opacity_tl }
+ { \c_@@_hexcol_tl \c_@@_opacity_tl }
{ \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } }
-
- \tl_set_eq:NN #1 \l_@@_rawfeatures_sclist
}
% \end{macrocode}
% \end{macro}
@@ -386,41 +386,45 @@
% selecting.
%
% \begin{macrocode}
-\prg_new_conditional:Nnn \@@_save_family_needed:n {TF}
- {
+\prg_new_conditional:Nnn \@@_save_family_needed:n { TF }
+ {
%<debug> \typeout{save~ family:~ #1}
%<debug> \typeout{== fontid_tl: "\l_@@_fontid_tl".}
- \tl_if_exist:cF {g_@@_UID_\l_@@_fontid_tl}
+ \tl_if_empty:NTF \l_@@_nfss_fam_tl
{
- \tl_new:c {g_@@_UID_\l_@@_fontid_tl}
+ \prop_get:NVNTF \g_@@_fontid_family_prop \l_@@_fontid_tl \l_@@_tmp_tl
+ {
+ \tl_gset_eq:NN \g_@@_nfss_family_tl \l_@@_tmp_tl
+ \prg_return_false:
+ }
+ {
+ \tl_set:Nx \l_@@_tmp_tl {#1}
+ \tl_remove_all:Nn \l_@@_tmp_tl { ~ }
+ \@@_save_fontid_family:VV \l_@@_fontid_tl \l_@@_tmp_tl
+ \prg_return_true:
+ }
}
-
- \tl_if_exist:NT \l_@@_nfss_fam_tl
{
- \tl_set_eq:cN {g_@@_UID_\l_@@_fontid_tl} \l_@@_nfss_fam_tl
+ \tl_gset_eq:NN \g_@@_nfss_family_tl \l_@@_nfss_fam_tl
+ \cs_undefine:c { g_@@_fontinfo_ \g_@@_nfss_family_tl _prop }
+ \prg_return_true:
}
-
- \tl_if_empty:cT {g_@@_UID_\l_@@_fontid_tl}
- {
- % The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped:
- \tl_set:Nx \l_@@_tmp_tl {#1}
- \tl_remove_all:Nn \l_@@_tmp_tl {~}
-
- \cs_if_exist:cTF {g_@@_family_ \l_@@_tmp_tl _int}
- { \int_gincr:c {g_@@_family_ \l_@@_tmp_tl _int} }
- { \int_new:c {g_@@_family_ \l_@@_tmp_tl _int} }
-
- \tl_gset:cx {g_@@_UID_\l_@@_fontid_tl}
- {
- \l_@@_tmp_tl ( \int_use:c {g_@@_family_ \l_@@_tmp_tl _int} )
- }
- }
- \tl_gset:Nv \l_fontspec_family_tl {g_@@_UID_\l_@@_fontid_tl}
- \cs_if_exist:cTF {g_@@_fontinfo_ \l_fontspec_family_tl _prop}
- \prg_return_false: \prg_return_true:
- }
+ }
+\cs_new:Nn \@@_save_fontid_family:nn
+ {
+ \prop_get:NnNTF \g_@@_family_int_prop {#2} \l_@@_tmp_tl
+ {
+ \tl_set:Nx \l_@@_tmp_tl
+ { \int_eval:n { \l_@@_tmp_tl + 1 } }
+ }
+ { \tl_set:Nn \l_@@_tmp_tl { 0 } }
+ \prop_gput:NnV \g_@@_family_int_prop {#2} \l_@@_tmp_tl
+ \tl_gset:Nx \g_@@_nfss_family_tl { #2 ( \l_@@_tmp_tl ) }
+ \prop_gput:NnV \g_@@_fontid_family_prop {#1} \g_@@_nfss_family_tl
+ }
+\cs_generate_variant:Nn \@@_save_fontid_family:nn { VV }
% \end{macrocode}
% \end{macro}
%
@@ -431,7 +435,7 @@
{
\@@_save_fontinfo:n {#2}
\@@_find_autofonts:
- \DeclareFontFamily{\l_@@_nfss_enc_tl}{\l_fontspec_family_tl}{}
+ \DeclareFontFamily{\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{}
\@@_set_faces:
\@@_info:nxx {defining-font} {#1} {#2}
}
@@ -443,18 +447,18 @@
% \begin{macrocode}
\cs_new:Nn \@@_save_fontinfo:n
{
- \prop_new:c {g_@@_fontinfo_ \l_fontspec_family_tl _prop}
- \prop_gput:cnx {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {fontname} { #1 }
- \prop_gput:cnx {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {options} { \l_@@_all_features_clist }
- \prop_gput:cnx {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {fontdef}
+ \prop_new:c {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop}
+ \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontname} { #1 }
+ \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {options} { \l_@@_all_features_clist }
+ \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef}
{
\@@_construct_font_call:nn {\l_fontspec_fontname_tl}
- { \l_@@_pre_feat_sclist \l_@@_rawfeatures_sclist }
+ { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist }
}
- \prop_gput:cnV {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {script-num} \l_@@_script_int
- \prop_gput:cnV {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {lang-num} \l_@@_language_int
- \prop_gput:cnV {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl
- \prop_gput:cnV {g_@@_fontinfo_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl
+ \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
+ \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl
+ \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-tag} \l_fontspec_lang_tl
}
% \end{macrocode}
% \end{macro}
@@ -761,14 +765,14 @@
{
%<debug>\typeout{====~Setup~NFSS~shape:~<\l_@@_size_tl>~\l_fontspec_fontname_tl}
- \@@_get_features:Nn \l_@@_rawfeatures_sclist { #2 , #3 , #4 }
-%<debug>\typeout{====~Gathered~features:~\l_@@_rawfeatures_sclist}
+ \@@_get_features:n { #2 , #3 , #4 }
+%<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist}
\tl_put_right:Nx #1
{
<\l_@@_size_tl> \l_@@_scale_tl
\@@_construct_font_call:nn { \l_fontspec_fontname_tl }
- { \l_@@_pre_feat_sclist \l_@@_rawfeatures_sclist }
+ { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist }
}
}
% \end{macrocode}
@@ -778,7 +782,7 @@
% \begin{macrocode}
\cs_new:Nn \@@_declare_shapes_normal:nn
{
- \@@_DeclareFontShape:xxxxxx {\l_@@_nfss_enc_tl} {\l_fontspec_family_tl}
+ \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl}
{#1} {#2} {\l_@@_nfss_tl}{\l_@@_postadjust_tl}
}
% \end{macrocode}
@@ -790,7 +794,7 @@
{
\tl_if_empty:NF \l_@@_nfss_sc_tl
{
- \@@_DeclareFontShape:xxxxxx {\l_@@_nfss_enc_tl} {\l_fontspec_family_tl} {#1}
+ \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl} {#1}
{ \@@_combo_sc_shape:n {#2} } {\l_@@_nfss_sc_tl} {\l_@@_postadjust_tl}
}
}
@@ -833,8 +837,8 @@
!(\str_if_eq_x_p:nn {\itdefault} {\sldefault})
}
{
- \@@_DeclareFontShape:xxxxxx {\l_@@_nfss_enc_tl}{\l_fontspec_family_tl}{#1}{\sldefault}
- {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_@@_postadjust_tl}
+ \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{#1}{\sldefault}
+ {<->ssub*\g_@@_nfss_family_tl/#1/\itdefault}{\l_@@_postadjust_tl}
}
}
% \end{macrocode}
@@ -845,7 +849,7 @@
% \begin{macrocode}
\cs_new:Nn \@@_declare_shape_loginfo:nn
{
- \tl_gput_right:Nx \l_fontspec_defined_shapes_tl
+ \tl_gput_right:Nx \g_@@_defined_shapes_tl
{
\exp_not:n { \\ }
-~ \exp_not:N \str_case:nn {#1/#2}
@@ -939,7 +943,7 @@
% \end{macro}
%
% \begin{macro}{\@@_update_featstr:n}
-% \cmd{\l_@@_rawfeatures_sclist} is the string used to define the list of specific
+% \cmd{\g_@@_rawfeatures_sclist} is the string used to define the list of specific
% font features. Each time another font feature is requested, this
% macro is used to add that feature to the list. Font features are
% separated by semicolons.
@@ -951,7 +955,7 @@
{
\tl_gset:Nx \g_@@_single_feat_tl { #1 }
%<debug> \typeout{::::~ Adding~ feature.}
- \tl_gput_right:Nx \l_@@_rawfeatures_sclist {#1;}
+ \tl_gput_right:Nx \g_@@_rawfeatures_sclist {#1;}
}
}
% \end{macrocode}
@@ -965,7 +969,7 @@
\clist_map_inline:nn {#1}
{
%<debug> \typeout{::::~ Removing~ feature~ "##1;"}
- \tl_gremove_all:Nn \l_@@_rawfeatures_sclist {##1;}
+ \tl_gremove_all:Nn \g_@@_rawfeatures_sclist {##1;}
}
}
% \end{macrocode}
@@ -988,9 +992,9 @@
\tl_clear:N \l_@@_optical_size_tl
\tl_clear:N \l_@@_ttc_index_tl
\tl_clear:N \l_fontspec_renderer_tl
- \tl_clear:N \l_fontspec_defined_shapes_tl
- \tl_clear:N \g_@@_curr_series_tl
- \tl_gset_eq:NN \l_@@_nfss_enc_tl \g_fontspec_encoding_tl
+ \tl_gclear:N \g_@@_defined_shapes_tl
+ \tl_gclear:N \g_@@_curr_series_tl
+ \tl_gset_eq:NN \g_@@_nfss_enc_tl \g_fontspec_encoding_tl
%<*LU>
\tl_set:Nn \l_fontspec_mode_tl {node}
@@ -1008,11 +1012,11 @@
% \begin{macrocode}
\cs_new:Nn \@@_init_fontface:
{
- \tl_clear:N \l_@@_rawfeatures_sclist
+ \tl_gclear:N \g_@@_rawfeatures_sclist
\tl_clear:N \l_@@_scale_tl
- \tl_set_eq:NN \l_@@_opacity_tl \g_@@_opacity_tl
- \tl_set_eq:NN \l_@@_hexcol_tl \g_@@_hexcol_tl
- \tl_set_eq:NN \l_@@_postadjust_tl \g_@@_postadjust_tl
+ \tl_set_eq:NN \l_@@_opacity_tl \c_@@_opacity_tl
+ \tl_set_eq:NN \l_@@_hexcol_tl \c_@@_hexcol_tl
+ \tl_set_eq:NN \l_@@_postadjust_tl \c_@@_postadjust_tl
\tl_clear:N \l_@@_wordspace_adjust_tl
\tl_clear:N \l_@@_punctspace_adjust_tl
}
@@ -1074,7 +1078,7 @@
% ------------------------------------------------
% The FONTSPEC package <wspr.io/fontspec>
% ------------------------------------------------
-% Copyright 2004-2017 Will Robertson, LPPL "maintainer"
+% Copyright 2004-2018 Will Robertson, LPPL "maintainer"
% Copyright 2009-2015 Khaled Hosny
% Copyright 2013 Philipp Gesang
% Copyright 2013-2016 Joseph Wright