From 2783c1b2807e488a59202f7e4605c8d5693c9ab7 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 12 Feb 2017 23:33:12 +0000
Subject: fontspec (12feb17)

git-svn-id: svn://tug.org/texlive/trunk@43202 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/fontspec/fontspec-luatex.sty         | 141 ++++++++++++++++-----
 1 file changed, 112 insertions(+), 29 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty')

diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
index bec92bbe616..19f343fc5f4 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
@@ -22,6 +22,7 @@
 %% fontspec-enc.dtx  (with options: `fontspec,luatex')
 %% fontspec-math.dtx  (with options: `fontspec,luatex')
 %% fontspec-closing.dtx  (with options: `fontspec,luatex')
+%% fontspec-xfss.dtx  (with options: `fontspec,luatex')
 %% fontspec-patches.dtx  (with options: `fontspec,luatex')
 %% ------------------------------------------------
 %% The FONTSPEC package for XeLaTeX/LuaLaTeX
@@ -31,7 +32,7 @@
 \RequirePackage{expl3}
 \RequirePackage{xparse}
 \ProvidesExplPackage{fontspec-luatex}%
-  {2017/01/24}{2.5d}{Font selection for XeLaTeX and LuaLaTeX}
+  {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX}
 \bool_new:N \l__fontspec_firsttime_bool
 \bool_new:N \l__fontspec_nobf_bool
 \bool_new:N \l__fontspec_noit_bool
@@ -56,12 +57,15 @@
 \bool_new:N \l__fontspec_never_check_bool
 \bool_new:N \l__fontspec_defining_encoding_bool
 \bool_new:N \l__fontspec_script_exist_bool
+\bool_new:N \g__fontspec_em_normalise_slant_bool
 \int_new:N \l__fontspec_script_int
 \int_new:N \l__fontspec_language_int
 \int_new:N \l__fontspec_strnum_int
 \int_new:N \l__fontspec_tmp_int
 \int_new:N \l__fontspec_em_int
 \int_new:N \l__fontspec_emdef_int
+\int_new:N \l__fontspec_strong_int
+\int_new:N \l__fontspec_strongdef_int
 \fp_new:N \l__fontspec_tmpa_fp
 \fp_new:N \l__fontspec_tmpb_fp
 \dim_new:N \l__fontspec_tmpa_dim
@@ -102,6 +106,7 @@
 \tl_new:N \l_fontspec_script_tl
 \tl_new:N \l__fontspec_lang_name_tl
 \tl_new:N \l_fontspec_lang_tl
+\tl_new:N  \l__fontspec_mapping_tl
 \tl_new:N  \g__fontspec_hexcol_tl
 \tl_new:N  \g__fontspec_opacity_tl
 \tl_set:Nn \g__fontspec_hexcol_tl {000000}
@@ -642,20 +647,24 @@
  {
   \keys_if_exist:nnF { fontspec / options } {#1}
     { \__fontspec_define_opentype_feature_group:n {#1} }
+
   \keys_if_choice_exist:nnnT {fontspec} {#1} {#2}
     { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} }
-  \__fontspec_define_opentype_feature:nnn {#1}{#2}{#3}
+
+  \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn {#1}{#2}{ \__fontspec_strip_plus_minus:n {#3} }{#3}{}
  }
+
+\cs_new:Nn \__fontspec_strip_plus_minus:n { \__fontspec_strip_plus_minus_aux:Nq #1 \q_nil }
+\cs_new:Npn \__fontspec_strip_plus_minus_aux:Nq #1#2 \q_nil
+  { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} }
+
 \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated
 \DeclareDocumentCommand \aliasfontfeature {mm}
  {
   \bool_set_false:N \l__fontspec_alias_bool
 
-  \clist_map_inline:nn
-   { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-external,
-     fontspec-preparse-nested, fontspec-renderer }
+  \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist
    {
-
      \keys_if_exist:nnT {##1} {#1}
       {
         \bool_set_true:N \l__fontspec_alias_bool
@@ -673,16 +682,16 @@
 
   \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist
    {
-
-     \keys_if_exist:nnT {##1} {#1}
+     \keys_if_exist:nnT { ##1 / #1 } {#2}
       {
         \bool_set_true:N \l__fontspec_alias_bool
-        \keys_define:nn { ##1 / #1 } { #3 .meta:n = {#2} }
+        \keys_define:nn { ##1 / #1 }
+          { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } }
       }
    }
 
   \bool_if:NF \l__fontspec_alias_bool
-    { \__fontspec_warning:nx {rename-feature-not-exist} {#1} }
+    { \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} }
  }
 \DeclareDocumentCommand \newfontscript {mm}
  {
@@ -1069,7 +1078,8 @@
  }
 \cs_set:Nn \__fontspec_construct_font_call:nnnnnn
  {
-  " \__fontspec_fontname_wrap:n { #1 #2 #3 } #4 #5
+  " \__fontspec_fontname_wrap:n { #1 #2 } #3
+    #4 #5
     \str_if_eq_x:nnF {#6}{} {:#6} "
  }
 \cs_set:Nn \__fontspec_construct_font_call:nn
@@ -1088,7 +1098,7 @@
   }
 \cs_new:Nn \__fontspec_font_is_file:
   {
-    \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { file:\l__fontspec_font_path_tl ##1 }
+    \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] }
   }
 \cs_new:Nn \__fontspec_set_scriptlang:
  {
@@ -1126,7 +1136,10 @@
   \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2}
     \l__fontspec_keys_leftover_clist
   \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist
-  \keys_set:nx {fontspec-opentype} {\l__fontspec_keys_leftover_clist}
+  \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist
+
+  \tl_if_empty:NF \l__fontspec_mapping_tl
+    { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } }
 
   \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl }
                    { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl }
@@ -1515,7 +1528,10 @@
   \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2}
   \keys_define:nn {fontspec-opentype}
    {
-    #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} }
+    #1/#2 .code:n =
+      {
+        \__fontspec_make_OT_feature:nnn {#3} {#4} {#5}
+      }
    }
  }
 \cs_new:Nn \__fontspec_feat_off:n {#1Off}
@@ -1556,9 +1572,9 @@
       }
   }
 \cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx}
-\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:NNNNN #1 }
-\cs_new:Nn \__fontspec_swap_plus_minus_aux:NNNNN
-  { \str_case:nn {#1} { {+} {-#2#3#4#5} {-} {+#2#3#4#5} } }
+\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:Nq #1 \q_nil }
+\cs_new:Npn \__fontspec_swap_plus_minus_aux:Nq #1#2 \q_nil
+  { \str_case:nn {#1} { {+} {-#2} {-} {+#2} } }
 \prg_new_conditional:Nnn \__fontspec_check_script:n {TF}
   {
     \bool_if:NTF \l__fontspec_never_check_bool
@@ -2121,7 +2137,7 @@
      \int_to_hex:n { \l__fontspec_tmp_int }
    }
  }
-\__fontspec_keys_define_code:nnn {fontspec} {Mapping}
+\__fontspec_keys_define_code:nnn {fontspec-opentype} {Mapping}
  {
   \str_if_eq:nnTF {#1} {tex-text}
    {
@@ -2207,7 +2223,11 @@
    },
   AutoFakeBold .default:n = {1.5}
 }
-\__fontspec_keys_define_code:nnn {fontspec} {RawFeature}
+\__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature}
+ {
+  \__fontspec_update_featstr:n {#1}
+ }
+\__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature}
  {
   \__fontspec_update_featstr:n {#1}
  }
@@ -2258,8 +2278,9 @@
 \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Lowercase}    {onum} {onum} {+lnum,-lnum}
 \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Uppercase}    {lnum} {lnum} {+onum,-onum}
 \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {SlashedZero}  {zero} {zero} {}
-\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle}
-\aliasfontfeatureoption {Numbers} {Uppercase} {Lining}
+\aliasfontfeatureoption {Numbers} {Monospaced} {Tabular}
+\aliasfontfeatureoption {Numbers} {Lowercase}  {OldStyle}
+\aliasfontfeatureoption {Numbers} {Uppercase}  {Lining}
   \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Arabic} {anum} {anum} {}
 \__fontspec_define_opentype_feature_group:n  {VerticalPosition}
 \__fontspec_define_opentype_feature:nnnnn    {VerticalPosition} {ResetAll} {} {}
@@ -3308,14 +3329,24 @@
  }
 \cs_new_protected:Npn \emfontdeclare #1
   {
-    \prop_clear:N \g__fontspec_em_prop
-    \int_zero:N   \l__fontspec_emdef_int
+    \prop_clear:N    \g__fontspec_em_prop
+    \int_zero:N      \l__fontspec_emdef_int
+    \bool_set_true:N \g__fontspec_em_normalise_slant_bool
+
+    \tl_if_in:nnT {#1} {\slshape}
+      {
+        \tl_if_in:nnT {#1} {\itshape}
+          {
+            \bool_set_false:N \g__fontspec_em_normalise_slant_bool
+          }
+      }
+
     \group_begin:
       \normalfont
       \clist_map_inline:nn {\emreset,#1}
         {
           ##1
-          \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@series/\f@shape } { \l__fontspec_emdef_int }
+          \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@shape } { \l__fontspec_emdef_int }
           \prop_gput:Nxn \g__fontspec_em_prop { switch-\int_use:N \l__fontspec_emdef_int } { ##1 }
           \int_incr:N \l__fontspec_emdef_int
         }
@@ -3324,9 +3355,17 @@
 \DeclareRobustCommand \em
   {
     \@nomath\em
+    \tl_set:Nx \l__fontspec_emshape_query_tl { \f@shape }
 
-    \prop_get:NxNT \g__fontspec_em_prop { \f@series/\f@shape } \l__fontspec_em_tmp_tl
-      { \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } }
+    \bool_if:NT \g__fontspec_em_normalise_slant_bool
+      {
+        \tl_replace_all:Nnn \l__fontspec_emshape_query_tl {/sl} {/it}
+      }
+
+    \prop_get:NxNT \g__fontspec_em_prop { \l__fontspec_emshape_query_tl } \l__fontspec_em_tmp_tl
+      {
+        \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl }
+      }
 
     \int_incr:N \l__fontspec_em_int
 
@@ -3342,9 +3381,53 @@
 \cs_set:Npn \emreset { \upshape }
 \cs_set:Npn \emshape { \itshape }
 \cs_set:Npn \eminnershape { \upshape }
+\cs_new_protected:Npn \strongfontdeclare #1
+  {
+    \prop_clear:N    \g__fontspec_strong_prop
+    \int_zero:N      \l__fontspec_strongdef_int
+
+    \group_begin:
+      \normalfont
+      \clist_map_inline:nn {\strongreset,#1}
+        {
+          ##1
+          \prop_gput_if_new:NxV \g__fontspec_strong_prop { \f@series } { \l__fontspec_strongdef_int }
+          \prop_gput:Nxn \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strongdef_int } { ##1 }
+          \int_incr:N \l__fontspec_strongdef_int
+        }
+    \group_end:
+  }
+\DeclareRobustCommand \strongenv
+  {
+    \@nomath\strongenv
+
+    \prop_get:NxNT \g__fontspec_strong_prop { \f@series } \l__fontspec_strong_tmp_tl
+      {
+        \int_set:Nn \l__fontspec_strong_int { \l__fontspec_strong_tmp_tl }
+      }
+
+    \int_incr:N \l__fontspec_strong_int
+
+    \prop_get:NxNTF \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strong_int } \l__fontspec_strong_switch_tl
+      { \l__fontspec_strong_switch_tl }
+      {
+        \int_zero:N \l__fontspec_strong_int
+        \strongreset
+      }
+
+  }
+\DeclareTextFontCommand{\strong}{\strongenv}
+\cs_set:Npn \strongreset {}
+\cs_set:Npn \reset@font
+  {
+    \normalfont
+    \int_zero:N \l__fontspec_em_int
+    \int_zero:N \l__fontspec_strong_int
+  }
+\cs_new:Nn \fontspec_set_em_level:n     { \int_set:Nn \l__fontspec_em_int     {#1} }
+\cs_new:Nn \fontspec_set_strong_level:n { \int_set:Nn \l__fontspec_strong_int {#1} }
+\strongfontdeclare{ \bfseries }
 \emfontdeclare{ \emshape, \eminnershape }
-\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int }
-\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} }
 \DeclareRobustCommand{\-}
  {
   \discretionary
@@ -3446,7 +3529,7 @@
   { \addfontfeature{Numbers=Lining} #1 }
  }
 %% ------------------------------------------------
-%% Copyright 2004--2017 Will Robertson <wspr81@gmail.com>
+%% Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org>
 %% Copyright 2009--2013   Khaled Hosny <khaledhosny@eglug.org>
 %% 
 %% Distributable under the LaTeX Project Public License, version 1.3c or higher.
-- 
cgit v1.2.3

