[latex3-commits] [git/LaTeX3-latex3-xxetex] main: fix: \the cannot expand luacall (10d3f5f)
Henri Menke
henri at henrimenke.de
Thu Jan 26 09:55:39 CET 2023
Repository : https://github.com/latex3/xxetex
On branch : main
Link : https://github.com/latex3/xxetex/commit/10d3f5f680ed84af02aeed7f998e01c8b808150a
>---------------------------------------------------------------
commit 10d3f5f680ed84af02aeed7f998e01c8b808150a
Author: Henri Menke <henri at henrimenke.de>
Date: Thu Jan 26 09:55:39 2023 +0100
fix: \the cannot expand luacall
To behave a bit like actual primitives many of the \XeTeX commands should be
\protected. However, protecting the on the Lua level using
token.set_lua("XeTeXfonttype", #lft, "global", "protected")
is somehow not possible. In this case \the cannot expand into the resulting luacall
! You can't use `luacall 1' after \the.
l.9 \edef\x{\the\XeTeXfonttype
\1}“\x”
Hence we have to go back to the TeX level to define these commands.
TODO: Is this a bug in LuaTeX?
>---------------------------------------------------------------
10d3f5f680ed84af02aeed7f998e01c8b808150a
xxetex.lua | 30 +++++++++++-------------------
xxetex.tex | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/xxetex.lua b/xxetex.lua
index 75fe925..cbc7c85 100644
--- a/xxetex.lua
+++ b/xxetex.lua
@@ -134,22 +134,14 @@ local function XeTeXglyphbounds()
end
end
-local lft = lua.get_functions_table()
-lft[#lft + 1] = XeTeXfonttype
-token.set_lua("XeTeXfonttype", #lft, "global")
-lft[#lft + 1] = XeTeXfirstfontchar
-token.set_lua("XeTeXfirstfontchar", #lft, "global")
-lft[#lft + 1] = XeTeXlastfontchar
-token.set_lua("XeTeXlastfontchar", #lft, "global")
-lft[#lft + 1] = XeTeXglyph
-token.set_lua("XeTeXglyph", #lft, "global", "protected")
-lft[#lft + 1] = XeTeXcountglyphs
-token.set_lua("XeTeXcountglyphs", #lft, "global")
-lft[#lft + 1] = XeTeXglyphname
-token.set_lua("XeTeXglyphname", #lft, "global", "protected")
-lft[#lft + 1] = XeTeXglyphindex
-token.set_lua("XeTeXglyphindex", #lft, "global")
-lft[#lft + 1] = XeTeXcharglyph
-token.set_lua("XeTeXcharglyph", #lft, "global")
-lft[#lft + 1] = XeTeXglyphbounds
-token.set_lua("XeTeXglyphbounds", #lft, "global")
+return {
+ XeTeXfonttype = XeTeXfonttype,
+ XeTeXfirstfontchar = XeTeXfirstfontchar,
+ XeTeXlastfontchar = XeTeXlastfontchar,
+ XeTeXglyph = XeTeXglyph,
+ XeTeXcountglyphs = XeTeXcountglyphs,
+ XeTeXglyphname = XeTeXglyphname,
+ XeTeXglyphindex = XeTeXglyphindex,
+ XeTeXcharglyph = XeTeXcharglyph,
+ XeTeXglyphbounds = XeTeXglyphbounds,
+}
diff --git a/xxetex.tex b/xxetex.tex
index d3b4738..26bf672 100644
--- a/xxetex.tex
+++ b/xxetex.tex
@@ -1,3 +1,18 @@
+% xxetex (xetex emulation in luatex)
+% Copyright 2022-2023 LaTeX Project
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+
+%\catcode`\{=1
+%\catcode`\}=2
+\catcode`\@=11
+\catcode`\!=11
+%\catcode`\_=11
+%\catcode`\:=11
+
+\let\@@!directlua\directlua %\let\directlua\undefined
+
\chardef\XeTeXversion=0
\def\XeTeXrevision{.99999}%
@@ -6,6 +21,21 @@
\let\XeTeXmathcode\Umathcode
-\directlua{dofile("xxetex.lua")}
+\@@!directlua{xxetex = xxetex or require("xxetex.lua")}
+
+\protected\def\XeTeXfonttype {\@@!directlua{xxetex.XeTeXfonttype()}}
+\protected\def\XeTeXfirstfontchar{\@@!directlua{xxetex.XeTeXfirstfontchar()}}
+\protected\def\XeTeXlastfontchar {\@@!directlua{xxetex.XeTeXlastfontchar()}}
+ \def\XeTeXglyph {\@@!directlua{xxetex.XeTeXglyph()}}
+\protected\def\XeTeXcountglyphs {\@@!directlua{xxetex.XeTeXcountglyphs()}}
+ \def\XeTeXglyphname {\@@!directlua{xxetex.XeTeXglyphname()}}
+\protected\def\XeTeXglyphindex {\@@!directlua{xxetex.XeTeXglyphindex()}}
+\protected\def\XeTeXcharglyph {\@@!directlua{xxetex.XeTeXcharglyph()}}
+\protected\def\XeTeXglyphbounds {\@@!directlua{xxetex.XeTeXglyphbounds()}}
-\endinput
\ No newline at end of file
+%\catcode`\{=12
+%\catcode`\{=12
+\catcode`\@=12
+\catcode`\!=12
+%\catcode`\_=12
+%\catcode`\:=12
More information about the latex3-commits
mailing list.