texlive[50011] Master/texmf-dist: fontspec (12feb19)

commits+karl at tug.org commits+karl at tug.org
Tue Feb 12 23:04:13 CET 2019


Revision: 50011
          http://tug.org/svn/texlive?view=revision&revision=50011
Author:   karl
Date:     2019-02-12 23:04:13 +0100 (Tue, 12 Feb 2019)
Log Message:
-----------
fontspec (12feb19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fontspec/CHANGES.md
    trunk/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf
    trunk/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex
    trunk/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
    trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
    trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
    trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
    trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.sty

Modified: trunk/Master/texmf-dist/doc/latex/fontspec/CHANGES.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontspec/CHANGES.md	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/doc/latex/fontspec/CHANGES.md	2019-02-12 22:04:13 UTC (rev 50011)
@@ -1,6 +1,34 @@
 Change history
 ==============
 
+## v2.7b (2019/02/12)
+
+    * Fix regression in loading `Language=Turkish`. This now allows users to define more
+      than one OpenType tag when defining a language name, where the first tag found is
+      the one selected for the font. E.g.,
+
+          \newfontlanguage{Turkish}{TRK,TUR}
+
+      when selected, this first checks for the existance of the TRK language tag, and if
+      not found then checks for the TUR language tag to use if available.
+
+    * Add new `Renderer` options for LuaTeX that enable the Harfbuzz engine. These only
+      work running under `luahbtex` and are currently experimental. The new options are
+      `Harfbuzz`, `OpenType`, `AAT`, and `Graphite`.
+
+    * Always try to remove ‘clashing’ font features inside `\addfontfeatures` even in
+      cases when the requested font feature doesn't exist. E.g., now if a font is loaded
+      with `Numbers=OldStyle` and *doesn't have* `Numbers=Lining`, requesting the latter
+      will still reset the former.
+
+    * Add `pxfonts`, `txfonts`, `newpxmath`, `newtxmath`, `mtpro2` to the list
+      of packages that automatically invoke `no-math`.
+
+    * Add `\providefontfamily`, `\setfontface`, `\renewfontface`, and `\providefontface`.
+
+    * Add local/global distinction with `\fontspec_(g)set_family:Nnn` and `\fontspec_(g)set_fontface:NNnn`.
+
+
 ## v2.7a (2019/01/25)
 
     * One last (?!) fix for recent regression (!!). I am not getting enough sleep at the moment and it is too hot.

Modified: trunk/Master/texmf-dist/doc/latex/fontspec/fontspec-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-api.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -97,8 +97,8 @@
             \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {lang-num} \l_@@_tmp_tl
             \int_set:Nn \l_@@_language_int {\l_@@_tmp_tl}
 
-            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
-            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {lang-tag}    \l_fontspec_lang_tl
+            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {script-tag}  \l_@@_script_tl
+            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {lang-tag}    \l_@@_lang_tl
 
             \@@_check_ot_feat:NnTF \font {#1} {\prg_return_true:} {\prg_return_false:}
           }
@@ -173,7 +173,7 @@
           {
             \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {script-num} \l_@@_tmp_tl
             \int_set:Nn \l_@@_script_int {\l_@@_tmp_tl}
-            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
+            \prop_get:cnN {g_@@_fontinfo_ \f at family _prop} {script-tag}  \l_@@_script_tl
 
             \@@_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false:
           }
@@ -265,15 +265,18 @@
 % variable because the actual \LaTeX\ family name is automatically generated
 % by fontspec and it's easier to keep it that way.
 %    \begin{macrocode}
-\cs_new:Nn \fontspec_set_family:Nnn
+\cs_new:Nn \@@_tl_new_if_free:N { \tl_if_exist:NF #1 { \tl_new:N #1 } }
+\cs_new:Nn \@@_set_family:NnnN
   {
     \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
     \tl_set:Nn \l_@@_family_label_tl {#1}
     \@@_select_font_family:nn {#2} {#3}
-    \tl_if_exist:NF #1 { \tl_new:N #1 }
-    \tl_set_eq:NN #1 \l_fontspec_family_tl
+    \@@_tl_new_if_free:N #1
+    #4 #1 \l_fontspec_family_tl
     \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_family:Nnn { \@@_set_family:NnnN #1 {#2} {#3} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_family:Nnn  { \@@_set_family:NnnN #1 {#2} {#3} \tl_set_eq:NN  }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -289,14 +292,16 @@
 %    \begin{macrocode}
 \tl_new:N \l_@@_fontface_cs_tl
 \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font}
-\cs_new:Nn \fontspec_set_fontface:NNnn
+\cs_new:Nn \@@_set_fontface:NNnnN
   {
     \tl_set:Nn \l_@@_fontface_cs_tl {#1}
     \tl_set:Nn \l_@@_family_label_tl {#2}
     \@@_select_font_family:nn {#3} {#4}
-    \tl_set_eq:NN #2 \l_fontspec_family_tl
+    #5 #2 \l_fontspec_family_tl
     \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_fontface:NNnn { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_fontface:NNnn  { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_set_eq:NN  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -326,6 +331,8 @@
 %    \begin{macrocode}
 \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F}
   {
+%<debug>\typeout{::~fontspec_if_current_feature:n~{#1}}
+%<debug>\typeout{::::~primitive_font_current_name:~=~\@@_primitive_font_current_name:}
     \exp_args:Nxx \tl_if_in:nnTF
       { \@@_primitive_font_current_name: } { \tl_to_str:n {#1} }
       { \prg_return_true: } { \prg_return_false: }

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-feat-opentype.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -449,7 +449,7 @@
               {
 %<debug>\typeout{Script~tag~found:~####1}
                 \tl_set:Nn \l_@@_script_name_tl {#1}
-                \tl_set:Nn \l_fontspec_script_tl {####1}
+                \tl_set:Nn \l_@@_script_tl {####1}
                 \int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
                 \bool_set_true:N \l_@@_scriptlang_exist_bool
                 \tl_gset:Nx \g_@@_single_feat_tl { script=####1 }
@@ -497,11 +497,11 @@
         \bool_set_false:N \l_@@_scriptlang_exist_bool
         \clist_map_inline:nn {#2}
           {
-            \exp_args:No \@@_check_lang:NnTF \l_@@_fontface_cs_tl {#2}
+            \exp_args:No \@@_check_lang:NnTF \l_@@_fontface_cs_tl {####1}
               {
-                \tl_set:Nn \l_fontspec_lang_tl {#2}
+                \tl_set:Nn \l_@@_lang_tl {####1}
                 \int_set:Nn \l_@@_language_int {\l_@@_strnum_int}
-                \tl_gset:Nx \g_@@_single_feat_tl { language=#2 }
+                \tl_gset:Nx \g_@@_single_feat_tl { language=####1 }
                 \bool_set_true:N \l_@@_scriptlang_exist_bool
                 \clist_map_break:
               }
@@ -524,7 +524,7 @@
 %    \begin{macrocode}
 \@@_keys_define_code:nnn {fontspec-opentype} { Language / Default }
   {
-    \tl_set:Nn \l_fontspec_lang_tl {DFLT}
+    \tl_set:Nn \l_@@_lang_tl {DFLT}
     \int_zero:N \l_@@_language_int
     \tl_gset:Nn \g_@@_single_feat_tl { language=DFLT }
   }

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-interfaces.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -87,7 +87,7 @@
 %    \begin{macrocode}
 \NewDocumentCommand \newfontfamily { m O{} m O{} }
   {
-    \@@_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \NewDocumentCommand
+    \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
 %    \end{macrocode}
 %
@@ -94,7 +94,7 @@
 %    \begin{macrocode}
 \NewDocumentCommand \renewfontfamily { m O{} m O{} }
   {
-    \@@_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \RenewDocumentCommand
+    \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
   }
 %    \end{macrocode}
 %
@@ -101,17 +101,45 @@
 %    \begin{macrocode}
 \NewDocumentCommand \setfontfamily { m O{} m O{} }
   {
-    \@@_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \DeclareDocumentCommand
+    \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
   }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+\NewDocumentCommand \providefontfamily { m O{} m O{} }
+  {
+    \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \NewDocumentCommand \newfontface { m O{} m O{} }
   {
-    \@@_main_newfontface:nnn {#1} {#2,#4} {#3}
+    \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\NewDocumentCommand \renewfontface { m O{} m O{} }
+  {
+    \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\NewDocumentCommand \setfontface { m O{} m O{} }
+  {
+    \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\NewDocumentCommand \providefontface { m O{} m O{} }
+  {
+    \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
+%    \end{macrocode}
+%
 % \begin{macro}{\defaultfontfeatures}
 %   This macro takes one argument that consists of all of feature
 %   options that will be applied by default to all subsequent \cs{fontspec} commands.

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-internal.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -275,7 +275,7 @@
       {#1}
       \l_@@_extension_tl
       \l_@@_ttc_index_tl
-      \l_fontspec_renderer_tl
+      \l_@@_renderer_tl
       \l_@@_optical_size_tl
       {#2}
   }
@@ -449,8 +449,8 @@
       }
     \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
+    \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-tag} \l_@@_script_tl
+    \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-tag}   \l_@@_lang_tl
   }
 %    \end{macrocode}
 % \end{macro}
@@ -580,7 +580,7 @@
 		\or
 %<debug>  \typeout{:::: AAT}
 			\bool_set_true:N \l_@@_atsui_bool
-			\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} }
+			\tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/AAT} }
 			\ifnum\XeTeXcountvariations #1 > 0\relax
 %<debug>  \typeout{:::: MM}
 				\bool_set_true:N \l_@@_mm_bool
@@ -588,15 +588,15 @@
 		\or
 %<debug>  \typeout{:::: OpenType}
 			\bool_set_true:N \l_@@_ot_bool
-			\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} }
+			\tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/OT} }
 		\or
 %<debug>  \typeout{:::: Graphite}
 			\bool_set_true:N \l_@@_graphite_bool
-			\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} }
+			\tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/GR} }
 		\fi
 %</XE>
 %    \end{macrocode}
-% If automatic, the \cmd{\l_fontspec_renderer_tl} token list will still be
+% If automatic, the \cmd{\l_@@_renderer_tl} token list will still be
 % empty (other suffices that could be added will be later in the feature
 % processing), and if it is indeed still empty, assign it a value so that the
 % other weights of the font are specifically loaded with the same renderer.
@@ -923,10 +923,10 @@
   {
     \bool_if:NT \l_@@_ot_bool
       {
-        \tl_if_empty:NF \l_fontspec_script_tl
+        \tl_if_empty:NF \l_@@_script_tl
           {
-            script   = \l_fontspec_script_tl ;
-            language = \l_fontspec_lang_tl   ;
+            script   = \l_@@_script_tl ;
+            language = \l_@@_lang_tl   ;
           }
       }
   }
@@ -933,12 +933,16 @@
 %</XE>
 %<*LU>
   {
-    mode     = \l_fontspec_mode_tl   ;
-    \tl_if_empty:NF \l_fontspec_script_tl
+    mode     = \l_@@_mode_tl   ;
+    \tl_if_empty:NF \l_@@_shaper_tl
       {
-        script   = \l_fontspec_script_tl ;
-        language = \l_fontspec_lang_tl   ;
+        shaper = \l_@@_shaper_tl   ;
       }
+    \tl_if_empty:NF \l_@@_script_tl
+      {
+        script   = \l_@@_script_tl ;
+        language = \l_@@_lang_tl   ;
+      }
   }
 %</LU>
 %    \end{macrocode}
@@ -1001,6 +1005,7 @@
         \tl_gremove_all:Nn \g_@@_rawfeatures_sclist {##1;}
       }
   }
+\cs_generate_variant:Nn \@@_remove_clashing_featstr:n {x}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1020,12 +1025,12 @@
     \tl_clear:N \l_@@_font_path_tl
     \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_@@_renderer_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}
+    \tl_set:Nn \l_@@_mode_tl {node}
     \int_set:Nn \prehyphenchar { `\- } % fixme
     \int_zero:N \posthyphenchar        % fixme
     \int_zero:N \preexhyphenchar       % fixme

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-keyval.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -91,42 +91,67 @@
 %
 %
 % \paragraph{\feat{Renderer}}
-% This feature must be processed before all others (the other font shape and features options are also pre-parsed for convenience) because the renderer determines the format of the features and even whether certain features are available.
+% This feature must be processed before all others (the other font shape and features
+% options are also pre-parsed for convenience) because the renderer determines the format
+% of the features and whether certain features are available.
 %    \begin{macrocode}
+%<*XE>
 \keys_define:nn {fontspec-renderer}
   {
     Renderer .choices:nn =
-      {AAT,ICU,OpenType,Graphite,Full,Basic}
+      {AAT,ICU,OpenType,Graphite,Full,Basic,Node,Base,Harfbuzz}
       {
         \int_compare:nTF {\l_keys_choice_int <= 4}
           {
-%<*XE>
-            \tl_set:Nx \l_fontspec_renderer_tl
+            \tl_set:Nx \l_@@_renderer_tl
               {
                 \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} }
               }
-%<debug>\typeout{Renderer: \l_fontspec_renderer_tl}
-            \tl_gset:Nx \g_@@_single_feat_tl { \l_fontspec_renderer_tl }
-%</XE>
-%<*LU>
-            \@@_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite}
-%</LU>
+%<debug>\typeout{Renderer:~ \l_@@_renderer_tl}
+            \tl_gset:Nx \g_@@_single_feat_tl { \l_@@_renderer_tl }
           }
           {
-%<*XE>
-            \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic}
+            \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic/Node/Base/Harfbuzz}
+          }
+      }
+  }
 %</XE>
 %<*LU>
-              \tl_set:Nx \l_fontspec_mode_tl
-                {
-                  \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} }
-                }
-%<debug>\typeout{Mode: \l_fontspec_mode_tl}
-              \tl_gset:Nx \g_@@_single_feat_tl { mode=\l_fontspec_mode_tl }
-%</LU>
+\keys_define:nn {fontspec-renderer}
+  {
+    Renderer .choices:nn =
+      {Full,Node,Basic,Base,Harfbuzz,OpenType,AAT,Graphite}
+      {
+        \int_compare:nTF {\l_keys_choice_int >= 5} { \bool_set_true:N \l_@@_harfbuzz_bool }
+
+        \tl_set:Nx \l_@@_mode_tl
+          {
+            \int_case:nn \l_keys_choice_int { 1 {node} 2 {node} 3 {base} 4 {base} 5 {harf} 6 {harf} 7 {harf} 8 {harf} }
           }
-      }
+
+        \tl_set:Nx \l_@@_shaper_tl
+          {
+            \int_case:nn \l_keys_choice_int { 1 {} 2 {} 3 {} 4 {} 5 {} 6 {ot} 7 {coretext_aat} 8 {graphite2} }
+          }
+
+%<debug>\typeout{Mode:~"\l_@@_mode_tl"~/~Shaper:~"\l_@@_shaper_tl"}
+
+        \tl_gset:Nx \g_@@_single_feat_tl
+          {
+            mode=\l_@@_mode_tl ;
+            \tl_if_empty:NF \l_@@_shaper_tl { shaper=\l_@@_shaper_tl}
+          }
+      } ,
+
+    Renderer unknown .code:n =
+      {
+        \bool_set_true:N \l_@@_harfbuzz_bool
+        \@@_warning:nx {unknown-renderer} {#1}
+        \tl_set:Nn \l_@@_mode_tl {harf}
+        \tl_set:Nn \l_@@_shaper_tl {#1}
+      } ,
   }
+%</LU>
 %    \end{macrocode}
 %
 % \subsection{Pre-parsed features}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-math.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -220,6 +220,11 @@
   \@ifpackageloaded{MinionPro}    {\bool_gset_false:N \g_@@_math_bool}{}
   \@ifpackageloaded{unicode-math} {\bool_gset_false:N \g_@@_math_bool}{}
   \@ifpackageloaded{breqn}        {\bool_gset_false:N \g_@@_math_bool}{}
+  \@ifpackageloaded{pxfonts}      {\bool_gset_false:N \g_@@_math_bool}{}
+  \@ifpackageloaded{txfonts}      {\bool_gset_false:N \g_@@_math_bool}{}
+  \@ifpackageloaded{newpxmath}    {\bool_gset_false:N \g_@@_math_bool}{}
+  \@ifpackageloaded{newtxmath}    {\bool_gset_false:N \g_@@_math_bool}{}
+  \@ifpackageloaded{mtpro2}       {\bool_gset_false:N \g_@@_math_bool}{}
   \bool_if:NT \g_@@_math_bool
    {
     \@@_info:n {setup-math}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-msg.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -168,19 +168,24 @@
  }
 \@@_msg_new:nnn {fontspec} {only-xetex-feature}
  {
-  Ignored XeTeX only feature: '#1'.
+  Ignored XeTeX-only feature: '#1'.
  }
 \@@_msg_new:nnn {fontspec} {only-luatex-feature}
  {
-  Ignored LuaTeX only feature: '#1'.
+  Ignored LuaTeX-only feature: '#1'.
  }
+\@@_msg_new:nnn {fontspec} {unknown-renderer}
+ {
+  Renderer '#1' unknown. Assuming Harfbuzz with 'shaper=#1'.
+  Please raise a fontspec issue to add this shaper to the interface.
+ }
 \@@_msg_new:nnn {fontspec} {no-mapping}
  {
-  Input mapping not (yet?) supported in LuaTeX.
+  Input mapping not supported in LuaTeX.
  }
 \@@_msg_new:nnn {fontspec} {no-mapping-ligtex}
  {
-  Input mapping not (yet?) supported in LuaTeX.\\
+  Input mapping not supported in LuaTeX.\\
   Use "Ligatures=TeX" instead of "Mapping=tex-text".
  }
 \@@_msg_new:nnn {fontspec} {cm-default-obsolete}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-opentype.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -113,10 +113,8 @@
 %<debug>  \typeout{:: @@_make_OT_feature:nnn \exp_not:n { {#1}{#2}{#3} } }
 
     \bool_set_true:N \l_@@_proceed_bool
-    \bool_set_true:N  \l_@@_check_feat_bool
 
-    \tl_if_empty:nT {#1} { \bool_set_false:N \l_@@_check_feat_bool }
-    \bool_if:NT \l_@@_check_feat_bool
+    \tl_if_empty:nF {#1}
       {
         \exp_args:No \@@_check_ot_feat:NnF \l_@@_fontface_cs_tl {#1}
           {
@@ -125,13 +123,9 @@
           }
       }
 
-    \bool_if:NT \l_@@_proceed_bool
-      {
-        \exp_args:Nx \@@_remove_clashing_featstr:n
-          { #2 , \@@_swap_plus_minus:n {#2} , #3 }
+    \@@_remove_clashing_featstr:x { #2 , \@@_swap_plus_minus:n {#2} , #3 }
 
-        \@@_update_featstr:n {#2}
-      }
+    \bool_if:NT \l_@@_proceed_bool { \@@_update_featstr:n {#2} }
   }
 \cs_generate_variant:Nn \@@_make_OT_feature:nnn {xxx}
 %    \end{macrocode}
@@ -208,7 +202,7 @@
 %    \begin{macrocode}
 \prg_new_conditional:Nnn \@@_check_lang:Nn {TF}
   {
-    \@@_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:}
+    \@@_check_lang:NnnTF #1 {#2} {\l_@@_script_tl} {\prg_return_true:} {\prg_return_false:}
   }
 %    \end{macrocode}
 %
@@ -272,7 +266,7 @@
 %    \begin{macrocode}
 \prg_new_conditional:Nnn \@@_check_ot_feat:Nn {TF,F}
   {
-    \@@_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl}
+    \@@_check_ot_feat:NnnnTF #1 {#2} {\l_@@_lang_tl} {\l_@@_script_tl}
       {\prg_return_true:} {\prg_return_false:}
   }
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-user.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -116,8 +116,8 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_main_setmathrm:nn
   {
-%<XE> \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1} {#2}
-%<LU> \fontspec_set_family:Nnn \g_@@_mathrm_tl {Renderer=Basic,#1} {#2}
+%<XE> \fontspec_gset_family:Nnn \g_@@_mathrm_tl {#1} {#2}
+%<LU> \fontspec_gset_family:Nnn \g_@@_mathrm_tl {Renderer=Basic,#1} {#2}
     \@@_setmathrm_hook:nn {#1} {#2}
   }
 %    \end{macrocode}
@@ -127,8 +127,8 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_main_setboldmathrm:nn
   {
-%<XE> \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
-%<LU> \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {Renderer=Basic,#1} {#2}
+%<XE> \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
+%<LU> \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {Renderer=Basic,#1} {#2}
     \@@_setboldmathrm_hook:nn {#1} {#2}
   }
 %    \end{macrocode}
@@ -138,8 +138,8 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_main_setmathsf:nn
   {
-%<XE> \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1} {#2}
-%<LU> \fontspec_set_family:Nnn \g_@@_mathsf_tl {Renderer=Basic,#1} {#2}
+%<XE> \fontspec_gset_family:Nnn \g_@@_mathsf_tl {#1} {#2}
+%<LU> \fontspec_gset_family:Nnn \g_@@_mathsf_tl {Renderer=Basic,#1} {#2}
     \@@_setmathsf_hook:nn {#1} {#2}
   }
 %    \end{macrocode}
@@ -149,8 +149,8 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_main_setmathtt:nn
   {
-%<XE> \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1} {#2}
-%<LU> \fontspec_set_family:Nnn \g_@@_mathtt_tl {Renderer=Basic,#1} {#2}
+%<XE> \fontspec_gset_family:Nnn \g_@@_mathtt_tl {#1} {#2}
+%<LU> \fontspec_gset_family:Nnn \g_@@_mathtt_tl {Renderer=Basic,#1} {#2}
     \@@_setmathtt_hook:nn {#1} {#2}
   }
 %    \end{macrocode}
@@ -183,12 +183,12 @@
 \tl_gset:Nn \g_@@_mathtt_tl {\ttdefault}
 %    \end{macrocode}
 %
-% \begin{macro}{\@@_main_newfontfamily:nnnN}
+% \begin{macro}{\@@_main_newfontfamily:NnnN}
 %   The inner fontspec workings define a font family, which is then used in a typical
 %   NFSS \cmd\fontfamily\ declaration, saved in the macro name specified.
 %   The fourth argument determines which xparse function to set the macro with (new/renew/etc).
 %    \begin{macrocode}
-\cs_new:Nn \@@_main_newfontfamily:nnnN
+\cs_new:Nn \@@_main_newfontfamily:NnnN
   {
     \fontspec_set_family:cnn { l_@@_ \cs_to_str:N #1 _family_tl } {#2} {#3}
     \use:x
@@ -204,12 +204,12 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_main_newfontface:nnn}
+% \begin{macro}{\@@_main_newfontface:NnnN}
 % \cmd\newfontface\ uses the fact that if the argument to \feat{BoldFont}, etc., is empty (\ie, |BoldFont={}|), then no bold font is searched for.
 %    \begin{macrocode}
-\cs_new:Nn \@@_main_newfontface:nnn
+\cs_new:Nn \@@_main_newfontface:NnnN
   {
-    \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
+    \@@_main_newfontfamily:NnnN #1 { BoldFont={},ItalicFont={},SmallCapsFont={},#2 } {#3} #4
   }
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-code-vars.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -37,6 +37,7 @@
 \bool_new:N \l_@@_atsui_bool
 \bool_new:N \l_@@_ot_bool
 \bool_new:N \l_@@_mm_bool
+\bool_new:N \l_@@_harfbuzz_bool
 \bool_new:N \l_@@_graphite_bool
 \bool_new:N \l_@@_fontcfg_bool
 \bool_set_true:N \l_@@_fontcfg_bool
@@ -63,7 +64,6 @@
 \bool_new:N \l_@@_scriptlang_exist_bool
 \bool_new:N \g_@@_em_normalise_slant_bool
 \bool_new:N \l_@@_proceed_bool
-\bool_new:N \l_@@_check_feat_bool
 %    \end{macrocode}
 %
 % \begin{macro}{\l_@@_never_check_bool}
@@ -152,13 +152,17 @@
 %    \end{macrocode}
 %
 % \paragraph{Token lists}
+%
+% \paragraph{Visible (perhaps?)}
+%
 %    \begin{macrocode}
 \tl_new:N \l_fontspec_family_tl
 \tl_new:N \g_fontspec_encoding_tl
-\tl_new:N \l_fontspec_renderer_tl
 \tl_new:N \l_fontspec_fontname_tl
 %    \end{macrocode}
 %
+% \paragraph{2e interactions}
+%
 %    \begin{macrocode}
 \tl_clear_new:N \UTFencname
 \tl_clear_new:N \cyrillicencoding
@@ -165,14 +169,19 @@
 \tl_clear_new:N \latinencoding
 %    \end{macrocode}
 %
+% \paragraph{Renderer/shaper}
+%
 %    \begin{macrocode}
-\tl_new:N \l_fontspec_mode_tl
-\tl_new:N \g_@@_curr_series_tl
+\tl_new:N \l_@@_renderer_tl
+\tl_new:N \l_@@_mode_tl
+\tl_new:N \l_@@_shaper_tl
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \tl_new:N \g_@@_defined_shapes_tl
-\tl_new:N \g_@@_nfss_enc_tl
-\tl_new:N \g_@@_nfss_family_tl
 \tl_new:N \g_@@_single_feat_tl
 \tl_new:N \l_@@_basename_tl
+\tl_new:N \g_@@_curr_series_tl
 \tl_new:N \l_@@_curr_fontname_tl
 \tl_new:N \l_@@_curr_bfname_tl
 \tl_new:N \l_@@_ext_filename_tl
@@ -180,31 +189,43 @@
 \tl_new:N \l_@@_font_path_tl
 \tl_new:N \l_@@_fontid_tl
 \tl_new:N \l_@@_fontname_tl
-\tl_new:N \l_@@_hexcol_tl
+\tl_new:N \l_@@_options_tl
+\tl_new:N \l_@@_saved_fontname_tl
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tl_new:N \g_@@_nfss_enc_tl
+\tl_new:N \g_@@_nfss_family_tl
 \tl_new:N \l_@@_nfss_sc_tl
 \tl_new:N \l_@@_nfss_tl
 \tl_new:N \l_@@_nfss_fam_tl
-\tl_new:N \l_@@_opacity_tl
-\tl_new:N \l_@@_optical_size_tl
-\tl_new:N \l_@@_options_tl
-\tl_new:N \l_@@_saved_fontname_tl
-\tl_new:N \l_@@_scale_tl
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \tl_new:N \l_@@_size_tl
 \tl_new:N \l_@@_sizedfont_tl
 \tl_new:N \l_@@_this_font_tl
+\tl_new:N \l_@@_ttc_index_tl
+\tl_new:N \l_@@_smcp_shape_tl
+%    \end{macrocode}
+%
+% \paragraph{EM and STRONG}
+%    \begin{macrocode}
+\tl_new:N \l_@@_emshape_query_tl
+\tl_new:N \l_@@_em_switch_tl
+\tl_new:N \l_@@_strong_switch_tl
+%    \end{macrocode}
+%
+% \paragraph{Scratch variables}
+%    \begin{macrocode}
 \tl_new:N \l_@@_tmp_tl
 \tl_new:N \l_@@_tmpa_tl
 \tl_new:N \l_@@_tmpb_tl
-\tl_new:N \l_@@_ttc_index_tl
-\tl_new:N \l_@@_emshape_query_tl
-\tl_new:N \l_@@_em_switch_tl
 \tl_new:N \l_@@_em_tmp_tl
 \tl_new:N \l_@@_strong_tmp_tl
-\tl_new:N \l_@@_strong_switch_tl
-\tl_new:N \l_@@_hyphenchar_tl
-\tl_new:N \l_@@_smcp_shape_tl
 %    \end{macrocode}
 %
+% \paragraph{Maths fonts}
 %    \begin{macrocode}
 \tl_new:N \g_@@_mathrm_tl
 \tl_new:N \g_@@_bfmathrm_tl
@@ -212,7 +233,7 @@
 \tl_new:N \g_@@_mathtt_tl
 %    \end{macrocode}
 %
-% Defaults:
+% Defaults: (these are set elsewhere; TODO: check if redundant)
 %    \begin{macrocode}
 \tl_gset:Nn \g_@@_mathrm_tl {\rmdefault}
 \tl_gset:Nn \g_@@_mathsf_tl {\sfdefault}
@@ -225,6 +246,7 @@
 \tl_new:N \l_@@_fake_embolden_tl
 %    \end{macrocode}
 %
+% \paragraph{Internal font names}
 %    \begin{macrocode}
 \tl_new:N \l_@@_fontname_up_tl
 \tl_new:N \l_@@_fontname_bf_tl
@@ -235,20 +257,32 @@
 \tl_new:N \l_@@_fontname_sc_tl
 %    \end{macrocode}
 %
+% \paragraph{Script and Language}
+%
 %    \begin{macrocode}
-\tl_new:N \l_@@_script_name_tl
+\tl_new:N  \l_@@_script_tl
+\tl_new:N  \l_@@_script_name_tl
 \tl_set:Nn \l_@@_script_name_tl {CustomDefault}
-\tl_new:N \l_fontspec_script_tl
-\tl_new:N \l_@@_lang_name_tl
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tl_new:N  \l_@@_lang_tl
+\tl_new:N  \l_@@_lang_name_tl
 \tl_set:Nn \l_@@_lang_name_tl {Default}
-\tl_new:N \l_fontspec_lang_tl
 %    \end{macrocode}
 %
+% \paragraph{Generic font features}
+%
 %    \begin{macrocode}
-\tl_new:N  \l_@@_mapping_tl
-\tl_new:N  \l_@@_punctspace_adjust_tl
-\tl_new:N  \l_@@_wordspace_adjust_tl
-\tl_new:N  \l_@@_postadjust_tl
+\tl_new:N \l_@@_scale_tl
+\tl_new:N \l_@@_hyphenchar_tl
+\tl_new:N \l_@@_hexcol_tl
+\tl_new:N \l_@@_opacity_tl
+\tl_new:N \l_@@_optical_size_tl
+\tl_new:N \l_@@_mapping_tl
+\tl_new:N \l_@@_punctspace_adjust_tl
+\tl_new:N \l_@@_wordspace_adjust_tl
+\tl_new:N \l_@@_postadjust_tl
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -265,7 +299,6 @@
 %    \end{macrocode}
 %
 % \paragraph{Font families}
-% Again not a real data structure, and also probably poorly named.
 %    \begin{macrocode}
 \tl_new:N \l_@@_rmfamily_family_tl
 \tl_new:N \l_@@_sffamily_family_tl

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-api.tex	2019-02-12 22:04:13 UTC (rev 50011)
@@ -183,6 +183,7 @@
 
 \subsection{Functions for loading new fonts and families}
 
+\begin{macro}{\fontspec_gset_family:Nnn}
 \begin{macro}{\fontspec_set_family:Nnn}
 \darg{\LaTeX\ family}
 \darg{fontspec features}
@@ -193,11 +194,10 @@
 \cs{fontfamily}\marg{family}\cs{selectfont}.
 See the standard \pkg{fontspec} user commands for applications of this
 function.
-
-Previously this function set the \meta{family} variable locally, but this was inconsistent
-with how the NFSS assigns families. It is now a \textbf{global} operation.
 \end{macro}
+\end{macro}
 
+\begin{macro}{\fontspec_gset_fontface:NNnn}
 \begin{macro}{\fontspec_set_fontface:NNnn}
 \darg{primitive font}
 \darg{\LaTeX\ family}
@@ -209,10 +209,8 @@
 command will only select the regular face.
 This feature is designed for \LaTeX\ programmers who need to
 perform subsequent font-related tests on the \meta{primitive font}.
-
-Previously this function set the \meta{family} variable locally, but this was inconsistent
-with how the NFSS assigns families. It is now a \textbf{global} operation.
 \end{macro}
+\end{macro}
 
 
 \subsection{Conditionals}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex	2019-02-12 22:04:13 UTC (rev 50011)
@@ -36,15 +36,15 @@
   \CMD{\string\newfontfamily}\meta{cmd}\marg{font}\oarg{font features}\\
   \CMD{\string\setfontfamily}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}\\
   \CMD{\string\renewfontfamily}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}
+  \CMD{\string\providefontfamily}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}
 }
 
 These commands define new font family commands (like \cs{rmfamily}).
 The |new| command checks if \meta{cmd} has been defined, and issues an error if so.
 The |renew| command checks if \meta{cmd} has been defined, and issues an error if not.
+The |provide| command checks if \meta{cmd} has been defined, and silently aborts if so.
 The |set| command never checks; use at your own risk.
 
-\textbf{NEW:} In previous versions of \pkg{fontspec}, only \cs{newfontfamily} was provided, but it behaved
-like \cs{setfontfamily}. You'll have to update your code slightly if this now causes problems; apologies.
 
 
 \bigskip
@@ -282,20 +282,15 @@
 
 \section{Commands to select font families}
 
-\cmdbox{
-  \CMD{\string\newfontfamily}\cs{\meta{font-switch}}\marg{font name}\oarg{font features} \\
-  \CMD{\string\newfontface}\cs{\meta{font-switch}}\marg{font name}\oarg{font features}
-}
-
-\noindent For cases when a specific font with a specific
+For cases when a specific font with a specific
 feature set is going to be re-used many times in a document, it is inefficient
 to keep calling \cs{fontspec} for every use. While the \cs{fontspec} command does not define
 a new font instance after the first call, the feature options must still be
 parsed and processed.
 
-\DescribeMacro{\newfontfamily}
 For this reason, new commands can be created for loading a particular font
-family with the \cmd\newfontfamily\ command, demonstrated in \exref{nff}.
+family with the \cmd\newfontfamily\ command and variants,
+outlined in \vref{sec:main-cmd} and demonstrated in \exref{nff}.
 This macro should be used to create commands that would be used in
 the same way as \cmd\rmfamily, for example.
 If you would like to create a command that only changes the font
@@ -313,7 +308,31 @@
   \notefont This is a \emph{note}.
 \end{Lexample}
 
-\DescribeMacro{\newfontface}
+\emph{Comment for advanced users:}
+The commands defined by \cs{newfontfamily} (and \cs{newfontface}; see next section) include
+their encoding information, so even if the document is set to use a
+legacy \TeX\ encoding, such commands will still work correctly. For example,
+\begin{Verbatim}
+\documentclass{article}
+\usepackage{fontspec}
+\newfontfamily\unicodefont{Lucida Grande}
+\usepackage{mathpazo}
+\usepackage[T1]{fontenc}
+\begin{document}
+A legacy \TeX\ font. {\unicodefont A unicode font.}
+\end{document}
+\end{Verbatim}
+
+
+\section{Commands to select single font faces}
+
+\cmdbox{%
+  \CMD{\string\newfontface}\meta{cmd}\marg{font}\oarg{font features}\\
+  \CMD{\string\setfontface}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}\\
+  \CMD{\string\renewfontface}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}
+  \CMD{\string\providefontface}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}
+}
+
 Sometimes only a specific font face is desired, without accompanying italic or bold variants
 being automatically selected.
 This is common when selecting a fancy italic font, say, that has swash features unavailable
@@ -327,20 +346,6 @@
   % \emph, \textbf, etc., all don't work
 \end{Xexample}
 
-Comment for advanced users:
-The commands defined by \cs{newfontface} and \cs{newfontfamily} include
-their encoding information, so even if the document is set to use a
-legacy \TeX\ encoding, such commands will still work correctly. For example,
-\begin{Verbatim}
-\documentclass{article}
-\usepackage{fontspec}
-\newfontfamily\unicodefont{Lucida Grande}
-\usepackage{mathpazo}
-\usepackage[T1]{fontenc}
-\begin{document}
-A legacy \TeX\ font. {\unicodefont A unicode font.}
-\end{document}
-\end{Verbatim}
 
 \subsection{More control over font shape selection}
 \label{sec:bfitfonts}

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex	2019-02-12 22:04:13 UTC (rev 50011)
@@ -8,10 +8,43 @@
 \part{\LuaTeX-only font features}
 \label{sec:luatex-features}
 
+\section{Different font technologies and shapers}
+\label{sec:renderer-luatex}
+
+\LuaTeX\ does not directly support any font rendering technologies out of the box, it
+requires additional functionality to be added to properly support and control technologies such as OpenType.
+
+Using the \feat{Renderer} feature, there are a number of options that \pkg{fontspec} can pass to the engine to control which font technology is being used.
+Pre-2019, there were two options provided by \pkg{luaotfload} that generally did not require user intervention.
+
+\begin{itemize}
+\item \feat{Renderer} = \opt{Node} : the default `mode' for typesetting OpenType fonts.
+\item \feat{Renderer} = \opt{Base} : a simplified mode useful only in a limited number of situations such as mathematics typesetting.
+\end{itemize}
+
+From 2019 the possibility of using the Harfbuzz text shaping engine within \LuaTeX\ has
+been developed by Khaled Hosny. When running a suitable \LuaTeX\ engine with Harfbuzz support, \pkg{fontspec} provides the following options:
+
+\begin{itemize}
+\item \feat{Renderer} = \opt{Harfbuzz} : use the Harfbuzz engine without an explicit `shaper'.
+\item \feat{Renderer} = \opt{OpenType} : use the Harfbuzz engine with the OpenType shaper.
+\item \feat{Renderer} = \opt{AAT} : use the Harfbuzz engine with the AAT shaper.
+\item \feat{Renderer} = \opt{Graphite} : use the Harfbuzz engine with the Graphite shaper.
+\item \feat{Renderer} = \meta{foo} : use the Harfbuzz engine with the \meta{foo} shaper.
+\end{itemize}
+
+Support for the Harfbuzz renderer is preliminary and may be improved over time.
+Please treat the interface for Harfbuzz fonts as subject to change.
+
+
 \section{Custom font features}
 
 \LuaTeX, via the \pkg{luaotfload} package, allows the definition and re-definition of custom OpenType features for a selected font. This facility is particularly useful to implement custom substitutions or to disable unwanted but not all ligatures.
+
 Figure~\ref{fig:featurefile} shows an minimal example of this type of functionality.
+This example creates a new OpenType feature, \texttt{oneb}, which substitutes the glyph
+when typesetting `\texttt{1}' for the named glyph \texttt{one.ss01}. The glyph names
+are font specific and can be interrogated with third-party software such as \emph{FontForge}.
 
 A third-party collection of additional examples are maintained in the repository `\texttt{fonts-in-luatex}'\footnote{\url{https://github.com/mewtant/fonts-in-luatex}}.
 These examples are intended to correct or adjust font features in a range of commercial fonts and provide a good introduction to some of the possibilities that \LuaTeX\ affords.

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex	2019-02-12 22:04:13 UTC (rev 50011)
@@ -184,7 +184,7 @@
 settings are automatically selected
 by \pkg{fontspec} before all others, and, if \XeTeX\ is being used, will
 specifically select the \opt{OpenType}
-renderer for this font, as described in \vref{sec:renderer}.
+renderer for this font, as described in \vref{sec:renderer-xetex}.
 
 OpenType fonts can make available different font features depending on the Script and
 Language chosen.

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex	2019-02-12 22:04:13 UTC (rev 50011)
@@ -30,7 +30,7 @@
 \LuaTeX\ documents.
 
 
-\subsection{Different font technologies: \AAT, OpenType, and Graphite}\label{sec:renderer}
+\subsection{Different font technologies: \AAT, OpenType, and Graphite}\label{sec:renderer-xetex}
 
 \XeTeX\ supports three rendering technologies for typesetting, selected with
 the \feat{Renderer} font feature. The first, \opt{AAT}, is

Modified: trunk/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fontspec/fontspec.dtx	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/source/latex/fontspec/fontspec.dtx	2019-02-12 22:04:13 UTC (rev 50011)
@@ -71,7 +71,7 @@
 \ProvidesExplFile{fontspec.dtx}
 %</dtx>
 %<*fontspec>
-  {2019/01/25}{2.7a}{Font selection for XeLaTeX and LuaLaTeX}
+  {2019/02/12}{2.7b}{Font selection for XeLaTeX and LuaLaTeX}
 %</fontspec>
 %    \end{macrocode}
 %
@@ -90,8 +90,8 @@
 %<lua>local fontspec    = fontspec
 %<lua>fontspec.module   = {
 %<lua>    name          = "fontspec",
-%<lua>    version       = "2.7a",
-%<lua>    date          = "2019/01/25",
+%<lua>    version       = "2.7b",
+%<lua>    date          = "2019/02/12",
 %<lua>    description   = "Font selection for XeLaTeX and LuaLaTeX",
 %<lua>    author        = "Khaled Hosny, Philipp Gesang, Will Robertson",
 %<lua>    copyright     = "Khaled Hosny, Philipp Gesang, Will Robertson",

Modified: trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty	2019-02-12 22:04:13 UTC (rev 50011)
@@ -41,7 +41,7 @@
 
 \RequirePackage{xparse}
 \ProvidesExplPackage{fontspec-luatex}%
-  {2019/01/25}{2.7a}{Font selection for XeLaTeX and LuaLaTeX}
+  {2019/02/12}{2.7b}{Font selection for XeLaTeX and LuaLaTeX}
 
 %%^^A%%  fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec>
 %%^^A%%  fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec>
@@ -54,6 +54,7 @@
 \bool_new:N \l__fontspec_atsui_bool
 \bool_new:N \l__fontspec_ot_bool
 \bool_new:N \l__fontspec_mm_bool
+\bool_new:N \l__fontspec_harfbuzz_bool
 \bool_new:N \l__fontspec_graphite_bool
 \bool_new:N \l__fontspec_fontcfg_bool
 \bool_set_true:N \l__fontspec_fontcfg_bool
@@ -71,7 +72,6 @@
 \bool_new:N \l__fontspec_scriptlang_exist_bool
 \bool_new:N \g__fontspec_em_normalise_slant_bool
 \bool_new:N \l__fontspec_proceed_bool
-\bool_new:N \l__fontspec_check_feat_bool
 \bool_new:N \l__fontspec_never_check_bool
 \int_new:N \l__fontspec_script_int
 \int_new:N \l__fontspec_language_int
@@ -123,18 +123,17 @@
 \prop_new:N \g__fontspec_family_int_prop
 \tl_new:N \l_fontspec_family_tl
 \tl_new:N \g_fontspec_encoding_tl
-\tl_new:N \l_fontspec_renderer_tl
 \tl_new:N \l_fontspec_fontname_tl
 \tl_clear_new:N \UTFencname
 \tl_clear_new:N \cyrillicencoding
 \tl_clear_new:N \latinencoding
-\tl_new:N \l_fontspec_mode_tl
-\tl_new:N \g__fontspec_curr_series_tl
+\tl_new:N \l__fontspec_renderer_tl
+\tl_new:N \l__fontspec_mode_tl
+\tl_new:N \l__fontspec_shaper_tl
 \tl_new:N \g__fontspec_defined_shapes_tl
-\tl_new:N \g__fontspec_nfss_enc_tl
-\tl_new:N \g__fontspec_nfss_family_tl
 \tl_new:N \g__fontspec_single_feat_tl
 \tl_new:N \l__fontspec_basename_tl
+\tl_new:N \g__fontspec_curr_series_tl
 \tl_new:N \l__fontspec_curr_fontname_tl
 \tl_new:N \l__fontspec_curr_bfname_tl
 \tl_new:N \l__fontspec_ext_filename_tl
@@ -142,29 +141,26 @@
 \tl_new:N \l__fontspec_font_path_tl
 \tl_new:N \l__fontspec_fontid_tl
 \tl_new:N \l__fontspec_fontname_tl
-\tl_new:N \l__fontspec_hexcol_tl
+\tl_new:N \l__fontspec_options_tl
+\tl_new:N \l__fontspec_saved_fontname_tl
+\tl_new:N \g__fontspec_nfss_enc_tl
+\tl_new:N \g__fontspec_nfss_family_tl
 \tl_new:N \l__fontspec_nfss_sc_tl
 \tl_new:N \l__fontspec_nfss_tl
 \tl_new:N \l__fontspec_nfss_fam_tl
-\tl_new:N \l__fontspec_opacity_tl
-\tl_new:N \l__fontspec_optical_size_tl
-\tl_new:N \l__fontspec_options_tl
-\tl_new:N \l__fontspec_saved_fontname_tl
-\tl_new:N \l__fontspec_scale_tl
 \tl_new:N \l__fontspec_size_tl
 \tl_new:N \l__fontspec_sizedfont_tl
 \tl_new:N \l__fontspec_this_font_tl
+\tl_new:N \l__fontspec_ttc_index_tl
+\tl_new:N \l__fontspec_smcp_shape_tl
+\tl_new:N \l__fontspec_emshape_query_tl
+\tl_new:N \l__fontspec_em_switch_tl
+\tl_new:N \l__fontspec_strong_switch_tl
 \tl_new:N \l__fontspec_tmp_tl
 \tl_new:N \l__fontspec_tmpa_tl
 \tl_new:N \l__fontspec_tmpb_tl
-\tl_new:N \l__fontspec_ttc_index_tl
-\tl_new:N \l__fontspec_emshape_query_tl
-\tl_new:N \l__fontspec_em_switch_tl
 \tl_new:N \l__fontspec_em_tmp_tl
 \tl_new:N \l__fontspec_strong_tmp_tl
-\tl_new:N \l__fontspec_strong_switch_tl
-\tl_new:N \l__fontspec_hyphenchar_tl
-\tl_new:N \l__fontspec_smcp_shape_tl
 \tl_new:N \g__fontspec_mathrm_tl
 \tl_new:N \g__fontspec_bfmathrm_tl
 \tl_new:N \g__fontspec_mathsf_tl
@@ -182,16 +178,21 @@
 \tl_new:N \l__fontspec_fontname_sl_tl
 \tl_new:N \l__fontspec_fontname_bfsl_tl
 \tl_new:N \l__fontspec_fontname_sc_tl
-\tl_new:N \l__fontspec_script_name_tl
+\tl_new:N  \l__fontspec_script_tl
+\tl_new:N  \l__fontspec_script_name_tl
 \tl_set:Nn \l__fontspec_script_name_tl {CustomDefault}
-\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_lang_name_tl
 \tl_set:Nn \l__fontspec_lang_name_tl {Default}
-\tl_new:N \l_fontspec_lang_tl
-\tl_new:N  \l__fontspec_mapping_tl
-\tl_new:N  \l__fontspec_punctspace_adjust_tl
-\tl_new:N  \l__fontspec_wordspace_adjust_tl
-\tl_new:N  \l__fontspec_postadjust_tl
+\tl_new:N \l__fontspec_scale_tl
+\tl_new:N \l__fontspec_hyphenchar_tl
+\tl_new:N \l__fontspec_hexcol_tl
+\tl_new:N \l__fontspec_opacity_tl
+\tl_new:N \l__fontspec_optical_size_tl
+\tl_new:N \l__fontspec_mapping_tl
+\tl_new:N \l__fontspec_punctspace_adjust_tl
+\tl_new:N \l__fontspec_wordspace_adjust_tl
+\tl_new:N \l__fontspec_postadjust_tl
 \tl_const:Nn \c__fontspec_hexcol_tl {000000}
 \tl_const:Nn \c__fontspec_opacity_tl {FF~}
 \tl_const:Nn \c__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl }
@@ -346,19 +347,24 @@
  }
 \__fontspec_msg_new:nnn {fontspec} {only-xetex-feature}
  {
-  Ignored XeTeX only feature: '#1'.
+  Ignored XeTeX-only feature: '#1'.
  }
 \__fontspec_msg_new:nnn {fontspec} {only-luatex-feature}
  {
-  Ignored LuaTeX only feature: '#1'.
+  Ignored LuaTeX-only feature: '#1'.
  }
+\__fontspec_msg_new:nnn {fontspec} {unknown-renderer}
+ {
+  Renderer '#1' unknown. Assuming Harfbuzz with 'shaper=#1'.
+  Please raise a fontspec issue to add this shaper to the interface.
+ }
 \__fontspec_msg_new:nnn {fontspec} {no-mapping}
  {
-  Input mapping not (yet?) supported in LuaTeX.
+  Input mapping not supported in LuaTeX.
  }
 \__fontspec_msg_new:nnn {fontspec} {no-mapping-ligtex}
  {
-  Input mapping not (yet?) supported in LuaTeX.\\
+  Input mapping not supported in LuaTeX.\\
   Use "Ligatures=TeX" instead of "Mapping=tex-text".
  }
 \__fontspec_msg_new:nnn {fontspec} {cm-default-obsolete}
@@ -626,20 +632,36 @@
   }
 \NewDocumentCommand \newfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \NewDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
 \NewDocumentCommand \renewfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \RenewDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
   }
 \NewDocumentCommand \setfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \DeclareDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
   }
+\NewDocumentCommand \providefontfamily { m O{} m O{} }
+  {
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
 \NewDocumentCommand \newfontface { m O{} m O{} }
   {
-    \__fontspec_main_newfontface:nnn {#1} {#2,#4} {#3}
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
+\NewDocumentCommand \renewfontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
+  }
+\NewDocumentCommand \setfontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
+  }
+\NewDocumentCommand \providefontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
 \NewDocumentCommand \defaultfontfeatures { t+ o m }
   {
     \IfNoValueTF {#2}
@@ -771,22 +793,22 @@
   }
 \cs_new:Nn \__fontspec_main_setmathrm:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
     \__fontspec_setmathrm_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setboldmathrm:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {Renderer=Basic,#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_bfmathrm_tl {Renderer=Basic,#1} {#2}
     \__fontspec_setboldmathrm_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setmathsf:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
     \__fontspec_setmathsf_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setmathtt:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
     \__fontspec_setmathtt_hook:nn {#1} {#2}
   }
 \cs_set_eq:NN \__fontspec_setmainfont_hook:nn   \use_none:nn
@@ -803,7 +825,7 @@
 \tl_gset:Nn \g__fontspec_mathrm_tl {\rmdefault}
 \tl_gset:Nn \g__fontspec_mathsf_tl {\sfdefault}
 \tl_gset:Nn \g__fontspec_mathtt_tl {\ttdefault}
-\cs_new:Nn \__fontspec_main_newfontfamily:nnnN
+\cs_new:Nn \__fontspec_main_newfontfamily:NnnN
   {
     \fontspec_set_family:cnn { l__fontspec_ \cs_to_str:N #1 _family_tl } {#2} {#3}
     \use:x
@@ -816,9 +838,9 @@
           }
       }
   }
-\cs_new:Nn \__fontspec_main_newfontface:nnn
+\cs_new:Nn \__fontspec_main_newfontface:NnnN
   {
-    \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
+    \__fontspec_main_newfontfamily:NnnN #1 { BoldFont={},ItalicFont={},SmallCapsFont={},#2 } {#3} #4
   }
 \cs_new:Nn \__fontspec_set_default_features:nn
   {
@@ -1040,8 +1062,8 @@
             \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-num} \l__fontspec_tmp_tl
             \int_set:Nn \l__fontspec_language_int {\l__fontspec_tmp_tl}
 
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-tag}    \l_fontspec_lang_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l__fontspec_script_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-tag}    \l__fontspec_lang_tl
 
             \__fontspec_check_ot_feat:NnTF \font {#1} {\prg_return_true:} {\prg_return_false:}
           }
@@ -1088,7 +1110,7 @@
           {
             \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-num} \l__fontspec_tmp_tl
             \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl}
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l__fontspec_script_tl
 
             \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false:
           }
@@ -1139,26 +1161,31 @@
       }
       { \prg_return_false: }
   }
-\cs_new:Nn \fontspec_set_family:Nnn
+\cs_new:Nn \__fontspec_tl_new_if_free:N { \tl_if_exist:NF #1 { \tl_new:N #1 } }
+\cs_new:Nn \__fontspec_set_family:NnnN
   {
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
     \tl_set:Nn \l__fontspec_family_label_tl {#1}
     \__fontspec_select_font_family:nn {#2} {#3}
-    \tl_if_exist:NF #1 { \tl_new:N #1 }
-    \tl_set_eq:NN #1 \l_fontspec_family_tl
+    \__fontspec_tl_new_if_free:N #1
+    #4 #1 \l_fontspec_family_tl
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_family:Nnn { \__fontspec_set_family:NnnN #1 {#2} {#3} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_family:Nnn  { \__fontspec_set_family:NnnN #1 {#2} {#3} \tl_set_eq:NN  }
 \cs_generate_variant:Nn \fontspec_set_family:Nnn {c}
 \tl_new:N \l__fontspec_fontface_cs_tl
 \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font}
-\cs_new:Nn \fontspec_set_fontface:NNnn
+\cs_new:Nn \__fontspec_set_fontface:NNnnN
   {
     \tl_set:Nn \l__fontspec_fontface_cs_tl {#1}
     \tl_set:Nn \l__fontspec_family_label_tl {#2}
     \__fontspec_select_font_family:nn {#3} {#4}
-    \tl_set_eq:NN #2 \l_fontspec_family_tl
+    #5 #2 \l_fontspec_family_tl
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_fontface:NNnn { \__fontspec_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_fontface:NNnn  { \__fontspec_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_set_eq:NN  }
 \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F}
   {
     \group_begin:
@@ -1350,7 +1377,7 @@
       {#1}
       \l__fontspec_extension_tl
       \l__fontspec_ttc_index_tl
-      \l_fontspec_renderer_tl
+      \l__fontspec_renderer_tl
       \l__fontspec_optical_size_tl
       {#2}
   }
@@ -1445,8 +1472,8 @@
       }
     \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int
     \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num}   \l__fontspec_language_int
-    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl
-    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag}   \l_fontspec_lang_tl
+    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l__fontspec_script_tl
+    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag}   \l__fontspec_lang_tl
   }
 \cs_new:Nn \__fontspec_find_autofonts:
   {
@@ -1701,12 +1728,16 @@
   }
 \tl_set:Nn \l__fontspec_pre_feat_sclist
   {
-    mode     = \l_fontspec_mode_tl   ;
-    \tl_if_empty:NF \l_fontspec_script_tl
+    mode     = \l__fontspec_mode_tl   ;
+    \tl_if_empty:NF \l__fontspec_shaper_tl
       {
-        script   = \l_fontspec_script_tl ;
-        language = \l_fontspec_lang_tl   ;
+        shaper = \l__fontspec_shaper_tl   ;
       }
+    \tl_if_empty:NF \l__fontspec_script_tl
+      {
+        script   = \l__fontspec_script_tl ;
+        language = \l__fontspec_lang_tl   ;
+      }
   }
 \cs_new:Nn \__fontspec_make_smallcaps:TF
   {
@@ -1727,6 +1758,7 @@
         \tl_gremove_all:Nn \g__fontspec_rawfeatures_sclist {##1;}
       }
   }
+\cs_generate_variant:Nn \__fontspec_remove_clashing_featstr:n {x}
 \cs_set:Npn \__fontspec_init:
   {
     \bool_set_false:N \l__fontspec_ot_bool
@@ -1735,11 +1767,11 @@
     \tl_clear:N \l__fontspec_font_path_tl
     \tl_clear:N \l__fontspec_optical_size_tl
     \tl_clear:N \l__fontspec_ttc_index_tl
-    \tl_clear:N \l_fontspec_renderer_tl
+    \tl_clear:N \l__fontspec_renderer_tl
     \tl_gclear:N \g__fontspec_defined_shapes_tl
     \tl_gclear:N \g__fontspec_curr_series_tl
     \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl
-    \tl_set:Nn \l_fontspec_mode_tl {node}
+    \tl_set:Nn \l__fontspec_mode_tl {node}
     \int_set:Nn \prehyphenchar { `\- } % fixme
     \int_zero:N \posthyphenchar        % fixme
     \int_zero:N \preexhyphenchar       % fixme
@@ -1828,10 +1860,8 @@
   {
 
     \bool_set_true:N \l__fontspec_proceed_bool
-    \bool_set_true:N  \l__fontspec_check_feat_bool
 
-    \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool }
-    \bool_if:NT \l__fontspec_check_feat_bool
+    \tl_if_empty:nF {#1}
       {
         \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1}
           {
@@ -1840,13 +1870,9 @@
           }
       }
 
-    \bool_if:NT \l__fontspec_proceed_bool
-      {
-        \exp_args:Nx \__fontspec_remove_clashing_featstr:n
-          { #2 , \__fontspec_swap_plus_minus:n {#2} , #3 }
+    \__fontspec_remove_clashing_featstr:x { #2 , \__fontspec_swap_plus_minus:n {#2} , #3 }
 
-        \__fontspec_update_featstr:n {#2}
-      }
+    \bool_if:NT \l__fontspec_proceed_bool { \__fontspec_update_featstr:n {#2} }
   }
 \cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx}
 \cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:Nq #1 \q_nil }
@@ -1877,7 +1903,7 @@
   }
 \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF}
   {
-    \__fontspec_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:}
+    \__fontspec_check_lang:NnnTF #1 {#2} {\l__fontspec_script_tl} {\prg_return_true:} {\prg_return_false:}
   }
 \prg_new_conditional:Nnn \__fontspec_check_lang:Nnn {TF}
   {
@@ -1899,7 +1925,7 @@
   }
 \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F}
   {
-    \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl}
+    \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l__fontspec_lang_tl} {\l__fontspec_script_tl}
       {\prg_return_true:} {\prg_return_false:}
   }
 \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F}
@@ -2095,20 +2121,35 @@
 \keys_define:nn {fontspec-renderer}
   {
     Renderer .choices:nn =
-      {AAT,ICU,OpenType,Graphite,Full,Basic}
+      {Full,Node,Basic,Base,Harfbuzz,OpenType,AAT,Graphite}
       {
-        \int_compare:nTF {\l_keys_choice_int <= 4}
+        \int_compare:nTF {\l_keys_choice_int >= 5} { \bool_set_true:N \l__fontspec_harfbuzz_bool }
+
+        \tl_set:Nx \l__fontspec_mode_tl
           {
-            \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite}
+            \int_case:nn \l_keys_choice_int { 1 {node} 2 {node} 3 {base} 4 {base} 5 {harf} 6 {harf} 7 {harf} 8 {harf} }
           }
+
+        \tl_set:Nx \l__fontspec_shaper_tl
           {
-              \tl_set:Nx \l_fontspec_mode_tl
-                {
-                  \int_case:nn \l_keys_choice_int { 5 {node} 6 {base} }
-                }
-              \tl_gset:Nx \g__fontspec_single_feat_tl { mode=\l_fontspec_mode_tl }
+            \int_case:nn \l_keys_choice_int { 1 {} 2 {} 3 {} 4 {} 5 {} 6 {ot} 7 {coretext_aat} 8 {graphite2} }
           }
-      }
+
+
+        \tl_gset:Nx \g__fontspec_single_feat_tl
+          {
+            mode=\l__fontspec_mode_tl ;
+            \tl_if_empty:NF \l__fontspec_shaper_tl { shaper=\l__fontspec_shaper_tl}
+          }
+      } ,
+
+    Renderer unknown .code:n =
+      {
+        \bool_set_true:N \l__fontspec_harfbuzz_bool
+        \__fontspec_warning:nx {unknown-renderer} {#1}
+        \tl_set:Nn \l__fontspec_mode_tl {harf}
+        \tl_set:Nn \l__fontspec_shaper_tl {#1}
+      } ,
   }
 \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script}
   {
@@ -2834,7 +2875,7 @@
             \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1}
               {
                 \tl_set:Nn \l__fontspec_script_name_tl {#1}
-                \tl_set:Nn \l_fontspec_script_tl {####1}
+                \tl_set:Nn \l__fontspec_script_tl {####1}
                 \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int}
                 \bool_set_true:N \l__fontspec_scriptlang_exist_bool
                 \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 }
@@ -2875,11 +2916,11 @@
         \bool_set_false:N \l__fontspec_scriptlang_exist_bool
         \clist_map_inline:nn {#2}
           {
-            \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2}
+            \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {####1}
               {
-                \tl_set:Nn \l_fontspec_lang_tl {#2}
+                \tl_set:Nn \l__fontspec_lang_tl {####1}
                 \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int}
-                \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 }
+                \tl_gset:Nx \g__fontspec_single_feat_tl { language=####1 }
                 \bool_set_true:N \l__fontspec_scriptlang_exist_bool
                 \clist_map_break:
               }
@@ -2894,7 +2935,7 @@
   }
 \__fontspec_keys_define_code:nnn {fontspec-opentype} { Language / Default }
   {
-    \tl_set:Nn \l_fontspec_lang_tl {DFLT}
+    \tl_set:Nn \l__fontspec_lang_tl {DFLT}
     \int_zero:N \l__fontspec_language_int
     \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT }
   }
@@ -3673,6 +3714,11 @@
   \@ifpackageloaded{MinionPro}    {\bool_gset_false:N \g__fontspec_math_bool}{}
   \@ifpackageloaded{unicode-math} {\bool_gset_false:N \g__fontspec_math_bool}{}
   \@ifpackageloaded{breqn}        {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{pxfonts}      {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{txfonts}      {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{newpxmath}    {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{newtxmath}    {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{mtpro2}       {\bool_gset_false:N \g__fontspec_math_bool}{}
   \bool_if:NT \g__fontspec_math_bool
    {
     \__fontspec_info:n {setup-math}

Modified: trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty	2019-02-12 22:04:13 UTC (rev 50011)
@@ -41,7 +41,7 @@
 
 \RequirePackage{xparse}
 \ProvidesExplPackage{fontspec-xetex}%
-  {2019/01/25}{2.7a}{Font selection for XeLaTeX and LuaLaTeX}
+  {2019/02/12}{2.7b}{Font selection for XeLaTeX and LuaLaTeX}
 
 %%^^A%%  fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec>
 %%^^A%%  fontspec-code-vars.dtx -- part of FONTSPEC <wspr.io/fontspec>
@@ -54,6 +54,7 @@
 \bool_new:N \l__fontspec_atsui_bool
 \bool_new:N \l__fontspec_ot_bool
 \bool_new:N \l__fontspec_mm_bool
+\bool_new:N \l__fontspec_harfbuzz_bool
 \bool_new:N \l__fontspec_graphite_bool
 \bool_new:N \l__fontspec_fontcfg_bool
 \bool_set_true:N \l__fontspec_fontcfg_bool
@@ -71,7 +72,6 @@
 \bool_new:N \l__fontspec_scriptlang_exist_bool
 \bool_new:N \g__fontspec_em_normalise_slant_bool
 \bool_new:N \l__fontspec_proceed_bool
-\bool_new:N \l__fontspec_check_feat_bool
 \bool_new:N \l__fontspec_never_check_bool
 \int_new:N \l__fontspec_script_int
 \int_new:N \l__fontspec_language_int
@@ -123,18 +123,17 @@
 \prop_new:N \g__fontspec_family_int_prop
 \tl_new:N \l_fontspec_family_tl
 \tl_new:N \g_fontspec_encoding_tl
-\tl_new:N \l_fontspec_renderer_tl
 \tl_new:N \l_fontspec_fontname_tl
 \tl_clear_new:N \UTFencname
 \tl_clear_new:N \cyrillicencoding
 \tl_clear_new:N \latinencoding
-\tl_new:N \l_fontspec_mode_tl
-\tl_new:N \g__fontspec_curr_series_tl
+\tl_new:N \l__fontspec_renderer_tl
+\tl_new:N \l__fontspec_mode_tl
+\tl_new:N \l__fontspec_shaper_tl
 \tl_new:N \g__fontspec_defined_shapes_tl
-\tl_new:N \g__fontspec_nfss_enc_tl
-\tl_new:N \g__fontspec_nfss_family_tl
 \tl_new:N \g__fontspec_single_feat_tl
 \tl_new:N \l__fontspec_basename_tl
+\tl_new:N \g__fontspec_curr_series_tl
 \tl_new:N \l__fontspec_curr_fontname_tl
 \tl_new:N \l__fontspec_curr_bfname_tl
 \tl_new:N \l__fontspec_ext_filename_tl
@@ -142,29 +141,26 @@
 \tl_new:N \l__fontspec_font_path_tl
 \tl_new:N \l__fontspec_fontid_tl
 \tl_new:N \l__fontspec_fontname_tl
-\tl_new:N \l__fontspec_hexcol_tl
+\tl_new:N \l__fontspec_options_tl
+\tl_new:N \l__fontspec_saved_fontname_tl
+\tl_new:N \g__fontspec_nfss_enc_tl
+\tl_new:N \g__fontspec_nfss_family_tl
 \tl_new:N \l__fontspec_nfss_sc_tl
 \tl_new:N \l__fontspec_nfss_tl
 \tl_new:N \l__fontspec_nfss_fam_tl
-\tl_new:N \l__fontspec_opacity_tl
-\tl_new:N \l__fontspec_optical_size_tl
-\tl_new:N \l__fontspec_options_tl
-\tl_new:N \l__fontspec_saved_fontname_tl
-\tl_new:N \l__fontspec_scale_tl
 \tl_new:N \l__fontspec_size_tl
 \tl_new:N \l__fontspec_sizedfont_tl
 \tl_new:N \l__fontspec_this_font_tl
+\tl_new:N \l__fontspec_ttc_index_tl
+\tl_new:N \l__fontspec_smcp_shape_tl
+\tl_new:N \l__fontspec_emshape_query_tl
+\tl_new:N \l__fontspec_em_switch_tl
+\tl_new:N \l__fontspec_strong_switch_tl
 \tl_new:N \l__fontspec_tmp_tl
 \tl_new:N \l__fontspec_tmpa_tl
 \tl_new:N \l__fontspec_tmpb_tl
-\tl_new:N \l__fontspec_ttc_index_tl
-\tl_new:N \l__fontspec_emshape_query_tl
-\tl_new:N \l__fontspec_em_switch_tl
 \tl_new:N \l__fontspec_em_tmp_tl
 \tl_new:N \l__fontspec_strong_tmp_tl
-\tl_new:N \l__fontspec_strong_switch_tl
-\tl_new:N \l__fontspec_hyphenchar_tl
-\tl_new:N \l__fontspec_smcp_shape_tl
 \tl_new:N \g__fontspec_mathrm_tl
 \tl_new:N \g__fontspec_bfmathrm_tl
 \tl_new:N \g__fontspec_mathsf_tl
@@ -182,16 +178,21 @@
 \tl_new:N \l__fontspec_fontname_sl_tl
 \tl_new:N \l__fontspec_fontname_bfsl_tl
 \tl_new:N \l__fontspec_fontname_sc_tl
-\tl_new:N \l__fontspec_script_name_tl
+\tl_new:N  \l__fontspec_script_tl
+\tl_new:N  \l__fontspec_script_name_tl
 \tl_set:Nn \l__fontspec_script_name_tl {CustomDefault}
-\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_lang_name_tl
 \tl_set:Nn \l__fontspec_lang_name_tl {Default}
-\tl_new:N \l_fontspec_lang_tl
-\tl_new:N  \l__fontspec_mapping_tl
-\tl_new:N  \l__fontspec_punctspace_adjust_tl
-\tl_new:N  \l__fontspec_wordspace_adjust_tl
-\tl_new:N  \l__fontspec_postadjust_tl
+\tl_new:N \l__fontspec_scale_tl
+\tl_new:N \l__fontspec_hyphenchar_tl
+\tl_new:N \l__fontspec_hexcol_tl
+\tl_new:N \l__fontspec_opacity_tl
+\tl_new:N \l__fontspec_optical_size_tl
+\tl_new:N \l__fontspec_mapping_tl
+\tl_new:N \l__fontspec_punctspace_adjust_tl
+\tl_new:N \l__fontspec_wordspace_adjust_tl
+\tl_new:N \l__fontspec_postadjust_tl
 \tl_const:Nn \c__fontspec_hexcol_tl {000000}
 \tl_const:Nn \c__fontspec_opacity_tl {FF~}
 \tl_const:Nn \c__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl }
@@ -346,19 +347,24 @@
  }
 \__fontspec_msg_new:nnn {fontspec} {only-xetex-feature}
  {
-  Ignored XeTeX only feature: '#1'.
+  Ignored XeTeX-only feature: '#1'.
  }
 \__fontspec_msg_new:nnn {fontspec} {only-luatex-feature}
  {
-  Ignored LuaTeX only feature: '#1'.
+  Ignored LuaTeX-only feature: '#1'.
  }
+\__fontspec_msg_new:nnn {fontspec} {unknown-renderer}
+ {
+  Renderer '#1' unknown. Assuming Harfbuzz with 'shaper=#1'.
+  Please raise a fontspec issue to add this shaper to the interface.
+ }
 \__fontspec_msg_new:nnn {fontspec} {no-mapping}
  {
-  Input mapping not (yet?) supported in LuaTeX.
+  Input mapping not supported in LuaTeX.
  }
 \__fontspec_msg_new:nnn {fontspec} {no-mapping-ligtex}
  {
-  Input mapping not (yet?) supported in LuaTeX.\\
+  Input mapping not supported in LuaTeX.\\
   Use "Ligatures=TeX" instead of "Mapping=tex-text".
  }
 \__fontspec_msg_new:nnn {fontspec} {cm-default-obsolete}
@@ -619,20 +625,36 @@
   }
 \NewDocumentCommand \newfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \NewDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
 \NewDocumentCommand \renewfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \RenewDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
   }
 \NewDocumentCommand \setfontfamily { m O{} m O{} }
   {
-    \__fontspec_main_newfontfamily:nnnN {#1} {#2,#4} {#3} \DeclareDocumentCommand
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
   }
+\NewDocumentCommand \providefontfamily { m O{} m O{} }
+  {
+    \__fontspec_main_newfontfamily:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
 \NewDocumentCommand \newfontface { m O{} m O{} }
   {
-    \__fontspec_main_newfontface:nnn {#1} {#2,#4} {#3}
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
   }
+\NewDocumentCommand \renewfontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
+  }
+\NewDocumentCommand \setfontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
+  }
+\NewDocumentCommand \providefontface { m O{} m O{} }
+  {
+    \__fontspec_main_newfontface:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
+  }
 \NewDocumentCommand \defaultfontfeatures { t+ o m }
   {
     \IfNoValueTF {#2}
@@ -764,22 +786,22 @@
   }
 \cs_new:Nn \__fontspec_main_setmathrm:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
     \__fontspec_setmathrm_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setboldmathrm:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
     \__fontspec_setboldmathrm_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setmathsf:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
     \__fontspec_setmathsf_hook:nn {#1} {#2}
   }
 \cs_new:Nn \__fontspec_main_setmathtt:nn
   {
- \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+ \fontspec_gset_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
     \__fontspec_setmathtt_hook:nn {#1} {#2}
   }
 \cs_set_eq:NN \__fontspec_setmainfont_hook:nn   \use_none:nn
@@ -796,7 +818,7 @@
 \tl_gset:Nn \g__fontspec_mathrm_tl {\rmdefault}
 \tl_gset:Nn \g__fontspec_mathsf_tl {\sfdefault}
 \tl_gset:Nn \g__fontspec_mathtt_tl {\ttdefault}
-\cs_new:Nn \__fontspec_main_newfontfamily:nnnN
+\cs_new:Nn \__fontspec_main_newfontfamily:NnnN
   {
     \fontspec_set_family:cnn { l__fontspec_ \cs_to_str:N #1 _family_tl } {#2} {#3}
     \use:x
@@ -809,9 +831,9 @@
           }
       }
   }
-\cs_new:Nn \__fontspec_main_newfontface:nnn
+\cs_new:Nn \__fontspec_main_newfontface:NnnN
   {
-    \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
+    \__fontspec_main_newfontfamily:NnnN #1 { BoldFont={},ItalicFont={},SmallCapsFont={},#2 } {#3} #4
   }
 \cs_new:Nn \__fontspec_set_default_features:nn
   {
@@ -1033,8 +1055,8 @@
             \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-num} \l__fontspec_tmp_tl
             \int_set:Nn \l__fontspec_language_int {\l__fontspec_tmp_tl}
 
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-tag}    \l_fontspec_lang_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l__fontspec_script_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {lang-tag}    \l__fontspec_lang_tl
 
             \__fontspec_check_ot_feat:NnTF \font {#1} {\prg_return_true:} {\prg_return_false:}
           }
@@ -1081,7 +1103,7 @@
           {
             \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-num} \l__fontspec_tmp_tl
             \int_set:Nn \l__fontspec_script_int {\l__fontspec_tmp_tl}
-            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l_fontspec_script_tl
+            \prop_get:cnN {g__fontspec_fontinfo_ \f at family _prop} {script-tag}  \l__fontspec_script_tl
 
             \__fontspec_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false:
           }
@@ -1132,26 +1154,31 @@
       }
       { \prg_return_false: }
   }
-\cs_new:Nn \fontspec_set_family:Nnn
+\cs_new:Nn \__fontspec_tl_new_if_free:N { \tl_if_exist:NF #1 { \tl_new:N #1 } }
+\cs_new:Nn \__fontspec_set_family:NnnN
   {
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
     \tl_set:Nn \l__fontspec_family_label_tl {#1}
     \__fontspec_select_font_family:nn {#2} {#3}
-    \tl_if_exist:NF #1 { \tl_new:N #1 }
-    \tl_set_eq:NN #1 \l_fontspec_family_tl
+    \__fontspec_tl_new_if_free:N #1
+    #4 #1 \l_fontspec_family_tl
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_family:Nnn { \__fontspec_set_family:NnnN #1 {#2} {#3} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_family:Nnn  { \__fontspec_set_family:NnnN #1 {#2} {#3} \tl_set_eq:NN  }
 \cs_generate_variant:Nn \fontspec_set_family:Nnn {c}
 \tl_new:N \l__fontspec_fontface_cs_tl
 \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font}
-\cs_new:Nn \fontspec_set_fontface:NNnn
+\cs_new:Nn \__fontspec_set_fontface:NNnnN
   {
     \tl_set:Nn \l__fontspec_fontface_cs_tl {#1}
     \tl_set:Nn \l__fontspec_family_label_tl {#2}
     \__fontspec_select_font_family:nn {#3} {#4}
-    \tl_set_eq:NN #2 \l_fontspec_family_tl
+    #5 #2 \l_fontspec_family_tl
     \tl_set:Nn \l__fontspec_fontface_cs_tl {\l_fontspec_font} % reset
   }
+\cs_new:Nn \fontspec_gset_fontface:NNnn { \__fontspec_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_gset_eq:NN }
+\cs_new:Nn \fontspec_set_fontface:NNnn  { \__fontspec_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_set_eq:NN  }
 \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F}
   {
     \group_begin:
@@ -1342,7 +1369,7 @@
       {#1}
       \l__fontspec_extension_tl
       \l__fontspec_ttc_index_tl
-      \l_fontspec_renderer_tl
+      \l__fontspec_renderer_tl
       \l__fontspec_optical_size_tl
       {#2}
   }
@@ -1444,8 +1471,8 @@
       }
     \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-num} \l__fontspec_script_int
     \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-num}   \l__fontspec_language_int
-    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l_fontspec_script_tl
-    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag}   \l_fontspec_lang_tl
+    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {script-tag} \l__fontspec_script_tl
+    \prop_gput:cnV {g__fontspec_fontinfo_ \g__fontspec_nfss_family_tl _prop} {lang-tag}   \l__fontspec_lang_tl
   }
 \cs_new:Nn \__fontspec_find_autofonts:
   {
@@ -1514,16 +1541,16 @@
 \bool_set_true:N \l__fontspec_tfm_bool
 \or
 \bool_set_true:N \l__fontspec_atsui_bool
-\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} }
+\tl_if_empty:NT \l__fontspec_renderer_tl { \tl_set:Nn \l__fontspec_renderer_tl {/AAT} }
 \ifnum\XeTeXcountvariations #1 > 0\relax
 \bool_set_true:N \l__fontspec_mm_bool
 \fi
 \or
 \bool_set_true:N \l__fontspec_ot_bool
-\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/OT} }
+\tl_if_empty:NT \l__fontspec_renderer_tl { \tl_set:Nn \l__fontspec_renderer_tl {/OT} }
 \or
 \bool_set_true:N \l__fontspec_graphite_bool
-\tl_if_empty:NT \l_fontspec_renderer_tl { \tl_set:Nn \l_fontspec_renderer_tl {/GR} }
+\tl_if_empty:NT \l__fontspec_renderer_tl { \tl_set:Nn \l__fontspec_renderer_tl {/GR} }
 \fi
   }
 \cs_new:Nn \__fontspec_set_autofont:Nnn
@@ -1720,10 +1747,10 @@
   {
     \bool_if:NT \l__fontspec_ot_bool
       {
-        \tl_if_empty:NF \l_fontspec_script_tl
+        \tl_if_empty:NF \l__fontspec_script_tl
           {
-            script   = \l_fontspec_script_tl ;
-            language = \l_fontspec_lang_tl   ;
+            script   = \l__fontspec_script_tl ;
+            language = \l__fontspec_lang_tl   ;
           }
       }
   }
@@ -1758,6 +1785,7 @@
         \tl_gremove_all:Nn \g__fontspec_rawfeatures_sclist {##1;}
       }
   }
+\cs_generate_variant:Nn \__fontspec_remove_clashing_featstr:n {x}
 \cs_set:Npn \__fontspec_init:
   {
     \bool_set_false:N \l__fontspec_ot_bool
@@ -1766,7 +1794,7 @@
     \tl_clear:N \l__fontspec_font_path_tl
     \tl_clear:N \l__fontspec_optical_size_tl
     \tl_clear:N \l__fontspec_ttc_index_tl
-    \tl_clear:N \l_fontspec_renderer_tl
+    \tl_clear:N \l__fontspec_renderer_tl
     \tl_gclear:N \g__fontspec_defined_shapes_tl
     \tl_gclear:N \g__fontspec_curr_series_tl
     \tl_gset_eq:NN \g__fontspec_nfss_enc_tl \g_fontspec_encoding_tl
@@ -1869,10 +1897,8 @@
   {
 
     \bool_set_true:N \l__fontspec_proceed_bool
-    \bool_set_true:N  \l__fontspec_check_feat_bool
 
-    \tl_if_empty:nT {#1} { \bool_set_false:N \l__fontspec_check_feat_bool }
-    \bool_if:NT \l__fontspec_check_feat_bool
+    \tl_if_empty:nF {#1}
       {
         \exp_args:No \__fontspec_check_ot_feat:NnF \l__fontspec_fontface_cs_tl {#1}
           {
@@ -1881,13 +1907,9 @@
           }
       }
 
-    \bool_if:NT \l__fontspec_proceed_bool
-      {
-        \exp_args:Nx \__fontspec_remove_clashing_featstr:n
-          { #2 , \__fontspec_swap_plus_minus:n {#2} , #3 }
+    \__fontspec_remove_clashing_featstr:x { #2 , \__fontspec_swap_plus_minus:n {#2} , #3 }
 
-        \__fontspec_update_featstr:n {#2}
-      }
+    \bool_if:NT \l__fontspec_proceed_bool { \__fontspec_update_featstr:n {#2} }
   }
 \cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx}
 \cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:Nq #1 \q_nil }
@@ -1920,7 +1942,7 @@
   }
 \prg_new_conditional:Nnn \__fontspec_check_lang:Nn {TF}
   {
-    \__fontspec_check_lang:NnnTF #1 {#2} {\l_fontspec_script_tl} {\prg_return_true:} {\prg_return_false:}
+    \__fontspec_check_lang:NnnTF #1 {#2} {\l__fontspec_script_tl} {\prg_return_true:} {\prg_return_false:}
   }
 \prg_new_conditional:Nnn \__fontspec_check_lang:Nnn {TF}
   {
@@ -1956,7 +1978,7 @@
   }
 \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nn {TF,F}
   {
-    \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l_fontspec_lang_tl} {\l_fontspec_script_tl}
+    \__fontspec_check_ot_feat:NnnnTF #1 {#2} {\l__fontspec_lang_tl} {\l__fontspec_script_tl}
       {\prg_return_true:} {\prg_return_false:}
   }
 \prg_new_conditional:Nnn \__fontspec_check_ot_feat:Nnnn {TF,F}
@@ -2227,18 +2249,18 @@
 \keys_define:nn {fontspec-renderer}
   {
     Renderer .choices:nn =
-      {AAT,ICU,OpenType,Graphite,Full,Basic}
+      {AAT,ICU,OpenType,Graphite,Full,Basic,Node,Base,Harfbuzz}
       {
         \int_compare:nTF {\l_keys_choice_int <= 4}
           {
-            \tl_set:Nx \l_fontspec_renderer_tl
+            \tl_set:Nx \l__fontspec_renderer_tl
               {
                 \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} }
               }
-            \tl_gset:Nx \g__fontspec_single_feat_tl { \l_fontspec_renderer_tl }
+            \tl_gset:Nx \g__fontspec_single_feat_tl { \l__fontspec_renderer_tl }
           }
           {
-            \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic}
+            \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic/Node/Base/Harfbuzz}
           }
       }
   }
@@ -2984,7 +3006,7 @@
             \exp_args:No \__fontspec_check_script:NnT \l__fontspec_fontface_cs_tl {####1}
               {
                 \tl_set:Nn \l__fontspec_script_name_tl {#1}
-                \tl_set:Nn \l_fontspec_script_tl {####1}
+                \tl_set:Nn \l__fontspec_script_tl {####1}
                 \int_set:Nn \l__fontspec_script_int {\l__fontspec_strnum_int}
                 \bool_set_true:N \l__fontspec_scriptlang_exist_bool
                 \tl_gset:Nx \g__fontspec_single_feat_tl { script=####1 }
@@ -3025,11 +3047,11 @@
         \bool_set_false:N \l__fontspec_scriptlang_exist_bool
         \clist_map_inline:nn {#2}
           {
-            \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {#2}
+            \exp_args:No \__fontspec_check_lang:NnTF \l__fontspec_fontface_cs_tl {####1}
               {
-                \tl_set:Nn \l_fontspec_lang_tl {#2}
+                \tl_set:Nn \l__fontspec_lang_tl {####1}
                 \int_set:Nn \l__fontspec_language_int {\l__fontspec_strnum_int}
-                \tl_gset:Nx \g__fontspec_single_feat_tl { language=#2 }
+                \tl_gset:Nx \g__fontspec_single_feat_tl { language=####1 }
                 \bool_set_true:N \l__fontspec_scriptlang_exist_bool
                 \clist_map_break:
               }
@@ -3044,7 +3066,7 @@
   }
 \__fontspec_keys_define_code:nnn {fontspec-opentype} { Language / Default }
   {
-    \tl_set:Nn \l_fontspec_lang_tl {DFLT}
+    \tl_set:Nn \l__fontspec_lang_tl {DFLT}
     \int_zero:N \l__fontspec_language_int
     \tl_gset:Nn \g__fontspec_single_feat_tl { language=DFLT }
   }
@@ -3960,6 +3982,11 @@
   \@ifpackageloaded{MinionPro}    {\bool_gset_false:N \g__fontspec_math_bool}{}
   \@ifpackageloaded{unicode-math} {\bool_gset_false:N \g__fontspec_math_bool}{}
   \@ifpackageloaded{breqn}        {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{pxfonts}      {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{txfonts}      {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{newpxmath}    {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{newtxmath}    {\bool_gset_false:N \g__fontspec_math_bool}{}
+  \@ifpackageloaded{mtpro2}       {\bool_gset_false:N \g__fontspec_math_bool}{}
   \bool_if:NT \g__fontspec_math_bool
    {
     \__fontspec_info:n {setup-math}

Modified: trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.lua	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.lua	2019-02-12 22:04:13 UTC (rev 50011)
@@ -23,8 +23,8 @@
 local fontspec    = fontspec
 fontspec.module   = {
     name          = "fontspec",
-    version       = "2.7a",
-    date          = "2019/01/25",
+    version       = "2.7b",
+    date          = "2019/02/12",
     description   = "Font selection for XeLaTeX and LuaLaTeX",
     author        = "Khaled Hosny, Philipp Gesang, Will Robertson",
     copyright     = "Khaled Hosny, Philipp Gesang, Will Robertson",

Modified: trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.sty	2019-02-12 22:03:53 UTC (rev 50010)
+++ trunk/Master/texmf-dist/tex/latex/fontspec/fontspec.sty	2019-02-12 22:04:13 UTC (rev 50011)
@@ -21,7 +21,7 @@
 
 \RequirePackage{xparse}
 \ProvidesExplPackage{fontspec}%
-  {2019/01/25}{2.7a}{Font selection for XeLaTeX and LuaLaTeX}
+  {2019/02/12}{2.7b}{Font selection for XeLaTeX and LuaLaTeX}
 
 %%^^A%%  fontspec-code-load.dtx -- part of FONTSPEC <wspr.io/fontspec>
 \sys_if_engine_luatex:T



More information about the tex-live-commits mailing list