[latex3-commits] [git/LaTeX3-latex3-latex3] lmtx: Basic support for LuaMetaTeX (d92026c95)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Apr 20 18:17:14 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : lmtx
Link       : https://github.com/latex3/latex3/commit/d92026c953038733c8e37d205a178f68c002400a

>---------------------------------------------------------------

commit d92026c953038733c8e37d205a178f68c002400a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Apr 20 17:17:14 2023 +0100

    Basic support for LuaMetaTeX


>---------------------------------------------------------------

d92026c953038733c8e37d205a178f68c002400a
 l3backend/CHANGELOG.md         |  3 ++
 l3backend/l3backend-basics.dtx |  4 +++
 l3backend/l3backend-pdf.dtx    |  4 +--
 l3backend/l3backend.ins        | 13 +++++++
 l3kernel/CHANGELOG.md          |  3 ++
 l3kernel/l3sys.dtx             | 79 ++++++++++++++++++++++++++----------------
 6 files changed, 75 insertions(+), 31 deletions(-)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 5877ce53d..71d4a2b1a 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+- Basic support for LuaMetaTeX
+
 ## [2023-04-19]
 
 ### Changed
diff --git a/l3backend/l3backend-basics.dtx b/l3backend/l3backend-basics.dtx
index cf4ad444b..70617d58c 100644
--- a/l3backend/l3backend-basics.dtx
+++ b/l3backend/l3backend-basics.dtx
@@ -81,6 +81,10 @@
   {l3backend-dvisvgm.def}{2023-04-19}{}
   {L3 backend support: dvisvgm}
 %</dvisvgm>
+%<*lmtx>
+  {l3backend-lmtx.def}{2023-04-19}{}
+  {L3 backend support: LuaMetaTeX}
+%</lmtx>
 %<*luatex>
   {l3backend-luatex.def}{2023-04-19}{}
   {L3 backend support: PDF output (LuaTeX)}
diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index a95aff407..e1708207a 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -72,7 +72,7 @@
 % are common to most backends.
 %
 %    \begin{macrocode}
-%<*!dvisvgm>
+%<*!dvisvgm&!lmtx>
 %    \end{macrocode}
 %
 % \begin{variable}{\l_@@_internal_box}
@@ -82,7 +82,7 @@
 % \end{variable}
 %
 %    \begin{macrocode}
-%</!dvisvgm>
+%</!dvisvgm&!lmtx>
 %    \end{macrocode}
 %
 % \subsection{\texttt{dvips} backend}
diff --git a/l3backend/l3backend.ins b/l3backend/l3backend.ins
index 5b8945f01..0d6de5544 100644
--- a/l3backend/l3backend.ins
+++ b/l3backend/l3backend.ins
@@ -97,6 +97,19 @@ and all files in that bundle must be distributed together.
         \from{l3backend-opacity.dtx} {package,dvisvgm}
       }
   }
+\generate
+  {
+    \file{l3backend-lmtx.def}
+      {
+        \from{l3backend-basics.dtx}  {package,lmtx}
+        \from{l3backend-color.dtx}   {package,lmtx}
+        \from{l3backend-box.dtx}     {package,lmtx}
+        \from{l3backend-draw.dtx}    {package,lmtx}
+        \from{l3backend-graphics.dtx}{package,lmtx}
+        \from{l3backend-pdf.dtx}     {package,lmtx}
+        \from{l3backend-opacity.dtx} {package,lmtx}
+      }
+  }
 \generate
   {
     \file{l3backend-luatex.def}
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 72a221124..64dd0b052 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+- Basic support for LuaMetaTeX
+
 ## [2023-04-20]
 
 ### Changed
diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index 2457024b1..6a2ba9076 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -81,8 +81,9 @@
 %
 % \section{Engine}
 %
-% \begin{function}[added = 2015-09-07, EXP, pTF]
+% \begin{function}[added = 2015-09-07, updated = 2023-04-20, EXP, pTF]
 %   {
+%     \sys_if_engine_lmtx:  ,
 %     \sys_if_engine_luatex:,
 %     \sys_if_engine_pdftex:,
 %     \sys_if_engine_ptex:  ,
@@ -102,13 +103,13 @@
 %
 % \begin{variable}[added = 2015-09-19]{\c_sys_engine_str}
 %   The current engine given as a lower case string: one of
-%   |luatex|, |pdftex|, |ptex|, |uptex| or |xetex|.
+%   |lmtx|, |luatex|, |pdftex|, |ptex|, |uptex| or |xetex|.
 % \end{variable}
 %
-% \begin{variable}[added = 2020-08-20]{\c_sys_engine_exec_str}
+% \begin{variable}[added = 2020-08-20, updated = 2023-04-20]{\c_sys_engine_exec_str}
 %   The name of the standard executable for the current \TeX{} engine given
-%   as a lower case string: one of  |luatex|,
-%   |luahbtex|, |pdftex|, |eptex|, |euptex| or |xetex|.
+%   as a lower case string: one of |lmtx|, |luatex|,
+%   |luahbtex|, |pdftex|, |eptex|, |euptex| or |xetex|. Note that 
 % \end{variable}
 %
 % \begin{variable}[added = 2020-08-20]{\c_sys_engine_format_str}
@@ -146,12 +147,14 @@
 %   operating in. This is always one of two outcomes, DVI mode or
 %   PDF mode. The two sets of conditionals are thus complementary and
 %   are both provided to allow the programmer to emphasise the most
-%   appropriate case.
+%   appropriate case. If the \texttt{ltmx} engine is in use, both
+%   conditionals will be \texttt{false} at present.
 % \end{function}
 %
 % \begin{variable}[added = 2015-09-19]{\c_sys_output_str}
 %   The current output mode given as a lower case string: one of
-%   |dvi| or |pdf|.
+%   |dvi| or |pdf|. If the \texttt{ltmx} engine is in use, the string
+%   will be empty.
 % \end{variable}
 %
 % \section{Platform}
@@ -372,6 +375,7 @@
 %
 % \begin{macro}[pTF, EXP]
 %   {
+%     \sys_if_engine_lmtx:,
 %     \sys_if_engine_luatex:,
 %     \sys_if_engine_pdftex:,
 %     \sys_if_engine_ptex:,
@@ -384,7 +388,12 @@
 %    \begin{macrocode}
 \str_const:Nx \c_sys_engine_str
   {
-    \cs_if_exist:NT \tex_luatexversion:D { luatex }
+    \cs_if_exist:NT \tex_luatexversion:D
+      {
+        \int_compare:nNnTF \tex_luatexversion:D < 200
+          { luatex }
+          { lmtx }
+      }
     \cs_if_exist:NT \tex_pdftexversion:D { pdftex }
     \cs_if_exist:NT \tex_kanjiskip:D
       {
@@ -394,7 +403,8 @@
       }
     \cs_if_exist:NT \tex_XeTeXversion:D { xetex }
   }
-\tl_map_inline:nn { { luatex } { pdftex } { ptex } { uptex } { xetex } }
+\tl_map_inline:nn
+  { { lmtx } { luatex } { pdftex } { ptex } { uptex } { xetex } }
   {
     \@@_const:nn { sys_if_engine_ #1 }
       { \str_if_eq_p:Vn \c_sys_engine_str {#1} }
@@ -421,20 +431,24 @@
   \cs_set_eq:NN \lua_now:e    \tex_directlua:D
   \str_const:Nx \c_sys_engine_exec_str
     {
-      \sys_if_engine_pdftex:T { pdf }
-      \sys_if_engine_xetex:T  { xe  }
-      \sys_if_engine_ptex:T   { ep  }
-      \sys_if_engine_uptex:T  { eup }
-      \sys_if_engine_luatex:T
+      \sys_if_engine_lmtx:TF
+        { lmtx }
         {
-          lua \lua_now:e
+          \sys_if_engine_pdftex:T { pdf }
+          \sys_if_engine_xetex:T  { xe  }
+          \sys_if_engine_ptex:T   { ep  }
+          \sys_if_engine_uptex:T  { eup }
+          \sys_if_engine_luatex:T
             {
-              if (pcall(require, 'luaharfbuzz')) then ~
-                tex.print("hb") ~
-              end
+              lua \lua_now:e
+                {
+                  if (pcall(require, 'luaharfbuzz')) then ~
+                    tex.print("hb") ~
+                  end
+                }
             }
+          tex
         }
-      tex
     }
 \group_end:
 \str_const:Nx \c_sys_engine_format_str
@@ -558,16 +572,20 @@
               }
           }
           {
-            \str_case:VnF #1
+            \sys_if_engine_lmtx:TF
+              { \tl_gset:Nn #1 { lmtx } }
               {
-                { dvipdfmx } { }
-                { dvips }    { }
-                { dvisvgm }  { }
-              }
-              {
-                \msg_error:nnxx { sys } { wrong-backend }
-                  #1 { dvips }
-                \tl_gset:Nn #1 { dvips }
+                \str_case:VnF #1
+                  {
+                    { dvipdfmx } { }
+                    { dvips }    { }
+                    { dvisvgm }  { }
+                  }
+                  {
+                    \msg_error:nnxx { sys } { wrong-backend }
+                      #1 { dvips }
+                    \tl_gset:Nn #1 { dvips }
+                  }
               }
           }
       }
@@ -1031,7 +1049,10 @@ end
         \int_compare:nNnTF
           { \cs_if_exist_use:NF \tex_pdfoutput:D { 0 } } > { 0 }
           { pdf }
-          { dvi }
+          {
+            \sys_if_engine_lmtx:F
+              { dvi }
+          }
       }
     \@@_const:nn { sys_if_output_dvi }
       { \str_if_eq_p:Vn \c_sys_output_str { dvi } }





More information about the latex3-commits mailing list.